From 10576c5b01aa0323bc7438d21509f8e1fa43a15d Mon Sep 17 00:00:00 2001 From: arcum42 Date: Mon, 21 Jun 2010 09:40:15 +0000 Subject: [PATCH] spu2-x: Fix a crash in Linux. (Do the same thing to ZeroSPU2 for good measure.) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3252 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/spu2-x/src/Linux/SPU2-X.cbp | 1 + plugins/spu2-x/src/Mixer.cpp | 20 ++++++++++---------- plugins/zerospu2/voices.cpp | 11 ++++++----- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/plugins/spu2-x/src/Linux/SPU2-X.cbp b/plugins/spu2-x/src/Linux/SPU2-X.cbp index 708cef220f..c262b9f674 100644 --- a/plugins/spu2-x/src/Linux/SPU2-X.cbp +++ b/plugins/spu2-x/src/Linux/SPU2-X.cbp @@ -14,6 +14,7 @@ + diff --git a/plugins/spu2-x/src/Mixer.cpp b/plugins/spu2-x/src/Mixer.cpp index 8442c36a79..296cc65787 100644 --- a/plugins/spu2-x/src/Mixer.cpp +++ b/plugins/spu2-x/src/Mixer.cpp @@ -251,16 +251,16 @@ static __forceinline void GetNextDataDummy(V_Core& thiscore, uint voiceidx) ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// // // + static s32 __forceinline GetNoiseValues() { static s32 Seed = 0x41595321; s32 retval = 0x8000; - + if( Seed&0x100 ) retval = (Seed&0xff) << 8; else if( Seed&0xffff ) retval = 0x7fff; - #ifdef _WIN32 __asm { MOV eax,Seed @@ -274,22 +274,22 @@ static s32 __forceinline GetNoiseValues() MOV Seed,eax } #else - __asm__ ( + __asm__ __volatile__ ( ".intel_syntax\n" "MOV %%eax,%1\n" "ROR %%eax,5\n" "XOR %%eax,0x9a\n" - "MOV %%ebx,%%eax\n" + "MOV %%esi,%%eax\n" "ROL %%eax,2\n" - "ADD %%eax,%%ebx\n" - "XOR %%eax,%%ebx\n" + "ADD %%eax,%%esi\n" + "XOR %%eax,%%esi\n" "ROR %%eax,3\n" "MOV %0,%%eax\n" - ".att_syntax\n" : "=r"(Seed) :"r"(Seed)); + ".att_syntax\n" : "=r"(Seed) :"r"(Seed) + ); #endif return retval; } - ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// // // @@ -501,7 +501,7 @@ static __forceinline s32 GetNoiseValues( V_Core& thiscore, uint voiceidx ) // Performs no cache invalidation -- use only for dynamic memory ranges // of the SPU2 (between 0x0000 and SPU2_DYN_MEMLINE) static __forceinline void spu2M_WriteFast( u32 addr, s16 value ) -{ +{ // Fixes some of the oldest hangs in pcsx2's history! :p for( uint i=0; i<2; i++ ) { @@ -595,7 +595,7 @@ static __forceinline StereoOut32 MixVoice( uint coreidx, uint voiceidx ) if (voiceidx==1) spu2M_WriteFast( ( (0==coreidx) ? 0x400 : 0xc00 ) + OutPos, vc.OutX ); else if (voiceidx==3) spu2M_WriteFast( ( (0==coreidx) ? 0x600 : 0xe00 ) + OutPos, vc.OutX ); - + return ApplyVolume( StereoOut32( Value, Value ), vc.Volume ); } else diff --git a/plugins/zerospu2/voices.cpp b/plugins/zerospu2/voices.cpp index 81b2f33118..652b69a809 100644 --- a/plugins/zerospu2/voices.cpp +++ b/plugins/zerospu2/voices.cpp @@ -204,18 +204,19 @@ static void __forceinline GetNoiseValues(s32& VD) MOV Seed,eax } #else - __asm__ ( + __asm__ __volatile__ ( ".intel_syntax\n" "MOV %%eax,%1\n" "ROR %%eax,5\n" "XOR %%eax,0x9a\n" - "MOV %%ebx,%%eax\n" + "MOV %%esi,%%eax\n" "ROL %%eax,2\n" - "ADD %%eax,%%ebx\n" - "XOR %%eax,%%ebx\n" + "ADD %%eax,%%esi\n" + "XOR %%eax,%%esi\n" "ROR %%eax,3\n" "MOV %0,%%eax\n" - ".att_syntax\n" : "=r"(Seed) :"r"(Seed)); + ".att_syntax\n" : "=r"(Seed) :"r"(Seed) + ); #endif }