Fixed Issue 1697, this also makes usb_kbd enabled again.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4646 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-05 17:34:32 +00:00
parent 0f0c77c299
commit 6a5a90b9db
5 changed files with 16 additions and 21 deletions

View File

@ -470,26 +470,18 @@ void Update()
void UpdateDevices() void UpdateDevices()
{ {
// This is called frequently so better make this route simple
// currently we only have one device: USB that needs update and its ID is fixed to IPC_FIRST_HARDWARE_ID
// So let's skip the query and call it directly, which will speed up a lot
//
IWII_IPC_HLE_Device* pDevice = g_DeviceMap[IPC_FIRST_HARDWARE_ID];
if (pDevice->IsOpened())
pDevice->Update();
/*
// check if a device must be updated // check if a device must be updated
TDeviceMap::const_iterator itr = g_DeviceMap.begin(); TDeviceMap::const_iterator itr = g_DeviceMap.begin();
while(itr != g_DeviceMap.end()) while(itr != g_DeviceMap.find(IPC_FIRST_FILEIO_ID))
{ {
if (itr->second->Update()) if (itr->second->IsOpened())
{ {
break; if (itr->second->Update())
break;
} }
++itr; ++itr;
} }
*/
} }

View File

@ -76,7 +76,6 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress, bool _bForce)
fclose(m_Card); fclose(m_Card);
m_Card = NULL; m_Card = NULL;
} }
m_Status = CARD_INSERTED;
m_BlockLength = 0; m_BlockLength = 0;
m_BusWidth = 0; m_BusWidth = 0;
@ -167,7 +166,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
case IOCTL_GETSTATUS: case IOCTL_GETSTATUS:
INFO_LOG(WII_IPC_SD, "IOCTL_GETSTATUS. Replying that SD card is %s%s", INFO_LOG(WII_IPC_SD, "IOCTL_GETSTATUS. Replying that SD card is %s%s",
(m_Status & CARD_INSERTED) ? "inserted" : "", (m_Status & CARD_INSERTED) ? "inserted" : "not exitsting",
(m_Status & CARD_INITIALIZED) ? " and initialized" : ""); (m_Status & CARD_INITIALIZED) ? " and initialized" : "");
Memory::Write_U32(m_Status, BufferOut); Memory::Write_U32(m_Status, BufferOut);
break; break;
@ -407,9 +406,12 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
DEBUG_LOG(WII_IPC_SD, "SDHC_CAPABILITIES"); DEBUG_LOG(WII_IPC_SD, "SDHC_CAPABILITIES");
// SDHC 1.0 supports only 10-63 MHz. // SDHC 1.0 supports only 10-63 MHz.
// So of course we reply 63MHz :) // So of course we reply 63MHz :)
u8 mhz_units = 1 << 7; u32 freq = (63 << 8) + (1 << 7) + 63;
u16 freq = 63 << 8; // Only support 3.3V
u32 caps = freq | mhz_units; u32 voltage = 1 << 24;
// High Speed support
u32 speed = 1 << 21;
u32 caps = freq | voltage | speed;
Memory::Write_U32(caps, _BufferOut); Memory::Write_U32(caps, _BufferOut);
break; break;
} }

View File

@ -70,6 +70,7 @@ private:
// Status // Status
enum enum
{ {
CARD_NOT_EXIST = 0,
CARD_INSERTED = 1, CARD_INSERTED = 1,
CARD_INITIALIZED = 0x10000, CARD_INITIALIZED = 0x10000,
}; };

View File

@ -472,10 +472,10 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
// or CPU will disconnect WiiMote automatically // or CPU will disconnect WiiMote automatically
// but don't send too many or it will jam the bus and cost extra CPU time // but don't send too many or it will jam the bus and cost extra CPU time
// //
if (m_HCIBuffer.m_address && !WII_IPCInterface::GetAddress() && m_WiiMotes[0].IsConnected()) if (m_HCIBuffer.m_address && m_WiiMotes[0].IsConnected())
{ {
m_FreqDividerSync++; m_FreqDividerSync++;
if ((m_PacketCount > 0) || (m_FreqDividerSync > 30)) // Feel free to tweak it if ((m_PacketCount > 0) || (m_FreqDividerSync > 60)) // Feel free to tweak it
{ {
m_FreqDividerSync = 0; m_FreqDividerSync = 0;
SendEventNumberOfCompletedPackets(m_WiiMotes[0].GetConnectionHandle(), m_PacketCount); SendEventNumberOfCompletedPackets(m_WiiMotes[0].GetConnectionHandle(), m_PacketCount);
@ -490,7 +490,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
// Besides, decreasing its reporting frequency also brings us great FPS boost // Besides, decreasing its reporting frequency also brings us great FPS boost
// Now I am making it running at 1/100 frequency of IPC which is already fast enough for human input // Now I am making it running at 1/100 frequency of IPC which is already fast enough for human input
// //
if (m_ACLBuffer.m_address && !WII_IPCInterface::GetAddress() && !m_LastCmd && m_WiiMotes[0].IsLinked()) if (m_ACLBuffer.m_address && !m_LastCmd && m_WiiMotes[0].IsLinked())
{ {
m_FreqDividerMote++; m_FreqDividerMote++;
if(m_FreqDividerMote > 99) // Feel free to tweak it if(m_FreqDividerMote > 99) // Feel free to tweak it

View File

@ -46,7 +46,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mode)
bool CWII_IPC_HLE_Device_usb_kbd::Close(u32 _CommandAddress, bool _bForce) bool CWII_IPC_HLE_Device_usb_kbd::Close(u32 _CommandAddress, bool _bForce)
{ {
INFO_LOG(WII_IPC_NET, "USB_KBD: Close"); INFO_LOG(WII_IPC_STM, "CWII_IPC_HLE_Device_usb_kbd: Close");
if (!_bForce) if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4); Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false; m_Active = false;