From e473ebc2e301fc6c801c69157af87c4765d90c55 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 16 Jul 2015 04:36:42 +0200 Subject: [PATCH] Display a message on screen when the emulated software disconnects a Wiimote. --- Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 8 ++++++++ Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index bfd90e4652..6267bcda6a 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -1308,6 +1308,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDisconnect(u8* _Input) DEBUG_LOG(WII_IPC_WIIMOTE, " Reason: 0x%02x", pDiscon->reason); Host_SetWiiMoteConnectionState(0); + DisplayDisconnectMessage((pDiscon->con_handle & 0xFF) + 1, pDiscon->reason); SendEventCommandStatus(HCI_CMD_DISCONNECT); SendEventDisconnect(pDiscon->con_handle, pDiscon->reason); @@ -1877,6 +1878,13 @@ CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _Co return nullptr; } +void CWII_IPC_HLE_Device_usb_oh1_57e_305::DisplayDisconnectMessage(const int wiimoteNumber, const int reason) +{ + // TODO: If someone wants to be fancy we could also figure out what the values for pDiscon->reason mean + // and display things like "Wiimote %i disconnected due to inactivity!" etc. + Core::DisplayMessage(StringFromFormat(_trans("Wiimote %i disconnected by emulated software"), wiimoteNumber), 3000); +} + void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey) { DEBUG_LOG(WII_IPC_WIIMOTE, " link key: " diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h index 03676c5f76..4c0a29999b 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h @@ -267,6 +267,8 @@ private: void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size); void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size); + static void DisplayDisconnectMessage(const int wiimoteNumber, const int reason); + // Debugging void LOG_LinkKey(const u8* _pLinkKey);