remove wiimote led/speaker status from statusbar

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5187 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-03-11 17:20:32 +00:00
parent 5fa18ae114
commit e6efc4a611
16 changed files with 14 additions and 727 deletions

View File

@ -85,8 +85,6 @@ void SConfig::SaveSettings()
ini.Set("Interface", "MainWindowPosY", m_LocalCoreStartupParameter.iPosY); ini.Set("Interface", "MainWindowPosY", m_LocalCoreStartupParameter.iPosY);
ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth); ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight); 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", "Language", m_InterfaceLanguage);
ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar); ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar); ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
@ -197,8 +195,6 @@ void SConfig::LoadSettings()
ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100); ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100);
ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800); ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800);
ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600); 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", "Language", (int*)&m_InterfaceLanguage, 0);
ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true); ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true);
ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true); ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true);

View File

@ -47,7 +47,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bEnableCheats(false), bEnableIsoCache(false), bEnableCheats(false), bEnableIsoCache(false),
bRunCompareServer(false), bRunCompareClient(false), bRunCompareServer(false), bRunCompareClient(false),
iTLBHack(0), SelectedLanguage(0), iTLBHack(0), SelectedLanguage(0),
bWii(false), bWiiLeds(false), bWiiSpeakers(false), bWii(false),
bConfirmStop(false), bHideCursor(false), bConfirmStop(false), bHideCursor(false),
bAutoHideCursor(false), bUsePanicHandlers(true), bAutoHideCursor(false), bUsePanicHandlers(true),
iTheme(0), iTheme(0),

View File

@ -73,8 +73,7 @@ struct SCoreStartupParameter
int SelectedLanguage; int SelectedLanguage;
// Wii settings bool bWii;
bool bWii, bWiiLeds, bWiiSpeakers;
// Interface settings // Interface settings
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers; bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers;

View File

@ -53,8 +53,4 @@ void Host_UpdateStatusBar(const char* _pText, int Filed = 0);
void Host_SysMessage(const char *fmt, ...); void Host_SysMessage(const char *fmt, ...);
void Host_SetWiiMoteConnectionState(int _State); void Host_SetWiiMoteConnectionState(int _State);
void Host_UpdateLeds(int bits);
void Host_UpdateSpeakerStatus(int index, int bits);
void Host_UpdateStatus();
#endif #endif

View File

@ -146,75 +146,10 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
} }
m_Connected = 3; m_Connected = 3;
UpdateStatus();
return false; 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: case HID_CONTROL_CHANNEL:
mote->Wiimote_ControlChannel(m_ConnectionHandle & 0xFF, pHeader->CID, pData, DataSize); mote->Wiimote_ControlChannel(m_ConnectionHandle & 0xFF, pHeader->CID, pData, DataSize);
// Call Wiimote Plugin
break; break;
case HID_INTERRUPT_CHANNEL: case HID_INTERRUPT_CHANNEL:
ShowStatus(pData);
mote->Wiimote_InterruptChannel(m_ConnectionHandle & 0xFF, pHeader->CID, pData, DataSize); mote->Wiimote_InterruptChannel(m_ConnectionHandle & 0xFF, pHeader->CID, pData, DataSize);
// Call Wiimote Plugin
break; break;
default: default:

View File

@ -130,66 +130,33 @@ struct SL2CAP_CommandDisconnectionResponse // 0x07
#pragma pack(pop) #pragma pack(pop)
class CBigEndianBuffer class CBigEndianBuffer
{ {
public: public:
CBigEndianBuffer(u8* pBuffer) CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {}
: m_pBuffer(pBuffer)
{
}
u8 Read8(u32 offset) u8 Read8(u32 offset) { return m_pBuffer[offset]; }
{ u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
return m_pBuffer[offset]; u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
}
u16 Read16(u32 offset) void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
{ void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }
return Common::swap16(*(u16*)&m_pBuffer[offset]); void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); }
}
u32 Read32(u32 offset) u8* GetPointer(u32 offset) { return &m_pBuffer[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];
}
private: private:
u8* m_pBuffer; u8* m_pBuffer;
}; };
class CWII_IPC_HLE_WiiMote class CWII_IPC_HLE_WiiMote
{ {
public: public:
CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number, bool ready = false); 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); void DoState(PointerWrap &p);
@ -200,8 +167,6 @@ public:
bool LinkChannel(); bool LinkChannel();
void ResetChannels(); void ResetChannels();
void Activate(bool ready); void Activate(bool ready);
void ShowStatus(const void* _pData); // Show status
void UpdateStatus(); // Update status
void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU
void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote
@ -220,7 +185,6 @@ public:
const u8* GetLinkKey() const { return m_LinkKey; } const u8* GetLinkKey() const { return m_LinkKey; }
private: private:
// -1: inactive, 0: ready, 1: connecting 2: linking 3: connected & linked // -1: inactive, 0: ready, 1: connecting 2: linking 3: connected & linked
int m_Connected; int m_Connected;
@ -277,9 +241,7 @@ private:
void ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u32 _Size); void ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u32 _Size);
// some new ugly stuff // some new ugly stuff
//
// should be inside the plugin // should be inside the plugin
//
void HandleSDP(u16 _SCID, u8* _pData, u32 _Size); void HandleSDP(u16 _SCID, u8* _pData, u32 _Size);
void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount); void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Dolphin" Name="Dolphin"
ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}" ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
RootNamespace="DolphinWX" RootNamespace="DolphinWX"
@ -855,10 +855,6 @@
RelativePath=".\Src\FrameTools.cpp" RelativePath=".\Src\FrameTools.cpp"
> >
</File> </File>
<File
RelativePath=".\Src\FrameWiimote.cpp"
>
</File>
<File <File
RelativePath=".\src\GameListCtrl.cpp" RelativePath=".\src\GameListCtrl.cpp"
> >

View File

@ -139,9 +139,6 @@ bool BootCore(const std::string& _rFilename)
{ {
// Save the window handle of the eventual parent to the rendering window // Save the window handle of the eventual parent to the rendering window
StartUp.hMainWindow = main_frame->GetRenderHandle(); StartUp.hMainWindow = main_frame->GetRenderHandle();
// Now that we know if we have a Wii game we can run this
main_frame->ModifyStatusBar();
} }
#endif #endif
// Init the core // Init the core

View File

@ -56,8 +56,6 @@ EVT_CHECKBOX(ID_INTERFACE_HIDECURSOR, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged)
#endif #endif
EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged) 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_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged)
@ -229,8 +227,6 @@ void CConfigMain::InitializeGUIValues()
AutoHideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor); AutoHideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor);
HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
#endif #endif
WiimoteStatusLEDs->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds);
WiimoteStatusSpeakers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers);
Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme); Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme);
// need redesign // need redesign
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage); 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.") 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.")); wxT("\nIt can be convenient in a Wii game that already has a cursor."));
#endif #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") InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
wxT("\nthe game list of PAL GC games.")); wxT("\nthe game list of PAL GC games."));
// Themes: Copyright notice // Themes: Copyright notice
@ -352,11 +346,6 @@ void CConfigMain::CreateGUIControls()
AutoHideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_AUTOHIDECURSOR, wxT("Auto")); AutoHideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_AUTOHIDECURSOR, wxT("Auto"));
HideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_HIDECURSOR, wxT("Always")); HideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_HIDECURSOR, wxT("Always"));
#endif #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 // Interface Language
// At the moment this only changes the language displayed in m_gamelistctrl // 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 // 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); sHideCursor->Add(HideCursor, 0, wxLEFT, 5);
sbInterface->Add(sHideCursor, 0, wxALL, 5); sbInterface->Add(sHideCursor, 0, wxALL, 5);
#endif #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); sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5);
wxBoxSizer *sInterfaceLanguage = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sInterfaceLanguage = new wxBoxSizer(wxHORIZONTAL);
sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); 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(); SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
main_frame->InitBitmaps(); main_frame->InitBitmaps();
break; 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: case ID_INTERFACE_LANG:
SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection(); SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
bRefreshList = true; bRefreshList = true;

View File

@ -52,7 +52,6 @@ private:
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER && defined _WIN32
wxCheckBox* HideCursor, *AutoHideCursor; wxCheckBox* HideCursor, *AutoHideCursor;
#endif #endif
wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers;
wxChoice* InterfaceLang; wxChoice* InterfaceLang;
wxChoice* Framelimit; wxChoice* Framelimit;
wxRadioBox* Theme; wxRadioBox* Theme;
@ -175,7 +174,6 @@ private:
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER && defined _WIN32
ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR, ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR,
#endif #endif
ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS,
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
ID_INTERFACE_THEME, ID_INTERFACE_THEME,
ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT, ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT,

View File

@ -173,7 +173,7 @@ CPanel::CPanel(
main_frame->bNoWiimoteMsg = false; main_frame->bNoWiimoteMsg = false;
else else
{ {
// The Wiimote has been disconnect, we offer reconnect here // The Wiimote has been disconnected, we offer reconnect here
wxMessageDialog *dlg = new wxMessageDialog( wxMessageDialog *dlg = new wxMessageDialog(
this, this,
wxString::Format(wxT("Wiimote %i has been disconnected by system.\n") wxString::Format(wxT("Wiimote %i has been disconnected by system.\n")
@ -321,7 +321,6 @@ CFrame::CFrame(wxFrame* parent,
, g_pCodeWindow(NULL) , g_pCodeWindow(NULL)
, m_MenuBar(NULL) , m_MenuBar(NULL)
, bRenderToMain(false), bNoWiimoteMsg(false) , bRenderToMain(false), bNoWiimoteMsg(false)
, HaveLeds(false), HaveSpeakers(false)
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
, bFloatLogWindow(false), bFloatConsoleWindow(false) , bFloatLogWindow(false), bFloatConsoleWindow(false)
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) , 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) if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
X11_SendEvent("MAIN_RESIZED"); X11_SendEvent("MAIN_RESIZED");
#endif #endif
DoMoveIcons(); // In FrameWiimote.cpp
} }
void CFrame::OnResizeAll(wxSizeEvent& event) void CFrame::OnResizeAll(wxSizeEvent& event)
{ {

View File

@ -93,23 +93,6 @@ class CFrame : public wxFrame
void OnCustomHostMessage(int Id); void OnCustomHostMessage(int Id);
void StartGame(const std::string& filename); 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 // AUI
wxAuiManager *m_Mgr; wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
@ -235,14 +218,6 @@ class CFrame : public wxFrame
THEMES_MAX THEMES_MAX
}; };
enum WiimoteBitmaps // Wiimote speaker bitmaps
{
CREATELEDS,
DESTROYLEDS,
CREATESPEAKERS,
DESTROYSPEAKERS
};
wxBitmap m_Bitmaps[EToolbar_Max]; wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max]; wxBitmap m_BitmapsMenu[EToolbar_Max];

View File

@ -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 <wx/statusbr.h>
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);
}
}
// ==============

View File

@ -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_UpdateMemoryView()
{} {}
void Host_SetDebugMode(bool) void Host_SetDebugMode(bool)
{} {}
void Host_SetWaitCursor(bool enable) void Host_SetWaitCursor(bool enable)
{ {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -99,16 +99,6 @@ void Host_SysMessage(const char *fmt, ...)
fprintf(stderr, "%s", msg); 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) {} void Host_SetWiiMoteConnectionState(int _State) {}

View File

@ -23,7 +23,6 @@ if wxenv['HAVE_WX']:
'Frame.cpp', 'Frame.cpp',
'FrameAui.cpp', 'FrameAui.cpp',
'FrameTools.cpp', 'FrameTools.cpp',
'FrameWiimote.cpp',
'LuaWindow.cpp', 'LuaWindow.cpp',
'LogWindow.cpp', 'LogWindow.cpp',
'GameListCtrl.cpp', 'GameListCtrl.cpp',