[GameInteractor] Update Naming Modhooks (#2543)

This commit is contained in:
David Chavez 2023-02-27 01:46:25 +01:00 committed by GitHub
parent c1ddeec02a
commit 448b4e49d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 13 deletions

View File

@ -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})

View File

@ -1,5 +1,6 @@
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "mods.h"
#include <libultraship/bridge.h>
#include "game-interactor/GameInteractor.h"
extern "C" {
#include <z64.h>
@ -8,7 +9,7 @@ extern PlayState* gPlayState;
extern void Play_PerformSave(PlayState* play);
}
void RegisterAutoSaveOnReceiveItem() {
void RegisterAutoSaveOnReceiveItemHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnReceiveItem>([](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();
}

View File

@ -0,0 +1,14 @@
#ifndef MODS_H
#define MODS_H
#ifdef __cplusplus
extern "C" {
#endif
void InitMods();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +0,0 @@
#ifdef __cplusplus
extern "C" {
void RegisterModHooks(void);
}
#endif

View File

@ -74,7 +74,7 @@
CrowdControl* CrowdControl::Instance;
#endif
#include "Enhancements/mods/modhooks.h"
#include "Enhancements/mods.h"
#include "Enhancements/game-interactor/GameInteractor.h"
#include <libultraship/libultraship.h>
@ -588,7 +588,7 @@ extern "C" void InitOTR() {
OTRExtScanner();
VanillaItemTable_Init();
RegisterModHooks();
InitMods();
time_t now = time(NULL);
tm *tm_now = localtime(&now);