From d51ee7ffe48d0fb6cea90295ff0a7f1a474a4ec2 Mon Sep 17 00:00:00 2001 From: Blockyyy <88585273+Blockyyy@users.noreply.github.com> Date: Mon, 25 Nov 2024 07:51:32 +0100 Subject: [PATCH] Fix HOOK_ON_SEQ_LOAD (#518) --- src/audio/load.c | 4 ++-- src/pc/lua/smlua_hooks.c | 2 +- src/pc/lua/smlua_hooks.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/load.c b/src/audio/load.c index 29f6f032c..281dbe445 100644 --- a/src/audio/load.c +++ b/src/audio/load.c @@ -1553,10 +1553,10 @@ void preload_sequence(u32 seqId, u8 preloadMask) { void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync); void load_sequence(u32 player, u32 seqId, s32 loadAsync) { - u8 returnValue = 0; + s16 returnValue = -1; smlua_call_event_hooks_on_seq_load(HOOK_ON_SEQ_LOAD, player, seqId, loadAsync, &returnValue); - if (returnValue != 0) { + if (returnValue > -1) { seqId = returnValue; } diff --git a/src/pc/lua/smlua_hooks.c b/src/pc/lua/smlua_hooks.c index b6b6887f6..f0e834985 100644 --- a/src/pc/lua/smlua_hooks.c +++ b/src/pc/lua/smlua_hooks.c @@ -723,7 +723,7 @@ void smlua_call_event_hooks_on_play_sound(enum LuaHookedEventType hookType, s32 } } -void smlua_call_event_hooks_on_seq_load(enum LuaHookedEventType hookType, u32 player, u32 seqId, s32 loadAsync, u8* returnValue) { +void smlua_call_event_hooks_on_seq_load(enum LuaHookedEventType hookType, u32 player, u32 seqId, s32 loadAsync, s16* returnValue) { lua_State* L = gLuaState; if (L == NULL) { return; } struct LuaHookedEvent* hook = &sHookedEvents[hookType]; diff --git a/src/pc/lua/smlua_hooks.h b/src/pc/lua/smlua_hooks.h index e36fc0651..ced55b2ad 100644 --- a/src/pc/lua/smlua_hooks.h +++ b/src/pc/lua/smlua_hooks.h @@ -185,7 +185,7 @@ bool smlua_call_event_hooks_mario_param_and_int_ret_int(enum LuaHookedEventType bool smlua_call_event_hooks_mario_param_ret_float(enum LuaHookedEventType hookType, struct MarioState* m, f32* returnValue); bool smlua_call_event_hooks_mario_param_and_int_and_int_ret_int(enum LuaHookedEventType hookType, struct MarioState* m, s32 param, u32 args, s32* returnValue); void smlua_call_event_hooks_graph_node_object_and_int_param(enum LuaHookedEventType hookType, struct GraphNodeObject* node, s32 param); -void smlua_call_event_hooks_on_seq_load(enum LuaHookedEventType hookType, u32 player, u32 seqId, s32 loadAsync, u8* returnValue); +void smlua_call_event_hooks_on_seq_load(enum LuaHookedEventType hookType, u32 player, u32 seqId, s32 loadAsync, s16* returnValue); const char *smlua_call_event_hooks_int_ret_bool_and_string(enum LuaHookedEventType hookType, s32 param, bool* returnValue); void smlua_call_event_hooks_string_param(enum LuaHookedEventType hookType, const char* string);