Merge pull request #4184 from EmptyChaos/wii_ipc-init

WII_IPC_HLE: Fix Reinit
This commit is contained in:
Scott Mansell 2016-09-06 15:51:30 +12:00 committed by GitHub
commit 3e0355e7f6
3 changed files with 11 additions and 3 deletions

View File

@ -119,9 +119,9 @@ std::shared_ptr<T> AddDevice(const char* deviceName)
return device; return device;
} }
void Init() void Reinit()
{ {
_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init"); _assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "Reinit called while already initialized");
CWII_IPC_HLE_Device_es::m_ContentFile = ""; CWII_IPC_HLE_Device_es::m_ContentFile = "";
num_devices = 0; num_devices = 0;
@ -156,6 +156,11 @@ void Init()
#endif #endif
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1"); AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1");
AddDevice<IWII_IPC_HLE_Device>("_Unimplemented_Device_"); AddDevice<IWII_IPC_HLE_Device>("_Unimplemented_Device_");
}
void Init()
{
Reinit();
event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEvent); event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEvent);
event_sdio_notify = CoreTiming::RegisterEvent("SDIO_EventNotify", SDIO_EventNotify_CPUThread); event_sdio_notify = CoreTiming::RegisterEvent("SDIO_EventNotify", SDIO_EventNotify_CPUThread);

View File

@ -45,6 +45,9 @@ namespace WII_IPC_HLE_Interface
// Init // Init
void Init(); void Init();
// Needs to be called after Reset(true) to recreate the device tree
void Reinit();
// Shutdown // Shutdown
void Shutdown(); void Shutdown();

View File

@ -1000,7 +1000,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected(); wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
WII_IPC_HLE_Interface::Reset(true); WII_IPC_HLE_Interface::Reset(true);
WII_IPC_HLE_Interface::Init(); WII_IPC_HLE_Interface::Reinit();
s_Usb = GetUsbPointer(); s_Usb = GetUsbPointer();
for (unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); i++) for (unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); i++)
{ {