diff --git a/Externals/wxWidgets/include/msvc/wx/setup.h b/Externals/wxWidgets/include/msvc/wx/setup.h index a1ce91fa17..6ddc636cb3 100644 --- a/Externals/wxWidgets/include/msvc/wx/setup.h +++ b/Externals/wxWidgets/include/msvc/wx/setup.h @@ -30,7 +30,8 @@ include\wx\setup.h ? include\wx\msw\setup.h ? include\wx\univ\setup.h ? - include\wx\msw\setup0.h - The original univ file, not used + include\wx\msw\setup0.h - The original msw file, not used + include\wx\univ\setup0.h - The original univ file, not used The configuration consistency check files: diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index a371be5f99..522fdc6870 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -15,12 +15,13 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "Common.h" + +#include "Common.h" // Common #include "StringUtil.h" #include "FileUtil.h" +#include "MappedFile.h" -#include "../HLE/HLE.h" - +#include "../HLE/HLE.h" // Core #include "../PowerPC/PowerPC.h" #include "../PowerPC/PPCAnalyst.h" #include "../Core.h" @@ -32,7 +33,7 @@ #include "../HW/VideoInterface.h" #include "../HW/CPU.h" -#include "../Debugger/Debugger_SymbolMap.h" +#include "../Debugger/Debugger_SymbolMap.h" // Debugger #include "../Debugger/Debugger_BreakPoints.h" #include "Boot_DOL.h" @@ -42,11 +43,9 @@ #include "../PatchEngine.h" #include "../PowerPC/SignatureDB.h" #include "../PowerPC/SymbolDB.h" - #include "../MemTools.h" -#include "MappedFile.h" -#include "VolumeCreator.h" +#include "VolumeCreator.h" // DiscIO void CBoot::Load_FST(bool _bIsWii) { @@ -153,7 +152,7 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara) VideoInterface::PreInit(_StartupPara.bNTSC); switch (_StartupPara.m_BootType) { - // GCM + // GCM and Wii // =================================================================================== case SCoreStartupParameter::BOOT_ISO: { @@ -176,6 +175,7 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara) DVDInterface::SetDiscInside(true); + // Use HLE BIOS or not if (_StartupPara.bHLEBios) { if (!VolumeHandler::IsWii()) @@ -200,6 +200,9 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara) } } } + + /* Try to load the symbol map if there is one, and then scan it for + and eventually replace code */ if (LoadMapFromFilename(_StartupPara.m_strFilename, gameID)) HLE::PatchFunctions(); } diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 6cc4f0de73..cf99d1d4b3 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -15,12 +15,15 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "Common.h" -#include "Boot/Boot.h" +#include "Common.h" // Common #include "FileUtil.h" #include "StringUtil.h" + +#include "VolumeCreator.h" // DiscIO + +#include "Boot/Boot.h" // Core #include "CoreParameter.h" -#include "VolumeCreator.h" +#include "Core.h" // for bWii SCoreStartupParameter::SCoreStartupParameter() { @@ -79,7 +82,9 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) } m_strName = pVolume->GetName(); m_strUniqueID = pVolume->GetUniqueID(); - bWii = DiscIO::IsVolumeWiiDisc(pVolume); + + // Check if we have a Wii disc + bWii = DiscIO::IsVolumeWiiDisc(pVolume); switch (pVolume->GetCountry()) { @@ -146,7 +151,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) break; } - // setup paths + // Setup paths m_strBios = FULL_GC_SYS_DIR + Region + DIR_SEP GC_IPL; m_strMemoryCardA = FULL_GC_USER_DIR + Region + DIR_SEP GC_MEMCARDA; m_strMemoryCardB = FULL_GC_USER_DIR + Region + DIR_SEP GC_MEMCARDB; 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 187db7b571..782a755194 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 @@ -15,17 +15,18 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "Common.h" +#include "Common.h" // Common #include "StringUtil.h" -#include "WII_IPC_HLE_WiiMote.h" -#include "../../DolphinWX/Src/Frame.h" +#include "WII_IPC_HLE_WiiMote.h" // Core +#include "WII_IPC_HLE_Device_usb.h" #include "../Plugins/Plugin_Wiimote.h" #include "../Host.h" +#include "../Core.h" -#include "WII_IPC_HLE_Device_usb.h" +#include "../../DolphinWX/Src/Frame.h" // DolphinWX, for the wiimote status -#include "l2cap.h" +#include "l2cap.h" // Local #include "WiiMote_HID_Attr.h" extern CFrame* main_frame; // for the status report @@ -386,6 +387,12 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) // ---------------- void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) { + + // Check if it's enabled + bool LedsOn = Core::g_CoreStartupParameter.bWiiLeds; + bool SpeakersOn = Core::g_CoreStartupParameter.bWiiSpeakers; + if(! (LedsOn || SpeakersOn) ) return; + const u8* data = (const u8*)_pData; if(data[1] == 0x11 || data[1] == 0x14 || data[1] == 0x16 @@ -397,7 +404,7 @@ void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) // Get the last four bits with LED info u8 Bits; - if(data[1] == 0x11) + if(data[1] == 0x11 && LedsOn) { Bits = (data[2] >> 4); @@ -410,7 +417,7 @@ void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) main_frame->UpdateLeds(); } - if(data[1] == 0x14) // Enable and disable speakers + if(data[1] == 0x14 && SpeakersOn) // Enable and disable speakers { // Get the value if(data[2] == 0x02) Bits = 0; @@ -419,7 +426,7 @@ void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) main_frame->UpdateSpeakers(); } - if(data[1] == 0x19) // Mute and unmute + if(data[1] == 0x19 && SpeakersOn) // Mute and unmute { // Get the value if(data[2] == 0x02) Bits = 0; @@ -428,7 +435,7 @@ void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) main_frame->UpdateSpeakers(); } - if(data[1] == 0x16) // Write to speaker registry + if(data[1] == 0x16 && SpeakersOn) // Write to speaker registry { // Don't care what it does, call all activity main_frame->g_Speakers[2] = 1; @@ -439,6 +446,9 @@ void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData) // Turn off the activity icon again void CWII_IPC_HLE_WiiMote::UpdateStatus() { + // Check if it's enabled + if(!Core::g_CoreStartupParameter.bWiiSpeakers) return; + 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()); diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index e6081a126f..d96ce251f2 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -956,7 +956,7 @@ void CCodeWindow::DoTip(wxString text) #endif } - +// See the comment under BEGIN_EVENT_TABLE for explanation of why we use these two void CCodeWindow::OnStatusBar(wxMenuEvent& event) { DoTip(pMenuBar->GetHelpString(event.GetId())); @@ -965,7 +965,6 @@ void CCodeWindow::OnStatusBar_(wxUpdateUIEvent& event) { DoTip(pMenuBar->GetHelpString(event.GetId())); } - // =========== diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 55c7d50436..f83004cff9 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -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 #include @@ -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)) diff --git a/Source/Core/DolphinWX/Src/Config.h b/Source/Core/DolphinWX/Src/Config.h index 9fc360b6db..9f0239f4d7 100644 --- a/Source/Core/DolphinWX/Src/Config.h +++ b/Source/Core/DolphinWX/Src/Config.h @@ -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 diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index b74ef1a34e..a4b11a30e4 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -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)) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 4d0c8249ba..2a275bcea5 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -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(); diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 99c7941a53..d7c115a6de 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -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(); diff --git a/Source/Core/DolphinWX/Src/FrameWiimote.cpp b/Source/Core/DolphinWX/Src/FrameWiimote.cpp index 4f034658de..4e351bf2ad 100644 --- a/Source/Core/DolphinWX/Src/FrameWiimote.cpp +++ b/Source/Core/DolphinWX/Src/FrameWiimote.cpp @@ -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()); } // ==============