From a0da3ee37af1523cba4314127874ad05adeafa01 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 13 Feb 2009 09:57:15 +0000 Subject: [PATCH] Linux/Plugins: Use spu2ghz's noise rng in ZeroSPU2, clean various plugins before compiling them, put in better default values for the Linux port when configuring, and go into pcsx2 after configuring for the first time, rather then quitting. Oh, and disable the debugger for the moment in Linux. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@485 96395faa-99c1-11dd-bbfe-3dabce05a288 --- build.sh | 4 ++-- pcsx2/Linux/LnxMain.cpp | 9 +++++--- pcsx2/Linux/interface.c | 1 + pcsx2/Linux/pcsx2.glade | 1 + plugins/CDVDiso/build.sh | 1 + plugins/CDVDnull/build.sh | 1 + plugins/FWnull/build.sh | 1 + plugins/SPU2null/build.sh | 1 + plugins/dev9null/build.sh | 6 ++++- plugins/zerospu2/voices.cpp | 44 +++++++++++++++++++++++++++++++++++-- plugins/zerospu2/zerospu2.h | 4 ++-- 11 files changed, 63 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index f46dad8a8e..378d4b9979 100644 --- a/build.sh +++ b/build.sh @@ -6,11 +6,11 @@ # Uncomment if building by itself, rather then with all the plugins #Normal -export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --prefix `pwd`" +#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --prefix `pwd`" #Optimized, but a devbuild -#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --prefix `pwd`" +export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --prefix `pwd`" #Debug / Devbuild version #export PCSX2OPTIONS="--enable-debug --enable-devbuild --enable-sse3 --prefix `pwd`" diff --git a/pcsx2/Linux/LnxMain.cpp b/pcsx2/Linux/LnxMain.cpp index b9dd0028b4..d4acef6d2c 100644 --- a/pcsx2/Linux/LnxMain.cpp +++ b/pcsx2/Linux/LnxMain.cpp @@ -180,15 +180,18 @@ int main(int argc, char *argv[]) memset(&Config, 0, sizeof(Config)); strcpy(Config.BiosDir, DEFAULT_BIOS_DIR "/"); strcpy(Config.PluginsDir, DEFAULT_PLUGINS_DIR "/"); - Config.Patch = 1; - Config.Options = PCSX2_EEREC | PCSX2_VU0REC | PCSX2_VU1REC; + Config.Patch = 0; + Config.PsxOut = 1; + Config.Options = PCSX2_EEREC | PCSX2_VU0REC | PCSX2_VU1REC | PCSX2_FRAMELIMIT_LIMIT; Config.sseMXCSR = DEFAULT_sseMXCSR; Config.sseVUMXCSR = DEFAULT_sseVUMXCSR; + Config.eeOptions = DEFAULT_eeOptions; + Config.vuOptions = DEFAULT_vuOptions; Msgbox::Alert("Pcsx2 needs to be configured"); Pcsx2Configure(); - return 0; + LoadConfig(); } InitLanguages(); diff --git a/pcsx2/Linux/interface.c b/pcsx2/Linux/interface.c index d1f4348da3..15dea4fa6a 100644 --- a/pcsx2/Linux/interface.c +++ b/pcsx2/Linux/interface.c @@ -2686,6 +2686,7 @@ create_MainWindow (void) GtkMenuItem_EnterDebugger = gtk_menu_item_new_with_mnemonic (_("Enter Debugger ...")); gtk_widget_show (GtkMenuItem_EnterDebugger); gtk_container_add (GTK_CONTAINER (GtkMenuItem_Debug_menu), GtkMenuItem_EnterDebugger); + gtk_widget_set_sensitive (GtkMenuItem_EnterDebugger, FALSE); GtkMenuItem_Logging = gtk_menu_item_new_with_mnemonic (_("Logging")); gtk_widget_show (GtkMenuItem_Logging); diff --git a/pcsx2/Linux/pcsx2.glade b/pcsx2/Linux/pcsx2.glade index 53bc0047b0..83574d8ab3 100644 --- a/pcsx2/Linux/pcsx2.glade +++ b/pcsx2/Linux/pcsx2.glade @@ -5188,6 +5188,7 @@ Version x.x True + False Enter Debugger ... True diff --git a/plugins/CDVDiso/build.sh b/plugins/CDVDiso/build.sh index 3f569fbc03..3b953bbd62 100644 --- a/plugins/CDVDiso/build.sh +++ b/plugins/CDVDiso/build.sh @@ -7,6 +7,7 @@ echo Building CDVDiso echo ---------------- cd ${curdir}/src/Linux +make clean make $@ # copy the files diff --git a/plugins/CDVDnull/build.sh b/plugins/CDVDnull/build.sh index cc8792b0b5..759bcb36b0 100644 --- a/plugins/CDVDnull/build.sh +++ b/plugins/CDVDnull/build.sh @@ -6,6 +6,7 @@ echo ----------------- echo Building CDVDnull echo ----------------- cd ${curdir}/Src +make clean make $@ # copy the files diff --git a/plugins/FWnull/build.sh b/plugins/FWnull/build.sh index a7ad4f2a69..21b259dba4 100644 --- a/plugins/FWnull/build.sh +++ b/plugins/FWnull/build.sh @@ -7,6 +7,7 @@ echo --------------- curdir=`pwd` cd ${curdir}/Linux +make clean make $@ if [ -s cfgFWnull ] && [ -s libFWnull.so ] diff --git a/plugins/SPU2null/build.sh b/plugins/SPU2null/build.sh index 5360bcdfe6..5d04adfb50 100644 --- a/plugins/SPU2null/build.sh +++ b/plugins/SPU2null/build.sh @@ -7,6 +7,7 @@ echo Building SPU2null echo ----------------- cd ${curdir}/Src +make clean make $@ cp libSPU2null.so ${PCSX2PLUGINS} diff --git a/plugins/dev9null/build.sh b/plugins/dev9null/build.sh index 496e73341b..321284aa69 100644 --- a/plugins/dev9null/build.sh +++ b/plugins/dev9null/build.sh @@ -1,9 +1,13 @@ #!/bin/sh -echo Building dev9null... +echo ----------------- +echo Building dev9null +echo ----------------- + curdir=`pwd` cd ${curdir}/src +make clean make $@ cp libDEV9null.so ${PCSX2PLUGINS} diff --git a/plugins/zerospu2/voices.cpp b/plugins/zerospu2/voices.cpp index 7d30fa4c8d..d46ee1592f 100644 --- a/plugins/zerospu2/voices.cpp +++ b/plugins/zerospu2/voices.cpp @@ -182,6 +182,45 @@ void VOICE_PROCESSED::FModChangeFrequency(int ns) iFMod[ns]=0; } +static void __forceinline GetNoiseValues(s32& VD) +{ + static s32 Seed = 0x41595321; + + if(Seed&0x100) + VD = (s32)((Seed&0xff)<<8); + else if(!(Seed&0xffff)) + VD = (s32)0x8000; + else + VD = (s32)0x7fff; + +#ifdef _WIN32 + __asm { + MOV eax,Seed + ROR eax,5 + XOR eax,0x9a + MOV ebx,eax + ROL eax,2 + ADD eax,ebx + XOR eax,ebx + ROR eax,3 + MOV Seed,eax + } +#else + __asm__ ( + ".intel_syntax\n" + "MOV %%eax,%0\n" + "ROR %%eax,5\n" + "XOR %%eax,0x9a\n" + "MOV %%ebx,%%eax\n" + "ROL %%eax,2\n" + "ADD %%eax,%%ebx\n" + "XOR %%eax,%%ebx\n" + "ROR %%eax,3\n" + "MOV %0,%%eax\n" + ".att_syntax\n" : :"r"(Seed)); +#endif +} + // fixme - noise handler... just produces some noise data // surely wrong... and no noise frequency (spuCtrl&0x3f00) will be used... // and sometimes the noise will be used as fmod modulation... pfff @@ -189,14 +228,15 @@ int VOICE_PROCESSED::iGetNoiseVal() { int fa; - if ((dwNoiseVal<<=1)&0x80000000L) + /*if ((dwNoiseVal<<=1)&0x80000000L) { dwNoiseVal^=0x0040001L; fa = ((dwNoiseVal>>2)&0x7fff); fa = -fa; } else - fa=(dwNoiseVal>>2)&0x7fff; + fa=(dwNoiseVal>>2)&0x7fff;*/ + GetNoiseValues(fa); // mmm... depending on the noise freq we allow bigger/smaller changes to the previous val fa=iOldNoise + ((fa - iOldNoise) / ((0x001f - (GetCtrl()->noiseFreq)) + 1)); diff --git a/plugins/zerospu2/zerospu2.h b/plugins/zerospu2/zerospu2.h index c67b54d1f5..087a416630 100644 --- a/plugins/zerospu2/zerospu2.h +++ b/plugins/zerospu2/zerospu2.h @@ -78,6 +78,8 @@ extern FILE *spu2Log; #define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting #define NSPACKETS 24 +#define SPU_NUMBER_VOICES 48 + #define SAMPLE_RATE 48000L #define RECORD_FILENAME "zerospu2.wav" @@ -211,8 +213,6 @@ static __forceinline void C_SPUADDR_SET(u32 value, int c) C1_SPUADDR_SET(value); } -#define SPU_NUMBER_VOICES 48 - struct SPU_CONTROL_ { u16 extCd : 1;