[mupen64plus-rsp-hle] 68/167: Imported Upstream version 1.99.5~hg20110828
Sven Eckelmann
ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:02:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-rsp-hle.
commit cb09983d0b5b3aa801ef2e1865b55609ee9a7315
Author: Sven Eckelmann <sven at narfation.org>
Date: Sun Aug 28 18:47:23 2011 +0200
Imported Upstream version 1.99.5~hg20110828
---
projects/unix/Makefile | 138 +++++++++++++++------------
src/hle.h | 6 +-
src/jpeg.c | 1 +
src/main.c | 6 +-
src/ucode1.cpp | 18 ++--
src/ucode2.cpp | 21 ++--
src/ucode3.cpp | 254 ++-----------------------------------------------
7 files changed, 115 insertions(+), 329 deletions(-)
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index d7b6a1c..7854963 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -49,6 +49,12 @@ ifeq ("$(UNAME)","FreeBSD")
SO_EXTENSION = so
SHARED = -shared
endif
+ifeq ("$(UNAME)","OpenBSD")
+ OS = FREEBSD
+ SO_EXTENSION = so
+ SHARED = -shared
+ $(warning OS type "$(UNAME)" not officially supported.')
+endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX
SO_EXTENSION = so
@@ -66,56 +72,65 @@ ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
CPU := X86
ifeq ("$(BITS)", "32")
ARCH_DETECTED := 64BITS_32
+ PIC ?= 0
else
ARCH_DETECTED := 64BITS
+ PIC ?= 1
endif
endif
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
CPU := X86
ARCH_DETECTED := 32BITS
+ PIC ?= 0
+endif
+ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
+ CPU := PPC
+ ARCH_DETECTED := 32BITS
+ BIG_ENDIAN := 1
+ PIC ?= 1
+ $(warning Architecture "$(HOST_CPU)" not officially supported.')
+endif
+ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
+ CPU := PPC
+ ARCH_DETECTED := 64BITS
+ BIG_ENDIAN := 1
+ PIC ?= 1
+ $(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
-# PPC doesn't work yet
-#ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
-# CPU := PPC
-# ARCH_DETECTED := 32BITS
-#endif
-#ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
-# CPU := PPC
-# ARCH_DETECTED := 64BITS
-#endif
ifeq ("$(CPU)","NONE")
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif
-# base CFLAGS, LIBS, and LDFLAGS
-CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
+# base CFLAGS, LDLIBS, and LDFLAGS
+OPTFLAGS ?= -O3
+CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
CXXFLAGS += -fvisibility-inlines-hidden
+LDFLAGS += $(SHARED)
-# Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
-# On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
-ifeq ($(ARCH_DETECTED), 64BITS)
- CFLAGS += -fPIC -DPIC
+# Since we are building a shared library, we must compile with -fPIC on some architectures
+# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
+ifeq ($(PIC), 1)
+ CFLAGS += -fPIC
+ LDFLAGS += -fPIC
endif
+
+ifeq ($(BIG_ENDIAN), 1)
+ CFLAGS += -DM64P_BIG_ENDIAN
+endif
+
# tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32)
ifeq ($(OS), FREEBSD)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
CFLAGS += -m32
- LDFLAGS += -m32 -m elf_i386
+ LDFLAGS += -m32 -Wl,-m,elf_i386
endif
# set special flags per-system
ifeq ($(OS), LINUX)
# only export api symbols
LDFLAGS += -Wl,-version-script,$(SRCDIR)/rsp_api_export.ver
- ifeq ($(CPU), X86)
- ifeq ($(ARCH_DETECTED), 64BITS)
- CFLAGS += -pipe -O3 -march=athlon64
- else
- CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
- endif
- endif
endif
ifeq ($(OS), OSX)
ifeq ($(CPU), X86)
@@ -128,9 +143,6 @@ ifeq ($(OS), OSX)
endif
endif
endif
-ifeq ($(CPU), PPC)
- CFLAGS += -mcpu=powerpc
-endif
# set mupen64plus core API header path
ifneq ("$(APIDIR)","")
@@ -154,20 +166,31 @@ else
endif
endif
-# set shell function names
-CC ?= gcc
-CXX ?= g++
-INSTALL ?= install
-ifeq ($(OS),OSX)
- STRIP ?= strip -x
-else
- STRIP ?= strip -s
+# reduced compile output when running make without V=1
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ Q_CC = @echo ' CC '$@;
+ Q_CXX = @echo ' CXX '$@;
+ Q_LD = @echo ' LD '$@;
endif
+endif
+
+# set base program pointers and flags
+CC ?= gcc
+CXX ?= g++
+RM ?= rm -f
+INSTALL ?= install
+MKDIR ?= mkdir -p
+COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+LINK.o = $(Q_LD)$(CXX) $(LDFLAGS) $(TARGET_ARCH)
# set special flags for given Makefile parameters
ifeq ($(DEBUG),1)
CFLAGS += -g
- STRIP = true # disable binary strip
+ INSTALL_STRIP_FLAG ?=
+else
+ INSTALL_STRIP_FLAG ?= -s
endif
# set installation options
@@ -175,7 +198,10 @@ ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ifeq ($(LIBDIR),)
- LIBDIR := $(PREFIX)/lib/mupen64plus
+ LIBDIR := $(PREFIX)/lib
+endif
+ifeq ($(PLUGINDIR),)
+ PLUGINDIR := $(LIBDIR)/mupen64plus
endif
SRCDIR = ../../src
@@ -194,7 +220,7 @@ SOURCE = \
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
OBJDIRS = $(dir $(OBJECTS))
-$(shell mkdir -p $(OBJDIRS))
+$(shell $(MKDIR) $(OBJDIRS))
# build targets
TARGET = mupen64plus-rsp-hle.$(SO_EXTENSION)
@@ -210,25 +236,28 @@ targets:
@echo " Options:"
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
@echo " APIDIR=path == path to find Mupen64Plus Core headers"
+ @echo " OPTFLAGS=flag == compiler optimization (default: -O3)"
+ @echo " PIC=(1|0) == Force enable/disable of position independent code"
@echo " Install Options:"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
- @echo " LIBDIR=path == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
+ @echo " LIBDIR=path == library prefix (default: PREFIX/lib)"
+ @echo " PLUGINDIR=path == path to install plugin libraries (default: LIBDIR/mupen64plus)"
@echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)"
@echo " Debugging Options:"
@echo " DEBUG=1 == add debugging symbols"
+ @echo " V=1 == show verbose compiler output"
all: $(TARGET)
install: $(TARGET)
- $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
- $(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
+ $(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
+ $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
uninstall:
- rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
+ $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
clean:
- rm -rf ./_obj/* $(TARGET)
- rmdir ./_obj
+ $(RM) -r ./_obj $(TARGET)
rebuild: clean all
@@ -238,23 +267,14 @@ CFLAGS += -MD
CXXFLAGS += $(CFLAGS)
-# reduced compile output when running make without V=1
-ifneq ($(findstring $(MAKEFLAGS),s),s)
-ifndef V
- Q_CC = @echo ' CC '$@;
- Q_CXX = @echo ' CXX '$@;
- Q_LD = @echo ' LD '$@;
-endif
-endif
+# standard build rules
+$(OBJDIR)/%.o: $(SRCDIR)/%.c
+ $(COMPILE.c) -o $@ $<
-# build rules
+$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
+ $(COMPILE.cc) -o $@ $<
$(TARGET): $(OBJECTS)
- $(Q_LD)$(CXX) $(SHARED) $^ $(LDFLAGS) -o $@
- $(STRIP) $@
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-$(OBJDIR)/%.o: $(SRCDIR)/%.c
- $(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
-
-$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
- $(Q_CXX)$(CXX) -o $@ $(CXXFLAGS) -c $<
+.PHONY: all clean install uninstall targets
diff --git a/src/hle.h b/src/hle.h
index 82fb090..e2d8ecf 100644
--- a/src/hle.h
+++ b/src/hle.h
@@ -22,11 +22,13 @@
#ifndef HLE_H
#define HLE_H
+#define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_plugin.h"
-#define RSP_HLE_VERSION 0x016304
+#define RSP_HLE_VERSION 0x016304
+#define RSP_PLUGIN_API_VERSION 0x020000
-#ifdef _BIG_ENDIAN
+#ifdef M64P_BIG_ENDIAN
#define S 0
#define S16 0
#define S8 0
diff --git a/src/jpeg.c b/src/jpeg.c
index dd9a4fe..9363f30 100644
--- a/src/jpeg.c
+++ b/src/jpeg.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
+#define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_types.h"
#include "m64p_plugin.h"
#include "hle.h"
diff --git a/src/main.c b/src/main.c
index 536bcd4..eef6fe7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,7 +24,9 @@
#include <string.h>
#include <stdio.h>
+#define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_types.h"
+#include "m64p_common.h"
#include "m64p_plugin.h"
#include "hle.h"
@@ -60,7 +62,7 @@ extern void (*ABI1[0x20])();
extern void (*ABI2[0x20])();
extern void (*ABI3[0x20])();
-void (*ABI[0x20])();
+static void (*ABI[0x20])();
u32 inst1, inst2;
@@ -156,7 +158,7 @@ EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *Plugi
*PluginVersion = RSP_HLE_VERSION;
if (APIVersion != NULL)
- *APIVersion = PLUGIN_API_VERSION;
+ *APIVersion = RSP_PLUGIN_API_VERSION;
if (PluginNamePtr != NULL)
*PluginNamePtr = "Hacktarux/Azimer High-Level Emulation RSP Plugin";
diff --git a/src/ucode1.cpp b/src/ucode1.cpp
index 0c0ad75..7d0c40f 100644
--- a/src/ucode1.cpp
+++ b/src/ucode1.cpp
@@ -825,17 +825,17 @@ static void LOADADPCM (void) { // Loads an ADPCM table - Works 100% Now 03-13-01
//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;
diff --git a/src/ucode2.cpp b/src/ucode2.cpp
index 0ab3591..29b2835 100644
--- a/src/ucode2.cpp
+++ b/src/ucode2.cpp
@@ -56,17 +56,17 @@ static void LOADADPCM2 (void) { // Loads an ADPCM table - Works 100% Now 03-13-0
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% Accurate...
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% Accurate...
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 verification...
Left2=*(inSrcL++);
Right2=*(inSrcR++);
-#ifdef _BIG_ENDIAN
+#ifdef M64P_BIG_ENDIAN
*(outbuff++)=Right;
*(outbuff++)=Left;
*(outbuff++)=Right2;
diff --git a/src/ucode3.cpp b/src/ucode3.cpp
index ad8db73..b007b56 100644
--- a/src/ucode3.cpp
+++ b/src/ucode3.cpp
@@ -248,242 +248,6 @@ static void ENVMIXER3 (void) {
//*(u32 *)(hleMixerWorkArea + 24) = 0x13371337; // 22-23
memcpy(rsp.RDRAM+addy, (u8 *)hleMixerWorkArea,80);
}
-//*/
-static void ENVMIXER3o (void) {
- u8 flags = (u8)((inst1 >> 16) & 0xff);
- u32 addy = (inst2 & 0xFFFFFF);// + SEGMENTS[(inst2>>24)&0xf];
- //static FILE *dfile = fopen ("d:\\envmix.txt", "wt");
-// ********* Make sure these conditions are met... ***********
- if ((AudioInBuffer | AudioOutBuffer | AudioAuxA | AudioAuxC | AudioAuxE | AudioCount) & 0x3) {
- DebugMessage(M64MSG_ERROR, "Unaligned EnvMixer");
- }
-// ------------------------------------------------------------
- short *inp=(short *)(BufferSpace+0x4F0);
- short *out=(short *)(BufferSpace+0x9D0);
- short *aux1=(short *)(BufferSpace+0xB40);
- short *aux2=(short *)(BufferSpace+0xCB0);
- short *aux3=(short *)(BufferSpace+0xE20);
-
- int MainR;
- int MainL;
- int AuxR;
- int AuxL;
- int i1,o1,a1,a2,a3;
- unsigned short AuxIncRate=1;
- short zero[8];
- memset(zero,0,16);
- s32 LVol, RVol;
- s32 LAcc, RAcc;
- s32 LTrg, RTrg;
- s16 Wet, Dry;
-
- //fprintf (dfile, "\n----------------------------------------------------\n");
- Vol_Right = inst1;
- if (flags & A_INIT) {
- LVol = (((s32)(s16)Vol_Left * VolRamp_Left) - ((s32)(s16)Vol_Left << 16)) >> 3;
- RVol = (((s32)(s16)Vol_Right * VolRamp_Right) - ((s32)(s16)Vol_Right << 16)) >> 3;
- LAcc = ((s32)(s16)Vol_Left << 16);
- RAcc = ((s32)(s16)Vol_Right << 16);
- Wet = Env_Wet; Dry = Env_Dry; // Save Wet/Dry values
- //LTrg = (VolTrg_Left << 16); RTrg = (VolTrg_Right << 16); // Save Current Left/Right Targets
- LTrg = VolTrg_Left*0x10000; RTrg = VolTrg_Right*0x10000;
- //fprintf (dfile, "Vol_Left = %08X LVol = %08X\n", Vol_Left, LVol);
- } else {
- // Load LVol, RVol, LAcc, and RAcc (all 32bit)
- // Load Wet, Dry, LTrg, RTrg
- memcpy((u8 *)hleMixerWorkArea, (rsp.RDRAM+addy), 80);
- Wet = *(s16 *)(hleMixerWorkArea + 0); // 0-1
- Dry = *(s16 *)(hleMixerWorkArea + 2); // 2-3
- LTrg = *(s32 *)(hleMixerWorkArea + 4); // 4-5
- RTrg = *(s32 *)(hleMixerWorkArea + 6); // 6-7
- LVol = *(s32 *)(hleMixerWorkArea + 8); // 8-9 (hleMixerWorkArea is a 16bit pointer)
- RVol = *(s32 *)(hleMixerWorkArea + 10); // 10-11
- LAcc = *(s32 *)(hleMixerWorkArea + 12); // 12-13
- RAcc = *(s32 *)(hleMixerWorkArea + 14); // 14-15
- }
-
- if(!(flags&A_AUX)) {
- AuxIncRate=0;
- aux2=aux3=zero;
- }
-
- //fprintf (dfile, "LTrg = %08X, LVol = %08X\n", LTrg, LVol);
-
- for (int x=0; x<(0x170/2); x++) {
- i1=(int)inp[x^S];
- o1=(int)out[x^S];
- a1=(int)aux1[x^S];
- if (AuxIncRate) {
- a2=(int)aux2[x^S];
- a3=(int)aux3[x^S];
- }
- // TODO: here...
- //LAcc = (LTrg << 16);
- //RAcc = (RTrg << 16);
-
- LAcc += LVol;
- RAcc += RVol;
-
- if (LVol < 0) { // Decrementing
- if (LAcc < LTrg) {
- LAcc = LTrg;
- LVol = 0;
- }
- } else {
- if (LAcc > LTrg) {
- LAcc = LTrg;
- LVol = 0;
- }
- }
-
- if (RVol < 0) { // Decrementing
- if (RAcc < RTrg) {
- RAcc = RTrg;
- RVol = 0;
- }
- } else {
- if (RAcc > RTrg) {
- RAcc = RTrg;
- RVol = 0;
- }
- }
-
- //fprintf (dfile, "%04X ", (LAcc>>16));
-
- MainL = ((Dry * (LAcc>>16)) + 0x4000) >> 15;
- MainR = ((Dry * (RAcc>>16)) + 0x4000) >> 15;
- AuxL = ((Wet * (LAcc>>16)) + 0x4000) >> 15;
- AuxR = ((Wet * (RAcc>>16)) + 0x4000) >> 15;
- /*if (MainL>32767) MainL = 32767;
- else if (MainL<-32768) MainL = -32768;
- if (MainR>32767) MainR = 32767;
- else if (MainR<-32768) MainR = -32768;
- if (AuxL>32767) AuxL = 32767;
- else if (AuxL<-32768) AuxR = -32768;
- if (AuxR>32767) AuxR = 32767;
- else if (AuxR<-32768) AuxR = -32768;*/
- /*
- MainR = (Dry * RTrg + 0x10000) >> 15;
- MainL = (Dry * LTrg + 0x10000) >> 15;
- AuxR = (Wet * RTrg + 0x8000) >> 16;
- AuxL = (Wet * LTrg + 0x8000) >> 16;*/
-
- o1+=(/*(o1*0x7fff)+*/(i1*MainR)+0x4000)>>15;
-
- a1+=(/*(a1*0x7fff)+*/(i1*MainL)+0x4000)>>15;
-
- if(o1>32767) o1=32767;
- else if(o1<-32768) o1=-32768;
-
- if(a1>32767) a1=32767;
- else if(a1<-32768) a1=-32768;
-
- out[x^S]=o1;
- aux1[x^S]=a1;
- if (AuxIncRate) {
- a2+=(/*(a2*0x7fff)+*/(i1*AuxR)+0x4000)>>15;
- a3+=(/*(a3*0x7fff)+*/(i1*AuxL)+0x4000)>>15;
-
- if(a2>32767) a2=32767;
- else if(a2<-32768) a2=-32768;
-
- if(a3>32767) a3=32767;
- else if(a3<-32768) a3=-32768;
-
- aux2[x^S]=a2;
- aux3[x^S]=a3;
- }
- }
-
- *(s16 *)(hleMixerWorkArea + 0) = Wet; // 0-1
- *(s16 *)(hleMixerWorkArea + 2) = Dry; // 2-3
- *(s32 *)(hleMixerWorkArea + 4) = LTrg; // 4-5
- *(s32 *)(hleMixerWorkArea + 6) = RTrg; // 6-7
- *(s32 *)(hleMixerWorkArea + 8) = LVol; // 8-9 (hleMixerWorkArea is a 16bit pointer)
- *(s32 *)(hleMixerWorkArea + 10) = RVol; // 10-11
- *(s32 *)(hleMixerWorkArea + 12) = LAcc; // 12-13
- *(s32 *)(hleMixerWorkArea + 14) = RAcc; // 14-15
- memcpy(rsp.RDRAM+addy, (u8 *)hleMixerWorkArea,80);
-}
-/*
-static void ENVMIXER3 (void) { // Borrowed from RCP...
- u8 flags = (u8)((inst1 >> 16) & 0xff);
- u32 addy = (inst2 & 0xffffff);// + SEGMENTS[(inst2>>24)&0xf];
-
- short *inp=(short *)(BufferSpace+0x4F0);
- short *out=(short *)(BufferSpace+0x9D0);
- short *aux1=(short *)(BufferSpace+0xB40);
- short *aux2=(short *)(BufferSpace+0xCB0);
- short *aux3=(short *)(BufferSpace+0xE20);
-
- Vol_Right = (inst1 & 0xffff); // Needed for future references
-
- int i1,o1,a1,a2,a3;
- int MainR;
- int MainL;
- int AuxR;
- int AuxL;
-
- unsigned short AuxIncRate=1;
- short zero[8];
- memset(zero,0,16);
- if(flags & A_INIT) {
- MainR = (Env_Dry * VolTrg_Right + 0x10000) >> 15;
- MainL = (Env_Dry * VolTrg_Left + 0x10000) >> 15;
- AuxR = (Env_Wet * VolTrg_Right + 0x8000) >> 16;
- AuxL = (Env_Wet * VolTrg_Left + 0x8000) >> 16;
- } else {
- memcpy((u8 *)hleMixerWorkArea, (rsp.RDRAM+addy), 80);
- MainR=hleMixerWorkArea[0];
- MainL=hleMixerWorkArea[2];
- AuxR=hleMixerWorkArea[4];
- AuxL=hleMixerWorkArea[6];
- }
- if(!(flags&A_AUX))
- {
- AuxIncRate=0;
- aux2=aux3=zero;
- }
- for(int i=0;i<(0x170/2);i++)
- {
- i1=(int)*(inp++);
- o1=(int)*out;
- a1=(int)*aux1;
- a2=(int)*aux2;
- a3=(int)*aux3;
-
- o1=((o1*0x7fff)+(i1*MainR)+0x10000)>>15;
- a2=((a2*0x7fff)+(i1*AuxR)+0x8000)>>16;
-
- a1=((a1*0x7fff)+(i1*MainL)+0x10000)>>15;
- a3=((a3*0x7fff)+(i1*AuxL)+0x8000)>>16;
-
- if(o1>32767) o1=32767;
- else if(o1<-32768) o1=-32768;
-
- if(a1>32767) a1=32767;
- else if(a1<-32768) a1=-32768;
-
- if(a2>32767) a2=32767;
- else if(a2<-32768) a2=-32768;
-
- if(a3>32767) a3=32767;
- else if(a3<-32768) a3=-32768;
-
- *(out++)=o1;
- *(aux1++)=a1;
- *aux2=a2;
- *aux3=a3;
- aux2+=AuxIncRate;
- aux3+=AuxIncRate;
- }
- hleMixerWorkArea[0]=MainR;
- hleMixerWorkArea[2]=MainL;
- hleMixerWorkArea[4]=AuxR;
- hleMixerWorkArea[6]=AuxL;
- memcpy(rsp.RDRAM+addy, (u8 *)hleMixerWorkArea,80);
-}*/
-
static void CLEARBUFF3 (void) {
u16 addr = (u16)(inst1 & 0xffff);
@@ -534,17 +298,17 @@ static void LOADADPCM3 (void) { // Loads an ADPCM table - Works 100% Now 03-13-0
//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 +703,7 @@ static void INTERLEAVE3 (void) { // Needs accuracy verification...
Left2=*(inSrcL++);
Right2=*(inSrcR++);
-#ifdef _BIG_ENDIAN
+#ifdef M64P_BIG_ENDIAN
*(outbuff++)=Right;
*(outbuff++)=Left;
*(outbuff++)=Right2;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-rsp-hle.git
More information about the Pkg-games-commits
mailing list