[Regression] Fixed the loading of some WADs that were broken (again! :() since r4646.

Added /dev/usb/hid into hardware device list.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4675 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-10 20:24:27 +00:00
parent 888e6e12e6
commit d901fd2e38
1 changed files with 7 additions and 4 deletions

View File

@ -97,6 +97,7 @@ void Init()
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ip_top(i, std::string("/dev/net/ip/top")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ip_top(i, std::string("/dev/net/ip/top")); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_oh0(i, std::string("/dev/usb/oh0")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_oh0(i, std::string("/dev/usb/oh0")); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, std::string("/dev/usb/kbd")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, std::string("/dev/usb/kbd")); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_hid(i, std::string("/dev/usb/hid")); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_sdio_slot0(i, std::string("/dev/sdio/slot0")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_sdio_slot0(i, std::string("/dev/sdio/slot0")); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_Error(i, std::string("_Unknown_Device_")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_Error(i, std::string("_Unknown_Device_")); i++;
@ -110,6 +111,7 @@ void Reset(bool _bHard)
{ {
if (itr->second) if (itr->second)
{ {
// Force close
itr->second->Close(NULL, true); itr->second->Close(NULL, true);
// Hardware should not be deleted unless it is a hard reset // Hardware should not be deleted unless it is a hard reset
if (_bHard || !itr->second->IsHardware()) if (_bHard || !itr->second->IsHardware())
@ -117,8 +119,9 @@ void Reset(bool _bHard)
} }
++itr; ++itr;
} }
// Erase invalid device // Skip hardware devices if not a hard reset
itr = g_DeviceMap.find((_bHard)? IPC_FIRST_HARDWARE_ID : IPC_FIRST_FILEIO_ID); itr = (_bHard) ? g_DeviceMap.begin() : g_DeviceMap.lower_bound(IPC_FIRST_FILEIO_ID);
// Erase devices
g_DeviceMap.erase(itr, g_DeviceMap.end()); g_DeviceMap.erase(itr, g_DeviceMap.end());
g_FileNameMap.clear(); g_FileNameMap.clear();
@ -470,10 +473,10 @@ void Update()
void UpdateDevices() void UpdateDevices()
{ {
// check if a device must be updated // Check if a hardware device must be updated
TDeviceMap::const_iterator itr = g_DeviceMap.begin(); TDeviceMap::const_iterator itr = g_DeviceMap.begin();
while(itr != g_DeviceMap.find(IPC_FIRST_FILEIO_ID)) while (itr != g_DeviceMap.lower_bound(IPC_FIRST_FILEIO_ID))
{ {
if (itr->second->IsOpened()) if (itr->second->IsOpened())
{ {