update ui after savestate load (because loading a savestate can affect whether certain items should be grayed out in the menu)

This commit is contained in:
nitsuja 2011-12-18 01:15:59 -08:00
parent cfad00d6e0
commit c88e4a097e
4 changed files with 24 additions and 0 deletions

View File

@ -61,6 +61,8 @@ static int ev_FileSave, ev_BufferSave, ev_FileLoad, ev_BufferLoad, ev_FileVerify
static std::string g_current_filename, g_last_filename;
static CallbackFunc g_onAfterLoadCb = NULL;
// Temporary undo state buffer
static std::vector<u8> g_undo_load_buffer;
static std::vector<u8> g_current_buffer;
@ -406,12 +408,20 @@ void LoadFileStateCallback(u64 userdata, int cyclesLate)
g_op_in_progress = false;
if (g_onAfterLoadCb)
g_onAfterLoadCb();
g_loadDepth--;
// resume dat core
CCPU::EnableStepping(false);
}
void SetOnAfterLoadCallback(CallbackFunc callback)
{
g_onAfterLoadCb = callback;
}
void VerifyFileStateCallback(u64 userdata, int cyclesLate)
{
Flush();

View File

@ -56,6 +56,10 @@ void UndoLoadState();
void Flush(); // wait until previously scheduled savestate event (if any) is done
// for calling back into UI code without introducing a dependency on it in core
typedef void(*CallbackFunc)(void);
void SetOnAfterLoadCallback(CallbackFunc callback);
}
#endif

View File

@ -410,6 +410,8 @@ CFrame::CFrame(wxFrame* parent,
g_TASInputDlg = new TASInputDlg(this);
Movie::SetInputManip(TASManipFunction);
State::SetOnAfterLoadCallback(OnAfterLoadCallback);
// Setup perspectives
if (g_pCodeWindow)
{
@ -859,6 +861,12 @@ int GetCmdForHotkey(unsigned int key)
return -1;
}
void OnAfterLoadCallback()
{
if(main_frame)
main_frame->UpdateGUI();
}
void TASManipFunction(SPADStatus *PadStatus, int controllerID)
{
if (main_frame)

View File

@ -361,6 +361,8 @@ private:
int GetCmdForHotkey(unsigned int key);
void OnAfterLoadCallback();
// For TASInputDlg
void TASManipFunction(SPADStatus *PadStatus, int controllerID);