[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;
}
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();
}

View File

@ -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();

View File

@ -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;