[Poject64] register callback for GameRunning_LoadingInProgress to refresh menu

This commit is contained in:
zilmar 2015-11-12 21:20:30 +11:00
parent 93c76fe7dc
commit 89361c5713
3 changed files with 8 additions and 8 deletions

View File

@ -180,13 +180,10 @@ bool CN64System::RunFileImage(const char * FileLoc)
{ {
return false; return false;
} }
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
WriteTrace(TraceDebug, __FUNCTION__ ": Mark Rom as loading"); WriteTrace(TraceDebug, __FUNCTION__ ": Mark Rom as loading");
//Mark the rom as loading //Mark the rom as loading
g_Settings->SaveBool(GameRunning_LoadingInProgress, true); g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
Notify().RefreshMenu();
//Try to load the passed N64 rom //Try to load the passed N64 rom
if (g_Rom == NULL) if (g_Rom == NULL)
@ -209,7 +206,6 @@ bool CN64System::RunFileImage(const char * FileLoc)
Notify().SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str()); Notify().SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str());
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
Notify().RefreshMenu();
if (g_Settings->LoadDword(Setting_AutoStart) != 0) if (g_Settings->LoadDword(Setting_AutoStart) != 0)
{ {
@ -227,7 +223,6 @@ bool CN64System::RunFileImage(const char * FileLoc)
delete g_Rom; delete g_Rom;
g_Rom = NULL; g_Rom = NULL;
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
Notify().RefreshMenu();
return false; return false;
} }
return true; return true;
@ -254,7 +249,6 @@ bool CN64System::EmulationStarting(HANDLE hThread, DWORD ThreadId)
g_BaseSystem->m_CPU_ThreadID = ThreadId; g_BaseSystem->m_CPU_ThreadID = ThreadId;
WriteTrace(TraceDebug, __FUNCTION__ ": Setting up N64 system done"); WriteTrace(TraceDebug, __FUNCTION__ ": Setting up N64 system done");
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
Notify().RefreshMenu();
try try
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Game set to auto start, starting"); 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"); WriteTrace(TraceError, __FUNCTION__ ": SetActiveSystem failed");
g_Notify->DisplayError(__FUNCTIONW__ L": Failed to Initialize N64 System"); g_Notify->DisplayError(__FUNCTIONW__ L": Failed to Initialize N64 System");
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
Notify().RefreshMenu();
bRes = false; bRes = false;
} }
return bRes; return bRes;
@ -336,7 +329,6 @@ void CN64System::StartEmulation2(bool NewThread)
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
g_Notify->DisplayError(MSG_PLUGIN_NOT_INIT); g_Notify->DisplayError(MSG_PLUGIN_NOT_INIT);
Notify().RefreshMenu();
Notify().ShowRomBrowser(); Notify().ShowRomBrowser();
} }

View File

@ -49,6 +49,7 @@ m_ResetInfo(NULL)
g_Settings->RegisterChangeCB(RomBrowser_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged); g_Settings->RegisterChangeCB(RomBrowser_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged);
g_Settings->RegisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged); g_Settings->RegisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged);
g_Settings->RegisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); 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 //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_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged);
g_Settings->UnregisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged); g_Settings->UnregisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged);
g_Settings->UnregisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); g_Settings->UnregisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged);
g_Settings->UnregisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged);
} }
if (m_hMainWindow) if (m_hMainWindow)
{ {
@ -111,6 +113,11 @@ void RomBowserEnabledChanged(CMainGui * Gui)
} }
} }
void CMainGui::LoadingInProgressChanged(CMainGui * Gui)
{
Gui->RefreshMenu();
}
void RomBowserColoumnsChanged(CMainGui * Gui) void RomBowserColoumnsChanged(CMainGui * Gui)
{ {
Gui->ResetRomBrowserColomuns(); Gui->ResetRomBrowserColomuns();

View File

@ -110,6 +110,7 @@ private:
friend void RomBowserEnabledChanged(CMainGui * Gui); friend void RomBowserEnabledChanged(CMainGui * Gui);
friend void RomBowserColoumnsChanged(CMainGui * Gui); friend void RomBowserColoumnsChanged(CMainGui * Gui);
friend void RomBrowserRecursiveChanged(CMainGui * Gui); friend void RomBrowserRecursiveChanged(CMainGui * Gui);
static void LoadingInProgressChanged(CMainGui * Gui);
CBaseMenu * m_Menu; CBaseMenu * m_Menu;