try fixing spu race conditions more

This commit is contained in:
zeromus 2010-12-19 05:29:48 +00:00
parent e2c27f9c88
commit d37ac82039
4 changed files with 12 additions and 6 deletions

View File

@ -2120,9 +2120,7 @@ void NDS_Reset()
TotalLagFrames = 0; TotalLagFrames = 0;
} }
//spu must reset early on, since it will crash due to keeping a pointer into MMU memory for the sample pointers. yuck! SPU_DeInit();
SPU_Reset();
MMU_Reset(); MMU_Reset();
@ -2476,6 +2474,8 @@ void NDS_Reset()
memcpy(FW_Mac, (MMU.fw.data + 0x36), 6); memcpy(FW_Mac, (MMU.fw.data + 0x36), 6);
initSchedule(); initSchedule();
SPU_ReInit();
} }
static std::string MakeInputDisplayString(u16 pad, const std::string* Buttons, int count) { static std::string MakeInputDisplayString(u16 pad, const std::string* Buttons, int count) {

View File

@ -64,6 +64,7 @@ static int buffersize = 0;
static ESynchMode synchmode = ESynchMode_DualSynchAsynch; static ESynchMode synchmode = ESynchMode_DualSynchAsynch;
static ESynchMethod synchmethod = ESynchMethod_N; static ESynchMethod synchmethod = ESynchMethod_N;
static int SNDCoreId=-1;
static SoundInterface_struct *SNDCore=NULL; static SoundInterface_struct *SNDCore=NULL;
extern SoundInterface_struct *SNDCoreList[]; extern SoundInterface_struct *SNDCoreList[];
@ -151,6 +152,8 @@ int SPU_ChangeSoundCore(int coreid, int buffersize)
} }
} }
SNDCoreId = coreid;
//If the user picked the dummy core, disable the user spu //If the user picked the dummy core, disable the user spu
if(SNDCore == &SNDDummy) if(SNDCore == &SNDDummy)
return 0; return 0;
@ -178,6 +181,11 @@ SoundInterface_struct *SPU_SoundCore()
return SNDCore; return SNDCore;
} }
void SPU_ReInit()
{
SPU_Init(SNDCoreId, buffersize);
}
//static double cos_lut[256]; //static double cos_lut[256];
int SPU_Init(int coreid, int buffersize) int SPU_Init(int coreid, int buffersize)
{ {

View File

@ -198,6 +198,7 @@ public:
int SPU_ChangeSoundCore(int coreid, int buffersize); int SPU_ChangeSoundCore(int coreid, int buffersize);
SoundInterface_struct *SPU_SoundCore(); SoundInterface_struct *SPU_SoundCore();
void SPU_ReInit();
int SPU_Init(int coreid, int buffersize); int SPU_Init(int coreid, int buffersize);
void SPU_Pause(int pause); void SPU_Pause(int pause);
void SPU_SetVolume(int volume); void SPU_SetVolume(int volume);

View File

@ -197,9 +197,6 @@ void HK_StateLoadSlot(int num, bool justPressed)
{ {
if (romloaded && justPressed) if (romloaded && justPressed)
{ {
//keep the spu from running while we do the loadstate (or else it may trample on spu structures in the midst of getting twiddled)
Lock lock;
BOOL wasPaused = paused; BOOL wasPaused = paused;
Pause(); Pause();
loadstate_slot(num); //Loadstate loadstate_slot(num); //Loadstate