From 66536235e672507369c8c352e70f89b9ebb8f331 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 12 Dec 2008 03:38:50 +0000 Subject: [PATCH] compiletime warning fixes, possible wxw crashes fixed, disable build of njoy_test until it's more mature. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1502 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Core.vcproj | 8 +- Source/Core/DolphinWX/Src/BootManager.cpp | 4 +- Source/Core/DolphinWX/Src/ConfigMain.cpp | 3 - Source/Core/DolphinWX/Src/Frame.cpp | 140 ++++++++---------- Source/Core/DolphinWX/Src/Frame.h | 3 +- Source/Core/DolphinWX/Src/FrameWiimote.cpp | 22 +-- Source/Dolphin.sln | 10 +- .../Plugin_Wiimote/Plugin_Wiimote.vcproj | 10 +- 8 files changed, 84 insertions(+), 116 deletions(-) diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index 42c47f31f7..afd1046148 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -46,7 +46,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LOGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LOGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -344,7 +344,7 @@ OmitFramePointers="true" EnableFiberSafeOptimizations="false" AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO" - PreprocessorDefinitions="NDEBUG;_LIB;LOGGING;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" + PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" RuntimeLibrary="0" BufferSecurityCheck="true" EnableEnhancedInstructionSet="2" @@ -419,7 +419,7 @@ OmitFramePointers="true" EnableFiberSafeOptimizations="false" AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" - PreprocessorDefinitions="NDEBUG;_LIB;LOGGING;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" + PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" RuntimeLibrary="0" BufferSecurityCheck="false" FloatingPointModel="0" diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 0597c2d74a..9508971d83 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -146,8 +146,8 @@ bool BootCore(const std::string& _rFilename) //wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR])); - ini.Get("Core", "EnableProgressiveScan", &bEnableProgressiveScan, (int)m_SYSCONF[IPL_PGS]); - ini.Get("Core", "EnableWideScreen", &bEnableWideScreen, (int)m_SYSCONF[IPL_AR]); + ini.Get("Core", "EnableProgressiveScan", &bEnableProgressiveScan, m_SYSCONF[IPL_PGS] != 0); + ini.Get("Core", "EnableWideScreen", &bEnableWideScreen, m_SYSCONF[IPL_AR] != 0); m_SYSCONF[IPL_PGS] = bEnableProgressiveScan; m_SYSCONF[IPL_AR] = bEnableWideScreen; diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index a4b11a30e4..0d342aed12 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -341,9 +341,6 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) // save the config... dolphin crashes by far to often to save the settings on closing only SConfig::GetInstance().SaveSettings(); - - // Update the status bar - 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 bdc95b9453..08278dff59 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -102,7 +102,7 @@ EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState) EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT10, CFrame::OnSaveState) -EVT_SIZE(CFrame::MoveIcons) +EVT_SIZE(CFrame::OnResize) EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) END_EVENT_TABLE() @@ -440,15 +440,8 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event)) void CFrame::OnStop(wxCommandEvent& WXUNUSED (event)) { - // Ask for confirmation in case the user accidently clicked Stop - int answer = wxMessageBox(wxT("Are you sure you want to stop the current emulation?"), - wxT("Confirm"), wxYES_NO); - - if (answer == wxYES && Core::GetState() != Core::CORE_UNINITIALIZED) - { - Core::Stop(); - UpdateGUI(); - } + Core::Stop(); + UpdateGUI(); } @@ -559,6 +552,12 @@ void CFrame::OnLoadState(wxCommandEvent& event) State_Load(slot); } +void CFrame::OnResize(wxSizeEvent& event) +{ + DoMoveIcons(); // In FrameWiimote.cpp + event.Skip(); +} + void CFrame::OnSaveState(wxCommandEvent& event) { int id = event.GetId(); @@ -579,19 +578,18 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event) delete toolBar; SetToolBar(NULL); } + + this->SendSizeEvent(); } void CFrame::OnToggleStatusbar(wxCommandEvent& event) { if (event.IsChecked()) - { - m_pStatusBar = CreateStatusBar(); - } + m_pStatusBar->Show(); else - { - delete m_pStatusBar; - m_pStatusBar = NULL; - } + m_pStatusBar->Hide(); + + this->SendSizeEvent(); } void CFrame::OnKeyDown(wxKeyEvent& event) @@ -618,74 +616,58 @@ void CFrame::OnKeyDown(wxKeyEvent& event) void CFrame::UpdateGUI() { - // buttons + bool initialized = Core::GetState() != Core::CORE_UNINITIALIZED; + bool running = Core::GetState() == Core::CORE_RUN; + bool paused = Core::GetState() == Core::CORE_PAUSE; + + if (GetToolBar() != NULL) { - if (Core::GetState() == Core::CORE_UNINITIALIZED) - { - GetToolBar()->EnableTool(IDM_CONFIG_MAIN, true); - m_pPluginOptions->Enable(true); - - GetToolBar()->EnableTool(IDM_STOP, false); - - m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]); - m_pToolPlay->SetShortHelp(_T("Play")); - m_pToolPlay->SetLabel(_T("Play")); - - m_pMenuItemPlay->SetText(_T("&Play")); - - m_pMenuItemStop->Enable(false); - m_pMenuItemLoad->Enable(false); - m_pMenuItemSave->Enable(false); - } - else - { - GetToolBar()->EnableTool(IDM_CONFIG_MAIN, false); - m_pPluginOptions->Enable(false); - - GetToolBar()->EnableTool(IDM_STOP, true); - - m_pMenuItemStop->Enable(true); - m_pMenuItemLoad->Enable(true); - m_pMenuItemSave->Enable(true); - - if (Core::GetState() == Core::CORE_RUN) - { - m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]); - m_pToolPlay->SetShortHelp(_T("Pause")); - m_pToolPlay->SetLabel(_T("Pause")); - - m_pMenuItemPlay->SetText(_T("&Pause")); - } - else - { - m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]); - m_pToolPlay->SetShortHelp(_T("Play")); - m_pToolPlay->SetLabel(_T("Play")); - - m_pMenuItemPlay->SetText(_T("&Play")); - } - } - GetToolBar()->Realize(); + GetToolBar()->EnableTool(IDM_CONFIG_MAIN, !initialized); + GetToolBar()->EnableTool(IDM_STOP, running || paused); } - - // gamelistctrl + m_pMenuItemStop->Enable(running || paused); + m_pMenuItemLoad->Enable(initialized); + m_pMenuItemSave->Enable(initialized); + m_pPluginOptions->Enable(!running && !paused); + + if (running) { - if (Core::GetState() == Core::CORE_UNINITIALIZED) + if (GetToolBar() != NULL) { - if (m_GameListCtrl && !m_GameListCtrl->IsShown()) - { - m_GameListCtrl->Enable(); - m_GameListCtrl->Show(); - sizerPanel->FitInside(m_Panel); - } + m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]); + m_pToolPlay->SetShortHelp(_("Pause")); + m_pToolPlay->SetLabel(_("Pause")); } - else + m_pMenuItemPlay->SetText(_("&Pause")); + } + else + { + if (GetToolBar() != NULL) { - if (m_GameListCtrl && m_GameListCtrl->IsShown()) - { - m_GameListCtrl->Disable(); - m_GameListCtrl->Hide(); - } + m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]); + m_pToolPlay->SetShortHelp(_("Play")); + m_pToolPlay->SetLabel(_("Play")); + } + m_pMenuItemPlay->SetText(_("&Play")); + } + if (GetToolBar() != NULL) GetToolBar()->Realize(); + + + if (!initialized) + { + if (m_GameListCtrl && !m_GameListCtrl->IsShown()) + { + m_GameListCtrl->Enable(); + m_GameListCtrl->Show(); + sizerPanel->FitInside(m_Panel); + } + } + else + { + if (m_GameListCtrl && m_GameListCtrl->IsShown()) + { + m_GameListCtrl->Disable(); + m_GameListCtrl->Hide(); } } } diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 9b8fc86ddf..5402526abe 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -30,7 +30,7 @@ class CFrame : public wxFrame void UpdateLeds(); void UpdateSpeakers(); wxBitmap CreateBitmapForLeds(bool On); wxBitmap CreateBitmapForSpeakers(int BitmapType, bool On); - void MoveIcons(wxSizeEvent& event); void DoMoveIcons(); void MoveLeds(); void MoveSpeakers(); + void DoMoveIcons(); void MoveLeds(); void MoveSpeakers(); bool HaveLeds; bool HaveSpeakers; wxStaticBitmap *m_StatBmp[7]; @@ -102,6 +102,7 @@ class CFrame : public wxFrame void OnToggleDualCore(wxCommandEvent& event); void OnToggleSkipIdle(wxCommandEvent& event); void OnToggleThrottle(wxCommandEvent& event); + void OnResize(wxSizeEvent& event); void OnToggleToolbar(wxCommandEvent& event); void OnToggleStatusbar(wxCommandEvent& event); void OnKeyDown(wxKeyEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameWiimote.cpp b/Source/Core/DolphinWX/Src/FrameWiimote.cpp index d3382c4f05..50ef28ba0a 100644 --- a/Source/Core/DolphinWX/Src/FrameWiimote.cpp +++ b/Source/Core/DolphinWX/Src/FrameWiimote.cpp @@ -44,7 +44,7 @@ namespace WiimoteLeds int SPEAKER_SIZE_X = 8; int SPEAKER_SIZE_Y = 8; - int ConnectionStatusWidth = 103; // This needs to be wider, for vista at least + int ConnectionStatusWidth = 103; // These widths need to be revised, for vista at least int ConnectionStatusOnlyAdj = 7; int RightmostMargin = 6; int SpIconMargin = 11; @@ -105,9 +105,9 @@ void CFrame::ModifyStatusBar() { LedsOn = false; SpeakersOn = false; } // Declarations - int Fields; - int *Widths; - int *StylesFields; + int Fields = 0; + int *Widths = 0; + int *StylesFields = 0; // --------------------------------------- // Leds only @@ -227,7 +227,7 @@ void CFrame::CreateLeds() for(int i = 0; i < 4; i++) { m_StatBmp[i] = new wxStaticBitmap(m_pStatusBar, wxID_ANY, - CreateBitmapForLeds((bool)g_Leds[i])); + CreateBitmapForLeds(g_Leds[i] == 1)); } } // Update leds @@ -235,7 +235,7 @@ void CFrame::UpdateLeds() { for(int i = 0; i < 4; i++) { - m_StatBmp[i]->SetBitmap(CreateBitmapForLeds((bool)g_Leds[i])); + m_StatBmp[i]->SetBitmap(CreateBitmapForLeds(g_Leds[i] != 0)); } } // ============== @@ -252,7 +252,7 @@ void CFrame::CreateSpeakers() for(int i = 0; i < 3; i++) { m_StatBmp[i+4] = new wxStaticBitmap(m_pStatusBar, wxID_ANY, - CreateBitmapForSpeakers(i, (bool)g_Speakers[i])); + CreateBitmapForSpeakers(i, g_Speakers[i] != 0)); } } // Update icons @@ -265,7 +265,7 @@ void CFrame::UpdateSpeakers() { PanicAlert("Not Wii");}*/ for(int i = 0; i < 3; i++) { - m_StatBmp[i+4]->SetBitmap(CreateBitmapForSpeakers(i, (bool)g_Speakers[i])); + m_StatBmp[i+4]->SetBitmap(CreateBitmapForSpeakers(i, g_Speakers[i] != 0)); } } // ============== @@ -348,12 +348,6 @@ wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On) // ======================================================= // Move the bitmaps // ------------- -void CFrame::MoveIcons(wxSizeEvent& event) -{ - DoMoveIcons(); - event.Skip(); -} - void CFrame::DoMoveIcons() { if(HaveLeds) MoveLeds(); diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln index 0d82504006..968ed171ab 100644 --- a/Source/Dolphin.sln +++ b/Source/Dolphin.sln @@ -370,23 +370,17 @@ Global {C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Release|x64.ActiveCfg = Release|x64 {C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Release|x64.Build.0 = Release|x64 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32 - {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.Build.0 = Debug|Win32 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|x64.ActiveCfg = Debug|x64 - {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|x64.Build.0 = Debug|x64 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 - {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|Win32.Build.0 = DebugFast|Win32 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|x64.ActiveCfg = DebugFast|x64 - {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|x64.Build.0 = DebugFast|x64 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|Win32.ActiveCfg = Release|Win32 - {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|Win32.Build.0 = Release|Win32 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|x64.ActiveCfg = Release|x64 - {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|x64.Build.0 = Release|x64 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.Debug|Win32.ActiveCfg = Debug|Win32 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.Debug|Win32.Build.0 = Debug|Win32 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.Debug|x64.ActiveCfg = Debug|x64 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.Debug|x64.Build.0 = Debug|x64 - {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.DebugFast|Win32.ActiveCfg = Debug|Win32 - {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.DebugFast|Win32.Build.0 = Debug|Win32 + {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 + {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.DebugFast|Win32.Build.0 = DebugFast|Win32 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.DebugFast|x64.ActiveCfg = DebugFast|x64 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.DebugFast|x64.Build.0 = DebugFast|x64 {71B16F46-0B00-4EDA-B253-D6D9D03A215C}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj index 70e406701d..4070219693 100644 --- a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj +++ b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj @@ -1,7 +1,7 @@