mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Made the Wiimote status go away in GC mode
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1458 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -15,6 +15,29 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================
|
||||
// File description
|
||||
// -------------
|
||||
/* Purpose of this file: Collect boot settings for Core::Init()
|
||||
|
||||
Call sequenc: This file has one of the first function called when a game is booted,
|
||||
the boot sequence in the code is:
|
||||
|
||||
DolphinWX: GameListCtrl.cpp OnActivated
|
||||
BootManager.cpp BootCore
|
||||
Core Core.cpp Init Thread creation
|
||||
EmuThread Calls CBoot::BootUp
|
||||
Boot.cpp
|
||||
*/
|
||||
// =============
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -52,39 +75,40 @@ bool BootCore(const std::string& _rFilename)
|
||||
{
|
||||
SCoreStartupParameter StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
// StartUp.bUseDualCore = code_frame->UseDualCore();
|
||||
StartUp.bUseJIT = !g_pCodeWindow->UseInterpreter();
|
||||
StartUp.bAutomaticStart = g_pCodeWindow->AutomaticStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
// StartUp.bUseDualCore = false;
|
||||
// StartUp.bUseJIT = true;
|
||||
}
|
||||
#endif
|
||||
// Use custom settings for debugging mode
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
// StartUp.bUseDualCore = code_frame->UseDualCore();
|
||||
StartUp.bUseJIT = !g_pCodeWindow->UseInterpreter();
|
||||
StartUp.bAutomaticStart = g_pCodeWindow->AutomaticStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
// StartUp.bUseDualCore = false;
|
||||
// StartUp.bUseJIT = true;
|
||||
}
|
||||
StartUp.bEnableDebugging = g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
||||
#endif
|
||||
|
||||
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
||||
StartUp.m_strFilename = _rFilename;
|
||||
SConfig::GetInstance().m_LastFilename = StartUp.m_strFilename;
|
||||
StartUp.bRunCompareClient = false;
|
||||
StartUp.bRunCompareServer = false;
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
StartUp.bEnableDebugging = g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
||||
#endif
|
||||
std::string BaseDataPath;
|
||||
#ifdef _WIN32
|
||||
StartUp.hInstance = wxGetInstance();
|
||||
#ifdef _M_X64
|
||||
StartUp.bUseFastMem = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
StartUp.hInstance = wxGetInstance();
|
||||
#ifdef _M_X64
|
||||
StartUp.bUseFastMem = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( !StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
// Load game specific settings
|
||||
@ -151,9 +175,20 @@ bool BootCore(const std::string& _rFilename)
|
||||
// ---------
|
||||
}
|
||||
// ---------
|
||||
|
||||
// Save some values to our local version of SCoreStartupParameter
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bWii = StartUp.bWii;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC = StartUp.bNTSC;
|
||||
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if(main_frame)
|
||||
{
|
||||
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
|
||||
if (!Core::Init(StartUp))
|
||||
|
@ -42,14 +42,14 @@ struct SConfig
|
||||
// save settings
|
||||
void SaveSettings();
|
||||
|
||||
|
||||
// load settings
|
||||
void LoadSettings();
|
||||
|
||||
|
||||
/* Return the permanent and somewhat globally used instance of this struct
|
||||
there is also a Core::GetStartupParameter() instance of it with almost
|
||||
the same values */
|
||||
static SConfig& GetInstance() {return(m_Instance);}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// constructor
|
||||
|
@ -343,7 +343,7 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
|
||||
// Update the status bar
|
||||
main_frame->ModifyStatusBar(WiiLeds->IsChecked(), WiiSpeakers->IsChecked());
|
||||
main_frame->ModifyStatusBar();
|
||||
}
|
||||
|
||||
void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||
|
@ -154,8 +154,8 @@ CFrame::CFrame(wxFrame* parent,
|
||||
IconTemp.CopyFromBitmap(wxGetBitmapFromMemory(dolphin_png));
|
||||
SetIcon(IconTemp);
|
||||
|
||||
// Give it a status line
|
||||
CreateStatusBar_();
|
||||
// Give it a status bar
|
||||
m_pStatusBar = CreateStatusBar();
|
||||
|
||||
CreateMenu();
|
||||
|
||||
|
@ -23,8 +23,8 @@ class CFrame : public wxFrame
|
||||
// --------------------------------
|
||||
// Wiimote leds
|
||||
// ---------
|
||||
void CreateStatusBar_();
|
||||
void ModifyStatusBar(bool LedsOn, bool SpeakerOn);
|
||||
|
||||
void ModifyStatusBar();
|
||||
void CreateDestroy(int Case);
|
||||
void CreateLeds(); void CreateSpeakers();
|
||||
void UpdateLeds(); void UpdateSpeakers();
|
||||
|
@ -44,38 +44,77 @@ namespace WiimoteLeds
|
||||
int SPEAKER_SIZE_X = 8;
|
||||
int SPEAKER_SIZE_Y = 8;
|
||||
|
||||
static const int WidthsOn[] = { -1, 100, 50 + LED_SIZE_X * 4 };
|
||||
int ConnectionStatusWidth = 103;
|
||||
int ConnectionStatusOnlyAdj = 7;
|
||||
int RightmostMargin = 6;
|
||||
int SpIconMargin = 11;
|
||||
int LedIconMargin = 11;
|
||||
|
||||
// Leds only
|
||||
static const int LdWidthsOn[] =
|
||||
{
|
||||
-1,
|
||||
ConnectionStatusWidth,
|
||||
(LedIconMargin + LED_SIZE_X) * 4 + RightmostMargin
|
||||
};
|
||||
static const int StylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||
|
||||
static const int SpWidthsOn[] = { -1, 100, 40 + SPEAKER_SIZE_X * 3 };
|
||||
// Speakers only
|
||||
static const int SpWidthsOn[] =
|
||||
{
|
||||
-1,
|
||||
ConnectionStatusWidth,
|
||||
( SpIconMargin + SPEAKER_SIZE_X ) * 3 + RightmostMargin
|
||||
};
|
||||
static const int SpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||
|
||||
static const int LdSpWidthsOn[] = { -1, 100, 32 + SPEAKER_SIZE_X * 3, 50 + LED_SIZE_X * 4 };
|
||||
// Both
|
||||
static const int LdSpWidthsOn[] =
|
||||
{
|
||||
-1,
|
||||
ConnectionStatusWidth,
|
||||
(SpIconMargin + SPEAKER_SIZE_X) * 3,
|
||||
(LedIconMargin + LED_SIZE_X) * 4 + RightmostMargin
|
||||
};
|
||||
static const int LdSpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||
|
||||
static const int WidthsOff[] = { -1, 50 + 100 };
|
||||
// Only the Wiimote connection Status
|
||||
static const int WidthsOff[] =
|
||||
{
|
||||
-1,
|
||||
ConnectionStatusWidth + ConnectionStatusOnlyAdj + RightmostMargin
|
||||
};
|
||||
static const int StylesFieldOff[] = { wxSB_NORMAL, wxSB_NORMAL };
|
||||
|
||||
// GC mode
|
||||
static const int WidthsOffGC[] = { -1 };
|
||||
static const int StylesFieldOffGC[] = { wxSB_NORMAL };
|
||||
};
|
||||
|
||||
|
||||
// =======================================================
|
||||
// Create status bar
|
||||
// -------------
|
||||
void CFrame::CreateStatusBar_()
|
||||
{
|
||||
// Get settings
|
||||
bool LedsOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds;
|
||||
bool SpeakersOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers;
|
||||
m_pStatusBar = CreateStatusBar();
|
||||
ModifyStatusBar(LedsOn, SpeakersOn);
|
||||
}
|
||||
|
||||
|
||||
// =======================================================
|
||||
// Modify status bar
|
||||
// -------------
|
||||
void CFrame::ModifyStatusBar(bool LedsOn, bool SpeakersOn)
|
||||
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; }
|
||||
|
||||
/* For some reason the Debug build of wxWidgets can't use these bitmaps so it will
|
||||
produce a "assert "wxWidgets Debug Alert, bmp.Ok()" failed" message and show
|
||||
blank bitmaps. I check that wxUSE_STATBMP was enabled even for Debug builds so
|
||||
I don't see why it wouldn't work. You can uncomment this if you find the bug.
|
||||
|
||||
In my case the same thing occured for CFrame::InitBitmaps() so it was not just
|
||||
thse bitmaps that failed. So even with this comment you may get that warning. */
|
||||
#ifdef _DEBUG
|
||||
LedsOn = false; SpeakersOn = false;
|
||||
#endif
|
||||
|
||||
// Declarations
|
||||
int Fields;
|
||||
int *Widths;
|
||||
@ -87,7 +126,7 @@ void CFrame::ModifyStatusBar(bool LedsOn, bool SpeakersOn)
|
||||
if(LedsOn && !SpeakersOn)
|
||||
{
|
||||
Fields = 3;
|
||||
Widths = (int*)WiimoteLeds::WidthsOn;
|
||||
Widths = (int*)WiimoteLeds::LdWidthsOn;
|
||||
StylesFields = (int*)WiimoteLeds::StylesFieldOn;
|
||||
}
|
||||
// ---------------------------------------
|
||||
@ -116,6 +155,14 @@ void CFrame::ModifyStatusBar(bool LedsOn, bool 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* Destroy and create all, and check for HaveLeds and HaveSpeakers in case we have
|
||||
@ -222,20 +269,15 @@ void CFrame::CreateSpeakers()
|
||||
// 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, (bool)g_Speakers[i]));
|
||||
}
|
||||
if(g_Leds[0] == 0)
|
||||
{
|
||||
// LOGV(CONSOLE, 0, "Break");
|
||||
}
|
||||
|
||||
std::string Temp = ArrayToString(g_Speakers, sizeof(g_Speakers));
|
||||
LOGV(CONSOLE, 0, "Speakers: %s", Temp.c_str());
|
||||
|
||||
Temp = ArrayToString(g_Leds, sizeof(g_Leds));
|
||||
LOGV(CONSOLE, 0, "Leds: %s", Temp.c_str());
|
||||
}
|
||||
// ==============
|
||||
|
||||
|
Reference in New Issue
Block a user