From e6efc4a6110d5699df14ce79a5abfb7652cad499 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 11 Mar 2010 17:20:32 +0000 Subject: [PATCH] remove wiimote led/speaker status from statusbar git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5187 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/ConfigManager.cpp | 4 - Source/Core/Core/Src/CoreParameter.cpp | 2 +- Source/Core/Core/Src/CoreParameter.h | 3 +- Source/Core/Core/Src/Host.h | 4 - .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 68 --- .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h | 58 +-- Source/Core/DolphinWX/DolphinWX.vcproj | 6 +- Source/Core/DolphinWX/Src/BootManager.cpp | 3 - Source/Core/DolphinWX/Src/ConfigMain.cpp | 22 - Source/Core/DolphinWX/Src/ConfigMain.h | 2 - Source/Core/DolphinWX/Src/Frame.cpp | 5 +- Source/Core/DolphinWX/Src/Frame.h | 25 - Source/Core/DolphinWX/Src/FrameWiimote.cpp | 485 ------------------ Source/Core/DolphinWX/Src/Main.cpp | 43 -- Source/Core/DolphinWX/Src/MainNoGUI.cpp | 10 - Source/Core/DolphinWX/Src/SConscript | 1 - 16 files changed, 14 insertions(+), 727 deletions(-) delete mode 100644 Source/Core/DolphinWX/Src/FrameWiimote.cpp diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 14baf13eeb..93512ed18f 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -85,8 +85,6 @@ void SConfig::SaveSettings() ini.Set("Interface", "MainWindowPosY", m_LocalCoreStartupParameter.iPosY); ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth); ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight); - ini.Set("Interface", "ShowWiimoteLeds", m_LocalCoreStartupParameter.bWiiLeds); - ini.Set("Interface", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers); ini.Set("Interface", "Language", m_InterfaceLanguage); ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar); ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar); @@ -197,8 +195,6 @@ void SConfig::LoadSettings() ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100); ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800); ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600); - ini.Get("Interface", "ShowWiimoteLeds", &m_LocalCoreStartupParameter.bWiiLeds, false); - ini.Get("Interface", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false); ini.Get("Interface", "Language", (int*)&m_InterfaceLanguage, 0); ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true); ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true); diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index b777a54ae0..eae09c1124 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -47,7 +47,7 @@ SCoreStartupParameter::SCoreStartupParameter() bEnableCheats(false), bEnableIsoCache(false), bRunCompareServer(false), bRunCompareClient(false), iTLBHack(0), SelectedLanguage(0), - bWii(false), bWiiLeds(false), bWiiSpeakers(false), + bWii(false), bConfirmStop(false), bHideCursor(false), bAutoHideCursor(false), bUsePanicHandlers(true), iTheme(0), diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 06d4147d97..c6d85df1e8 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -73,8 +73,7 @@ struct SCoreStartupParameter int SelectedLanguage; - // Wii settings - bool bWii, bWiiLeds, bWiiSpeakers; + bool bWii; // Interface settings bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers; diff --git a/Source/Core/Core/Src/Host.h b/Source/Core/Core/Src/Host.h index 17d866650d..d429aa3bc1 100644 --- a/Source/Core/Core/Src/Host.h +++ b/Source/Core/Core/Src/Host.h @@ -53,8 +53,4 @@ void Host_UpdateStatusBar(const char* _pText, int Filed = 0); void Host_SysMessage(const char *fmt, ...); void Host_SetWiiMoteConnectionState(int _State); -void Host_UpdateLeds(int bits); -void Host_UpdateSpeakerStatus(int index, int bits); -void Host_UpdateStatus(); - #endif 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 d66bd09290..39aef08d98 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 @@ -146,75 +146,10 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel() } m_Connected = 3; - UpdateStatus(); return false; } -// =================================================== -/* Send a status report to the status bar. */ -// ---------------- -void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) -{ - // Check if it's enabled - SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter; - bool LedsOn = StartUp.bWiiLeds; - bool SpeakersOn = StartUp.bWiiSpeakers; - - const u8* data = (const u8*)_pData; - - // Get the last four bits with LED info - if (LedsOn) - { - if (data[1] == 0x11) - { - int led_bits = (data[2] >> 4); - Host_UpdateLeds(led_bits); - } - } - - int speaker_bits = 0; - - if (SpeakersOn) - { - u8 Bits = 0; - switch (data[1]) - { - case 0x14: // Enable and disable speakers - if (data[2] == 0x02) // Off - Bits = 0; - 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) // Unmute - Bits = 1; - else if (data[2] == 0x06) // Mute - Bits = 0; - Host_UpdateSpeakerStatus(1, Bits); - break; - // Write to speaker registry, or write sound - case 0x16: - case 0x18: - // Turn on the activity light - Host_UpdateSpeakerStatus(2, 1); - break; - } - } -} - -// Turn off the activity icon again -void CWII_IPC_HLE_WiiMote::UpdateStatus() -{ - // Check if it's enabled - if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers) - return; - Host_UpdateStatus(); -} - // // // @@ -335,13 +270,10 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size) case HID_CONTROL_CHANNEL: mote->Wiimote_ControlChannel(m_ConnectionHandle & 0xFF, pHeader->CID, pData, DataSize); - // Call Wiimote Plugin break; case HID_INTERRUPT_CHANNEL: - ShowStatus(pData); mote->Wiimote_InterruptChannel(m_ConnectionHandle & 0xFF, pHeader->CID, pData, DataSize); - // Call Wiimote Plugin break; default: diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h index 735c61dd25..7edba78858 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h @@ -130,66 +130,33 @@ struct SL2CAP_CommandDisconnectionResponse // 0x07 #pragma pack(pop) + class CBigEndianBuffer { public: - CBigEndianBuffer(u8* pBuffer) - : m_pBuffer(pBuffer) - { - } + CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {} - u8 Read8(u32 offset) - { - return m_pBuffer[offset]; - } + u8 Read8(u32 offset) { return m_pBuffer[offset]; } + u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); } + u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); } - u16 Read16(u32 offset) - { - return Common::swap16(*(u16*)&m_pBuffer[offset]); - } + void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; } + void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); } + void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); } - u32 Read32(u32 offset) - { - return Common::swap32(*(u32*)&m_pBuffer[offset]); - } - - void Write8(u32 offset, u8 data) - { - m_pBuffer[offset] = data; - } - - void Write16(u32 offset, u16 data) - { - *(u16*)&m_pBuffer[offset] = Common::swap16(data); - } - - void Write32(u32 offset, u32 data) - { - *(u32*)&m_pBuffer[offset] = Common::swap32(data); - } - - u8* GetPointer(u32 offset) - { - return &m_pBuffer[offset]; - } + u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; } private: - u8* m_pBuffer; - }; - - class CWII_IPC_HLE_WiiMote { public: - CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number, bool ready = false); - virtual ~CWII_IPC_HLE_WiiMote() - {} + virtual ~CWII_IPC_HLE_WiiMote() {} void DoState(PointerWrap &p); @@ -200,8 +167,6 @@ public: bool LinkChannel(); void ResetChannels(); void Activate(bool ready); - void ShowStatus(const void* _pData); // Show status - void UpdateStatus(); // Update status void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote @@ -220,7 +185,6 @@ public: const u8* GetLinkKey() const { return m_LinkKey; } private: - // -1: inactive, 0: ready, 1: connecting 2: linking 3: connected & linked int m_Connected; @@ -277,9 +241,7 @@ private: void ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u32 _Size); // some new ugly stuff - // // should be inside the plugin - // void HandleSDP(u16 _SCID, u8* _pData, u32 _Size); void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount); diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index f8b8c85083..7f008945ca 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -1,7 +1,7 @@ - - diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 03fce5a1e7..a3ae334358 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -139,9 +139,6 @@ bool BootCore(const std::string& _rFilename) { // Save the window handle of the eventual parent to the rendering window StartUp.hMainWindow = main_frame->GetRenderHandle(); - - // Now that we know if we have a Wii game we can run this - main_frame->ModifyStatusBar(); } #endif // Init the core diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 32ad7cfb39..1bb77de529 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -56,8 +56,6 @@ EVT_CHECKBOX(ID_INTERFACE_HIDECURSOR, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged) #endif EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_LEDS, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_SPEAKERS, CConfigMain::CoreSettingsChanged) EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged) @@ -229,8 +227,6 @@ void CConfigMain::InitializeGUIValues() AutoHideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor); HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); #endif - WiimoteStatusLEDs->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds); - WiimoteStatusSpeakers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers); Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme); // need redesign InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage); @@ -289,8 +285,6 @@ void CConfigMain::InitializeGUITooltips() HideCursor->SetToolTip(wxT("This will always hide the cursor when it's over the rendering window.") wxT("\nIt can be convenient in a Wii game that already has a cursor.")); #endif - WiimoteStatusLEDs->SetToolTip(wxT("Show which wiimotes are connected in the statusbar.")); - WiimoteStatusSpeakers->SetToolTip(wxT("Show wiimote speaker status in the statusbar.")); InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in") wxT("\nthe game list of PAL GC games.")); // Themes: Copyright notice @@ -352,11 +346,6 @@ void CConfigMain::CreateGUIControls() AutoHideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_AUTOHIDECURSOR, wxT("Auto")); HideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_HIDECURSOR, wxT("Always")); #endif - // Wiimote status in statusbar - wxStaticText *WiimoteStatusText = new wxStaticText(GeneralPage, ID_INTERFACE_WIIMOTE_TEXT, wxT("Show wiimote status:"), wxDefaultPosition, wxDefaultSize); - WiimoteStatusLEDs = new wxCheckBox(GeneralPage, ID_INTERFACE_WIIMOTE_LEDS, wxT("LEDs"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - WiimoteStatusSpeakers = new wxCheckBox(GeneralPage, ID_INTERFACE_WIIMOTE_SPEAKERS, wxT("Speakers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // Interface Language // At the moment this only changes the language displayed in m_gamelistctrl // If someone wants to control the whole GUI's language, it should be set here too @@ -396,11 +385,6 @@ void CConfigMain::CreateGUIControls() sHideCursor->Add(HideCursor, 0, wxLEFT, 5); sbInterface->Add(sHideCursor, 0, wxALL, 5); #endif - wxBoxSizer *sWiimoteStatus = new wxBoxSizer(wxHORIZONTAL); - sWiimoteStatus->Add(WiimoteStatusText); - sWiimoteStatus->Add(WiimoteStatusLEDs, 0, wxLEFT, 5); - sWiimoteStatus->Add(WiimoteStatusSpeakers, 0, wxLEFT, 5); - sbInterface->Add(sWiimoteStatus, 0, wxALL, 5); sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5); wxBoxSizer *sInterfaceLanguage = new wxBoxSizer(wxHORIZONTAL); sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -725,12 +709,6 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection(); main_frame->InitBitmaps(); break; - case ID_INTERFACE_WIIMOTE_LEDS: - SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds = WiimoteStatusLEDs->IsChecked(); - break; - case ID_INTERFACE_WIIMOTE_SPEAKERS: - SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers = WiimoteStatusSpeakers->IsChecked(); - break; case ID_INTERFACE_LANG: SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection(); bRefreshList = true; diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 19fbceddee..a647f299bf 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -52,7 +52,6 @@ private: #if wxUSE_TIMER && defined _WIN32 wxCheckBox* HideCursor, *AutoHideCursor; #endif - wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers; wxChoice* InterfaceLang; wxChoice* Framelimit; wxRadioBox* Theme; @@ -175,7 +174,6 @@ private: #if wxUSE_TIMER && defined _WIN32 ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR, #endif - ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS, ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, ID_INTERFACE_THEME, ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT, diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 2fcfe3c18d..755118233a 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -173,7 +173,7 @@ CPanel::CPanel( main_frame->bNoWiimoteMsg = false; else { - // The Wiimote has been disconnect, we offer reconnect here + // The Wiimote has been disconnected, we offer reconnect here wxMessageDialog *dlg = new wxMessageDialog( this, wxString::Format(wxT("Wiimote %i has been disconnected by system.\n") @@ -321,7 +321,6 @@ CFrame::CFrame(wxFrame* parent, , g_pCodeWindow(NULL) , m_MenuBar(NULL) , bRenderToMain(false), bNoWiimoteMsg(false) - , HaveLeds(false), HaveSpeakers(false) , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) , bFloatLogWindow(false), bFloatConsoleWindow(false) , m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) @@ -618,8 +617,6 @@ void CFrame::OnResize(wxSizeEvent& event) if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE) X11_SendEvent("MAIN_RESIZED"); #endif - - DoMoveIcons(); // In FrameWiimote.cpp } void CFrame::OnResizeAll(wxSizeEvent& event) { diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 21757a7072..5d0656a477 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -93,23 +93,6 @@ class CFrame : public wxFrame void OnCustomHostMessage(int Id); void StartGame(const std::string& filename); - // --------------------------------------- - // Wiimote leds - // -------------------- - void ModifyStatusBar(); - void CreateDestroy(int Case); - void CreateLeds(); void CreateSpeakers(); - void UpdateLeds(); void UpdateSpeakers(); - wxBitmap CreateBitmapForLeds(bool On); - wxBitmap CreateBitmapForSpeakers(int BitmapType, bool On); - void DoMoveIcons(); void MoveLeds(); void MoveSpeakers(); - bool HaveLeds; bool HaveSpeakers; - - wxStaticBitmap *m_StatBmp[7]; - u8 g_Leds[4]; u8 g_Leds_[4]; - u8 g_Speakers[3]; u8 g_Speakers_[3]; - // --------------- - // AUI wxAuiManager *m_Mgr; wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; @@ -235,14 +218,6 @@ class CFrame : public wxFrame THEMES_MAX }; - enum WiimoteBitmaps // Wiimote speaker bitmaps - { - CREATELEDS, - DESTROYLEDS, - CREATESPEAKERS, - DESTROYSPEAKERS - }; - wxBitmap m_Bitmaps[EToolbar_Max]; wxBitmap m_BitmapsMenu[EToolbar_Max]; diff --git a/Source/Core/DolphinWX/Src/FrameWiimote.cpp b/Source/Core/DolphinWX/Src/FrameWiimote.cpp deleted file mode 100644 index b11d824954..0000000000 --- a/Source/Core/DolphinWX/Src/FrameWiimote.cpp +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - - -// Include -// ------------- -#include "Globals.h" -#include "Frame.h" -#include "FileUtil.h" -#include "StringUtil.h" - -#include "GameListCtrl.h" -#include "BootManager.h" - -#include "Common.h" -#include "Setup.h" -#include "ConfigManager.h" -#include "Core.h" -#include "State.h" -#include "ConfigMain.h" -#include "PluginManager.h" -#include "MemcardManager.h" -#include "CheatsWindow.h" -#include "AboutDolphin.h" - -#include - - - -namespace WiimoteLeds -{ - int LED_SIZE_X = 8; - int LED_SIZE_Y = 8; - int SPEAKER_SIZE_X = 8; - int SPEAKER_SIZE_Y = 8; - - int ConnectionStatusWidth = 103; // These widths need to be revised, for vista at least - int ConnectionStatusOnlyAdj = 7; - int RightmostMargin = 6; - int SpIconMargin = 11; - int LedIconMargin = 11; - - // The necessary recording status width, allow Frame to be at last of the form 100,000 - #ifdef RERECORDING - static const int RerecordingStatusWidth = 340; - #endif - - // Leds only - static const int LdWidthsOn[] = - { - -1, - #ifdef RERECORDING - RerecordingStatusWidth, - #endif - ConnectionStatusWidth, - (LedIconMargin + LED_SIZE_X) * 4 + RightmostMargin - }; - static const int StylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL }; - - // Speakers only - static const int SpWidthsOn[] = - { - -1, - #ifdef RERECORDING - RerecordingStatusWidth, - #endif - ConnectionStatusWidth, - ( SpIconMargin + SPEAKER_SIZE_X ) * 3 + RightmostMargin - }; - static const int SpStylesFieldOn[] = { wxSB_NORMAL, - #ifdef RERECORDING - wxSB_NORMAL, - #endif - wxSB_NORMAL, wxSB_NORMAL }; - - // Both - static const int LdSpWidthsOn[] = - { - -1, - #ifdef RERECORDING - RerecordingStatusWidth, - #endif - ConnectionStatusWidth, - (SpIconMargin + SPEAKER_SIZE_X) * 3, - (LedIconMargin + LED_SIZE_X) * 4 + RightmostMargin - }; - static const int LdSpStylesFieldOn[] = { wxSB_NORMAL, - #ifdef RERECORDING - wxSB_NORMAL, - #endif - wxSB_NORMAL, wxSB_NORMAL }; - - // Only the Wiimote connection Status - static const int WidthsOff[] = - { - -1, - #ifdef RERECORDING - RerecordingStatusWidth, - #endif - ConnectionStatusWidth + ConnectionStatusOnlyAdj + RightmostMargin - }; - static const int StylesFieldOff[] = { wxSB_NORMAL, - #ifdef RERECORDING - wxSB_NORMAL, - #endif - wxSB_NORMAL }; - - // GC mode - static const int WidthsOffGC[] = { -1 - #ifdef RERECORDING - , RerecordingStatusWidth - #endif - }; - static const int StylesFieldOffGC[] = { wxSB_NORMAL - #ifdef RERECORDING - , wxSB_NORMAL - #endif - }; -}; - -// ======================================================= -// Modify status bar -// ------------- -void CFrame::ModifyStatusBar() -{ - // Get settings - bool LedsOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds; - bool SpeakersOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers; - - // Don't use this for GC games, or before a game is loaded - if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) - { LedsOn = false; SpeakersOn = false; } - - // Declarations - int Fields = 0; - int *Widths = 0; - int *StylesFields = 0; - - // --------------------------------------- - // Leds only - // ------------- - if(LedsOn && !SpeakersOn) - { - Fields = 3; - Widths = (int*)WiimoteLeds::LdWidthsOn; - StylesFields = (int*)WiimoteLeds::StylesFieldOn; - } - // --------------------------------------- - // Speaker only - // ------------- - else if(!LedsOn && SpeakersOn) - { - Fields = 3; - Widths = (int*)WiimoteLeds::SpWidthsOn; - StylesFields = (int*)WiimoteLeds::SpStylesFieldOn; - } - // --------------------------------------- - // Both on - // ------------- - else if(LedsOn && SpeakersOn) - { - Fields = 4; - Widths = (int*)WiimoteLeds::LdSpWidthsOn; - StylesFields = (int*)WiimoteLeds::LdSpStylesFieldOn; - } - // --------------------------------------- - // Both off - // ------------- - else if(!LedsOn && !SpeakersOn) - { - Fields = 2; - Widths = (int*)WiimoteLeds::WidthsOff; - StylesFields = (int*)WiimoteLeds::StylesFieldOff; - - // Maybe we should even go down to one field - if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) - { - Fields = 1; - Widths = (int*)WiimoteLeds::WidthsOffGC; - StylesFields = (int*)WiimoteLeds::StylesFieldOffGC; - } - } - - // Add a filed for the rerecording status - #ifdef RERECORDING - Fields++; - #endif - - // Update the settings - m_pStatusBar->SetFieldsCount(Fields); - m_pStatusBar->SetStatusWidths(Fields, Widths); - m_pStatusBar->SetStatusStyles(Fields, StylesFields); - - /* Destroy and create all, and check for HaveLeds and HaveSpeakers in case we have - gotten a confirmed on or off setting, in which case we don't do anything */ - if(!LedsOn && HaveLeds) CreateDestroy(DESTROYLEDS); - if(!SpeakersOn && HaveSpeakers) CreateDestroy(DESTROYSPEAKERS); - if(LedsOn && !HaveLeds) CreateDestroy(CREATELEDS); - if(SpeakersOn && !HaveSpeakers) CreateDestroy(CREATESPEAKERS); - - DoMoveIcons(); - m_pStatusBar->Refresh(); // avoid small glitches that can occur -} - - -// ======================================================= -// Create and destroy leds and speakers icons -// ------------- -void CFrame::CreateDestroy(int Case) -{ - switch(Case) - { - case CREATELEDS: - { - CreateLeds(); - UpdateLeds(); - HaveLeds = true; - break; - } - case DESTROYLEDS: - { - for(int i = 0; i < 4; i++) - { - m_StatBmp[i]->Destroy(); - } - HaveLeds = false; - break; - } - case CREATESPEAKERS: - { - CreateSpeakers(); - HaveSpeakers = true; - break; - } - - case DESTROYSPEAKERS: - { - for(int i = 4; i < 7; i++) - { - m_StatBmp[i]->Destroy(); - } - HaveSpeakers = false; - break; - } - } // end of switch - - DoMoveIcons(); -} -// ============= - - -// ======================================================= -// Create and update leds -// ------------- -void CFrame::CreateLeds() -{ - // Begin with blank ones - memset(&g_Leds, 0, sizeof(g_Leds)); - for(int i = 0; i < 4; i++) - { - m_StatBmp[i] = new wxStaticBitmap(m_pStatusBar, wxID_ANY, - CreateBitmapForLeds(g_Leds[i] == 1)); - } -} -// Update leds -void CFrame::UpdateLeds() -{ - for(int i = 0; i < 4; i++) - { - m_StatBmp[i]->SetBitmap(CreateBitmapForLeds(g_Leds[i] != 0)); - } -} -// ============== - - -// ======================================================= -// Create and speaker icons -// ------------- -void CFrame::CreateSpeakers() -{ - // Begin with blank ones - memset(&g_Speakers, 0, sizeof(g_Speakers)); - memset(&g_Speakers_, 0, sizeof(g_Speakers_)); - for(int i = 0; i < 3; i++) - { - m_StatBmp[i+4] = new wxStaticBitmap(m_pStatusBar, wxID_ANY, - CreateBitmapForSpeakers(i, g_Speakers[i] != 0)); - } -} -// Update icons -void CFrame::UpdateSpeakers() -{ - /*if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC) - { PanicAlert("Not NTSC");} - - if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) - { PanicAlert("Not Wii");}*/ - for(int i = 0; i < 3; i++) - { - m_StatBmp[i+4]->SetBitmap(CreateBitmapForSpeakers(i, g_Speakers[i] != 0)); - } -} -// ============== - - -// ======================================================= -// Create the Leds bitmap -// ------------- -wxBitmap CFrame::CreateBitmapForLeds(bool On) -{ - wxBitmap bitmap(WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y); - wxMemoryDC dc; - dc.SelectObject(bitmap); - - // Set outline and fill colors - wxBrush LightBlueBrush(_T("#0383f0")); - wxPen LightBluePen(_T("#80c5fd")); - wxPen LightGrayPen(_T("#909090")); - dc.SetPen(On ? LightBluePen : LightGrayPen); - dc.SetBrush(On ? LightBlueBrush : *wxWHITE_BRUSH); - - dc.Clear(); - dc.DrawRectangle(0, 0, WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y); - dc.SelectObject(wxNullBitmap); - return bitmap; -} - - -// ======================================================= -// Create the Speaker bitmap -// ------------- -wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On) -{ - wxBitmap bitmap(WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y); - wxMemoryDC dc; - dc.SelectObject(bitmap); - wxBrush BackgroundGrayBrush(_T("#ece9d8")); // the right color in windows - - switch(BitmapType) - { - case 0: // Speaker on - { - // Set outline and fill colors - dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN); - dc.SetBrush(On ? *wxGREEN_BRUSH : *wxWHITE_BRUSH); - dc.SetBackground(BackgroundGrayBrush); - dc.Clear(); - dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y); - dc.SelectObject(wxNullBitmap); - return bitmap; - } - case 1: // Speaker unmuted - { - // Set outline and fill colors - dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN); - dc.SetBrush(On ? *wxBLUE_BRUSH : *wxWHITE_BRUSH); - dc.SetBackground(BackgroundGrayBrush); - dc.Clear(); - dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y); - dc.SelectObject(wxNullBitmap); - return bitmap; - } - case 2: // Speaker activity - { - // Set outline and fill colors - dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN); - dc.SetBrush(On ? *wxGREEN_BRUSH : *wxWHITE_BRUSH); - dc.SetBackground(BackgroundGrayBrush); - dc.Clear(); - dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y); - dc.SelectObject(wxNullBitmap); - return bitmap; - } - } - - return bitmap; -} - - -// ======================================================= -// Move the bitmaps -// ------------- -void CFrame::DoMoveIcons() -{ - if (!m_pStatusBar) return; - - if(HaveLeds) MoveLeds(); - if(HaveSpeakers) MoveSpeakers(); - - // If there is not room for the led icons hide them - if(m_pStatusBar->GetFieldsCount() >= 2 && HaveLeds) - { - wxRect Rect; - #ifdef RERECORDING - m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 4 : 3, Rect); - #else - m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect); - #endif - if(Rect.GetWidth() < 20) - for (int i = 0; i < 4; i++) m_StatBmp[i]->Hide(); - else // if(!m_StatBmp[0]->IsShown()) - for (int i = 0; i < 4; i++) m_StatBmp[i]->Show(); - //INFO_LOG(CONSOLE, "LED: %i ", Rect.GetWidth()); - } - - // If there is not room for the speaker icons hide them - if(m_pStatusBar->GetFieldsCount() >= 2 && HaveSpeakers) - { - wxRect Rect; - #ifdef RERECORDING - m_pStatusBar->GetFieldRect(3, Rect); - #else - m_pStatusBar->GetFieldRect(2, Rect); - #endif - if(Rect.GetWidth() < 20) - for(int i = 0; i < 3; i++) m_StatBmp[i + 4]->Hide(); - else // if(!m_StatBmp[4]->IsShown()) - for (int i = 0; i < 3; i++) m_StatBmp[i + 4]->Show(); - //INFO_LOG(CONSOLE, "Speaker: %i\n", Rect.GetWidth()); - } -} - -void CFrame::MoveLeds() -{ - wxRect Rect; - // Get the bitmap field coordinates - #ifdef RERECORDING - m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 4 : 3, Rect); - #else - m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect); - #endif - wxSize Size = m_StatBmp[0]->GetSize(); // Get the bitmap size - - //wxMessageBox(wxString::Format("%i", Rect.x)); - int x = Rect.x + 10; - int Dist = WiimoteLeds::LED_SIZE_X + 7; - int y = Rect.y + (Rect.height - Size.y) / 2; - - for(int i = 0; i < 4; i++) - { - if(i > 0) x = m_StatBmp[i-1]->GetPosition().x + Dist; - m_StatBmp[i]->Move(x, y); - } -} - -void CFrame::MoveSpeakers() -{ - wxRect Rect; - // Get the bitmap field coordinates - #ifdef RERECORDING - m_pStatusBar->GetFieldRect(3, Rect); - #else - m_pStatusBar->GetFieldRect(2, Rect); - #endif - - // Get the actual bitmap size, currently it's the same as SPEAKER_SIZE_Y - wxSize Size = m_StatBmp[4]->GetSize(); - - //wxMessageBox(wxString::Format("%i", Rect.x)); - int x = Rect.x + 9; - int Dist = WiimoteLeds::SPEAKER_SIZE_X + 7; - int y = Rect.y + (Rect.height - Size.y) / 2; - - for(int i = 0; i < 3; i++) - { - if(i > 0) x = m_StatBmp[i-1+4]->GetPosition().x + Dist; - m_StatBmp[i + 4]->Move(x, y); - } -} -// ============== diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index a663b9e22a..87ff3a7b6b 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -613,55 +613,12 @@ void Host_UpdateBreakPointView() } } - - -// Update Wiimote status bar - -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; - main_frame->g_Leds[2] = led_bits >> 2; - main_frame->g_Leds[3] = led_bits >> 3; - - main_frame->UpdateLeds(); -} - -void Host_UpdateSpeakerStatus(int index, int speaker_bits) -{ - main_frame->g_Speakers[index] = speaker_bits; - main_frame->UpdateSpeakers(); -} - -void Host_UpdateStatus() -{ - // Debugging - //std::string Tmp = ArrayToString(main_frame->g_Speakers, sizeof(main_frame->g_Speakers)); - //std::string Tmp2 = ArrayToString(main_frame->g_Speakers_, sizeof(main_frame->g_Speakers_)); - //LOGV(CONSOLE, 0, "Tmp: %s", Tmp.c_str()); - //LOGV(CONSOLE, 0, "Tmp2: %s", Tmp2.c_str()); - // Don't do a lot of CreateBitmap() if we don't need to - 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)); - } -} - - - void Host_UpdateMemoryView() {} - void Host_SetDebugMode(bool) {} - void Host_SetWaitCursor(bool enable) { #ifdef _WIN32 diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index db88855145..31d4e03836 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -99,16 +99,6 @@ void Host_SysMessage(const char *fmt, ...) fprintf(stderr, "%s", msg); } -void Host_UpdateLeds(int led_bits) -{ -} -void Host_UpdateSpeakerStatus(int index, int speaker_bits) -{ -} -void Host_UpdateStatus() -{ -} - void Host_SetWiiMoteConnectionState(int _State) {} diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index 2605c736fb..e5baf72fd1 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -23,7 +23,6 @@ if wxenv['HAVE_WX']: 'Frame.cpp', 'FrameAui.cpp', 'FrameTools.cpp', - 'FrameWiimote.cpp', 'LuaWindow.cpp', 'LogWindow.cpp', 'GameListCtrl.cpp',