From 89361c57139778c684b618f5d37c97de8d2fbb27 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 12 Nov 2015 21:20:30 +1100 Subject: [PATCH] [Poject64] register callback for GameRunning_LoadingInProgress to refresh menu --- Source/Project64/N64 System/N64 Class.cpp | 8 -------- Source/Project64/User Interface/Gui Class.cpp | 7 +++++++ Source/Project64/User Interface/Gui Class.h | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index b222b9958..9bfe6bdf3 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -180,13 +180,10 @@ bool CN64System::RunFileImage(const char * FileLoc) { return false; } - g_Settings->SaveBool(GameRunning_LoadingInProgress, true); - WriteTrace(TraceDebug, __FUNCTION__ ": Mark Rom as loading"); //Mark the rom as loading g_Settings->SaveBool(GameRunning_LoadingInProgress, true); - Notify().RefreshMenu(); //Try to load the passed N64 rom if (g_Rom == NULL) @@ -209,7 +206,6 @@ bool CN64System::RunFileImage(const char * FileLoc) Notify().SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str()); g_Settings->SaveBool(GameRunning_LoadingInProgress, false); - Notify().RefreshMenu(); if (g_Settings->LoadDword(Setting_AutoStart) != 0) { @@ -227,7 +223,6 @@ bool CN64System::RunFileImage(const char * FileLoc) delete g_Rom; g_Rom = NULL; g_Settings->SaveBool(GameRunning_LoadingInProgress, false); - Notify().RefreshMenu(); return false; } return true; @@ -254,7 +249,6 @@ bool CN64System::EmulationStarting(HANDLE hThread, DWORD ThreadId) g_BaseSystem->m_CPU_ThreadID = ThreadId; WriteTrace(TraceDebug, __FUNCTION__ ": Setting up N64 system done"); g_Settings->SaveBool(GameRunning_LoadingInProgress, false); - Notify().RefreshMenu(); try { WriteTrace(TraceDebug, __FUNCTION__ ": Game set to auto start, starting"); @@ -271,7 +265,6 @@ bool CN64System::EmulationStarting(HANDLE hThread, DWORD ThreadId) WriteTrace(TraceError, __FUNCTION__ ": SetActiveSystem failed"); g_Notify->DisplayError(__FUNCTIONW__ L": Failed to Initialize N64 System"); g_Settings->SaveBool(GameRunning_LoadingInProgress, false); - Notify().RefreshMenu(); bRes = false; } return bRes; @@ -336,7 +329,6 @@ void CN64System::StartEmulation2(bool NewThread) g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Notify->DisplayError(MSG_PLUGIN_NOT_INIT); - Notify().RefreshMenu(); Notify().ShowRomBrowser(); } diff --git a/Source/Project64/User Interface/Gui Class.cpp b/Source/Project64/User Interface/Gui Class.cpp index ee2394dbb..6ecc23c69 100644 --- a/Source/Project64/User Interface/Gui Class.cpp +++ b/Source/Project64/User Interface/Gui Class.cpp @@ -49,6 +49,7 @@ m_ResetInfo(NULL) g_Settings->RegisterChangeCB(RomBrowser_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged); g_Settings->RegisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged); g_Settings->RegisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); + g_Settings->RegisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged); } //if this fails then it has already been created @@ -64,6 +65,7 @@ CMainGui::~CMainGui(void) g_Settings->UnregisterChangeCB(RomBrowser_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged); g_Settings->UnregisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged); g_Settings->UnregisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); + g_Settings->UnregisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged); } if (m_hMainWindow) { @@ -111,6 +113,11 @@ void RomBowserEnabledChanged(CMainGui * Gui) } } +void CMainGui::LoadingInProgressChanged(CMainGui * Gui) +{ + Gui->RefreshMenu(); +} + void RomBowserColoumnsChanged(CMainGui * Gui) { Gui->ResetRomBrowserColomuns(); diff --git a/Source/Project64/User Interface/Gui Class.h b/Source/Project64/User Interface/Gui Class.h index 0ab6b34f6..6d06c4fb1 100644 --- a/Source/Project64/User Interface/Gui Class.h +++ b/Source/Project64/User Interface/Gui Class.h @@ -110,6 +110,7 @@ private: friend void RomBowserEnabledChanged(CMainGui * Gui); friend void RomBowserColoumnsChanged(CMainGui * Gui); friend void RomBrowserRecursiveChanged(CMainGui * Gui); + static void LoadingInProgressChanged(CMainGui * Gui); CBaseMenu * m_Menu;