From ca0e807db6957be0910651b93db5a5e3a8afb642 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Sun, 8 Feb 2009 12:27:04 +0000 Subject: [PATCH] Wiimote: Fixed the speaker status bar status, the status is [Green] [Blue] [Green] that means [On/Off] [Muted/Unmuted] [Activity] git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2142 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 31 +++++++++---------- Source/Core/DolphinWX/Src/FrameWiimote.cpp | 6 ++-- Source/Core/DolphinWX/Src/Main.cpp | 7 +++-- .../Plugin_Wiimote/Src/EmuSubroutines.cpp | 4 ++- .../Plugins/Plugin_Wiimote/Src/FillReport.cpp | 3 -- Source/Plugins/Plugin_Wiimote/Src/main.cpp | 14 ++++++--- 6 files changed, 36 insertions(+), 29 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index 1c4e68d1ec..959c29e072 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -400,33 +400,32 @@ void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) int speaker_bits = 0; - if (SpeakersOn) { + if (SpeakersOn) + { u8 Bits = 0; - switch (data[1]) { // Enable and disable speakers - case 0x14: - // Get the value - if (data[2] == 0x02) + switch (data[1]) + { + case 0x14: // Enable and disable speakers + if (data[2] == 0x02) // Off Bits = 0; - else if (data[2] == 0x06) + else if (data[2] == 0x06) // On Bits = 1; Host_UpdateSpeakerStatus(0, Bits); break; case 0x19: // Mute and unmute // Get the value - if (data[2] == 0x02) - Bits = 0; - else if (data[2] == 0x06) + if (data[2] == 0x02) // Unmute Bits = 1; - Host_UpdateSpeakerStatus(0, Bits); + else if (data[2] == 0x06) // Mute + Bits = 0; + Host_UpdateSpeakerStatus(1, Bits); break; - + // Write to speaker registry, or write sound case 0x16: - if (data[1] == 0x16) // Write to speaker registry - { - // Don't care what it does, call all activity - Host_UpdateSpeakerStatus(0, 1); - } + case 0x18: + // Turn on the activity light + Host_UpdateSpeakerStatus(2, 1); break; } } diff --git a/Source/Core/DolphinWX/Src/FrameWiimote.cpp b/Source/Core/DolphinWX/Src/FrameWiimote.cpp index dc5b947916..8e9c627e2e 100644 --- a/Source/Core/DolphinWX/Src/FrameWiimote.cpp +++ b/Source/Core/DolphinWX/Src/FrameWiimote.cpp @@ -306,7 +306,7 @@ wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On) switch(BitmapType) { - case 0: + case 0: // Speaker on { // Set outline and fill colors dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN); @@ -317,7 +317,7 @@ wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On) dc.SelectObject(wxNullBitmap); return bitmap; } - case 1: + case 1: // Speaker unmuted { // Set outline and fill colors dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN); @@ -328,7 +328,7 @@ wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On) dc.SelectObject(wxNullBitmap); return bitmap; } - case 2: + case 2: // Speaker activity { // Set outline and fill colors dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index d0d009b665..6668df4844 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -385,7 +385,8 @@ void Host_UpdateBreakPointView() ///////////////////////////////////////////////////////////// /* Update Wiimote status bar */ // ŻŻŻŻŻŻŻŻŻ -void Host_UpdateLeds(int led_bits) { +void Host_UpdateLeds(int led_bits) +{ // Convert it to a simpler byte format main_frame->g_Leds[0] = led_bits >> 0; main_frame->g_Leds[1] = led_bits >> 1; @@ -395,7 +396,8 @@ void Host_UpdateLeds(int led_bits) { main_frame->UpdateLeds(); } -void Host_UpdateSpeakerStatus(int index, int speaker_bits) { +void Host_UpdateSpeakerStatus(int index, int speaker_bits) +{ main_frame->g_Speakers[index] = speaker_bits; main_frame->UpdateSpeakers(); } @@ -411,6 +413,7 @@ void Host_UpdateStatus() if(memcmp(main_frame->g_Speakers_, main_frame->g_Speakers, sizeof(main_frame->g_Speakers))) { + // Turn off the activity light again main_frame->g_Speakers[2] = 0; main_frame->UpdateSpeakers(); memcpy(main_frame->g_Speakers_, main_frame->g_Speakers, sizeof(main_frame->g_Speakers)); diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp index bad53a7dba..17dd56d099 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp @@ -115,13 +115,14 @@ void HidOutputReport(u16 _channelID, wm_report* sr) { case WM_WRITE_DATA: // 0x16 WmWriteData(_channelID, (wm_write_data*)sr->data); break; + case WM_SPEAKER_ENABLE: // 0x14 LOGV(WII_IPC_WIIMOTE, 1, " WM Speaker Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]); //Console::Print("Speaker Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]); if(sr->data[0] == 0x02) g_Speaker = 0; else if(sr->data[0] == 0x06) g_Speaker = 1; break; - case WM_SPEAKER_MUTE: + case WM_SPEAKER_MUTE: // 0x19 LOGV(WII_IPC_WIIMOTE, 1, " WM Mute Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]); //Console::Print("Speaker Mute/Unmute 0x%02x: 0x%02x\n", sr->channel, sr->data[0]); if(sr->data[0] == 0x02) g_SpeakerVoice = 0; // g_SpeakerVoice @@ -129,6 +130,7 @@ void HidOutputReport(u16 _channelID, wm_report* sr) { break; case WM_WRITE_SPEAKER_DATA: // 0x18 break; + default: PanicAlert("HidOutputReport: Unknown channel 0x%02x", sr->channel); return; diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index 9e1623e0bd..d713ac334b 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -250,9 +250,6 @@ void FillReportInfo(wm_core& _core) memset(&_core, 0x00, sizeof(wm_core)); #ifdef _WIN32 - // These keys are reserved for the recording - if ( GetAsyncKeyState(VK_SHIFT) || GetAsyncKeyState(VK_CONTROL) ) return; - // Check that Dolphin is in focus if (!IsFocus()) return; diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 220344bef5..b7e0363693 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -457,9 +457,9 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) if ((data[4] == 0x10 || data[4] == 0x20 || data[4] == 0x50) && data[5] == 0x00 && (data[6] == 0xfa || data[6] == 0xfe)) { if(data[4] == 0x10) - Console::Print("\n\nGame got the encrypted extension ID: %02x%02x\n", data[7], data[8]); + TmpData.append(StringFromFormat("Game got the encrypted extension ID: %02x%02x\n", data[7], data[8])); else if(data[4] == 0x50) - Console::Print("\n\nGame got the encrypted extension ID: %02x%02x%02x%02x%02x%02x\n", data[7], data[8], data[9], data[10], data[11], data[12]); + TmpData.append(StringFromFormat("Game got the encrypted extension ID: %02x%02x%02x%02x%02x%02x\n", data[7], data[8], data[9], data[10], data[11], data[12])); // We have already sent the data report so we can safely decrypt it now if(WiiMoteEmu::g_Encryption) @@ -479,6 +479,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) g_Config.Save(); WiiMoteEmu::UpdateEeprom(); if (frame) frame->UpdateGUI(); + Console::Print("%s", TmpData.c_str()); Console::Print("Game got the decrypted extension ID: %02x%02x\n\n", data[7], data[8]); } else if(data[4] == 0x50) @@ -489,6 +490,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) g_Config.Save(); WiiMoteEmu::UpdateEeprom(); if (frame) frame->UpdateGUI(); + Console::Print("%s", TmpData.c_str()); Console::Print("Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x\n\n", data[7], data[8], data[9], data[10], data[11], data[12]); } } @@ -756,6 +758,10 @@ void InterruptDebugging(bool Emu, const void* _pData) case WM_SPEAKER_MUTE: // 0x19 if (g_DebugComm) Name.append("WM_SPEAKER"); size = 1; + if(data[1] == 0x14) + Console::Print("\nSpeaker %s\n\n", (data[2] == 0x06) ? "On" : "Off"); + else if(data[1] == 0x19) + Console::Print("\nSpeaker %s\n\n", (data[2] == 0x06) ? "Muted" : "Unmuted"); break; case WM_WRITE_SPEAKER_DATA: // 0x18 if (g_DebugComm) Name.append("WM_SPEAKER_DATA"); @@ -851,13 +857,13 @@ void DoInitialize() // ---------------------------------------- // Debugging window // ---------- - /*Console::Open(130, 1000, "Wiimote"); // give room for 20 rows + /**/Console::Open(130, 1000, "Wiimote"); // give room for 20 rows Console::Print("\n\nWiimote console opened\n"); // Move window //MoveWindow(Console::GetHwnd(), 0,400, 100*8,10*14, true); // small window //MoveWindow(Console::GetHwnd(), 400,0, 100*8,70*14, true); // big window - MoveWindow(Console::GetHwnd(), 200,0, 130*8,70*14, true); // big wide window*/ + MoveWindow(Console::GetHwnd(), 200,0, 130*8,70*14, true); // big wide window // --------------- // Load config settings