SPU2: implement lifecycle callbacks

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-09-25 00:02:04 +02:00 committed by refractionpcsx2
parent cb0e422228
commit b6356eb5f8
2 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "IPC.h" #include "IPC.h"
#include "FW.h" #include "FW.h"
#include "SPU2/spu2.h" #include "SPU2/spu2.h"
#include "R3000A.h"
#include "../DebugTools/MIPSAnalyst.h" #include "../DebugTools/MIPSAnalyst.h"
#include "../DebugTools/SymbolMap.h" #include "../DebugTools/SymbolMap.h"
@ -89,6 +90,7 @@ void SysCoreThread::Start()
{ {
if( !GetCorePlugins().AreLoaded() ) return; if( !GetCorePlugins().AreLoaded() ) return;
GetCorePlugins().Init(); GetCorePlugins().Init();
SPU2init();
_parent::Start(); _parent::Start();
} }
@ -292,6 +294,7 @@ void SysCoreThread::OnSuspendInThread()
GetCorePlugins().Close(); GetCorePlugins().Close();
DoCDVDclose(); DoCDVDclose();
FWclose(); FWclose();
SPU2close();
} }
void SysCoreThread::OnResumeInThread( bool isSuspended ) void SysCoreThread::OnResumeInThread( bool isSuspended )
@ -300,6 +303,9 @@ void SysCoreThread::OnResumeInThread( bool isSuspended )
if (isSuspended || !g_GameStarted) if (isSuspended || !g_GameStarted)
DoCDVDopen(); DoCDVDopen();
FWopen(); FWopen();
SPU2open((void*)pDsp);
SPU2setDMABaseAddr((uptr)iopMem->Main);
SPU2setClockPtr(&psxRegs.cycle);
} }
@ -316,8 +322,10 @@ void SysCoreThread::OnCleanupInThread()
vu1Thread.WaitVU(); vu1Thread.WaitVU();
DoCDVDclose(); DoCDVDclose();
FWclose(); FWclose();
SPU2close();
GetCorePlugins().Close(); GetCorePlugins().Close();
GetCorePlugins().Shutdown(); GetCorePlugins().Shutdown();
SPU2shutdown();
_mm_setcsr( m_mxcsr_saved.bitmask ); _mm_setcsr( m_mxcsr_saved.bitmask );
Threading::DisableHiresScheduler(); Threading::DisableHiresScheduler();

View File

@ -28,6 +28,7 @@
#include "GS.h" #include "GS.h"
#include "CDVD/CDVD.h" #include "CDVD/CDVD.h"
#include "SPU2/spu2.h"
#include "Elfheader.h" #include "Elfheader.h"
#include "Patch.h" #include "Patch.h"
#include "R5900Exceptions.h" #include "R5900Exceptions.h"
@ -161,6 +162,7 @@ void AppCoreThread::Resume()
} }
GetCorePlugins().Init(); GetCorePlugins().Init();
SPU2init();
_parent::Resume(); _parent::Resume();
} }