Fix HOOK_ON_DIALOG
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run

This commit is contained in:
PeachyPeachSM64 2025-09-13 01:26:15 +02:00
parent 7f2c5cc53b
commit 2c332d4db6
2 changed files with 9 additions and 6 deletions

View file

@ -309,17 +309,20 @@ def main():
name=input["name"]
)
n_outputs = len(hook_event["outputs"])
generated += SMLUA_CALL_EVENT_HOOKS_CALLBACK.format(
n_inputs=len(hook_event["inputs"]) - mod_index_found,
n_outputs=len(hook_event["outputs"]),
n_outputs=n_outputs,
hook_type=hook_event["type"],
set_hook_result=set_hook_result
)
# Note: relative indexes for return values are reversed in the Lua stack
# -1 is the last value, -2 the penultimate, ... and -N the first
for i, output in enumerate(hook_event["outputs"]):
generated += SMLUA_TYPES[output["type"]]["output"].format(
name=output["name"],
output_index=i+1,
output_index=n_outputs - i,
return_on_output_set=return_on_output_set
)

View file

@ -1082,13 +1082,13 @@ bool smlua_call_event_hooks_HOOK_ON_DIALOG(s32 dialogID, bool *openDialogBox, co
hookResult = true;
// return openDialogBox
if (lua_type(L, -1) == LUA_TBOOLEAN) {
*openDialogBox = smlua_to_boolean(L, -1);
if (lua_type(L, -2) == LUA_TBOOLEAN) {
*openDialogBox = smlua_to_boolean(L, -2);
}
// return dialogTextOverride
if (lua_type(L, -2) == LUA_TSTRING) {
*dialogTextOverride = smlua_to_string(L, -2);
if (lua_type(L, -1) == LUA_TSTRING) {
*dialogTextOverride = smlua_to_string(L, -1);
}
lua_settop(L, prevTop);