diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 2643530264..8ba238f2d7 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -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 g_undo_load_buffer; static std::vector 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(); diff --git a/Source/Core/Core/Src/State.h b/Source/Core/Core/Src/State.h index 111c4e24f0..2c3a38cd8c 100644 --- a/Source/Core/Core/Src/State.h +++ b/Source/Core/Core/Src/State.h @@ -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 diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 4dc7928375..846971e884 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -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) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 526e52f3c9..770d459220 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -361,6 +361,8 @@ private: int GetCmdForHotkey(unsigned int key); +void OnAfterLoadCallback(); + // For TASInputDlg void TASManipFunction(SPADStatus *PadStatus, int controllerID);