Update all emulators/mupen64plus plugins to 1.99.5.
This makes the emulator actually playable on i386, and removes all patches (which had been taken from upstream). ok stsp@
This commit is contained in:
parent
be5360d931
commit
a5ec5219ce
@ -1,8 +1,8 @@
|
||||
# $OpenBSD: Makefile.inc,v 1.2 2011/12/26 23:03:24 stsp Exp $
|
||||
# $OpenBSD: Makefile.inc,v 1.3 2012/08/13 06:53:55 bentley Exp $
|
||||
|
||||
ONLY_FOR_ARCHS ?= amd64 i386
|
||||
SHARED_ONLY = Yes
|
||||
VERSION ?= 1.99.4
|
||||
VERSION ?= 1.99.5
|
||||
DISTNAME ?= mupen64plus-${MUPEN64PLUS_MOD}-src-${VERSION}
|
||||
PKGNAME ?= mupen64plus-${MUPEN64PLUS_MOD}-${VERSION}
|
||||
HOMEPAGE ?= http://code.google.com/p/mupen64plus/
|
||||
@ -17,7 +17,7 @@ FAKE_FLAGS ?= PREFIX=${PREFIX} LDCONFIG=true
|
||||
|
||||
.if ${MUPEN64PLUS_MOD} != "core"
|
||||
MAKE_FLAGS += APIDIR=${LOCALBASE}/include/mupen64plus
|
||||
LIB_DEPENDS += emulators/mupen64plus/core
|
||||
LIB_DEPENDS += emulators/mupen64plus/core>=1.99.5
|
||||
.endif
|
||||
|
||||
WRKBUILD ?= ${WRKDIST}/projects/unix
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (mupen64plus-audio-sdl-src-1.99.4.tar.gz) = Q32vP1xZ8yOY+1Ud/HaupA==
|
||||
RMD160 (mupen64plus-audio-sdl-src-1.99.4.tar.gz) = MFTtt+epBzoKYQO0HIQQCUkCePQ=
|
||||
SHA1 (mupen64plus-audio-sdl-src-1.99.4.tar.gz) = amVY0aO6r4bewkkOa+ZYukXitC4=
|
||||
SHA256 (mupen64plus-audio-sdl-src-1.99.4.tar.gz) = o+aTJEF8Kep+yPoKoTsDsqofNAxbQCJtAEv+hpw1W7Y=
|
||||
SIZE (mupen64plus-audio-sdl-src-1.99.4.tar.gz) = 22380
|
||||
SHA256 (mupen64plus-audio-sdl-src-1.99.5.tar.gz) = cbu0Tqs3RF+btfRmbZbjpmpAQvGCdGoWM5QOXIs+iZU=
|
||||
SIZE (mupen64plus-audio-sdl-src-1.99.5.tar.gz) = 23488
|
||||
|
@ -1,45 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-audio-sdl_projects_unix_Makefile,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- projects/unix/Makefile.orig Tue Nov 23 03:15:11 2010
|
||||
+++ projects/unix/Makefile Sun Dec 18 17:12:23 2011
|
||||
@@ -49,6 +49,11 @@ ifeq ("$(UNAME)","FreeBSD")
|
||||
SHARED = -shared
|
||||
SO_EXTENSION = so
|
||||
endif
|
||||
+ifeq ("$(UNAME)","OpenBSD")
|
||||
+ OS = OPENBSD
|
||||
+ SHARED = -shared
|
||||
+ SO_EXTENSION = so
|
||||
+endif
|
||||
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
SHARED = -shared
|
||||
@@ -140,6 +145,10 @@ ifeq ($(OS),FREEBSD)
|
||||
CFLAGS += $(shell sdl-config --cflags)
|
||||
LDFLAGS += $(shell sdl-config --libs)
|
||||
endif
|
||||
+ifeq ($(OS),OPENBSD)
|
||||
+ CFLAGS += $(shell sdl-config --cflags)
|
||||
+ LDFLAGS += $(shell sdl-config --libs)
|
||||
+endif
|
||||
ifeq ($(OS),OSX)
|
||||
CFLAGS += $(shell sdl-config --cflags)
|
||||
# sdl-config on mac screws up when we're trying to build a library and not an executable
|
||||
@@ -199,6 +208,9 @@ endif
|
||||
ifeq ($(OS),FREEBSD)
|
||||
STRIP += strip -s
|
||||
endif
|
||||
+ifeq ($(OS),OPENBSD)
|
||||
+ STRIP ?= strip -s
|
||||
+endif
|
||||
|
||||
# set special flags for given Makefile parameters
|
||||
ifeq ($(DEBUG),1)
|
||||
@@ -265,7 +277,7 @@ targets:
|
||||
all: $(TARGET)
|
||||
|
||||
install: $(TARGET)
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
|
||||
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
|
||||
|
||||
uninstall:
|
@ -1,7 +1,7 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2011/12/26 22:58:48 bentley Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2012/08/13 06:53:55 bentley Exp $
|
||||
|
||||
COMMENT = n64 emulator core
|
||||
SHARED_LIBS = mupen64plus 2.0
|
||||
SHARED_LIBS = mupen64plus 2.1 # 2.0
|
||||
|
||||
# GPLv2+
|
||||
PERMIT_PACKAGE_CDROM = Yes
|
||||
@ -16,4 +16,7 @@ LIB_DEPENDS = devel/sdl \
|
||||
|
||||
MUPEN64PLUS_MOD = core
|
||||
|
||||
MAKE_FLAGS = TARGET=libmupen64plus.so.${LIBmupen64plus_VERSION} \
|
||||
V=1
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (mupen64plus-core-src-1.99.4.tar.gz) = //cZ2AoJQBIVlSO2OUyNbQ==
|
||||
RMD160 (mupen64plus-core-src-1.99.4.tar.gz) = bJX5VMHg8Zmd2PupsWJSMMy7/9c=
|
||||
SHA1 (mupen64plus-core-src-1.99.4.tar.gz) = uw0B/f5NnQagfGa1bDGeRO6UBhM=
|
||||
SHA256 (mupen64plus-core-src-1.99.4.tar.gz) = 2UBObjAb3pUE4Hx3XYqNShTXzd7fb6JEac52ZGljNcw=
|
||||
SIZE (mupen64plus-core-src-1.99.4.tar.gz) = 1201678
|
||||
SHA256 (mupen64plus-core-src-1.99.5.tar.gz) = o0+eiE8IDtwKXrz4z2I7ivxYJOmTLXl88em+BHkdfWM=
|
||||
SIZE (mupen64plus-core-src-1.99.5.tar.gz) = 1218594
|
||||
|
@ -1,43 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_projects_unix_Makefile,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- projects/unix/Makefile.orig Tue Nov 23 03:15:08 2010
|
||||
+++ projects/unix/Makefile Sun Dec 18 17:37:08 2011
|
||||
@@ -39,6 +39,9 @@ endif
|
||||
ifeq ("$(UNAME)","FreeBSD")
|
||||
OS = FREEBSD
|
||||
endif
|
||||
+ifeq ("$(UNAME)","OpenBSD")
|
||||
+ OS = OPENBSD
|
||||
+endif
|
||||
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
endif
|
||||
@@ -102,6 +105,14 @@ ifeq ($(OS), FREEBSD)
|
||||
LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
|
||||
LIBS += -L${LOCALBASE}/lib -lGL -lGLU -lc
|
||||
endif
|
||||
+ifeq ($(OS), OPENBSD)
|
||||
+ TARGET = libmupen64plus.so.2.0
|
||||
+ LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
|
||||
+ LDFLAGS += $(shell pkg-config --ldflags libpng)
|
||||
+ LIBS += -L${LOCALBASE}/lib -lGL -lGLU -lc
|
||||
+ LIBS += $(shell pkg-config --libs libpng)
|
||||
+ CFLAGS += $(shell pkg-config --cflags libpng)
|
||||
+endif
|
||||
ifeq ($(OS), LINUX)
|
||||
TARGET = libmupen64plus.so.2.0.0
|
||||
SONAME = libmupen64plus.so.2
|
||||
@@ -362,11 +373,11 @@ targets:
|
||||
all: $(TARGET)
|
||||
|
||||
install: $(TARGET)
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
|
||||
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
|
||||
$(INSTALL) -m 0644 ../../data/* "$(DESTDIR)$(SHAREDIR)"
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(INCDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(INCDIR)"
|
||||
$(INSTALL) -m 0644 ../../src/api/m64p_*.h "$(DESTDIR)$(INCDIR)"
|
||||
if [ `id -u` -eq 0 ]; then $(LDCONFIG); fi
|
||||
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_memory_memory_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/memory/memory.c.orig Sun Dec 18 23:24:33 2011
|
||||
+++ src/memory/memory.c Sun Dec 18 20:04:55 2011
|
||||
@@ -72,7 +72,7 @@ unsigned char *PIF_RAMb = (unsigned char *)(PIF_RAM);
|
||||
// address : address of the read/write operation being done
|
||||
unsigned int address = 0;
|
||||
// *address_low = the lower 16 bit of the address :
|
||||
-#ifdef _BIG_ENDIAN
|
||||
+#ifdef M64P_BIG_ENDIAN
|
||||
static unsigned short *address_low = (unsigned short *)(&address)+1;
|
||||
#else
|
||||
static unsigned short *address_low = (unsigned short *)(&address);
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_memory_memory_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/memory/memory.h.orig Sun Dec 18 23:24:48 2011
|
||||
+++ src/memory/memory.h Sun Dec 18 20:04:55 2011
|
||||
@@ -241,7 +241,7 @@ extern DPS_register dps_register;
|
||||
|
||||
extern unsigned char *rdramb;
|
||||
|
||||
-#ifndef _BIG_ENDIAN
|
||||
+#ifndef M64P_BIG_ENDIAN
|
||||
#define sl(mot) \
|
||||
( \
|
||||
((mot & 0x000000FF) << 24) | \
|
@ -1,352 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_cop1_d_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/cop1_d.c.orig Sun Dec 18 23:21:14 2011
|
||||
+++ src/r4300/cop1_d.c Sun Dec 18 20:04:55 2011
|
||||
@@ -27,236 +27,194 @@
|
||||
#include "r4300.h"
|
||||
#include "ops.h"
|
||||
#include "macros.h"
|
||||
+#include "fpu.h"
|
||||
|
||||
void ADD_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] +
|
||||
- *reg_cop1_double[cfft];
|
||||
+ add_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void SUB_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] -
|
||||
- *reg_cop1_double[cfft];
|
||||
+ sub_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void MUL_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] *
|
||||
- *reg_cop1_double[cfft];
|
||||
+ mul_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void DIV_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] /
|
||||
- *reg_cop1_double[cfft];
|
||||
+ div_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void SQRT_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = sqrt(*reg_cop1_double[cffs]);
|
||||
+ sqrt_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void ABS_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = fabs(*reg_cop1_double[cffs]);
|
||||
+ abs_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void MOV_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs];
|
||||
+ mov_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void NEG_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = -(*reg_cop1_double[cffs]);
|
||||
+ neg_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void ROUND_L_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_round();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ round_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void TRUNC_L_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_trunc();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ trunc_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CEIL_L_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_ceil();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ ceil_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void FLOOR_L_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_floor();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ floor_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void ROUND_W_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_round();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ round_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void TRUNC_W_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_trunc();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ trunc_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CEIL_W_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_ceil();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ ceil_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void FLOOR_W_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_floor();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ floor_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_S_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) *reg_cop1_double[cffs];
|
||||
+ cvt_s_d(reg_cop1_double[cffs], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_W_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ cvt_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_L_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ cvt_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_F_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_f_d();
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_UN_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]))
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_un_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_EQ_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (!isnan(*reg_cop1_double[cffs]) && !isnan(*reg_cop1_double[cfft]) &&
|
||||
- *reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_eq_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_UEQ_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]) ||
|
||||
- *reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ueq_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_OLT_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (!isnan(*reg_cop1_double[cffs]) && !isnan(*reg_cop1_double[cfft]) &&
|
||||
- *reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_olt_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_ULT_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]) ||
|
||||
- *reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ult_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_OLE_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (!isnan(*reg_cop1_double[cffs]) && !isnan(*reg_cop1_double[cfft]) &&
|
||||
- *reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ole_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_ULE_D(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]) ||
|
||||
- *reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ule_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -267,7 +225,7 @@ void C_SF_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_sf_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -278,7 +236,7 @@ void C_NGLE_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_ngle_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -289,9 +247,7 @@ void C_SEQ_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_seq_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -302,9 +258,7 @@ void C_NGL_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngl_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -316,9 +270,7 @@ void C_LT_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_lt_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -330,9 +282,7 @@ void C_NGE_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_nge_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -344,9 +294,7 @@ void C_LE_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_le_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -358,9 +306,7 @@ void C_NGT_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngt_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_cop1_l_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/cop1_l.c.orig Sun Dec 18 23:21:48 2011
|
||||
+++ src/r4300/cop1_l.c Sun Dec 18 20:04:55 2011
|
||||
@@ -20,21 +20,20 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "r4300.h"
|
||||
+#include "r4300/ops.h"
|
||||
#include "macros.h"
|
||||
+#include "fpu.h"
|
||||
|
||||
void CVT_S_L(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) *((long long*)reg_cop1_double[cffs]);
|
||||
+ cvt_s_l((long long*)(reg_cop1_double[cffs]), reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_D_L(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = (double) *((long long*)reg_cop1_double[cffs]);
|
||||
+ cvt_d_l((long long*)(reg_cop1_double[cffs]), reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
-
|
@ -1,352 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_cop1_s_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/cop1_s.c.orig Sun Dec 18 23:22:33 2011
|
||||
+++ src/r4300/cop1_s.c Sun Dec 18 20:04:55 2011
|
||||
@@ -28,236 +28,194 @@
|
||||
#include "r4300.h"
|
||||
#include "ops.h"
|
||||
#include "macros.h"
|
||||
+#include "fpu.h"
|
||||
|
||||
void ADD_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] +
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ add_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void SUB_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] -
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ sub_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void MUL_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] *
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ mul_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void DIV_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] /
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ div_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void SQRT_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) sqrt(*reg_cop1_simple[cffs]);
|
||||
+ sqrt_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void ABS_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) fabs(*reg_cop1_simple[cffs]);
|
||||
+ abs_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void MOV_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs];
|
||||
+ mov_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void NEG_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = -(*reg_cop1_simple[cffs]);
|
||||
+ neg_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void ROUND_L_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_round();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ round_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void TRUNC_L_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_trunc();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ trunc_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CEIL_L_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_ceil();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ ceil_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void FLOOR_L_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_floor();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ floor_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void ROUND_W_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_round();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ round_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void TRUNC_W_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_trunc();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ trunc_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CEIL_W_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_ceil();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ ceil_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void FLOOR_W_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_floor();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ floor_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_D_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_simple[cffs];
|
||||
+ cvt_d_s(reg_cop1_simple[cffs], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_W_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ cvt_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_L_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ cvt_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_F_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_f_s();
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_UN_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]))
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_un_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_EQ_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (!isnan(*reg_cop1_simple[cffs]) && !isnan(*reg_cop1_simple[cfft]) &&
|
||||
- *reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_eq_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_UEQ_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]) ||
|
||||
- *reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ueq_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_OLT_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (!isnan(*reg_cop1_simple[cffs]) && !isnan(*reg_cop1_simple[cfft]) &&
|
||||
- *reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_olt_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_ULT_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]) ||
|
||||
- *reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ult_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_OLE_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (!isnan(*reg_cop1_simple[cffs]) && !isnan(*reg_cop1_simple[cfft]) &&
|
||||
- *reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ole_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void C_ULE_S(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]) ||
|
||||
- *reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ule_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -269,7 +227,7 @@ void C_SF_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_sf_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -281,7 +239,7 @@ void C_NGLE_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_ngle_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -293,9 +251,7 @@ void C_SEQ_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_seq_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -307,9 +263,7 @@ void C_NGL_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngl_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -321,9 +275,7 @@ void C_LT_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_lt_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -335,9 +287,7 @@ void C_NGE_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_nge_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -349,9 +299,7 @@ void C_LE_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_le_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
@@ -363,9 +311,7 @@ void C_NGT_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngt_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
PC++;
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_cop1_w_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/cop1_w.c.orig Sun Dec 18 23:22:38 2011
|
||||
+++ src/r4300/cop1_w.c Sun Dec 18 20:04:55 2011
|
||||
@@ -22,20 +22,18 @@
|
||||
#include "r4300.h"
|
||||
#include "ops.h"
|
||||
#include "macros.h"
|
||||
+#include "fpu.h"
|
||||
|
||||
void CVT_S_W(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) *((int*)reg_cop1_simple[cffs]);
|
||||
+ cvt_s_w((int*)reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
PC++;
|
||||
}
|
||||
|
||||
void CVT_D_W(void)
|
||||
{
|
||||
if (check_cop1_unusable()) return;
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *((int*)reg_cop1_simple[cffs]);
|
||||
+ cvt_d_w((int*)reg_cop1_simple[cffs], reg_cop1_double[cffd]);
|
||||
PC++;
|
||||
}
|
||||
-
|
@ -1,463 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_fpu_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/fpu.h.orig Sun Dec 18 23:17:35 2011
|
||||
+++ src/r4300/fpu.h Sun Dec 18 20:04:55 2011
|
||||
@@ -0,0 +1,459 @@
|
||||
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
+ * Mupen64plus - fpu.c *
|
||||
+ * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
+ * Copyright (C) 2010 Ari64 *
|
||||
+ * *
|
||||
+ * This program is free software; you can redistribute it and/or modify *
|
||||
+ * it under the terms of the GNU General Public License as published by *
|
||||
+ * the Free Software Foundation; either version 2 of the License, or *
|
||||
+ * (at your option) any later version. *
|
||||
+ * *
|
||||
+ * This program is distributed in the hope that it will be useful, *
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
+ * GNU General Public License for more details. *
|
||||
+ * *
|
||||
+ * You should have received a copy of the GNU General Public License *
|
||||
+ * along with this program; if not, write to the *
|
||||
+ * Free Software Foundation, Inc., *
|
||||
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
+
|
||||
+#include <math.h>
|
||||
+
|
||||
+#include "r4300.h"
|
||||
+
|
||||
+#ifdef _MSC_VER
|
||||
+ #define M64P_FPU_INLINE static __inline
|
||||
+ #include <float.h>
|
||||
+ typedef enum { FE_TONEAREST = 0, FE_TOWARDZERO, FE_UPWARD, FE_DOWNWARD } eRoundType;
|
||||
+ static void fesetround(eRoundType RoundType)
|
||||
+ {
|
||||
+ static const unsigned int msRound[4] = { _RC_NEAR, _RC_CHOP, _RC_UP, _RC_DOWN };
|
||||
+ unsigned int oldX87, oldSSE2;
|
||||
+ __control87_2(msRound[RoundType], _MCW_RC, &oldX87, &oldSSE2);
|
||||
+ }
|
||||
+ static __inline double round(double x) { return floor(x + 0.5); }
|
||||
+ static __inline float roundf(float x) { return (float) floor(x + 0.5); }
|
||||
+ static __inline double trunc(double x) { return (double) (int) x; }
|
||||
+ static __inline float truncf(float x) { return (float) (int) x; }
|
||||
+ #define isnan _isnan
|
||||
+#else
|
||||
+ #define M64P_FPU_INLINE static inline
|
||||
+ #include <fenv.h>
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+M64P_FPU_INLINE void set_rounding(void)
|
||||
+{
|
||||
+ switch(rounding_mode) {
|
||||
+ case 0x33F:
|
||||
+ fesetround(FE_TONEAREST);
|
||||
+ break;
|
||||
+ case 0xF3F:
|
||||
+ fesetround(FE_TOWARDZERO);
|
||||
+ break;
|
||||
+ case 0xB3F:
|
||||
+ fesetround(FE_UPWARD);
|
||||
+ break;
|
||||
+ case 0x73F:
|
||||
+ fesetround(FE_DOWNWARD);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void cvt_s_w(int *source,float *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *dest = (float) *source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_d_w(int *source,double *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *dest = (double) *source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_s_l(long long *source,float *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *dest = (float) *source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_d_l(long long *source,double *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *dest = (double) *source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_d_s(float *source,double *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *dest = (double) *source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_s_d(double *source,float *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *dest = (float) *source;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void round_l_s(float *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) roundf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void round_w_s(float *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) roundf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void trunc_l_s(float *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) truncf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void trunc_w_s(float *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) truncf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void ceil_l_s(float *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) ceilf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void ceil_w_s(float *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) ceilf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void floor_l_s(float *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) floorf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void floor_w_s(float *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) floorf(*source);
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void round_l_d(double *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) round(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void round_w_d(double *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) round(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void trunc_l_d(double *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) trunc(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void trunc_w_d(double *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) trunc(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void ceil_l_d(double *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) ceil(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void ceil_w_d(double *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) ceil(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void floor_l_d(double *source,long long *dest)
|
||||
+{
|
||||
+ *dest = (long long) floor(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void floor_w_d(double *source,int *dest)
|
||||
+{
|
||||
+ *dest = (int) floor(*source);
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void cvt_w_s(float *source,int *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ switch(FCR31&3)
|
||||
+ {
|
||||
+ case 0: round_w_s(source,dest);return;
|
||||
+ case 1: trunc_w_s(source,dest);return;
|
||||
+ case 2: ceil_w_s(source,dest);return;
|
||||
+ case 3: floor_w_s(source,dest);return;
|
||||
+ }
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_w_d(double *source,int *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ switch(FCR31&3)
|
||||
+ {
|
||||
+ case 0: round_w_d(source,dest);return;
|
||||
+ case 1: trunc_w_d(source,dest);return;
|
||||
+ case 2: ceil_w_d(source,dest);return;
|
||||
+ case 3: floor_w_d(source,dest);return;
|
||||
+ }
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_l_s(float *source,long long *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ switch(FCR31&3)
|
||||
+ {
|
||||
+ case 0: round_l_s(source,dest);return;
|
||||
+ case 1: trunc_l_s(source,dest);return;
|
||||
+ case 2: ceil_l_s(source,dest);return;
|
||||
+ case 3: floor_l_s(source,dest);return;
|
||||
+ }
|
||||
+}
|
||||
+M64P_FPU_INLINE void cvt_l_d(double *source,long long *dest)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ switch(FCR31&3)
|
||||
+ {
|
||||
+ case 0: round_l_d(source,dest);return;
|
||||
+ case 1: trunc_l_d(source,dest);return;
|
||||
+ case 2: ceil_l_d(source,dest);return;
|
||||
+ case 3: floor_l_d(source,dest);return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_f_s()
|
||||
+{
|
||||
+ FCR31 &= ~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_un_s(float *source,float *target)
|
||||
+{
|
||||
+ FCR31=(isnan(*source) || isnan(*target)) ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_eq_s(float *source,float *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31&=~0x800000;return;}
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ueq_s(float *source,float *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31|=0x800000;return;}
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_olt_s(float *source,float *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31&=~0x800000;return;}
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ult_s(float *source,float *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31|=0x800000;return;}
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_ole_s(float *source,float *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31&=~0x800000;return;}
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ule_s(float *source,float *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31|=0x800000;return;}
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_sf_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31&=~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ngle_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31&=~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_seq_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ngl_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_lt_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_nge_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_le_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ngt_s(float *source,float *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_f_d()
|
||||
+{
|
||||
+ FCR31 &= ~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_un_d(double *source,double *target)
|
||||
+{
|
||||
+ FCR31=(isnan(*source) || isnan(*target)) ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_eq_d(double *source,double *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31&=~0x800000;return;}
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ueq_d(double *source,double *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31|=0x800000;return;}
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_olt_d(double *source,double *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31&=~0x800000;return;}
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ult_d(double *source,double *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31|=0x800000;return;}
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_ole_d(double *source,double *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31&=~0x800000;return;}
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ule_d(double *source,double *target)
|
||||
+{
|
||||
+ if (isnan(*source) || isnan(*target)) {FCR31|=0x800000;return;}
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_sf_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31&=~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ngle_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31&=~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_seq_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ngl_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source==*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_lt_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_nge_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+M64P_FPU_INLINE void c_le_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+M64P_FPU_INLINE void c_ngt_d(double *source,double *target)
|
||||
+{
|
||||
+ //if (isnan(*source) || isnan(*target)) // FIXME - exception
|
||||
+ FCR31 = *source<=*target ? FCR31|0x800000 : FCR31&~0x800000;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+M64P_FPU_INLINE void add_s(float *source1,float *source2,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)+(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void sub_s(float *source1,float *source2,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)-(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void mul_s(float *source1,float *source2,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)*(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void div_s(float *source1,float *source2,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)/(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void sqrt_s(float *source,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=sqrtf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void abs_s(float *source,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=fabsf(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void mov_s(float *source,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=*source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void neg_s(float *source,float *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=-(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void add_d(double *source1,double *source2,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)+(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void sub_d(double *source1,double *source2,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)-(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void mul_d(double *source1,double *source2,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)*(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void div_d(double *source1,double *source2,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=(*source1)/(*source2);
|
||||
+}
|
||||
+M64P_FPU_INLINE void sqrt_d(double *source,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=sqrt(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void abs_d(double *source,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=fabs(*source);
|
||||
+}
|
||||
+M64P_FPU_INLINE void mov_d(double *source,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=*source;
|
||||
+}
|
||||
+M64P_FPU_INLINE void neg_d(double *source,double *target)
|
||||
+{
|
||||
+ set_rounding();
|
||||
+ *target=-(*source);
|
||||
+}
|
@ -1,15 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_interupt_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/interupt.c.orig Tue Nov 23 03:15:08 2010
|
||||
+++ src/r4300/interupt.c Sun Dec 18 23:38:17 2011
|
||||
@@ -560,10 +560,7 @@ void gen_interupt()
|
||||
{
|
||||
if (blocks[i])
|
||||
{
|
||||
- if (blocks[i]->block) { free_exec(blocks[i]->block); blocks[i]->block = NULL; }
|
||||
- if (blocks[i]->code) { free_exec(blocks[i]->code); blocks[i]->code = NULL; }
|
||||
- if (blocks[i]->jumps_table) { free(blocks[i]->jumps_table); blocks[i]->jumps_table = NULL; }
|
||||
- if (blocks[i]->riprel_table) { free(blocks[i]->riprel_table); blocks[i]->riprel_table = NULL; }
|
||||
+ free_block(blocks[i]);
|
||||
free(blocks[i]);
|
||||
blocks[i] = NULL;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_macros_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/macros.h.orig Sun Dec 18 23:19:42 2011
|
||||
+++ src/r4300/macros.h Sun Dec 18 20:04:55 2011
|
||||
@@ -49,7 +49,7 @@
|
||||
#define cffd PC->f.cf.fd
|
||||
|
||||
// 32 bits macros
|
||||
-#ifndef _BIG_ENDIAN
|
||||
+#ifndef M64P_BIG_ENDIAN
|
||||
#define rrt32 *((int*)PC->f.r.rt)
|
||||
#define rrd32 *((int*)PC->f.r.rd)
|
||||
#define rrs32 *((int*)PC->f.r.rs)
|
||||
@@ -89,20 +89,6 @@
|
||||
#define TagLo reg_cop0[28]
|
||||
#define TagHi reg_cop0[29]
|
||||
#define ErrorEPC reg_cop0[30]
|
||||
-
|
||||
-#if (defined(__i386__) || defined(__x86_64__))
|
||||
-#define set_rounding() __asm__ __volatile__("fldcw %0" : : "m" (rounding_mode))
|
||||
-#define set_trunc() __asm__ __volatile__("fldcw %0" : : "m" (trunc_mode))
|
||||
-#define set_round() __asm__ __volatile__("fldcw %0" : : "m" (round_mode))
|
||||
-#define set_ceil() __asm__ __volatile__("fldcw %0" : : "m" (ceil_mode))
|
||||
-#define set_floor() __asm__ __volatile__("fldcw %0" : : "m" (floor_mode))
|
||||
-#else
|
||||
-#define set_rounding() ((void) 0)
|
||||
-#define set_trunc() ((void) 0)
|
||||
-#define set_round() ((void) 0)
|
||||
-#define set_ceil() ((void) 0)
|
||||
-#define set_floor() ((void) 0)
|
||||
-#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,708 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_pure_interp_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/pure_interp.c.orig Sun Dec 18 23:17:24 2011
|
||||
+++ src/r4300/pure_interp.c Sun Dec 18 20:04:55 2011
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "exception.h"
|
||||
#include "macros.h"
|
||||
#include "interupt.h"
|
||||
+#include "fpu.h"
|
||||
|
||||
#ifdef DBG
|
||||
#include "debugger/dbg_types.h"
|
||||
@@ -1274,25 +1275,19 @@ static void (*interp_cop1_bc[4])(void) =
|
||||
|
||||
static void ADD_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] +
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ add_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void SUB_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] -
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ sub_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void MUL_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] *
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ mul_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1302,182 +1297,145 @@ static void DIV_S(void)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "DIV_S by 0");
|
||||
}
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs] /
|
||||
- *reg_cop1_simple[cfft];
|
||||
+ div_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void SQRT_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) sqrt(*reg_cop1_simple[cffs]);
|
||||
+ sqrt_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void ABS_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) fabs(*reg_cop1_simple[cffs]);
|
||||
+ abs_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void MOV_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = *reg_cop1_simple[cffs];
|
||||
+ mov_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void NEG_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = -(*reg_cop1_simple[cffs]);
|
||||
+ neg_s(reg_cop1_simple[cffs], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void ROUND_L_S(void)
|
||||
{
|
||||
- set_round();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ round_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void TRUNC_L_S(void)
|
||||
{
|
||||
- set_trunc();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ trunc_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CEIL_L_S(void)
|
||||
{
|
||||
- set_ceil();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ ceil_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void FLOOR_L_S(void)
|
||||
{
|
||||
- set_floor();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ floor_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void ROUND_W_S(void)
|
||||
{
|
||||
- set_round();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ round_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void TRUNC_W_S(void)
|
||||
{
|
||||
- set_trunc();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ trunc_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CEIL_W_S(void)
|
||||
{
|
||||
- set_ceil();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ ceil_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void FLOOR_W_S(void)
|
||||
{
|
||||
- set_floor();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ floor_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_D_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_simple[cffs];
|
||||
+ cvt_d_s(reg_cop1_simple[cffs], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_W_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_simple[cffs];
|
||||
+ cvt_w_s(reg_cop1_simple[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_L_S(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_simple[cffs];
|
||||
+ cvt_l_s(reg_cop1_simple[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_F_S(void)
|
||||
{
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_f_s();
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_UN_S(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]))
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_un_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_EQ_S(void)
|
||||
{
|
||||
- if (!isnan(*reg_cop1_simple[cffs]) && !isnan(*reg_cop1_simple[cfft]) &&
|
||||
- *reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_eq_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_UEQ_S(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]) ||
|
||||
- *reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ueq_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_OLT_S(void)
|
||||
{
|
||||
- if (!isnan(*reg_cop1_simple[cffs]) && !isnan(*reg_cop1_simple[cfft]) &&
|
||||
- *reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_olt_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_ULT_S(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]) ||
|
||||
- *reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ult_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_OLE_S(void)
|
||||
{
|
||||
- if (!isnan(*reg_cop1_simple[cffs]) && !isnan(*reg_cop1_simple[cfft]) &&
|
||||
- *reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ole_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_ULE_S(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_simple[cffs]) || isnan(*reg_cop1_simple[cfft]) ||
|
||||
- *reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ule_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1488,7 +1446,7 @@ static void C_SF_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_sf_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1499,7 +1457,7 @@ static void C_NGLE_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_ngle_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1510,9 +1468,7 @@ static void C_SEQ_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_seq_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1523,9 +1479,7 @@ static void C_NGL_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] == *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngl_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1536,9 +1490,7 @@ static void C_LT_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_lt_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1549,9 +1501,7 @@ static void C_NGE_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] < *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_nge_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1562,9 +1512,7 @@ static void C_LE_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_le_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1575,9 +1523,7 @@ static void C_NGT_S(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_simple[cffs] <= *reg_cop1_simple[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngt_s(reg_cop1_simple[cffs], reg_cop1_simple[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1595,25 +1541,19 @@ C_SF_S ,C_NGLE_S ,C_SEQ_S ,C_NGL_S ,C_LT_S ,C_NGE
|
||||
|
||||
static void ADD_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] +
|
||||
- *reg_cop1_double[cfft];
|
||||
+ add_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void SUB_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] -
|
||||
- *reg_cop1_double[cfft];
|
||||
+ sub_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void MUL_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] *
|
||||
- *reg_cop1_double[cfft];
|
||||
+ mul_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1628,182 +1568,145 @@ static void DIV_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "DIV_D by 0");
|
||||
//return;
|
||||
}
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs] /
|
||||
- *reg_cop1_double[cfft];
|
||||
+ div_d(reg_cop1_double[cffs], reg_cop1_double[cfft], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void SQRT_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = sqrt(*reg_cop1_double[cffs]);
|
||||
+ sqrt_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void ABS_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = fabs(*reg_cop1_double[cffs]);
|
||||
+ abs_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void MOV_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *reg_cop1_double[cffs];
|
||||
+ mov_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void NEG_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = -(*reg_cop1_double[cffs]);
|
||||
+ neg_d(reg_cop1_double[cffs], reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void ROUND_L_D(void)
|
||||
{
|
||||
- set_round();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ round_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void TRUNC_L_D(void)
|
||||
{
|
||||
- set_trunc();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ trunc_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CEIL_L_D(void)
|
||||
{
|
||||
- set_ceil();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ ceil_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void FLOOR_L_D(void)
|
||||
{
|
||||
- set_floor();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ floor_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void ROUND_W_D(void)
|
||||
{
|
||||
- set_round();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ round_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void TRUNC_W_D(void)
|
||||
{
|
||||
- set_trunc();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ trunc_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CEIL_W_D(void)
|
||||
{
|
||||
- set_ceil();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ ceil_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void FLOOR_W_D(void)
|
||||
{
|
||||
- set_floor();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ floor_w_d(reg_cop1_double[cffs], ((int*)reg_cop1_simple[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_S_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) *reg_cop1_double[cffs];
|
||||
+ cvt_s_d(reg_cop1_double[cffs], reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_W_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *((int*)reg_cop1_simple[cffd]) = (int) *reg_cop1_double[cffs];
|
||||
+ cvt_w_d(reg_cop1_double[cffs], (int*)reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_L_D(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *((long long*)(reg_cop1_double[cffd])) = (long long) *reg_cop1_double[cffs];
|
||||
+ cvt_l_d(reg_cop1_double[cffs], (long long*)(reg_cop1_double[cffd]));
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_F_D(void)
|
||||
{
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_f_d();
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_UN_D(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]))
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_un_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_EQ_D(void)
|
||||
{
|
||||
- if (!isnan(*reg_cop1_double[cffs]) && !isnan(*reg_cop1_double[cfft]) &&
|
||||
- *reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_eq_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_UEQ_D(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]) ||
|
||||
- *reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ueq_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_OLT_D(void)
|
||||
{
|
||||
- if (!isnan(*reg_cop1_double[cffs]) && !isnan(*reg_cop1_double[cfft]) &&
|
||||
- *reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_olt_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_ULT_D(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]) ||
|
||||
- *reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ult_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_OLE_D(void)
|
||||
{
|
||||
- if (!isnan(*reg_cop1_double[cffs]) && !isnan(*reg_cop1_double[cfft]) &&
|
||||
- *reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ole_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void C_ULE_D(void)
|
||||
{
|
||||
- if (isnan(*reg_cop1_double[cffs]) || isnan(*reg_cop1_double[cfft]) ||
|
||||
- *reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ule_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1814,7 +1717,7 @@ static void C_SF_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_sf_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1825,7 +1728,7 @@ static void C_NGLE_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- FCR31 &= ~0x800000;
|
||||
+ c_ngle_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1836,9 +1739,7 @@ static void C_SEQ_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_seq_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1849,9 +1750,7 @@ static void C_NGL_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] == *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngl_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1862,9 +1761,7 @@ static void C_LT_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_lt_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1875,9 +1772,7 @@ static void C_NGE_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] < *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_nge_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1888,9 +1783,7 @@ static void C_LE_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_le_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1901,9 +1794,7 @@ static void C_NGT_D(void)
|
||||
DebugMessage(M64MSG_ERROR, "Invalid operation exception in C opcode");
|
||||
stop=1;
|
||||
}
|
||||
- if (*reg_cop1_double[cffs] <= *reg_cop1_double[cfft])
|
||||
- FCR31 |= 0x800000;
|
||||
- else FCR31 &= ~0x800000;
|
||||
+ c_ngt_d(reg_cop1_double[cffs], reg_cop1_double[cfft]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1921,15 +1812,13 @@ C_SF_D ,C_NGLE_D ,C_SEQ_D ,C_NGL_D ,C_LT_D ,C_NGE
|
||||
|
||||
static void CVT_S_W(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) *((int*)reg_cop1_simple[cffs]);
|
||||
+ cvt_s_w(((int*)reg_cop1_simple[cffs]), reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_D_W(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = *((int*)reg_cop1_simple[cffs]);
|
||||
+ cvt_d_w(((int*)reg_cop1_simple[cffs]), reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -1947,15 +1836,13 @@ static void (*interp_cop1_w[64])(void) =
|
||||
|
||||
static void CVT_S_L(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_simple[cffd] = (float) *((long long*)(reg_cop1_double[cffs]));
|
||||
+ cvt_s_l((long long*)(reg_cop1_double[cffs]), reg_cop1_simple[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
static void CVT_D_L(void)
|
||||
{
|
||||
- set_rounding();
|
||||
- *reg_cop1_double[cffd] = (double) *((long long*)(reg_cop1_double[cffs]));
|
||||
+ cvt_d_l((long long*)(reg_cop1_double[cffs]), reg_cop1_double[cffd]);
|
||||
interp_addr+=4;
|
||||
}
|
||||
|
||||
@@ -2021,16 +1908,16 @@ static void CTC1(void)
|
||||
switch((FCR31 & 3))
|
||||
{
|
||||
case 0:
|
||||
- rounding_mode = 0x33F;
|
||||
+ rounding_mode = 0x33F; // Round to nearest, or to even if equidistant
|
||||
break;
|
||||
case 1:
|
||||
- rounding_mode = 0xF3F;
|
||||
+ rounding_mode = 0xF3F; // Truncate (toward 0)
|
||||
break;
|
||||
case 2:
|
||||
- rounding_mode = 0xB3F;
|
||||
+ rounding_mode = 0xB3F; // Round up (toward +infinity)
|
||||
break;
|
||||
case 3:
|
||||
- rounding_mode = 0x73F;
|
||||
+ rounding_mode = 0x73F; // Round down (toward -infinity)
|
||||
break;
|
||||
}
|
||||
//if ((FCR31 >> 7) & 0x1F) printf("FPU Exception enabled : %x\n",
|
@ -1,69 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_r4300_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/r4300.c.orig Sun Dec 18 23:08:50 2011
|
||||
+++ src/r4300/r4300.c Sun Dec 18 20:04:55 2011
|
||||
@@ -64,7 +64,6 @@ char invalid_code[0x100000];
|
||||
precomp_block *blocks[0x100000], *actual;
|
||||
int rounding_mode = 0x33F, trunc_mode = 0xF3F, round_mode = 0x33F,
|
||||
ceil_mode = 0xB3F, floor_mode = 0x73F;
|
||||
-static void (*code)(void);
|
||||
|
||||
/*#define check_memory() \
|
||||
if (!invalid_code[address>>12]) \
|
||||
@@ -1497,7 +1496,7 @@ void jump_to_func(void)
|
||||
*/
|
||||
void shuffle_fpr_data(int oldStatus, int newStatus)
|
||||
{
|
||||
-#if defined(_BIG_ENDIAN)
|
||||
+#if defined(M64P_BIG_ENDIAN)
|
||||
const int isBigEndian = 1;
|
||||
#else
|
||||
const int isBigEndian = 0;
|
||||
@@ -1550,7 +1549,7 @@ void shuffle_fpr_data(int oldStatus, int newStatus)
|
||||
void set_fpr_pointers(int newStatus)
|
||||
{
|
||||
int i;
|
||||
-#if defined(_BIG_ENDIAN)
|
||||
+#if defined(M64P_BIG_ENDIAN)
|
||||
const int isBigEndian = 1;
|
||||
#else
|
||||
const int isBigEndian = 0;
|
||||
@@ -1889,9 +1888,15 @@ void r4300_execute(void)
|
||||
#if defined(DYNAREC)
|
||||
else if (r4300emu >= 2)
|
||||
{
|
||||
+ void (*code)(void);
|
||||
DebugMessage(M64MSG_INFO, "Starting R4300 emulator: Dynamic Recompiler");
|
||||
r4300emu = CORE_DYNAREC;
|
||||
init_blocks();
|
||||
+
|
||||
+ /* Prevent segfault on failed init_blocks */
|
||||
+ if (!actual->block || !actual->code)
|
||||
+ return;
|
||||
+
|
||||
code = (void *)(actual->code+(actual->block[0x40/4].local_addr));
|
||||
dyna_start(code);
|
||||
PC++;
|
||||
@@ -1919,6 +1924,11 @@ void r4300_execute(void)
|
||||
DebugMessage(M64MSG_INFO, "Starting R4300 emulator: Cached Interpreter");
|
||||
r4300emu = CORE_INTERPRETER;
|
||||
init_blocks();
|
||||
+
|
||||
+ /* Prevent segfault on failed init_blocks */
|
||||
+ if (!actual->block)
|
||||
+ return;
|
||||
+
|
||||
last_addr = PC->addr;
|
||||
while (!stop)
|
||||
{
|
||||
@@ -1940,10 +1950,7 @@ void r4300_execute(void)
|
||||
{
|
||||
if (blocks[i])
|
||||
{
|
||||
- if (blocks[i]->block) { free_exec(blocks[i]->block); blocks[i]->block = NULL; }
|
||||
- if (blocks[i]->code) { free_exec(blocks[i]->code); blocks[i]->code = NULL; }
|
||||
- if (blocks[i]->jumps_table) { free(blocks[i]->jumps_table); blocks[i]->jumps_table = NULL; }
|
||||
- if (blocks[i]->riprel_table) { free(blocks[i]->riprel_table); blocks[i]->riprel_table = NULL; }
|
||||
+ free_block(blocks[i]);
|
||||
free(blocks[i]);
|
||||
blocks[i] = NULL;
|
||||
}
|
@ -1,138 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_recomp_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/recomp.c.orig Sun Dec 18 23:13:44 2011
|
||||
+++ src/r4300/recomp.c Sun Dec 18 20:04:55 2011
|
||||
@@ -2159,6 +2159,17 @@ static void (*recomp_ops[64])(void) =
|
||||
RSC , RSWC1 , RSV , RSV , RSCD , RSDC1, RSV , RSD
|
||||
};
|
||||
|
||||
+static int get_block_length(const precomp_block *block)
|
||||
+{
|
||||
+ return (block->end-block->start)/4;
|
||||
+}
|
||||
+
|
||||
+static size_t get_block_memsize(const precomp_block *block)
|
||||
+{
|
||||
+ int length = get_block_length(block);
|
||||
+ return ((length+1)+(length>>2)) * sizeof(precomp_instr);
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
******************** initialize an empty block ***********************
|
||||
**********************************************************************/
|
||||
@@ -2171,12 +2182,26 @@ void init_block(int *source, precomp_block *block)
|
||||
DebugMessage(M64MSG_INFO, "init block %x - %x", (int) block->start, (int) block->end);
|
||||
#endif
|
||||
|
||||
- length = (block->end-block->start)/4;
|
||||
+ length = get_block_length(block);
|
||||
|
||||
if (!block->block)
|
||||
{
|
||||
- long memsize = ((length+1)+(length>>2)) * sizeof(precomp_instr);
|
||||
- block->block = (precomp_instr *) malloc_exec(memsize);
|
||||
+ size_t memsize = get_block_memsize(block);
|
||||
+ if (r4300emu == CORE_DYNAREC) {
|
||||
+ block->block = (precomp_instr *) malloc_exec(memsize);
|
||||
+ if (!block->block) {
|
||||
+ DebugMessage(M64MSG_ERROR, "Memory error: couldn't allocate executable memory for dynamic recompiler. Try to use an interpreter mode.");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ block->block = (precomp_instr *) malloc(memsize);
|
||||
+ if (!block->block) {
|
||||
+ DebugMessage(M64MSG_ERROR, "Memory error: couldn't allocate memory for cached interpreter.");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
memset(block->block, 0, memsize);
|
||||
already_exist = 0;
|
||||
}
|
||||
@@ -2338,6 +2363,22 @@ void init_block(int *source, precomp_block *block)
|
||||
end_section(COMPILER_SECTION);
|
||||
}
|
||||
|
||||
+void free_block(precomp_block *block)
|
||||
+{
|
||||
+ size_t memsize = get_block_memsize(block);
|
||||
+
|
||||
+ if (block->block) {
|
||||
+ if (r4300emu == CORE_DYNAREC)
|
||||
+ free_exec(block->block, memsize);
|
||||
+ else
|
||||
+ free(block->block);
|
||||
+ block->block = NULL;
|
||||
+ }
|
||||
+ if (block->code) { free_exec(block->code, block->max_code_length); block->code = NULL; }
|
||||
+ if (block->jumps_table) { free(block->jumps_table); block->jumps_table = NULL; }
|
||||
+ if (block->riprel_table) { free(block->riprel_table); block->riprel_table = NULL; }
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
********************* recompile a block of code **********************
|
||||
**********************************************************************/
|
||||
@@ -2594,17 +2635,16 @@ void *malloc_exec(size_t size)
|
||||
#if defined(WIN32)
|
||||
return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
#elif defined(__GNUC__)
|
||||
- int pagesize = sysconf(_SC_PAGE_SIZE);
|
||||
- if (pagesize == -1)
|
||||
- { DebugMessage(M64MSG_ERROR, "Memory error: couldn't determine system memory page size."); return NULL; }
|
||||
|
||||
- /* Allocate a buffer aligned on a page boundary; initial protection is PROT_READ | PROT_WRITE */
|
||||
- void *block = valloc(size);
|
||||
- if (block == NULL)
|
||||
- { DebugMessage(M64MSG_ERROR, "Memory error: couldn't allocate %i byte block of %i-byte aligned memory.", (int) size, pagesize); return NULL; }
|
||||
+ #ifndef MAP_ANONYMOUS
|
||||
+ #ifdef MAP_ANON
|
||||
+ #define MAP_ANONYMOUS MAP_ANON
|
||||
+ #endif
|
||||
+ #endif
|
||||
|
||||
- if (mprotect(block, size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
|
||||
- { DebugMessage(M64MSG_ERROR, "Memory error: couldn't set RWX permissions on %i byte block of memory.", (int) size); return NULL; }
|
||||
+ void *block = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
+ if (block == MAP_FAILED)
|
||||
+ { DebugMessage(M64MSG_ERROR, "Memory error: couldn't allocate %zi byte block of aligned RWX memory.", size); return NULL; }
|
||||
|
||||
return block;
|
||||
#else
|
||||
@@ -2615,30 +2655,30 @@ void *malloc_exec(size_t size)
|
||||
/**********************************************************************
|
||||
************* reallocate memory with executable bit set **************
|
||||
**********************************************************************/
|
||||
-void *realloc_exec(void *ptr, size_t size, size_t newsize)
|
||||
+void *realloc_exec(void *ptr, size_t oldsize, size_t newsize)
|
||||
{
|
||||
void* block = malloc_exec(newsize);
|
||||
if (block != NULL)
|
||||
{
|
||||
size_t copysize;
|
||||
- if (size < newsize)
|
||||
- copysize = size;
|
||||
+ if (oldsize < newsize)
|
||||
+ copysize = oldsize;
|
||||
else
|
||||
copysize = newsize;
|
||||
memcpy(block, ptr, copysize);
|
||||
}
|
||||
- free_exec(ptr);
|
||||
+ free_exec(ptr, oldsize);
|
||||
return block;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
**************** frees memory with executable bit set ****************
|
||||
**********************************************************************/
|
||||
-void free_exec(void *ptr)
|
||||
+void free_exec(void *ptr, size_t length)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
VirtualFree(ptr, 0, MEM_RELEASE);
|
||||
-#else
|
||||
- free(ptr);
|
||||
+#else
|
||||
+ munmap(ptr, length);
|
||||
#endif
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_recomp_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/recomp.h.orig Sun Dec 18 23:14:01 2011
|
||||
+++ src/r4300/recomp.h Sun Dec 18 20:04:55 2011
|
||||
@@ -88,14 +88,15 @@ typedef struct _precomp_block
|
||||
|
||||
void recompile_block(int *source, precomp_block *block, unsigned int func);
|
||||
void init_block(int *source, precomp_block *block);
|
||||
+void free_block(precomp_block *block);
|
||||
void recompile_opcode(void);
|
||||
void prefetch_opcode(unsigned int op);
|
||||
void dyna_jump(void);
|
||||
void dyna_start(void (*code)(void));
|
||||
void dyna_stop(void);
|
||||
void *malloc_exec(size_t size);
|
||||
-void *realloc_exec(void *ptr, size_t size, size_t newsize);
|
||||
-void free_exec(void *ptr);
|
||||
+void *realloc_exec(void *ptr, size_t oldsize, size_t newsize);
|
||||
+void free_exec(void *ptr, size_t length);
|
||||
|
||||
extern precomp_instr *dst; /* precomp_instr structure for instruction being recompiled */
|
||||
|
@ -1,128 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_x86_64_rjump_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/x86_64/rjump.c.orig Sun Dec 18 23:04:33 2011
|
||||
+++ src/r4300/x86_64/rjump.c Sun Dec 18 20:04:55 2011
|
||||
@@ -58,97 +58,33 @@ void dyna_start(void (*code)(void))
|
||||
/* It will jump to label 2, restore the base and stack pointers, and exit this function */
|
||||
DebugMessage(M64MSG_INFO, "R4300: starting 64-bit dynamic recompiler at: 0x%lx", (unsigned long) code);
|
||||
#if defined(__GNUC__) && defined(__x86_64__)
|
||||
- #if defined(PIC)
|
||||
- /* for -fPIC (shared libraries) */
|
||||
- #if defined(__APPLE__)
|
||||
- /* OSX uses underscores before the symbols names in 64-bit PIC compilation */
|
||||
- asm volatile
|
||||
- (" push %%rbx \n" /* we must push an even # of registers to keep stack 16-byte aligned */
|
||||
- " push %%r12 \n"
|
||||
- " push %%r13 \n"
|
||||
- " push %%r14 \n"
|
||||
- " push %%r15 \n"
|
||||
- " push %%rbp \n"
|
||||
- " mov %%rsp, _save_rsp(%%rip) \n"
|
||||
- " lea _reg(%%rip), %%r15 \n" /* store the base location of the r4300 registers in r15 for addressing */
|
||||
- " call 1f \n"
|
||||
- " jmp 2f \n"
|
||||
- "1: \n"
|
||||
- " pop %%rax \n"
|
||||
- " mov %%rax, _save_rip(%%rip) \n"
|
||||
- " call *%%rbx \n"
|
||||
- "2: \n"
|
||||
- " mov _save_rsp(%%rip), %%rsp \n"
|
||||
- " pop %%rbp \n"
|
||||
- " pop %%r15 \n"
|
||||
- " pop %%r14 \n"
|
||||
- " pop %%r13 \n"
|
||||
- " pop %%r12 \n"
|
||||
- " pop %%rbx \n"
|
||||
- :
|
||||
- : "b" (code)
|
||||
- : "%rax", "memory"
|
||||
- );
|
||||
- #else
|
||||
- /* Linux and other unix variants do not use underscores */
|
||||
- asm volatile
|
||||
- (" push %%rbx \n" /* we must push an even # of registers to keep stack 16-byte aligned */
|
||||
- " push %%r12 \n"
|
||||
- " push %%r13 \n"
|
||||
- " push %%r14 \n"
|
||||
- " push %%r15 \n"
|
||||
- " push %%rbp \n"
|
||||
- " mov %%rsp, save_rsp(%%rip) \n"
|
||||
- " lea reg(%%rip), %%r15 \n" /* store the base location of the r4300 registers in r15 for addressing */
|
||||
- " call 1f \n"
|
||||
- " jmp 2f \n"
|
||||
- "1: \n"
|
||||
- " pop %%rax \n"
|
||||
- " mov %%rax, save_rip(%%rip) \n"
|
||||
- " call *%%rbx \n"
|
||||
- "2: \n"
|
||||
- " mov save_rsp(%%rip), %%rsp \n"
|
||||
- " pop %%rbp \n"
|
||||
- " pop %%r15 \n"
|
||||
- " pop %%r14 \n"
|
||||
- " pop %%r13 \n"
|
||||
- " pop %%r12 \n"
|
||||
- " pop %%rbx \n"
|
||||
- :
|
||||
- : "b" (code)
|
||||
- : "%rax", "memory"
|
||||
- );
|
||||
- #endif
|
||||
- #else
|
||||
- /* for non-PIC binaries (this is normally not used, because the core is always compiled as a shared library) */
|
||||
- asm volatile
|
||||
- (" push %%rbx \n" /* we must push an even # of registers to keep stack 16-byte aligned */
|
||||
- " push %%r12 \n"
|
||||
- " push %%r13 \n"
|
||||
- " push %%r14 \n"
|
||||
- " push %%r15 \n"
|
||||
- " push %%rbp \n"
|
||||
- " mov %%rsp, save_rsp \n"
|
||||
- " lea reg, %%r15 \n" /* store the base location of the r4300 registers in r15 for addressing */
|
||||
- " call 1f \n"
|
||||
- " jmp 2f \n"
|
||||
- "1: \n"
|
||||
- " pop %%rax \n"
|
||||
- " mov %%rax, save_rip \n"
|
||||
- " call *%%rbx \n"
|
||||
- "2: \n"
|
||||
- " mov save_rsp, %%rsp \n"
|
||||
- " pop %%rbp \n"
|
||||
- " pop %%r15 \n"
|
||||
- " pop %%r14 \n"
|
||||
- " pop %%r13 \n"
|
||||
- " pop %%r12 \n"
|
||||
- " pop %%rbx \n"
|
||||
- :
|
||||
- : "b" (code)
|
||||
- : "%rax", "memory"
|
||||
- );
|
||||
- #endif
|
||||
+ asm volatile
|
||||
+ (" push %%rbx \n" /* we must push an even # of registers to keep stack 16-byte aligned */
|
||||
+ " push %%r12 \n"
|
||||
+ " push %%r13 \n"
|
||||
+ " push %%r14 \n"
|
||||
+ " push %%r15 \n"
|
||||
+ " push %%rbp \n"
|
||||
+ " mov %%rsp, %[save_rsp] \n"
|
||||
+ " lea %[reg], %%r15 \n" /* store the base location of the r4300 registers in r15 for addressing */
|
||||
+ " call 1f \n"
|
||||
+ " jmp 2f \n"
|
||||
+ "1: \n"
|
||||
+ " pop %%rax \n"
|
||||
+ " mov %%rax, %[save_rip] \n"
|
||||
+ " call *%%rbx \n"
|
||||
+ "2: \n"
|
||||
+ " mov %[save_rsp], %%rsp \n"
|
||||
+ " pop %%rbp \n"
|
||||
+ " pop %%r15 \n"
|
||||
+ " pop %%r14 \n"
|
||||
+ " pop %%r13 \n"
|
||||
+ " pop %%r12 \n"
|
||||
+ " pop %%rbx \n"
|
||||
+ : [save_rsp]"=m"(save_rsp), [save_rip]"=m"(save_rip)
|
||||
+ : "b" (code), [reg]"m"(*reg)
|
||||
+ : "%rax", "memory"
|
||||
+ );
|
||||
#endif
|
||||
|
||||
/* clear flag; stack is back to normal */
|
@ -1,88 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-core_src_r4300_x86_rjump_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/r4300/x86/rjump.c.orig Sun Dec 18 23:04:24 2011
|
||||
+++ src/r4300/x86/rjump.c Sun Dec 18 20:04:55 2011
|
||||
@@ -92,55 +92,39 @@ void dyna_start(void (*code)(void))
|
||||
mov edi, save_edi
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__i386__)
|
||||
- #if defined(PIC)
|
||||
+ #if defined(__PIC__)
|
||||
/* for -fPIC (shared libraries) */
|
||||
- asm volatile
|
||||
- (" movl %%ebp, save_ebp@GOTOFF(%%ebx)\n"
|
||||
- " movl %%esp, save_esp@GOTOFF(%%ebx)\n"
|
||||
- " movl %%esi, save_esi@GOTOFF(%%ebx)\n"
|
||||
- " movl %%edi, save_edi@GOTOFF(%%ebx)\n"
|
||||
- " call 1f \n"
|
||||
- " jmp 2f \n"
|
||||
- "1: \n"
|
||||
- " popl %%eax \n"
|
||||
- " movl %%eax, save_eip@GOTOFF(%%ebx)\n"
|
||||
- " call *%[codeptr] \n"
|
||||
- "2: \n"
|
||||
- " call __i686.get_pc_thunk.bx \n"
|
||||
- " addl $_GLOBAL_OFFSET_TABLE_, %%ebx \n"
|
||||
- " movl save_ebp@GOTOFF(%%ebx), %%ebp \n"
|
||||
- " movl save_esp@GOTOFF(%%ebx), %%esp \n"
|
||||
- " movl save_esi@GOTOFF(%%ebx), %%esi \n"
|
||||
- " movl save_edi@GOTOFF(%%ebx), %%edi \n"
|
||||
- :
|
||||
- : [codeptr]"r"(code)
|
||||
- : "eax", "ecx", "edx", "memory"
|
||||
- );
|
||||
+ #define STORE_EBX
|
||||
+ #define LOAD_EBX "call __i686.get_pc_thunk.bx \n" \
|
||||
+ "addl $_GLOBAL_OFFSET_TABLE_, %%ebx \n"
|
||||
#else
|
||||
/* for non-PIC binaries */
|
||||
- asm volatile
|
||||
- (" movl %%ebp, save_ebp \n"
|
||||
- " movl %%esp, save_esp \n"
|
||||
- " movl %%ebx, save_ebx \n"
|
||||
- " movl %%esi, save_esi \n"
|
||||
- " movl %%edi, save_edi \n"
|
||||
- " call 1f \n"
|
||||
- " jmp 2f \n"
|
||||
- "1: \n"
|
||||
- " popl %%eax \n"
|
||||
- " movl %%eax, save_eip \n"
|
||||
- " call *%[codeptr] \n"
|
||||
- "2: \n"
|
||||
- " movl save_ebp, %%ebp \n"
|
||||
- " movl save_esp, %%esp \n"
|
||||
- " movl save_ebx, %%ebx \n"
|
||||
- " movl save_esi, %%esi \n"
|
||||
- " movl save_edi, %%edi \n"
|
||||
- :
|
||||
- : [codeptr]"r"(code)
|
||||
- : "eax", "ecx", "edx", "memory"
|
||||
- );
|
||||
+ #define STORE_EBX "movl %%ebx, %[save_ebx] \n"
|
||||
+ #define LOAD_EBX "movl %[save_ebx], %%ebx \n"
|
||||
#endif
|
||||
+
|
||||
+ asm volatile
|
||||
+ (STORE_EBX
|
||||
+ " movl %%ebp, %[save_ebp] \n"
|
||||
+ " movl %%esp, %[save_esp] \n"
|
||||
+ " movl %%esi, %[save_esi] \n"
|
||||
+ " movl %%edi, %[save_edi] \n"
|
||||
+ " call 1f \n"
|
||||
+ " jmp 2f \n"
|
||||
+ "1: \n"
|
||||
+ " popl %%eax \n"
|
||||
+ " movl %%eax, %[save_eip] \n"
|
||||
+ " call *%[codeptr] \n"
|
||||
+ "2: \n"
|
||||
+ LOAD_EBX
|
||||
+ " movl %[save_ebp], %%ebp \n"
|
||||
+ " movl %[save_esp], %%esp \n"
|
||||
+ " movl %[save_esi], %%esi \n"
|
||||
+ " movl %[save_edi], %%edi \n"
|
||||
+ : [save_ebp]"=m"(save_ebp), [save_esp]"=m"(save_esp), [save_ebx]"=m"(save_ebx), [save_esi]"=m"(save_esi), [save_edi]"=m"(save_edi), [save_eip]"=m"(save_eip)
|
||||
+ : [codeptr]"r"(code)
|
||||
+ : "eax", "ecx", "edx", "memory"
|
||||
+ );
|
||||
#endif
|
||||
|
||||
/* clear flag; stack is back to normal */
|
@ -1,4 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.2 2012/08/13 06:53:55 bentley Exp $
|
||||
include/mupen64plus/
|
||||
include/mupen64plus/m64p_common.h
|
||||
include/mupen64plus/m64p_config.h
|
||||
@ -7,6 +7,7 @@ include/mupen64plus/m64p_frontend.h
|
||||
include/mupen64plus/m64p_plugin.h
|
||||
include/mupen64plus/m64p_types.h
|
||||
include/mupen64plus/m64p_vidext.h
|
||||
lib/libmupen64plus.so.2
|
||||
@lib lib/libmupen64plus.so.${LIBmupen64plus_VERSION}
|
||||
share/mupen64plus/
|
||||
share/mupen64plus/font.ttf
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (mupen64plus-input-sdl-src-1.99.4.tar.gz) = Ez19x45tOTV0vhyqJgnlCA==
|
||||
RMD160 (mupen64plus-input-sdl-src-1.99.4.tar.gz) = R+NbOUxAJjk0EwIPRpUW9270wpA=
|
||||
SHA1 (mupen64plus-input-sdl-src-1.99.4.tar.gz) = XdSZP2JMv/EqL8Hc0CzSAVUVGqI=
|
||||
SHA256 (mupen64plus-input-sdl-src-1.99.4.tar.gz) = WywRmrpM7QrIjmobFgl3Ylqi7XEZ4wi1zyu26lFwafA=
|
||||
SIZE (mupen64plus-input-sdl-src-1.99.4.tar.gz) = 39202
|
||||
SHA256 (mupen64plus-input-sdl-src-1.99.5.tar.gz) = Tw2js6lEIrNxTO1Lu9Q/NAymvrPOtjqweRwEfTr39YA=
|
||||
SIZE (mupen64plus-input-sdl-src-1.99.5.tar.gz) = 37756
|
||||
|
@ -1,27 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-input-sdl_projects_unix_Makefile,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- projects/unix/Makefile.orig Tue Nov 23 03:15:13 2010
|
||||
+++ projects/unix/Makefile Sun Dec 18 17:12:34 2011
|
||||
@@ -48,6 +48,11 @@ ifeq ("$(UNAME)","FreeBSD")
|
||||
SO_EXTENSION = so
|
||||
SHARED = -shared
|
||||
endif
|
||||
+ifeq ("$(UNAME)","OpenBSD")
|
||||
+ OS = OPENBSD
|
||||
+ SO_EXTENSION = so
|
||||
+ SHARED = -shared
|
||||
+endif
|
||||
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
SO_EXTENSION = so
|
||||
@@ -255,9 +260,9 @@ targets:
|
||||
all: $(TARGET)
|
||||
|
||||
install: $(TARGET)
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
|
||||
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
|
||||
$(INSTALL) -m 0644 "../../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)"
|
||||
|
||||
uninstall:
|
@ -1,440 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-input-sdl_src_config_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/config.c.orig Sun Dec 18 23:50:44 2011
|
||||
+++ src/config.c Sun Dec 18 23:52:30 2011
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "autoconfig.h"
|
||||
#include "plugin.h"
|
||||
|
||||
+#include "config.h"
|
||||
+
|
||||
#define HAT_POS_NAME( hat ) \
|
||||
((hat == SDL_HAT_UP) ? "Up" : \
|
||||
((hat == SDL_HAT_DOWN) ? "Down" : \
|
||||
@@ -94,6 +96,7 @@ static void clear_controller(int iCtrlIdx)
|
||||
}
|
||||
for( b = 0; b < 2; b++ )
|
||||
{
|
||||
+ controller[iCtrlIdx].mouse_sens[b] = 2.0;
|
||||
controller[iCtrlIdx].axis_deadzone[b] = 4096;
|
||||
controller[iCtrlIdx].axis_peak[b] = 32768;
|
||||
controller[iCtrlIdx].axis[b].button_a = controller[iCtrlIdx].axis[b].button_b = -1;
|
||||
@@ -143,12 +146,20 @@ static const char * get_sdl_joystick_name(int iCtrlIdx
|
||||
return JoyName;
|
||||
}
|
||||
|
||||
+/////////////////////////////////////
|
||||
+// load_controller_config()
|
||||
+// return value: 1 = OK
|
||||
+// 0 = fail: couldn't open config section
|
||||
+// -1 = fail: stored configuration incomplete - missing parameters
|
||||
+// -2 = fail: AutoKeyboard stored in mupen64plus.cfg file
|
||||
+// -3 = fail: joystick name stored in mupen64plus.cfg doesn't match SDL joystick name for given SDL joystick #
|
||||
+
|
||||
static int load_controller_config(const char *SectionName, int i)
|
||||
{
|
||||
m64p_handle pConfig;
|
||||
char input_str[256], value1_str[16], value2_str[16];
|
||||
const char *config_ptr;
|
||||
- int readOK, j;
|
||||
+ int j;
|
||||
|
||||
/* Open the configuration section for this controller */
|
||||
if (ConfigOpenSection(SectionName, &pConfig) != M64ERR_SUCCESS)
|
||||
@@ -156,103 +167,132 @@ static int load_controller_config(const char *SectionN
|
||||
DebugMessage(M64MSG_ERROR, "Couldn't open config section '%s'", SectionName);
|
||||
return 0;
|
||||
}
|
||||
- /* try to read all of the configuration values */
|
||||
- for (readOK = 0; readOK == 0; readOK = 1)
|
||||
+ /* check for the required parameters */
|
||||
+ if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS)
|
||||
+ return -1;
|
||||
+ if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[i].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
|
||||
+ return -1;
|
||||
+ if (ConfigGetParameter(pConfig, "device", M64TYPE_INT, &controller[i].device, sizeof(int)) != M64ERR_SUCCESS)
|
||||
+ return -1;
|
||||
+ /* Name validation only applies to stored configurations (not auto-configs) */
|
||||
+ if (strncmp(SectionName, "AutoConfig", 10) != 0)
|
||||
{
|
||||
- /* check for the required parameters */
|
||||
- if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS)
|
||||
- break;
|
||||
- if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[i].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
|
||||
- break;
|
||||
- if (ConfigGetParameter(pConfig, "device", M64TYPE_INT, &controller[i].device, sizeof(int)) != M64ERR_SUCCESS)
|
||||
- break;
|
||||
- /* then do the optional parameters */
|
||||
- ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int));
|
||||
- if (ConfigGetParameter(pConfig, "AnalogDeadzone", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
|
||||
+ char device_name[256];
|
||||
+ if (ConfigGetParameter(pConfig, "name", M64TYPE_STRING, device_name, 256) != M64ERR_SUCCESS)
|
||||
+ device_name[0] = 0;
|
||||
+ if (controller[i].device == DEVICE_NOT_JOYSTICK)
|
||||
{
|
||||
- if (sscanf(input_str, "%i,%i", &controller[i].axis_deadzone[0], &controller[i].axis_deadzone[1]) != 2)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in AnalogDeadzone parameter for controller %i", i + 1);
|
||||
+ /* do not load automatically generated keyboard config that was stored to disk (prefer any joysticks attached) */
|
||||
+ if (strcmp(device_name, "AutoKeyboard") == 0)
|
||||
+ return -2;
|
||||
}
|
||||
- if (ConfigGetParameter(pConfig, "AnalogPeak", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
|
||||
+ else if (controller[i].device >= 0 && device_name[0] != 0)
|
||||
{
|
||||
- if (sscanf(input_str, "%i,%i", &controller[i].axis_peak[0], &controller[i].axis_peak[1]) != 2)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in AnalogPeak parameter for controller %i", i + 1);
|
||||
- }
|
||||
- /* load configuration for all the digital buttons */
|
||||
- for (j = 0; j < X_AXIS; j++)
|
||||
- {
|
||||
- if (ConfigGetParameter(pConfig, button_names[j], M64TYPE_STRING, input_str, 256) != M64ERR_SUCCESS)
|
||||
- continue;
|
||||
- if ((config_ptr = strstr(input_str, "key")) != NULL)
|
||||
- if (sscanf(config_ptr, "key(%i)", (int *) &controller[i].button[j].key) != 1)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
- if ((config_ptr = strstr(input_str, "button")) != NULL)
|
||||
- if (sscanf(config_ptr, "button(%i)", &controller[i].button[j].button) != 1)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
- if ((config_ptr = strstr(input_str, "axis")) != NULL)
|
||||
+ /* check that the SDL device name matches the name stored in the config section */
|
||||
+ const char *sdl_name = get_sdl_joystick_name(controller[i].device);
|
||||
+ if (sdl_name == NULL || strncmp(device_name, sdl_name, 255) != 0)
|
||||
{
|
||||
- char chAxisDir;
|
||||
- if (sscanf(config_ptr, "axis(%d%c,%d", &controller[i].button[j].axis, &chAxisDir, &controller[i].button[j].axis_deadzone) != 3 &&
|
||||
- sscanf(config_ptr, "axis(%i%c", &controller[i].button[j].axis, &chAxisDir) != 2)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in axis() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
- controller[i].button[j].axis_dir = (chAxisDir == '+' ? 1 : (chAxisDir == '-' ? -1 : 0));
|
||||
+ DebugMessage(M64MSG_WARNING, "N64 Controller #%i: SDL joystick name '%s' doesn't match stored configuration name '%s'", i + 1, sdl_name, device_name);
|
||||
+ return -3;
|
||||
}
|
||||
- if ((config_ptr = strstr(input_str, "hat")) != NULL)
|
||||
- {
|
||||
- char *lastchar = NULL;
|
||||
- if (sscanf(config_ptr, "hat(%i %15s", &controller[i].button[j].hat, value1_str) != 2)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in hat() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
- value1_str[15] = 0;
|
||||
- /* chop off the last character of value1_str if it is the closing parenthesis */
|
||||
- lastchar = &value1_str[strlen(value1_str) - 1];
|
||||
- if (lastchar > value1_str && *lastchar == ')') *lastchar = 0;
|
||||
- controller[i].button[j].hat_pos = get_hat_pos_by_name(value1_str);
|
||||
- }
|
||||
- if ((config_ptr = strstr(input_str, "mouse")) != NULL)
|
||||
- if (sscanf(config_ptr, "mouse(%i)", &controller[i].button[j].mouse) != 1)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in mouse() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
}
|
||||
- /* load configuration for the 2 analog joystick axes */
|
||||
- for (j = X_AXIS; j <= Y_AXIS; j++)
|
||||
+ }
|
||||
+ /* then do the optional parameters */
|
||||
+ ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int));
|
||||
+ if (ConfigGetParameter(pConfig, "MouseSensitivity", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
|
||||
+ {
|
||||
+ if (sscanf(input_str, "%f,%f", &controller[i].mouse_sens[0], &controller[i].mouse_sens[1]) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in MouseSensitivity parameter for controller %i", i + 1);
|
||||
+ }
|
||||
+ if (ConfigGetParameter(pConfig, "AnalogDeadzone", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
|
||||
+ {
|
||||
+ if (sscanf(input_str, "%i,%i", &controller[i].axis_deadzone[0], &controller[i].axis_deadzone[1]) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in AnalogDeadzone parameter for controller %i", i + 1);
|
||||
+ }
|
||||
+ if (ConfigGetParameter(pConfig, "AnalogPeak", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
|
||||
+ {
|
||||
+ if (sscanf(input_str, "%i,%i", &controller[i].axis_peak[0], &controller[i].axis_peak[1]) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in AnalogPeak parameter for controller %i", i + 1);
|
||||
+ }
|
||||
+ /* load configuration for all the digital buttons */
|
||||
+ for (j = 0; j < X_AXIS; j++)
|
||||
+ {
|
||||
+ if (ConfigGetParameter(pConfig, button_names[j], M64TYPE_STRING, input_str, 256) != M64ERR_SUCCESS)
|
||||
{
|
||||
- int axis_idx = j - X_AXIS;
|
||||
- if (ConfigGetParameter(pConfig, button_names[j], M64TYPE_STRING, input_str, 256) != M64ERR_SUCCESS)
|
||||
- continue;
|
||||
- if ((config_ptr = strstr(input_str, "key")) != NULL)
|
||||
- if (sscanf(config_ptr, "key(%i,%i)", (int *) &controller[i].axis[axis_idx].key_a, (int *) &controller[i].axis[axis_idx].key_b) != 2)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
- if ((config_ptr = strstr(input_str, "button")) != NULL)
|
||||
- if (sscanf(config_ptr, "button(%i,%i)", &controller[i].axis[axis_idx].button_a, &controller[i].axis[axis_idx].button_b) != 2)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
- if ((config_ptr = strstr(input_str, "axis")) != NULL)
|
||||
- {
|
||||
- char chAxisDir1, chAxisDir2;
|
||||
- if (sscanf(config_ptr, "axis(%i%c,%i%c)", &controller[i].axis[axis_idx].axis_a, &chAxisDir1,
|
||||
- &controller[i].axis[axis_idx].axis_b, &chAxisDir2) != 4)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in axis() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
- controller[i].axis[axis_idx].axis_dir_a = (chAxisDir1 == '+' ? 1 : (chAxisDir1 == '-' ? -1 : 0));
|
||||
- controller[i].axis[axis_idx].axis_dir_b = (chAxisDir2 == '+' ? 1 : (chAxisDir2 == '-' ? -1 : 0));
|
||||
- }
|
||||
- if ((config_ptr = strstr(input_str, "hat")) != NULL)
|
||||
- {
|
||||
- char *lastchar = NULL;
|
||||
- if (sscanf(config_ptr, "hat(%i %15s %15s", &controller[i].axis[axis_idx].hat, value1_str, value2_str) != 3)
|
||||
- DebugMessage(M64MSG_WARNING, "parsing error in hat() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
- value1_str[15] = value2_str[15] = 0;
|
||||
- /* chop off the last character of value2_str if it is the closing parenthesis */
|
||||
- lastchar = &value2_str[strlen(value2_str) - 1];
|
||||
- if (lastchar > value2_str && *lastchar == ')') *lastchar = 0;
|
||||
- controller[i].axis[axis_idx].hat_pos_a = get_hat_pos_by_name(value1_str);
|
||||
- controller[i].axis[axis_idx].hat_pos_b = get_hat_pos_by_name(value2_str);
|
||||
- }
|
||||
+ DebugMessage(M64MSG_WARNING, "missing config key '%s' for controller %i button %i", button_names[j], i+1, j);
|
||||
+ continue;
|
||||
}
|
||||
+ if ((config_ptr = strstr(input_str, "key")) != NULL)
|
||||
+ if (sscanf(config_ptr, "key(%i)", (int *) &controller[i].button[j].key) != 1)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
+ if ((config_ptr = strstr(input_str, "button")) != NULL)
|
||||
+ if (sscanf(config_ptr, "button(%i)", &controller[i].button[j].button) != 1)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
+ if ((config_ptr = strstr(input_str, "axis")) != NULL)
|
||||
+ {
|
||||
+ char chAxisDir;
|
||||
+ if (sscanf(config_ptr, "axis(%d%c,%d", &controller[i].button[j].axis, &chAxisDir, &controller[i].button[j].axis_deadzone) != 3 &&
|
||||
+ sscanf(config_ptr, "axis(%i%c", &controller[i].button[j].axis, &chAxisDir) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in axis() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
+ controller[i].button[j].axis_dir = (chAxisDir == '+' ? 1 : (chAxisDir == '-' ? -1 : 0));
|
||||
+ }
|
||||
+ if ((config_ptr = strstr(input_str, "hat")) != NULL)
|
||||
+ {
|
||||
+ char *lastchar = NULL;
|
||||
+ if (sscanf(config_ptr, "hat(%i %15s", &controller[i].button[j].hat, value1_str) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in hat() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
+ value1_str[15] = 0;
|
||||
+ /* chop off the last character of value1_str if it is the closing parenthesis */
|
||||
+ lastchar = &value1_str[strlen(value1_str) - 1];
|
||||
+ if (lastchar > value1_str && *lastchar == ')') *lastchar = 0;
|
||||
+ controller[i].button[j].hat_pos = get_hat_pos_by_name(value1_str);
|
||||
+ }
|
||||
+ if ((config_ptr = strstr(input_str, "mouse")) != NULL)
|
||||
+ if (sscanf(config_ptr, "mouse(%i)", &controller[i].button[j].mouse) != 1)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in mouse() parameter of button '%s' for controller %i", button_names[j], i + 1);
|
||||
}
|
||||
+ /* load configuration for the 2 analog joystick axes */
|
||||
+ for (j = X_AXIS; j <= Y_AXIS; j++)
|
||||
+ {
|
||||
+ int axis_idx = j - X_AXIS;
|
||||
+ if (ConfigGetParameter(pConfig, button_names[j], M64TYPE_STRING, input_str, 256) != M64ERR_SUCCESS)
|
||||
+ {
|
||||
+ DebugMessage(M64MSG_WARNING, "missing config key '%s' for controller %i axis %i", button_names[j], i+1, axis_idx);
|
||||
+ continue;
|
||||
+ }
|
||||
+ if ((config_ptr = strstr(input_str, "key")) != NULL)
|
||||
+ if (sscanf(config_ptr, "key(%i,%i)", (int *) &controller[i].axis[axis_idx].key_a, (int *) &controller[i].axis[axis_idx].key_b) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
+ if ((config_ptr = strstr(input_str, "button")) != NULL)
|
||||
+ if (sscanf(config_ptr, "button(%i,%i)", &controller[i].axis[axis_idx].button_a, &controller[i].axis[axis_idx].button_b) != 2)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
+ if ((config_ptr = strstr(input_str, "axis")) != NULL)
|
||||
+ {
|
||||
+ char chAxisDir1, chAxisDir2;
|
||||
+ if (sscanf(config_ptr, "axis(%i%c,%i%c)", &controller[i].axis[axis_idx].axis_a, &chAxisDir1,
|
||||
+ &controller[i].axis[axis_idx].axis_b, &chAxisDir2) != 4)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in axis() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
+ controller[i].axis[axis_idx].axis_dir_a = (chAxisDir1 == '+' ? 1 : (chAxisDir1 == '-' ? -1 : 0));
|
||||
+ controller[i].axis[axis_idx].axis_dir_b = (chAxisDir2 == '+' ? 1 : (chAxisDir2 == '-' ? -1 : 0));
|
||||
+ }
|
||||
+ if ((config_ptr = strstr(input_str, "hat")) != NULL)
|
||||
+ {
|
||||
+ char *lastchar = NULL;
|
||||
+ if (sscanf(config_ptr, "hat(%i %15s %15s", &controller[i].axis[axis_idx].hat, value1_str, value2_str) != 3)
|
||||
+ DebugMessage(M64MSG_WARNING, "parsing error in hat() parameter of axis '%s' for controller %i", button_names[j], i + 1);
|
||||
+ value1_str[15] = value2_str[15] = 0;
|
||||
+ /* chop off the last character of value2_str if it is the closing parenthesis */
|
||||
+ lastchar = &value2_str[strlen(value2_str) - 1];
|
||||
+ if (lastchar > value2_str && *lastchar == ')') *lastchar = 0;
|
||||
+ controller[i].axis[axis_idx].hat_pos_a = get_hat_pos_by_name(value1_str);
|
||||
+ controller[i].axis[axis_idx].hat_pos_b = get_hat_pos_by_name(value2_str);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- return readOK;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
-/* global functions */
|
||||
-void save_controller_config(int iCtrlIdx)
|
||||
+static void save_controller_config(int iCtrlIdx, const char *pccDeviceName)
|
||||
{
|
||||
m64p_handle pConfig;
|
||||
char SectionName[32], Param[32], ParamString[128];
|
||||
@@ -273,7 +313,10 @@ void save_controller_config(int iCtrlIdx)
|
||||
ConfigSetDefaultInt(pConfig, "plugin", controller[iCtrlIdx].control->Plugin, "Specifies which type of expansion pak is in the controller: 1=None, 2=Mem pak, 5=Rumble pak");
|
||||
ConfigSetDefaultBool(pConfig, "mouse", controller[iCtrlIdx].mouse, "If True, then mouse buttons may be used with this controller");
|
||||
ConfigSetDefaultInt(pConfig, "device", controller[iCtrlIdx].device, "Specifies which joystick is bound to this controller: -2=Keyboard/mouse, -1=Auto config, 0 or more= SDL Joystick number");
|
||||
+ ConfigSetDefaultString(pConfig, "name", pccDeviceName, "SDL joystick name (name check disabled if this is empty string)");
|
||||
|
||||
+ sprintf(Param, "%.2f,%.2f", controller[iCtrlIdx].mouse_sens[0], controller[iCtrlIdx].mouse_sens[1]);
|
||||
+ ConfigSetDefaultString(pConfig, "MouseSensitivity", Param, "Scaling factor for mouse movements. For X, Y axes.");
|
||||
sprintf(Param, "%i,%i", controller[iCtrlIdx].axis_deadzone[0], controller[iCtrlIdx].axis_deadzone[1]);
|
||||
ConfigSetDefaultString(pConfig, "AnalogDeadzone", Param, "The minimum absolute value of the SDL analog joystick axis to move the N64 controller axis value from 0. For X, Y axes.");
|
||||
sprintf(Param, "%i,%i", controller[iCtrlIdx].axis_peak[0], controller[iCtrlIdx].axis_peak[1]);
|
||||
@@ -367,6 +410,30 @@ void save_controller_config(int iCtrlIdx)
|
||||
|
||||
}
|
||||
|
||||
+static void force_controller_keyboard(int n64CtrlIdx)
|
||||
+{
|
||||
+ if (n64CtrlIdx < 0 || n64CtrlIdx > 3)
|
||||
+ {
|
||||
+ DebugMessage(M64MSG_ERROR, "internal assert in ForceControllerKeyboard. n64CtrlIdx=%i", n64CtrlIdx);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ DebugMessage(M64MSG_INFO, "N64 Controller #%i: Forcing default keyboard configuration", n64CtrlIdx+1);
|
||||
+ auto_set_defaults(DEVICE_NOT_JOYSTICK, "Keyboard");
|
||||
+ if (load_controller_config("AutoConfig0", n64CtrlIdx) > 0)
|
||||
+ {
|
||||
+ /* use ConfigSetDefault*() to save this auto-config if config section was empty */
|
||||
+ save_controller_config(n64CtrlIdx, "AutoKeyboard");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ DebugMessage(M64MSG_ERROR, "Autoconfig keyboard setup invalid");
|
||||
+ }
|
||||
+ ConfigDeleteSection("AutoConfig0");
|
||||
+}
|
||||
+
|
||||
+/* global functions */
|
||||
+
|
||||
/* The reason why the architecture of this config-handling code is so wacky is that it tries to balance
|
||||
* several different user scenarios. From a high-level perspective, it works like this:
|
||||
* 1. If there is a valid configuration setup already in the config file, it should not be changed
|
||||
@@ -388,38 +455,56 @@ void load_configuration(int bPrintSummary)
|
||||
const char *JoyName;
|
||||
int joy_found = 0, joy_plugged = 0;
|
||||
int readOK;
|
||||
- int i, j;
|
||||
+ int n64CtrlIdx, sdlCtrlIdx, j;
|
||||
|
||||
/* loop through all 4 simulated N64 controllers */
|
||||
- for (i = 0; i < 4; i++)
|
||||
+ for (n64CtrlIdx=0,sdlCtrlIdx=0; n64CtrlIdx < 4; n64CtrlIdx++)
|
||||
{
|
||||
/* reset the controller configuration */
|
||||
- clear_controller(i);
|
||||
+ clear_controller(n64CtrlIdx);
|
||||
/* try to load the config from the core's configuration api */
|
||||
- sprintf(SectionName, "Input-SDL-Control%i", i + 1);
|
||||
- readOK = load_controller_config(SectionName, i);
|
||||
+ sprintf(SectionName, "Input-SDL-Control%i", n64CtrlIdx + 1);
|
||||
+ readOK = load_controller_config(SectionName, n64CtrlIdx);
|
||||
|
||||
- JoyName = get_sdl_joystick_name(i);
|
||||
- if (!readOK || controller[i].device == DEVICE_AUTO)
|
||||
+ if (readOK <= 0 || controller[n64CtrlIdx].device == DEVICE_AUTO)
|
||||
{
|
||||
int ControllersFound = 0;
|
||||
+ /* make sure that SDL device number hasn't already been used for a different N64 controller */
|
||||
+ for (j = 0; j < n64CtrlIdx; j++)
|
||||
+ {
|
||||
+ if (controller[j].device == sdlCtrlIdx)
|
||||
+ {
|
||||
+ sdlCtrlIdx++;
|
||||
+ j = -1;
|
||||
+ }
|
||||
+ }
|
||||
+ /* if auto / bad config, get joystick name based on SDL order */
|
||||
+ JoyName = get_sdl_joystick_name(sdlCtrlIdx);
|
||||
/* reset the controller configuration again and try to auto-configure */
|
||||
- ControllersFound = auto_set_defaults(i, JoyName);
|
||||
- if (ControllersFound > 0)
|
||||
+ ControllersFound = auto_set_defaults(sdlCtrlIdx, JoyName);
|
||||
+ sdlCtrlIdx++;
|
||||
+ if (ControllersFound == 0)
|
||||
{
|
||||
+ controller[n64CtrlIdx].device = DEVICE_AUTO;
|
||||
+ controller[n64CtrlIdx].control->Present = 0;
|
||||
+ DebugMessage(M64MSG_WARNING, "N64 Controller #%i: Disabled, SDL joystick %i is not available", n64CtrlIdx+1, sdlCtrlIdx-1);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
for (j = 0; j < ControllersFound; j++) /* a USB device may have > 1 controller */
|
||||
{
|
||||
sprintf(SectionName, "AutoConfig%i", j);
|
||||
- if (i + j > 3)
|
||||
+ if (n64CtrlIdx + j > 3)
|
||||
{
|
||||
ConfigDeleteSection(SectionName);
|
||||
continue;
|
||||
}
|
||||
- clear_controller(i + j);
|
||||
- if (load_controller_config(SectionName, i + j))
|
||||
+ clear_controller(n64CtrlIdx + j);
|
||||
+ if (load_controller_config(SectionName, n64CtrlIdx + j) > 0)
|
||||
{
|
||||
/* use ConfigSetDefault*() to save this auto-config if config section was empty */
|
||||
- save_controller_config(i + j);
|
||||
+ save_controller_config(n64CtrlIdx + j, JoyName);
|
||||
+ DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config for SDL joystick %i ('%s')", n64CtrlIdx+1, controller[n64CtrlIdx].device, JoyName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -427,36 +512,38 @@ void load_configuration(int bPrintSummary)
|
||||
}
|
||||
ConfigDeleteSection(SectionName);
|
||||
}
|
||||
- i += ControllersFound - 1;
|
||||
+ n64CtrlIdx += ControllersFound - 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- else if (controller[i].device >= 0)
|
||||
+ else if (controller[n64CtrlIdx].device >= 0)
|
||||
{
|
||||
+ /* if joystick found in cfg, take its SDL number from there */
|
||||
+ JoyName = get_sdl_joystick_name(controller[n64CtrlIdx].device);
|
||||
/* valid joystick configuration was read; check if the specified joystick is available in SDL */
|
||||
if (JoyName == NULL)
|
||||
{
|
||||
- controller[i].device = DEVICE_AUTO;
|
||||
- controller[i].control->Present = 0;
|
||||
- DebugMessage(M64MSG_INFO, "N64 Controller #%i: Disabled, SDL joystick is not available", i+1);
|
||||
+ controller[n64CtrlIdx].device = DEVICE_AUTO;
|
||||
+ controller[n64CtrlIdx].control->Present = 0;
|
||||
+ DebugMessage(M64MSG_WARNING, "N64 Controller #%i: Disabled, SDL joystick %i is not available", n64CtrlIdx+1, controller[n64CtrlIdx].device);
|
||||
}
|
||||
else
|
||||
- DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using SDL joystick %i ('%s')", i+1, controller[i].device, JoyName);
|
||||
+ DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using stored config for SDL joystick %i ('%s')", n64CtrlIdx+1, controller[n64CtrlIdx].device, JoyName);
|
||||
}
|
||||
else /* controller is configured for keyboard/mouse */
|
||||
{
|
||||
- DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using keyboard/mouse", i+1);
|
||||
+ DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using keyboard/mouse", n64CtrlIdx+1);
|
||||
}
|
||||
}
|
||||
|
||||
/* see how many joysticks were found */
|
||||
joy_found = 0, joy_plugged = 0;
|
||||
- for (i = 0; i < 4; i++)
|
||||
+ for (j = 0; j < 4; j++)
|
||||
{
|
||||
- if (controller[i].device >= 0 || controller[i].device == DEVICE_NOT_JOYSTICK)
|
||||
+ if (controller[j].device >= 0 || controller[j].device == DEVICE_NOT_JOYSTICK)
|
||||
{
|
||||
joy_found++;
|
||||
- if (controller[i].control->Present)
|
||||
+ if (controller[j].control->Present)
|
||||
joy_plugged++;
|
||||
}
|
||||
}
|
||||
@@ -464,18 +551,7 @@ void load_configuration(int bPrintSummary)
|
||||
/* fallback to keyboard if no joysticks are available and 'plugged in' */
|
||||
if (joy_found == 0 || joy_plugged == 0)
|
||||
{
|
||||
- DebugMessage(M64MSG_INFO, "N64 Controller #1: Forcing default keyboard configuration");
|
||||
- auto_set_defaults(DEVICE_NOT_JOYSTICK, "Keyboard");
|
||||
- if (load_controller_config("AutoConfig0", 0))
|
||||
- {
|
||||
- /* use ConfigSetDefault*() to save this auto-config if config section was empty */
|
||||
- save_controller_config(0);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- DebugMessage(M64MSG_ERROR, "Autoconfig keyboard setup invalid");
|
||||
- }
|
||||
- ConfigDeleteSection("AutoConfig0");
|
||||
+ force_controller_keyboard(0);
|
||||
}
|
||||
|
||||
if (bPrintSummary)
|
@ -1,11 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-input-sdl_src_config_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/config.h.orig Sun Dec 18 23:50:49 2011
|
||||
+++ src/config.h Sun Dec 18 19:51:24 2011
|
||||
@@ -23,7 +23,6 @@
|
||||
#define __CONFIG_H__
|
||||
|
||||
extern void load_configuration(int bPrintSummary);
|
||||
-extern void save_controller_config(int iCtrlIdx);
|
||||
|
||||
#endif /* __CONFIG_H__ */
|
||||
|
@ -1,101 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-input-sdl_src_plugin_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/plugin.c.orig Tue Nov 23 03:15:13 2010
|
||||
+++ src/plugin.c Sun Dec 18 23:59:37 2011
|
||||
@@ -1,7 +1,7 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-input-sdl - plugin.c *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
- * Copyright (C) 2008-2009 Richard Goedeken *
|
||||
+ * Copyright (C) 2008-2011 Richard Goedeken *
|
||||
* Copyright (C) 2008 Tillin9 *
|
||||
* Copyright (C) 2002 Blight *
|
||||
* *
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "m64p_plugin.h"
|
||||
+#include "m64p_common.h"
|
||||
#include "m64p_config.h"
|
||||
|
||||
#include "plugin.h"
|
||||
@@ -143,7 +144,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handl
|
||||
/* first thing is to set the callback function for debug info */
|
||||
l_DebugCallback = DebugCallback;
|
||||
l_DebugCallContext = Context;
|
||||
-
|
||||
+
|
||||
/* Get the core config function pointers from the library handle */
|
||||
ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection");
|
||||
ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection");
|
||||
@@ -428,6 +429,8 @@ EXPORT void CALL ControllerCommand(int Control, unsign
|
||||
*******************************************************************/
|
||||
EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
|
||||
{
|
||||
+ static int mousex_residual = 0;
|
||||
+ static int mousey_residual = 0;
|
||||
int b, axis_val;
|
||||
SDL_Event event;
|
||||
unsigned char mstate;
|
||||
@@ -532,30 +535,43 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
|
||||
controller[Control].buttons.Value |= button_bits[b];
|
||||
}
|
||||
|
||||
- if (controller[Control].mouse && SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
|
||||
+ if (controller[Control].mouse)
|
||||
{
|
||||
- SDL_PumpEvents();
|
||||
- while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) == 1)
|
||||
+ if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
|
||||
{
|
||||
- if (event.motion.xrel)
|
||||
+ SDL_PumpEvents();
|
||||
+ while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) == 1)
|
||||
{
|
||||
- axis_val = (event.motion.xrel * 10);
|
||||
- if (axis_val < -80)
|
||||
- axis_val = -80;
|
||||
- else if (axis_val > 80)
|
||||
- axis_val = 80;
|
||||
- controller[Control].buttons.X_AXIS = axis_val;
|
||||
+ if (event.motion.xrel)
|
||||
+ {
|
||||
+ mousex_residual += (int) (event.motion.xrel * controller[Control].mouse_sens[0]);
|
||||
+ }
|
||||
+ if (event.motion.yrel)
|
||||
+ {
|
||||
+ mousey_residual += (int) (event.motion.yrel * controller[Control].mouse_sens[1]);
|
||||
+ }
|
||||
}
|
||||
- if (event.motion.yrel)
|
||||
- {
|
||||
- axis_val = (event.motion.yrel * 10);
|
||||
- if (axis_val < -80)
|
||||
- axis_val = -80;
|
||||
- else if (axis_val > 80)
|
||||
- axis_val = 80;
|
||||
- controller[Control].buttons.Y_AXIS = -axis_val;
|
||||
- }
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ mousex_residual = 0;
|
||||
+ mousey_residual = 0;
|
||||
+ }
|
||||
+ axis_val = mousex_residual;
|
||||
+ if (axis_val < -80)
|
||||
+ axis_val = -80;
|
||||
+ else if (axis_val > 80)
|
||||
+ axis_val = 80;
|
||||
+ controller[Control].buttons.X_AXIS = axis_val;
|
||||
+ axis_val = mousey_residual;
|
||||
+ if (axis_val < -80)
|
||||
+ axis_val = -80;
|
||||
+ else if (axis_val > 80)
|
||||
+ axis_val = 80;
|
||||
+ controller[Control].buttons.Y_AXIS = -axis_val;
|
||||
+ /* the mouse x/y values decay exponentially */
|
||||
+ mousex_residual = (mousex_residual * 224) / 256;
|
||||
+ mousey_residual = (mousey_residual * 224) / 256;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
@ -1,11 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-input-sdl_src_plugin_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/plugin.h.orig Sun Dec 18 23:55:06 2011
|
||||
+++ src/plugin.h Sun Dec 18 23:55:12 2011
|
||||
@@ -99,6 +99,7 @@ typedef struct
|
||||
int event_joystick; // the /dev/input/eventX device for force feeback
|
||||
int axis_deadzone[2]; // minimum absolute value before analog movement is recognized
|
||||
int axis_peak[2]; // highest analog value returned by SDL, used for scaling
|
||||
+ float mouse_sens[2]; // mouse sensitivity
|
||||
} SController;
|
||||
|
||||
/* global data definitions */
|
@ -1,6 +1,5 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.2 2012/08/13 06:53:56 bentley Exp $
|
||||
lib/mupen64plus/
|
||||
lib/mupen64plus/mupen64plus-input-sdl.so
|
||||
share/doc/pkg-readmes/${FULLPKGNAME}
|
||||
share/mupen64plus/
|
||||
share/mupen64plus/InputAutoCfg.ini
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (mupen64plus-rsp-hle-src-1.99.4.tar.gz) = MXTkKRaMQhStv4neQSv6IA==
|
||||
RMD160 (mupen64plus-rsp-hle-src-1.99.4.tar.gz) = 5hySivaq9K/RnRP3mzvKk9NkDLw=
|
||||
SHA1 (mupen64plus-rsp-hle-src-1.99.4.tar.gz) = 8wpPP+V4GADdWSa4kp3giPdGxEE=
|
||||
SHA256 (mupen64plus-rsp-hle-src-1.99.4.tar.gz) = lmQ3snhDjLQEokZyFgUeX8YtEwBuiueyKR1SEFfsI2k=
|
||||
SIZE (mupen64plus-rsp-hle-src-1.99.4.tar.gz) = 42825
|
||||
SHA256 (mupen64plus-rsp-hle-src-1.99.5.tar.gz) = 3HuVqPBeCHDWNH8U/YU/AQB/3kvy/kpf1kgMIH28ZWY=
|
||||
SIZE (mupen64plus-rsp-hle-src-1.99.5.tar.gz) = 42073
|
||||
|
@ -1,24 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-rsp-hle_projects_unix_Makefile,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- projects/unix/Makefile.orig Tue Nov 23 03:15:14 2010
|
||||
+++ projects/unix/Makefile Sun Dec 18 17:12:40 2011
|
||||
@@ -49,6 +49,11 @@ ifeq ("$(UNAME)","FreeBSD")
|
||||
SO_EXTENSION = so
|
||||
SHARED = -shared
|
||||
endif
|
||||
+ifeq ("$(UNAME)","OpenBSD")
|
||||
+ OS = OPENBSD
|
||||
+ SO_EXTENSION = so
|
||||
+ SHARED = -shared
|
||||
+endif
|
||||
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
SO_EXTENSION = so
|
||||
@@ -220,7 +225,7 @@ targets:
|
||||
all: $(TARGET)
|
||||
|
||||
install: $(TARGET)
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
|
||||
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
|
||||
|
||||
uninstall:
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-rsp-hle_src_hle_h,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/hle.h.orig Mon Dec 19 00:00:35 2011
|
||||
+++ src/hle.h Mon Dec 19 00:00:45 2011
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#define RSP_HLE_VERSION 0x016304
|
||||
|
||||
-#ifdef _BIG_ENDIAN
|
||||
+#ifdef M64P_BIG_ENDIAN
|
||||
#define S 0
|
||||
#define S16 0
|
||||
#define S8 0
|
@ -1,38 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-rsp-hle_src_ucode1_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/ucode1.cpp.orig Mon Dec 19 00:02:57 2011
|
||||
+++ src/ucode1.cpp Sun Dec 18 19:51:29 2011
|
||||
@@ -825,17 +825,17 @@ static void LOADADPCM (void) { // Loads an ADPCM table
|
||||
//assert ((inst1&0xffff) <= 0x80);
|
||||
u16 *table = (u16 *)(rsp.RDRAM+v0);
|
||||
for (u32 x = 0; x < ((inst1&0xffff)>>0x4); x++) {
|
||||
- adpcmtable[0x0+(x<<3)^S] = table[0];
|
||||
- adpcmtable[0x1+(x<<3)^S] = table[1];
|
||||
+ adpcmtable[(0x0+(x<<3))^S] = table[0];
|
||||
+ adpcmtable[(0x1+(x<<3))^S] = table[1];
|
||||
|
||||
- adpcmtable[0x2+(x<<3)^S] = table[2];
|
||||
- adpcmtable[0x3+(x<<3)^S] = table[3];
|
||||
+ adpcmtable[(0x2+(x<<3))^S] = table[2];
|
||||
+ adpcmtable[(0x3+(x<<3))^S] = table[3];
|
||||
|
||||
- adpcmtable[0x4+(x<<3)^S] = table[4];
|
||||
- adpcmtable[0x5+(x<<3)^S] = table[5];
|
||||
+ adpcmtable[(0x4+(x<<3))^S] = table[4];
|
||||
+ adpcmtable[(0x5+(x<<3))^S] = table[5];
|
||||
|
||||
- adpcmtable[0x6+(x<<3)^S] = table[6];
|
||||
- adpcmtable[0x7+(x<<3)^S] = table[7];
|
||||
+ adpcmtable[(0x6+(x<<3))^S] = table[6];
|
||||
+ adpcmtable[(0x7+(x<<3))^S] = table[7];
|
||||
table += 8;
|
||||
}
|
||||
}
|
||||
@@ -860,7 +860,7 @@ static void INTERLEAVE (void) { // Works... - 3-11-01
|
||||
Left2=*(inSrcL++);
|
||||
Right2=*(inSrcR++);
|
||||
|
||||
-#ifdef _BIG_ENDIAN
|
||||
+#ifdef M64P_BIG_ENDIAN
|
||||
*(outbuff++)=Right;
|
||||
*(outbuff++)=Left;
|
||||
*(outbuff++)=Right2;
|
@ -1,60 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-rsp-hle_src_ucode2_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/ucode2.cpp.orig Mon Dec 19 00:02:57 2011
|
||||
+++ src/ucode2.cpp Sun Dec 18 19:51:29 2011
|
||||
@@ -56,17 +56,17 @@ static void LOADADPCM2 (void) { // Loads an ADPCM tabl
|
||||
u16 *table = (u16 *)(rsp.RDRAM+v0); // Zelda2 Specific...
|
||||
|
||||
for (u32 x = 0; x < ((inst1&0xffff)>>0x4); x++) {
|
||||
- adpcmtable[0x0+(x<<3)^S] = table[0];
|
||||
- adpcmtable[0x1+(x<<3)^S] = table[1];
|
||||
+ adpcmtable[(0x0+(x<<3))^S] = table[0];
|
||||
+ adpcmtable[(0x1+(x<<3))^S] = table[1];
|
||||
|
||||
- adpcmtable[0x2+(x<<3)^S] = table[2];
|
||||
- adpcmtable[0x3+(x<<3)^S] = table[3];
|
||||
+ adpcmtable[(0x2+(x<<3))^S] = table[2];
|
||||
+ adpcmtable[(0x3+(x<<3))^S] = table[3];
|
||||
|
||||
- adpcmtable[0x4+(x<<3)^S] = table[4];
|
||||
- adpcmtable[0x5+(x<<3)^S] = table[5];
|
||||
+ adpcmtable[(0x4+(x<<3))^S] = table[4];
|
||||
+ adpcmtable[(0x5+(x<<3))^S] = table[5];
|
||||
|
||||
- adpcmtable[0x6+(x<<3)^S] = table[6];
|
||||
- adpcmtable[0x7+(x<<3)^S] = table[7];
|
||||
+ adpcmtable[(0x6+(x<<3))^S] = table[6];
|
||||
+ adpcmtable[(0x7+(x<<3))^S] = table[7];
|
||||
table += 8;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,6 @@ static void ADPCM2 (void) { // Verified to be 100% Acc
|
||||
short *book1,*book2;
|
||||
|
||||
u8 srange;
|
||||
- u8 inpinc;
|
||||
u8 mask1;
|
||||
u8 mask2;
|
||||
u8 shifter;
|
||||
@@ -108,13 +107,11 @@ static void ADPCM2 (void) { // Verified to be 100% Acc
|
||||
|
||||
if (Flags & 0x4) { // Tricky lil Zelda MM and ABI2!!! hahaha I know your secrets! :DDD
|
||||
srange = 0xE;
|
||||
- inpinc = 0x5;
|
||||
mask1 = 0xC0;
|
||||
mask2 = 0x30;
|
||||
shifter = 10;
|
||||
} else {
|
||||
srange = 0xC;
|
||||
- inpinc = 0x9;
|
||||
mask1 = 0xf0;
|
||||
mask2 = 0x0f;
|
||||
shifter = 12;
|
||||
@@ -710,7 +707,7 @@ static void INTERLEAVE2 (void) { // Needs accuracy ver
|
||||
Left2=*(inSrcL++);
|
||||
Right2=*(inSrcR++);
|
||||
|
||||
-#ifdef _BIG_ENDIAN
|
||||
+#ifdef M64P_BIG_ENDIAN
|
||||
*(outbuff++)=Right;
|
||||
*(outbuff++)=Left;
|
||||
*(outbuff++)=Right2;
|
@ -1,38 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-rsp-hle_src_ucode3_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/ucode3.cpp.orig Mon Dec 19 00:02:57 2011
|
||||
+++ src/ucode3.cpp Mon Dec 19 00:05:06 2011
|
||||
@@ -534,17 +534,17 @@ static void LOADADPCM3 (void) { // Loads an ADPCM tabl
|
||||
//assert ((inst1&0xffff) <= 0x80);
|
||||
u16 *table = (u16 *)(rsp.RDRAM+v0);
|
||||
for (u32 x = 0; x < ((inst1&0xffff)>>0x4); x++) {
|
||||
- adpcmtable[0x0+(x<<3)^S] = table[0];
|
||||
- adpcmtable[0x1+(x<<3)^S] = table[1];
|
||||
+ adpcmtable[(0x0+(x<<3))^S] = table[0];
|
||||
+ adpcmtable[(0x1+(x<<3))^S] = table[1];
|
||||
|
||||
- adpcmtable[0x2+(x<<3)^S] = table[2];
|
||||
- adpcmtable[0x3+(x<<3)^S] = table[3];
|
||||
+ adpcmtable[(0x2+(x<<3))^S] = table[2];
|
||||
+ adpcmtable[(0x3+(x<<3))^S] = table[3];
|
||||
|
||||
- adpcmtable[0x4+(x<<3)^S] = table[4];
|
||||
- adpcmtable[0x5+(x<<3)^S] = table[5];
|
||||
+ adpcmtable[(0x4+(x<<3))^S] = table[4];
|
||||
+ adpcmtable[(0x5+(x<<3))^S] = table[5];
|
||||
|
||||
- adpcmtable[0x6+(x<<3)^S] = table[6];
|
||||
- adpcmtable[0x7+(x<<3)^S] = table[7];
|
||||
+ adpcmtable[(0x6+(x<<3))^S] = table[6];
|
||||
+ adpcmtable[(0x7+(x<<3))^S] = table[7];
|
||||
table += 8;
|
||||
}
|
||||
}
|
||||
@@ -939,7 +939,7 @@ static void INTERLEAVE3 (void) { // Needs accuracy ver
|
||||
Left2=*(inSrcL++);
|
||||
Right2=*(inSrcR++);
|
||||
|
||||
-#ifdef _BIG_ENDIAN
|
||||
+#ifdef M64P_BIG_ENDIAN
|
||||
*(outbuff++)=Right;
|
||||
*(outbuff++)=Left;
|
||||
*(outbuff++)=Right2;
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2011/12/26 22:58:48 bentley Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2012/08/13 06:53:56 bentley Exp $
|
||||
|
||||
COMMENT = n64 emulator command-line ui plugin
|
||||
#
|
||||
@ -12,6 +12,8 @@ WANTLIB = c pthread
|
||||
|
||||
MUPEN64PLUS_MOD = ui-console
|
||||
|
||||
MAKE_FLAGS = MANDIR=${PREFIX}/man
|
||||
|
||||
post-install:
|
||||
gunzip ${PREFIX}/man/man6/mupen64plus.6.gz
|
||||
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (mupen64plus-ui-console-src-1.99.4.tar.gz) = opfWMh1iNobSQZJDxE23fQ==
|
||||
RMD160 (mupen64plus-ui-console-src-1.99.4.tar.gz) = jFXu0ZkTDeVIAQdaasfVlzBGIk8=
|
||||
SHA1 (mupen64plus-ui-console-src-1.99.4.tar.gz) = 2q+C/sI8suLV6jAqevfdzLwlaqk=
|
||||
SHA256 (mupen64plus-ui-console-src-1.99.4.tar.gz) = 16DQvCOYmorpmcjkeuyuCTH1Dj9SOQNrp40C3+ARlUI=
|
||||
SIZE (mupen64plus-ui-console-src-1.99.4.tar.gz) = 35653
|
||||
SHA256 (mupen64plus-ui-console-src-1.99.5.tar.gz) = bSv5dTtMWMxVJcZZN+QUPuDcqyEXecre8MSbke7MxTk=
|
||||
SIZE (mupen64plus-ui-console-src-1.99.5.tar.gz) = 36427
|
||||
|
@ -1,25 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-ui-console_projects_unix_Makefile,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- projects/unix/Makefile.orig Tue Nov 23 03:15:10 2010
|
||||
+++ projects/unix/Makefile Sun Dec 18 17:12:47 2011
|
||||
@@ -38,6 +38,9 @@ endif
|
||||
ifeq ("$(UNAME)","FreeBSD")
|
||||
OS = FREEBSD
|
||||
endif
|
||||
+ifeq ("$(UNAME)","OpenBSD")
|
||||
+ OS = OPENBSD
|
||||
+endif
|
||||
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
endif
|
||||
@@ -226,9 +229,9 @@ clean:
|
||||
rebuild: clean all
|
||||
|
||||
install: $(TARGET)
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(BINDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(BINDIR)"
|
||||
$(INSTALL) -m 0755 $(TARGET) "$(DESTDIR)$(BINDIR)"
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(MANDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(MANDIR)"
|
||||
$(INSTALL) -m 0644 ../../doc/mupen64plus.6.gz "$(DESTDIR)$(MANDIR)"
|
||||
|
||||
uninstall:
|
@ -1,16 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-ui-console_src_compare_core_c,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/compare_core.c.orig Mon Dec 19 00:07:20 2011
|
||||
+++ src/compare_core.c Sun Dec 18 19:51:15 2011
|
||||
@@ -51,8 +51,10 @@ static void stop_it(void)
|
||||
|
||||
errors++;
|
||||
#if !defined(WIN32)
|
||||
- if (errors > 7)
|
||||
- asm("int $3;");
|
||||
+ #if defined(__i386__) || defined(__x86_64__)
|
||||
+ if (errors > 7)
|
||||
+ asm("int $3;");
|
||||
+ #endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2011/12/26 22:58:48 bentley Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2012/08/13 06:53:56 bentley Exp $
|
||||
|
||||
COMMENT = n64 emulator opengl video plugin
|
||||
|
||||
@ -12,11 +12,6 @@ WANTLIB = GL m stdc++ z SDL png
|
||||
LIB_DEPENDS = devel/sdl graphics/png
|
||||
MUPEN64PLUS_MOD = video-rice
|
||||
|
||||
# Use SSE instructions on amd64 only
|
||||
.if ${MACHINE_ARCH} != "amd64"
|
||||
MAKE_FLAGS = CC=${CC} CXX=${CXX} V=1 NO_ASM=1
|
||||
.endif
|
||||
|
||||
# resolve 'no newline at end of file' warning
|
||||
post-patch:
|
||||
echo >> ${WRKSRC}/src/osal_preproc.h
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (mupen64plus-video-rice-src-1.99.4.tar.gz) = zPvvSwVUHwj7vxUOmXt6Yw==
|
||||
RMD160 (mupen64plus-video-rice-src-1.99.4.tar.gz) = uC2zQLNzp2AF31rQOLQVRbce/RE=
|
||||
SHA1 (mupen64plus-video-rice-src-1.99.4.tar.gz) = cZ49ChoDEVx6n1c+uZrrAUJs8I8=
|
||||
SHA256 (mupen64plus-video-rice-src-1.99.4.tar.gz) = kHl51eBqEJ+fritMXBGa+yq/Rw393Z9cLdTcY3WSHN8=
|
||||
SIZE (mupen64plus-video-rice-src-1.99.4.tar.gz) = 361822
|
||||
SHA256 (mupen64plus-video-rice-src-1.99.5.tar.gz) = OWVglmcYP1dHnzA+PYmycDyJskq74cNKgtcmxNiN2Pw=
|
||||
SIZE (mupen64plus-video-rice-src-1.99.5.tar.gz) = 349922
|
||||
|
@ -1,49 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-video-rice_projects_unix_Makefile,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- projects/unix/Makefile.orig Tue Nov 23 03:15:17 2010
|
||||
+++ projects/unix/Makefile Sun Dec 18 17:12:53 2011
|
||||
@@ -49,6 +49,11 @@ ifeq ("$(UNAME)","FreeBSD")
|
||||
SO_EXTENSION = so
|
||||
SHARED = -shared
|
||||
endif
|
||||
+ifeq ("$(UNAME)","OpenBSD")
|
||||
+ OS = OPENBSD
|
||||
+ SO_EXTENSION = so
|
||||
+ SHARED = -shared
|
||||
+endif
|
||||
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
SO_EXTENSION = so
|
||||
@@ -112,6 +117,10 @@ ifeq ($(OS),FREEBSD)
|
||||
LDFLAGS += -lGL $(shell pkg-config --libs libpng)
|
||||
CFLAGS += $(shell pkg-config --cflags libpng)
|
||||
endif
|
||||
+ifeq ($(OS),OPENBSD)
|
||||
+ LDFLAGS += -lGL $(shell pkg-config --libs libpng)
|
||||
+ CFLAGS += $(shell pkg-config --cflags libpng)
|
||||
+endif
|
||||
ifeq ($(OS), LINUX)
|
||||
LDFLAGS += -ldl -lGL
|
||||
# only export api symbols
|
||||
@@ -147,6 +156,10 @@ ifeq ($(OS),FREEBSD)
|
||||
CFLAGS += $(shell sdl-config --cflags) -DPIC
|
||||
LDFLAGS += $(shell sdl-config --libs) -DPIC
|
||||
endif
|
||||
+ifeq ($(OS),OPENBSD)
|
||||
+ CFLAGS += $(shell sdl-config --cflags) -DPIC
|
||||
+ LDFLAGS += $(shell sdl-config --libs) -DPIC
|
||||
+endif
|
||||
ifeq ($(OS),OSX)
|
||||
CFLAGS += $(shell sdl-config --cflags) -DPIC
|
||||
# sdl-config on mac screws up when we're trying to build a library and not an executable
|
||||
@@ -294,9 +307,9 @@ targets:
|
||||
all: $(TARGET)
|
||||
|
||||
install: $(TARGET)
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
|
||||
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
|
||||
- $(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
|
||||
+ $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
|
||||
$(INSTALL) -m 0644 "../../data/RiceVideoLinux.ini" "$(DESTDIR)$(SHAREDIR)"
|
||||
|
||||
uninstall:
|
@ -1,24 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-video-rice_src_FrameBuffer_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/FrameBuffer.cpp.orig Mon Dec 19 00:17:20 2011
|
||||
+++ src/FrameBuffer.cpp Mon Dec 19 00:18:11 2011
|
||||
@@ -653,9 +653,9 @@ l1: mov esi, [ecx+ebx]
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__) && !defined(NO_ASM)
|
||||
asm volatile(" xorl %k2, %k2 \n"
|
||||
- " movsxl %k4, %q4 \n"
|
||||
+ " movslq %k4, %q4 \n"
|
||||
"0: \n"
|
||||
- " movsxl %3, %%rbx \n"
|
||||
+ " movslq %3, %%rbx \n"
|
||||
" sub $4, %%rbx \n"
|
||||
"1: \n"
|
||||
" movl (%0,%%rbx,1), %%eax \n"
|
||||
@@ -674,7 +674,7 @@ l1: mov esi, [ecx+ebx]
|
||||
: "%rbx", "%rax", "memory", "cc"
|
||||
);
|
||||
#elif !defined(NO_ASM)
|
||||
-# ifndef PIC
|
||||
+#if !defined(__PIC__)
|
||||
asm volatile("pusha \n"
|
||||
"mov pAsmStart, %%ecx \n" // = pStart
|
||||
"mov $0, %%edx \n" // The CRC
|
@ -1,14 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-video-rice_src_OGLRender_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/OGLRender.cpp.orig Mon Dec 19 00:22:51 2011
|
||||
+++ src/OGLRender.cpp Mon Dec 19 00:23:55 2011
|
||||
@@ -581,8 +581,8 @@ bool OGLRender::RenderLine3D()
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
|
||||
glColor4f(m_line3DVtx[1].r, m_line3DVtx[1].g, m_line3DVtx[1].b, m_line3DVtx[1].a);
|
||||
- glVertex3f(m_line3DVector[3].x, m_line3DVector[3].y, -m_line3DVtx[3].z);
|
||||
- glVertex3f(m_line3DVector[2].x, m_line3DVector[2].y, -m_line3DVtx[2].z);
|
||||
+ glVertex3f(m_line3DVector[3].x, m_line3DVector[3].y, -m_line3DVtx[1].z);
|
||||
+ glVertex3f(m_line3DVector[2].x, m_line3DVector[2].y, -m_line3DVtx[0].z);
|
||||
|
||||
glColor4ub(m_line3DVtx[0].r, m_line3DVtx[0].g, m_line3DVtx[0].b, m_line3DVtx[0].a);
|
||||
glVertex3f(m_line3DVector[1].x, m_line3DVector[1].y, -m_line3DVtx[1].z);
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-video-rice_src_RenderBase_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/RenderBase.cpp.orig Mon Dec 19 00:25:34 2011
|
||||
+++ src/RenderBase.cpp Mon Dec 19 00:25:42 2011
|
||||
@@ -384,7 +384,7 @@ __declspec( naked ) void __fastcall SSEVec3TransformD
|
||||
void SSEVec3Transform(int i)
|
||||
{
|
||||
asm volatile(" shl $4, %0 \n"
|
||||
- " movsxl %k0, %q0 \n"
|
||||
+ " movslq %k0, %q0 \n"
|
||||
" movaps (%1,%q0), %%xmm1 \n"
|
||||
" movaps 0(%2), %%xmm4 \n"
|
||||
" movaps 16(%2), %%xmm5 \n"
|
@ -1,137 +0,0 @@
|
||||
$OpenBSD: patch-source_mupen64plus-video-rice_src_TextureFilters_cpp,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
--- src/TextureFilters.cpp.orig Mon Dec 19 00:27:06 2011
|
||||
+++ src/TextureFilters.cpp Mon Dec 19 00:27:22 2011
|
||||
@@ -30,7 +30,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
#include "liblinux/BMGLibPNG.h"
|
||||
#include "liblinux/BMGDLL.h"
|
||||
#include <sys/types.h>
|
||||
+#include <algorithm>
|
||||
|
||||
+#ifdef min
|
||||
+#undef min
|
||||
+#endif
|
||||
+
|
||||
/************************************************************************/
|
||||
/* 2X filters */
|
||||
/************************************************************************/
|
||||
@@ -308,7 +313,7 @@ void SharpenFilter_32(uint32 *pdata, uint32 width, uin
|
||||
val[z]=t5;
|
||||
if( (t5*mul2) > (t1+t3+t7+t9+t2+t4+t6+t8)*mul1 )
|
||||
{
|
||||
- val[z]= min((((t5*mul3) - (t1+t3+t7+t9+t2+t4+t6+t8)*mul1)>>shift4),0xFF);
|
||||
+ val[z]= std::min((((t5*mul3) - (t1+t3+t7+t9+t2+t4+t6+t8)*mul1)>>shift4),0xFFU);
|
||||
}
|
||||
}
|
||||
dest[x] = val[0]|(val[1]<<8)|(val[2]<<16)|(val[3]<<24);
|
||||
@@ -375,7 +380,7 @@ void SharpenFilter_16(uint16 *pdata, uint32 width, uin
|
||||
if( (t5*mul2) > (t1+t3+t7+t9+t2+t4+t6+t8)*mul1 )
|
||||
{
|
||||
val[z] = (((t5*mul3) - (t1+t3+t7+t9+t2+t4+t6+t8)*mul1)>>shift4);
|
||||
- val[z]= min(val[z],0xF);
|
||||
+ val[z]= std::min(val[z],(unsigned short)0xFU);
|
||||
}
|
||||
}
|
||||
dest[x] = val[0]|(val[1]<<4)|(val[2]<<8)|(val[3]<<12);
|
||||
@@ -1288,6 +1293,7 @@ void FindAllHiResTextures(void)
|
||||
gHiresTxtrInfos.clear();
|
||||
if (!osal_is_directory(foldername))
|
||||
{
|
||||
+ DebugMessage(M64MSG_WARNING, "Couldn't open hi-res texture directory: %s", foldername);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -1377,7 +1383,8 @@ int FindScaleFactor(const ExtTxtrInfo &info, TxtrCache
|
||||
|
||||
int CheckTextureInfos( CSortedList<uint64,ExtTxtrInfo> &infos, TxtrCacheEntry &entry, int &indexa, int &scaleShift, bool bForDump = false)
|
||||
{
|
||||
- if(entry.ti.WidthToCreate/entry.ti.WidthToLoad > 2 || entry.ti.HeightToCreate/entry.ti.HeightToLoad > 2 )
|
||||
+ if ((entry.ti.WidthToLoad != 0 && entry.ti.WidthToCreate / entry.ti.WidthToLoad > 2) ||
|
||||
+ (entry.ti.HeightToLoad != 0 && entry.ti.HeightToCreate / entry.ti.HeightToLoad > 2 ))
|
||||
{
|
||||
//DebugMessage(M64MSG_WARNING, "Hires texture does not support extreme texture replication");
|
||||
return -1;
|
||||
@@ -1564,9 +1571,28 @@ bool LoadRGBBufferFromPNGFile(char *filename, unsigned
|
||||
pSrc++;
|
||||
}
|
||||
}
|
||||
+ else if (img.bits_per_pixel == 8 && (bits_per_pixel == 24 || bits_per_pixel == 32))
|
||||
+ {
|
||||
+ // do palette lookup and convert 8bpp to 24/32bpp
|
||||
+ int destBytePP = bits_per_pixel / 8;
|
||||
+ int paletteBytePP = img.bytes_per_palette_entry;
|
||||
+ unsigned char *pSrc = img.bits;
|
||||
+ unsigned char *pDst = *pbuf;
|
||||
+ // clear the destination image data (just to clear alpha if bpp=32)
|
||||
+ memset(*pbuf, 0, img.width*img.height*destBytePP);
|
||||
+ for (int i = 0; i < (int)(img.width*img.height); i++)
|
||||
+ {
|
||||
+ unsigned char clridx = *pSrc++;
|
||||
+ unsigned char *palcolor = img.palette + clridx * paletteBytePP;
|
||||
+ pDst[0] = palcolor[2]; // red
|
||||
+ pDst[1] = palcolor[1]; // green
|
||||
+ pDst[2] = palcolor[0]; // blue
|
||||
+ pDst += destBytePP;
|
||||
+ }
|
||||
+ }
|
||||
else
|
||||
{
|
||||
- DebugMessage(M64MSG_ERROR, "PNG file is %i bpp but texture is %i bpp.", img.bits_per_pixel, bits_per_pixel);
|
||||
+ DebugMessage(M64MSG_ERROR, "PNG file '%s' is %i bpp but texture is %i bpp.", filename, img.bits_per_pixel, bits_per_pixel);
|
||||
delete [] *pbuf;
|
||||
*pbuf = NULL;
|
||||
}
|
||||
@@ -1579,7 +1605,7 @@ bool LoadRGBBufferFromPNGFile(char *filename, unsigned
|
||||
}
|
||||
else
|
||||
{
|
||||
- DebugMessage(M64MSG_ERROR, "ReadPNG() returned error in LoadRGBBufferFromPNGFile!");
|
||||
+ DebugMessage(M64MSG_ERROR, "ReadPNG() returned error for '%s' in LoadRGBBufferFromPNGFile!", filename);
|
||||
*pbuf = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -1849,15 +1875,14 @@ void LoadHiresTexture( TxtrCacheEntry &entry )
|
||||
}
|
||||
|
||||
// calculate the texture size magnification by comparing the N64 texture size and the hi-res texture size
|
||||
- int scalex = width / (int)entry.ti.WidthToCreate;
|
||||
- int scaley = height / (int)entry.ti.HeightToCreate;
|
||||
+ int scale = 1 << scaleShift;
|
||||
int mirrorx = 1;
|
||||
int mirrory = 1;
|
||||
if (entry.ti.WidthToCreate/entry.ti.WidthToLoad == 2) mirrorx = 2;
|
||||
if (entry.ti.HeightToCreate/entry.ti.HeightToLoad == 2) mirrory = 2;
|
||||
- entry.pEnhancedTexture = CDeviceBuilder::GetBuilder()->CreateTexture(entry.ti.WidthToCreate*scalex*mirrorx, entry.ti.HeightToCreate*scaley*mirrory);
|
||||
+ entry.pEnhancedTexture = CDeviceBuilder::GetBuilder()->CreateTexture(entry.ti.WidthToCreate*scale, entry.ti.HeightToCreate*scale);
|
||||
DrawInfo info;
|
||||
-
|
||||
+
|
||||
if( entry.pEnhancedTexture && entry.pEnhancedTexture->StartUpdate(&info) )
|
||||
{
|
||||
|
||||
@@ -1913,22 +1938,22 @@ void LoadHiresTexture( TxtrCacheEntry &entry )
|
||||
|
||||
if (mirrorx == 2)
|
||||
{
|
||||
- //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scalex, scaley, mirrorx, mirrory, width, height, entry.ti.maskS+scaleShift);
|
||||
+ //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scale, scale, mirrorx, mirrory, width, height, entry.ti.maskS+scaleShift);
|
||||
gTextureManager.Mirror(info.lpSurface, width, entry.ti.maskS+scaleShift, width*2, width*2, height, S_FLAG, 4 );
|
||||
}
|
||||
|
||||
if (mirrory == 2)
|
||||
{
|
||||
- //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scalex, scaley, mirrorx, mirrory, width, height, entry.ti.maskT+scaleShift);
|
||||
+ //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scale, scale, mirrorx, mirrory, width, height, entry.ti.maskT+scaleShift);
|
||||
gTextureManager.Mirror(info.lpSurface, height, entry.ti.maskT+scaleShift, height*2, entry.pEnhancedTexture->m_dwCreatedTextureWidth, height, T_FLAG, 4 );
|
||||
}
|
||||
|
||||
- if( entry.ti.WidthToCreate*scalex*mirrorx < entry.pEnhancedTexture->m_dwCreatedTextureWidth )
|
||||
+ if( entry.ti.WidthToCreate*scale < entry.pEnhancedTexture->m_dwCreatedTextureWidth )
|
||||
{
|
||||
// Clamp
|
||||
gTextureManager.Clamp(info.lpSurface, width, entry.pEnhancedTexture->m_dwCreatedTextureWidth, entry.pEnhancedTexture->m_dwCreatedTextureWidth, height, S_FLAG, 4 );
|
||||
}
|
||||
- if( entry.ti.HeightToCreate*scaley*mirrory < entry.pEnhancedTexture->m_dwCreatedTextureHeight )
|
||||
+ if( entry.ti.HeightToCreate*scale < entry.pEnhancedTexture->m_dwCreatedTextureHeight )
|
||||
{
|
||||
// Clamp
|
||||
gTextureManager.Clamp(info.lpSurface, height, entry.pEnhancedTexture->m_dwCreatedTextureHeight, entry.pEnhancedTexture->m_dwCreatedTextureWidth, height, T_FLAG, 4 );
|
@ -1,5 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/12/26 13:38:27 stsp Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.2 2012/08/13 06:53:56 bentley Exp $
|
||||
lib/mupen64plus/
|
||||
lib/mupen64plus/mupen64plus-video-rice.so
|
||||
share/mupen64plus/
|
||||
share/mupen64plus/RiceVideoLinux.ini
|
||||
|
Loading…
x
Reference in New Issue
Block a user