From 448b4e49d3531e4af58f5d97135bb33289597031 Mon Sep 17 00:00:00 2001 From: David Chavez Date: Mon, 27 Feb 2023 01:46:25 +0100 Subject: [PATCH] [GameInteractor] Update Naming Modhooks (#2543) --- soh/CMakeLists.txt | 4 ++-- .../Enhancements/{mods/modhooks.cpp => mods.cpp} | 9 +++++---- soh/soh/Enhancements/mods.h | 14 ++++++++++++++ soh/soh/Enhancements/mods/modhooks.h | 5 ----- soh/soh/OTRGlobals.cpp | 4 ++-- 5 files changed, 23 insertions(+), 13 deletions(-) rename soh/soh/Enhancements/{mods/modhooks.cpp => mods.cpp} (93%) create mode 100644 soh/soh/Enhancements/mods.h delete mode 100644 soh/soh/Enhancements/mods/modhooks.h diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index e2ef54ea5..53e2db453 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -260,7 +260,7 @@ set(Header_Files__soh__Enhancements__item_tables source_group("Header Files\\soh\\Enhancements\\item-tables" FILES ${Header_Files__soh__Enhancements__item_tables}) set(Header_Files__soh__Enhancements__mods - "soh/Enhancements/mods/modhooks.h" + "soh/Enhancements/mods.h" ) source_group("Header Files\\soh\\Enhancements\\mods" FILES ${Header_Files__soh__Enhancements__mods}) @@ -618,7 +618,7 @@ set(Source_Files__soh__Enhancements__item_tables source_group("Source Files\\soh\\Enhancements\\item-tables" FILES ${Source_Files__soh__Enhancements__item_tables}) set(Source_Files__soh__Enhancements__mods - "soh/Enhancements/mods/modhooks.cpp" + "soh/Enhancements/mods.cpp" ) source_group("Source Files\\soh\\Enhancements\\mods" FILES ${Source_Files__soh__Enhancements__mods}) diff --git a/soh/soh/Enhancements/mods/modhooks.cpp b/soh/soh/Enhancements/mods.cpp similarity index 93% rename from soh/soh/Enhancements/mods/modhooks.cpp rename to soh/soh/Enhancements/mods.cpp index 510f09017..98150fa3f 100644 --- a/soh/soh/Enhancements/mods/modhooks.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -1,5 +1,6 @@ -#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "mods.h" #include +#include "game-interactor/GameInteractor.h" extern "C" { #include @@ -8,7 +9,7 @@ extern PlayState* gPlayState; extern void Play_PerformSave(PlayState* play); } -void RegisterAutoSaveOnReceiveItem() { +void RegisterAutoSaveOnReceiveItemHook() { GameInteractor::Instance->RegisterGameHook([](u8 item) { if (CVarGetInteger("gAutosave", 0) && (gPlayState != NULL) && (gPlayState->sceneNum != SCENE_KENJYANOMA) && (gSaveContext.pendingSale == ITEM_NONE) && (gPlayState->sceneNum != SCENE_GANON_DEMO)) { if (CVarGetInteger("gAutosaveAllItems", 0)) { @@ -63,6 +64,6 @@ void RegisterAutoSaveOnReceiveItem() { }); } -extern "C" void RegisterModHooks() { - RegisterAutoSaveOnReceiveItem(); +void InitMods() { + RegisterAutoSaveOnReceiveItemHook(); } diff --git a/soh/soh/Enhancements/mods.h b/soh/soh/Enhancements/mods.h new file mode 100644 index 000000000..99f547d3a --- /dev/null +++ b/soh/soh/Enhancements/mods.h @@ -0,0 +1,14 @@ +#ifndef MODS_H +#define MODS_H + +#ifdef __cplusplus +extern "C" { +#endif + +void InitMods(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/soh/soh/Enhancements/mods/modhooks.h b/soh/soh/Enhancements/mods/modhooks.h deleted file mode 100644 index 96b0da8e6..000000000 --- a/soh/soh/Enhancements/mods/modhooks.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef __cplusplus -extern "C" { - void RegisterModHooks(void); -} -#endif diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 968c9499a..d06d0aab9 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -74,7 +74,7 @@ CrowdControl* CrowdControl::Instance; #endif -#include "Enhancements/mods/modhooks.h" +#include "Enhancements/mods.h" #include "Enhancements/game-interactor/GameInteractor.h" #include @@ -588,7 +588,7 @@ extern "C" void InitOTR() { OTRExtScanner(); VanillaItemTable_Init(); - RegisterModHooks(); + InitMods(); time_t now = time(NULL); tm *tm_now = localtime(&now);