mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 15:31:17 +01:00
Some clean up
delete devices after reply git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1386 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c16732a012
commit
b08352d1e4
@ -250,6 +250,7 @@ void CopySettingsFile(std::string DeviceName)
|
|||||||
void ExecuteCommand(u32 _Address)
|
void ExecuteCommand(u32 _Address)
|
||||||
{
|
{
|
||||||
bool GenerateReply = false;
|
bool GenerateReply = false;
|
||||||
|
u32 erased = 0;
|
||||||
|
|
||||||
ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address));
|
ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address));
|
||||||
switch (Command)
|
switch (Command)
|
||||||
@ -334,18 +335,18 @@ void ExecuteCommand(u32 _Address)
|
|||||||
case COMMAND_CLOSE_DEVICE:
|
case COMMAND_CLOSE_DEVICE:
|
||||||
{
|
{
|
||||||
u32 DeviceID = Memory::Read_U32(_Address + 8);
|
u32 DeviceID = Memory::Read_U32(_Address + 8);
|
||||||
|
|
||||||
IWII_IPC_HLE_Device* pDevice = AccessDeviceByID(DeviceID);
|
IWII_IPC_HLE_Device* pDevice = AccessDeviceByID(DeviceID);
|
||||||
if (pDevice != NULL)
|
if (pDevice != NULL)
|
||||||
{
|
{
|
||||||
pDevice->Close(_Address);
|
pDevice->Close(_Address);
|
||||||
|
|
||||||
// Delete the device when CLOSE is called, this does not effect
|
// Delete the device when CLOSE is called, this does not effect
|
||||||
// GenerateReply() for any other purpose than the logging because
|
// GenerateReply() for any other purpose than the logging because
|
||||||
// it's a true / false only function //
|
// it's a true / false only function //
|
||||||
DeleteDeviceByID(DeviceID);
|
erased = DeviceID;
|
||||||
GenerateReply = true;
|
GenerateReply = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -411,23 +412,28 @@ void ExecuteCommand(u32 _Address)
|
|||||||
u32 DeviceID = Memory::Read_U32(_Address + 8);
|
u32 DeviceID = Memory::Read_U32(_Address + 8);
|
||||||
IWII_IPC_HLE_Device* pDevice = NULL;
|
IWII_IPC_HLE_Device* pDevice = NULL;
|
||||||
|
|
||||||
// Get the device from the device map
|
// Get the device from the device map
|
||||||
if (g_DeviceMap.find(DeviceID) != g_DeviceMap.end())
|
if (DeviceID != 0) {
|
||||||
pDevice = g_DeviceMap[DeviceID];
|
if (g_DeviceMap.find(DeviceID) != g_DeviceMap.end())
|
||||||
|
pDevice = g_DeviceMap[DeviceID];
|
||||||
|
|
||||||
if (pDevice != NULL)
|
if (pDevice != NULL) {
|
||||||
{
|
// Write reply, this will later be executed in Update()
|
||||||
// Write reply, this will later be executed in Update()
|
g_ReplyQueue.push(std::pair<u32, std::string>(_Address, pDevice->GetDeviceName()));
|
||||||
g_ReplyQueue.push(std::pair<u32, std::string>(_Address, pDevice->GetDeviceName()));
|
} else {
|
||||||
}
|
LOG(WII_IPC_HLE, "IOP: Reply to unknown device ID (DeviceID=%i)", DeviceID);
|
||||||
else
|
g_ReplyQueue.push(std::pair<u32, std::string>(_Address, "unknown"));
|
||||||
{
|
}
|
||||||
// 0 is ok, as it's used for devices that wasn't created yet
|
|
||||||
if (DeviceID != 0)
|
if (erased > 0 && erased == DeviceID)
|
||||||
LOG(WII_IPC_HLE, "IOP: Reply to unknown device ID (DeviceID=%i)", DeviceID);
|
DeleteDeviceByID(DeviceID);
|
||||||
g_ReplyQueue.push(std::pair<u32, std::string>(_Address, "unknown"));
|
|
||||||
}
|
} else {
|
||||||
|
// 0 is ok, as it's used for devices that weren't created yet
|
||||||
|
g_ReplyQueue.push(std::pair<u32, std::string>(_Address, "unknown"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called continuously and WII_IPCInterface::IsReady() is controlled from WII_IPC.cpp.
|
// This is called continuously and WII_IPCInterface::IsReady() is controlled from WII_IPC.cpp.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user