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

View File

@ -56,6 +56,10 @@ void UndoLoadState();
void Flush(); // wait until previously scheduled savestate event (if any) is done 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 #endif

View File

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

View File

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