diff --git a/soh/soh/Enhancements/debugger/hookDebugger.cpp b/soh/soh/Enhancements/debugger/hookDebugger.cpp index b31ddc3966f..8ee9b3391fc 100644 --- a/soh/soh/Enhancements/debugger/hookDebugger.cpp +++ b/soh/soh/Enhancements/debugger/hookDebugger.cpp @@ -4,14 +4,14 @@ #include #include -static std::unordered_map> hookData; +static std::unordered_map*> hookData; const ImVec4 grey = ImVec4(0.75, 0.75, 0.75, 1); const ImVec4 yellow = ImVec4(1, 1, 0, 1); const ImVec4 red = ImVec4(1, 0, 0, 1); void DrawHookRegisteringInfos(const char* hookName) { - if (hookData[hookName].size() == 0) { + if ((*hookData[hookName]).size() == 0) { ImGui::TextColored(grey, "No hooks found"); return; } @@ -27,7 +27,7 @@ void DrawHookRegisteringInfos(const char* hookName) { //ImGui::TableSetupColumn("Stub"); ImGui::TableSetupColumn("Number of Calls"); ImGui::TableHeadersRow(); - for (auto& [id, hookInfo] : hookData[hookName]) { + for (auto& [id, hookInfo] : (*hookData[hookName])) { ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -100,12 +100,10 @@ void HookDebuggerWindow::DrawElement() { } } -void HookDebuggerWindow::UpdateElement() { - hookData.clear(); - +void HookDebuggerWindow::InitElement() { #define DEFINE_HOOK(name, _) hookData.insert({#name, GameInteractor::Instance->GetHookData()}); #include "../game-interactor/GameInteractor_HookTable.h" #undef DEFINE_HOOK -} \ No newline at end of file +} diff --git a/soh/soh/Enhancements/debugger/hookDebugger.h b/soh/soh/Enhancements/debugger/hookDebugger.h index 90e6886b5ec..ae6f5113f26 100644 --- a/soh/soh/Enhancements/debugger/hookDebugger.h +++ b/soh/soh/Enhancements/debugger/hookDebugger.h @@ -4,7 +4,7 @@ class HookDebuggerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; - void InitElement() override {}; + void InitElement() override; void DrawElement() override; - void UpdateElement() override; + void UpdateElement() override {}; }; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 8b52b9b371e..e7312050184 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -641,8 +641,8 @@ class GameInteractor { inline static std::vector hooksForFilter; }; - template std::unordered_map GetHookData() { - return RegisteredGameHooks::hookData; + template std::unordered_map* GetHookData() { + return &RegisteredGameHooks::hookData; } // General Hooks