diff --git a/src/Cafe/GraphicPack/GraphicPack2.cpp b/src/Cafe/GraphicPack/GraphicPack2.cpp index ab4dbd3a..98149c93 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2.cpp @@ -11,6 +11,8 @@ #include "util/IniParser/IniParser.h" #include "util/helpers/StringHelpers.h" #include "Cafe/CafeSystem.h" +#include "HW/Espresso/Debugger/Debugger.h" + #include std::vector GraphicPack2::s_graphic_packs; @@ -130,6 +132,7 @@ bool GraphicPack2::ActivateGraphicPack(const std::shared_ptr& grap if (graphic_pack->Activate()) { s_active_graphic_packs.push_back(graphic_pack); + g_debuggerDispatcher.NotifyGraphicPacksModified(); return true; } @@ -153,6 +156,7 @@ bool GraphicPack2::DeactivateGraphicPack(const std::shared_ptr& gr graphic_pack->Deactivate(); s_active_graphic_packs.erase(it); + g_debuggerDispatcher.NotifyGraphicPacksModified(); return true; } diff --git a/src/Cafe/HW/Espresso/Debugger/Debugger.h b/src/Cafe/HW/Espresso/Debugger/Debugger.h index d385cadd..8b09477b 100644 --- a/src/Cafe/HW/Espresso/Debugger/Debugger.h +++ b/src/Cafe/HW/Espresso/Debugger/Debugger.h @@ -24,6 +24,7 @@ class DebuggerCallbacks virtual void MoveIP() {} virtual void NotifyModuleLoaded(void* module) {} virtual void NotifyModuleUnloaded(void* module) {} + virtual void NotifyGraphicPacksModified() {} virtual ~DebuggerCallbacks() = default; }; @@ -77,6 +78,11 @@ class DebuggerDispatcher { m_callbacks->NotifyModuleUnloaded(module); } + + void NotifyGraphicPacksModified() + { + m_callbacks->NotifyGraphicPacksModified(); + } } extern g_debuggerDispatcher; struct DebuggerBreakpoint diff --git a/src/gui/wxgui/debugger/DebuggerWindow2.cpp b/src/gui/wxgui/debugger/DebuggerWindow2.cpp index 8e73426b..bcc1d6a9 100644 --- a/src/gui/wxgui/debugger/DebuggerWindow2.cpp +++ b/src/gui/wxgui/debugger/DebuggerWindow2.cpp @@ -54,6 +54,7 @@ wxDEFINE_EVENT(wxEVT_MOVE_IP, wxCommandEvent); wxDEFINE_EVENT(wxEVT_RUN, wxCommandEvent); wxDEFINE_EVENT(wxEVT_NOTIFY_MODULE_LOADED, wxCommandEvent); wxDEFINE_EVENT(wxEVT_NOTIFY_MODULE_UNLOADED, wxCommandEvent); +wxDEFINE_EVENT(wxEVT_NOTIFY_GRAPHIC_PACKS_MODIFIED, wxCommandEvent); wxBEGIN_EVENT_TABLE(DebuggerWindow2, wxFrame) EVT_SHOW(DebuggerWindow2::OnShow) @@ -66,6 +67,7 @@ wxBEGIN_EVENT_TABLE(DebuggerWindow2, wxFrame) EVT_COMMAND(wxID_ANY, wxEVT_RUN, DebuggerWindow2::OnRunProgram) EVT_COMMAND(wxID_ANY, wxEVT_NOTIFY_MODULE_LOADED, DebuggerWindow2::OnNotifyModuleLoaded) EVT_COMMAND(wxID_ANY, wxEVT_NOTIFY_MODULE_UNLOADED, DebuggerWindow2::OnNotifyModuleUnloaded) + EVT_COMMAND(wxID_ANY, wxEVT_NOTIFY_GRAPHIC_PACKS_MODIFIED, DebuggerWindow2::OnNotifyGraphicPacksModified) EVT_COMMAND(wxID_ANY, wxEVT_DISASMCTRL_NOTIFY_GOTO_ADDRESS, DebuggerWindow2::OnDisasmCtrlGotoAddress) // file menu EVT_MENU(MENU_ID_FILE_EXIT, DebuggerWindow2::OnExit) @@ -437,6 +439,13 @@ void DebuggerWindow2::OnNotifyModuleUnloaded(wxCommandEvent& event) m_disasm_ctrl->Init(); } +void DebuggerWindow2::OnNotifyGraphicPacksModified(wxCommandEvent& event) +{ + m_module_window->OnGameLoaded(); + m_symbol_window->OnGameLoaded(); + m_disasm_ctrl->Init(); +} + void DebuggerWindow2::OnGameLoaded() { m_disasm_ctrl->Init(); @@ -720,6 +729,12 @@ void DebuggerWindow2::NotifyModuleLoaded(void* module) wxQueueEvent(this, evt); } +void DebuggerWindow2::NotifyGraphicPacksModified() +{ + auto* evt = new wxCommandEvent(wxEVT_NOTIFY_GRAPHIC_PACKS_MODIFIED); + wxQueueEvent(this, evt); +} + void DebuggerWindow2::NotifyModuleUnloaded(void* module) { auto* evt = new wxCommandEvent(wxEVT_NOTIFY_MODULE_UNLOADED); diff --git a/src/gui/wxgui/debugger/DebuggerWindow2.h b/src/gui/wxgui/debugger/DebuggerWindow2.h index a8771c4f..b06601ba 100644 --- a/src/gui/wxgui/debugger/DebuggerWindow2.h +++ b/src/gui/wxgui/debugger/DebuggerWindow2.h @@ -24,6 +24,7 @@ wxDECLARE_EVENT(wxEVT_BREAKPOINT_CHANGE, wxCommandEvent); wxDECLARE_EVENT(wxEVT_MOVE_IP, wxCommandEvent); wxDECLARE_EVENT(wxEVT_NOTIFY_MODULE_LOADED, wxCommandEvent); wxDECLARE_EVENT(wxEVT_NOTIFY_MODULE_UNLOADED, wxCommandEvent); +wxDECLARE_EVENT(wxEVT_NOTIFY_GRAPHIC_PACKS_MODIFIED, wxCommandEvent); struct DebuggerConfig { @@ -95,6 +96,7 @@ private: void OnMoveIP(wxCommandEvent& event); void OnNotifyModuleLoaded(wxCommandEvent& event); void OnNotifyModuleUnloaded(wxCommandEvent& event); + void OnNotifyGraphicPacksModified(wxCommandEvent& event); // events from DisasmCtrl void OnDisasmCtrlGotoAddress(wxCommandEvent& event); @@ -106,6 +108,7 @@ private: void NotifyRun() override; void MoveIP() override; void NotifyModuleLoaded(void* module) override; + void NotifyGraphicPacksModified() override; void NotifyModuleUnloaded(void* module) override; XMLDebuggerConfig m_config;