USB: implement lifecycle callbacks

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-02 22:38:36 +01:00 committed by refractionpcsx2
parent e5a7cc4a1c
commit a6c67dde55
2 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "FW.h" #include "FW.h"
#include "SPU2/spu2.h" #include "SPU2/spu2.h"
#include "DEV9/DEV9.h" #include "DEV9/DEV9.h"
#include "USB/USB.h"
#include "../DebugTools/MIPSAnalyst.h" #include "../DebugTools/MIPSAnalyst.h"
#include "../DebugTools/SymbolMap.h" #include "../DebugTools/SymbolMap.h"
@ -96,6 +97,7 @@ void SysCoreThread::Start()
GetCorePlugins().Init(); GetCorePlugins().Init();
SPU2init(); SPU2init();
DEV9init(); DEV9init();
USBinit();
_parent::Start(); _parent::Start();
} }
@ -304,6 +306,7 @@ void SysCoreThread::OnSuspendInThread()
{ {
GetCorePlugins().Close(); GetCorePlugins().Close();
DEV9close(); DEV9close();
USBclose();
DoCDVDclose(); DoCDVDclose();
FWclose(); FWclose();
SPU2close(); SPU2close();
@ -317,6 +320,7 @@ void SysCoreThread::OnResumeInThread(bool isSuspended)
FWopen(); FWopen();
SPU2open((void*)pDsp); SPU2open((void*)pDsp);
DEV9open((void*)pDsp); DEV9open((void*)pDsp);
USBopen((void*)pDsp);
} }
@ -331,12 +335,14 @@ void SysCoreThread::OnCleanupInThread()
R3000A::ioman::reset(); R3000A::ioman::reset();
// FIXME: temporary workaround for deadlock on exit, which actually should be a crash // FIXME: temporary workaround for deadlock on exit, which actually should be a crash
vu1Thread.WaitVU(); vu1Thread.WaitVU();
USBclose();
SPU2close(); SPU2close();
DEV9close(); DEV9close();
DoCDVDclose(); DoCDVDclose();
FWclose(); FWclose();
GetCorePlugins().Close(); GetCorePlugins().Close();
GetCorePlugins().Shutdown(); GetCorePlugins().Shutdown();
USBshutdown();
SPU2shutdown(); SPU2shutdown();
DEV9shutdown(); DEV9shutdown();

View File

@ -29,6 +29,7 @@
#include "CDVD/CDVD.h" #include "CDVD/CDVD.h"
#include "SPU2/spu2.h" #include "SPU2/spu2.h"
#include "USB/USB.h"
#include "Elfheader.h" #include "Elfheader.h"
#include "Patch.h" #include "Patch.h"
#include "R5900Exceptions.h" #include "R5900Exceptions.h"
@ -171,6 +172,7 @@ void AppCoreThread::Resume()
GetCorePlugins().Init(); GetCorePlugins().Init();
SPU2init(); SPU2init();
USBinit();
_parent::Resume(); _parent::Resume();
} }