From 591c71f35109f469d61354261ce28518e0b57a79 Mon Sep 17 00:00:00 2001 From: Sunketchupm Date: Thu, 29 Jan 2026 15:12:13 -0500 Subject: [PATCH] Fix interactions spoofing --- autogen/convert_functions.py | 9 ++++- src/pc/lua/smlua_functions_autogen.c | 60 ++++++++++++++-------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 9284eed8f..eb1319c25 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -866,7 +866,7 @@ def build_return_value(id, rtype, spoof_ret_as_bool): return ' smlua_push_pointer(L, %s, (void*)%s, NULL);\n' % (lvt, id) elif '???' not in lot and lot != 'LOT_NONE': return ' smlua_push_object(L, %s, %s, NULL);\n' % (lot, id) - + if spoof_ret_as_bool: lfunc = 'lua_pushboolean' @@ -980,7 +980,12 @@ def build_function(function, do_extern, spoof_ret_as_bool): push_value = True if is_interact_func: # special case for interaction functions to call the hooks associated with interactions - s += " lua_pushinteger(L, process_interaction(m, " + fid.upper() + ", o, " + fid + "));\n" + ctype = "integer" + if spoof_ret_as_bool: + ctype = "boolean" + + begin = " lua_push%s" % ctype + s += begin + "(L, process_interaction(m, " + fid.upper() + ", o, " + fid + "));\n" else: call_str = build_call(function, spoof_ret_as_bool) push_value = "lua_push" in call_str diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index ccc33ca42..d5078a482 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -14364,7 +14364,7 @@ int smlua_func_interact_coin_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_coin"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_COIN, o, interact_coin)); + lua_pushboolean(L, process_interaction(m, INTERACT_COIN, o, interact_coin)); return 1; } @@ -14404,7 +14404,7 @@ int smlua_func_interact_water_ring_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_water_ring"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_WATER_RING, o, interact_water_ring)); + lua_pushboolean(L, process_interaction(m, INTERACT_WATER_RING, o, interact_water_ring)); return 1; } @@ -14444,7 +14444,7 @@ int smlua_func_interact_star_or_key_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_star_or_key"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_STAR_OR_KEY, o, interact_star_or_key)); + lua_pushboolean(L, process_interaction(m, INTERACT_STAR_OR_KEY, o, interact_star_or_key)); return 1; } @@ -14484,7 +14484,7 @@ int smlua_func_interact_bbh_entrance_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_bbh_entrance"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_BBH_ENTRANCE, o, interact_bbh_entrance)); + lua_pushboolean(L, process_interaction(m, INTERACT_BBH_ENTRANCE, o, interact_bbh_entrance)); return 1; } @@ -14524,7 +14524,7 @@ int smlua_func_interact_warp_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_warp"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_WARP, o, interact_warp)); + lua_pushboolean(L, process_interaction(m, INTERACT_WARP, o, interact_warp)); return 1; } @@ -14564,7 +14564,7 @@ int smlua_func_interact_warp_door_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_warp_door"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_WARP_DOOR, o, interact_warp_door)); + lua_pushboolean(L, process_interaction(m, INTERACT_WARP_DOOR, o, interact_warp_door)); return 1; } @@ -14604,7 +14604,7 @@ int smlua_func_interact_door_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_door"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_DOOR, o, interact_door)); + lua_pushboolean(L, process_interaction(m, INTERACT_DOOR, o, interact_door)); return 1; } @@ -14644,7 +14644,7 @@ int smlua_func_interact_cannon_base_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_cannon_base"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_CANNON_BASE, o, interact_cannon_base)); + lua_pushboolean(L, process_interaction(m, INTERACT_CANNON_BASE, o, interact_cannon_base)); return 1; } @@ -14684,7 +14684,7 @@ int smlua_func_interact_player_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_player"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_PLAYER, o, interact_player)); + lua_pushboolean(L, process_interaction(m, INTERACT_PLAYER, o, interact_player)); return 1; } @@ -14724,7 +14724,7 @@ int smlua_func_interact_igloo_barrier_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_igloo_barrier"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_IGLOO_BARRIER, o, interact_igloo_barrier)); + lua_pushboolean(L, process_interaction(m, INTERACT_IGLOO_BARRIER, o, interact_igloo_barrier)); return 1; } @@ -14764,7 +14764,7 @@ int smlua_func_interact_tornado_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_tornado"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_TORNADO, o, interact_tornado)); + lua_pushboolean(L, process_interaction(m, INTERACT_TORNADO, o, interact_tornado)); return 1; } @@ -14804,7 +14804,7 @@ int smlua_func_interact_whirlpool_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_whirlpool"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_WHIRLPOOL, o, interact_whirlpool)); + lua_pushboolean(L, process_interaction(m, INTERACT_WHIRLPOOL, o, interact_whirlpool)); return 1; } @@ -14844,7 +14844,7 @@ int smlua_func_interact_strong_wind_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_strong_wind"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_STRONG_WIND, o, interact_strong_wind)); + lua_pushboolean(L, process_interaction(m, INTERACT_STRONG_WIND, o, interact_strong_wind)); return 1; } @@ -14884,7 +14884,7 @@ int smlua_func_interact_flame_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_flame"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_FLAME, o, interact_flame)); + lua_pushboolean(L, process_interaction(m, INTERACT_FLAME, o, interact_flame)); return 1; } @@ -14924,7 +14924,7 @@ int smlua_func_interact_snufit_bullet_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_snufit_bullet"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_SNUFIT_BULLET, o, interact_snufit_bullet)); + lua_pushboolean(L, process_interaction(m, INTERACT_SNUFIT_BULLET, o, interact_snufit_bullet)); return 1; } @@ -14964,7 +14964,7 @@ int smlua_func_interact_clam_or_bubba_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_clam_or_bubba"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_CLAM_OR_BUBBA, o, interact_clam_or_bubba)); + lua_pushboolean(L, process_interaction(m, INTERACT_CLAM_OR_BUBBA, o, interact_clam_or_bubba)); return 1; } @@ -15004,7 +15004,7 @@ int smlua_func_interact_bully_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_bully"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_BULLY, o, interact_bully)); + lua_pushboolean(L, process_interaction(m, INTERACT_BULLY, o, interact_bully)); return 1; } @@ -15044,7 +15044,7 @@ int smlua_func_interact_shock_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_shock"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_SHOCK, o, interact_shock)); + lua_pushboolean(L, process_interaction(m, INTERACT_SHOCK, o, interact_shock)); return 1; } @@ -15084,7 +15084,7 @@ int smlua_func_interact_mr_blizzard_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_mr_blizzard"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_MR_BLIZZARD, o, interact_mr_blizzard)); + lua_pushboolean(L, process_interaction(m, INTERACT_MR_BLIZZARD, o, interact_mr_blizzard)); return 1; } @@ -15124,7 +15124,7 @@ int smlua_func_interact_hit_from_below_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_hit_from_below"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_HIT_FROM_BELOW, o, interact_hit_from_below)); + lua_pushboolean(L, process_interaction(m, INTERACT_HIT_FROM_BELOW, o, interact_hit_from_below)); return 1; } @@ -15164,7 +15164,7 @@ int smlua_func_interact_bounce_top_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_bounce_top"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_BOUNCE_TOP, o, interact_bounce_top)); + lua_pushboolean(L, process_interaction(m, INTERACT_BOUNCE_TOP, o, interact_bounce_top)); return 1; } @@ -15204,7 +15204,7 @@ int smlua_func_interact_spiny_walking_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_spiny_walking"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_SPINY_WALKING, o, interact_spiny_walking)); + lua_pushboolean(L, process_interaction(m, INTERACT_SPINY_WALKING, o, interact_spiny_walking)); return 1; } @@ -15244,7 +15244,7 @@ int smlua_func_interact_damage_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_damage"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_DAMAGE, o, interact_damage)); + lua_pushboolean(L, process_interaction(m, INTERACT_DAMAGE, o, interact_damage)); return 1; } @@ -15284,7 +15284,7 @@ int smlua_func_interact_breakable_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_breakable"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_BREAKABLE, o, interact_breakable)); + lua_pushboolean(L, process_interaction(m, INTERACT_BREAKABLE, o, interact_breakable)); return 1; } @@ -15324,7 +15324,7 @@ int smlua_func_interact_koopa_shell_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_koopa_shell"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_KOOPA_SHELL, o, interact_koopa_shell)); + lua_pushboolean(L, process_interaction(m, INTERACT_KOOPA_SHELL, o, interact_koopa_shell)); return 1; } @@ -15364,7 +15364,7 @@ int smlua_func_interact_pole_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_pole"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_POLE, o, interact_pole)); + lua_pushboolean(L, process_interaction(m, INTERACT_POLE, o, interact_pole)); return 1; } @@ -15404,7 +15404,7 @@ int smlua_func_interact_hoot_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_hoot"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_HOOT, o, interact_hoot)); + lua_pushboolean(L, process_interaction(m, INTERACT_HOOT, o, interact_hoot)); return 1; } @@ -15444,7 +15444,7 @@ int smlua_func_interact_cap_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_cap"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_CAP, o, interact_cap)); + lua_pushboolean(L, process_interaction(m, INTERACT_CAP, o, interact_cap)); return 1; } @@ -15484,7 +15484,7 @@ int smlua_func_interact_grabbable_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_grabbable"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_GRABBABLE, o, interact_grabbable)); + lua_pushboolean(L, process_interaction(m, INTERACT_GRABBABLE, o, interact_grabbable)); return 1; } @@ -15524,7 +15524,7 @@ int smlua_func_interact_text_SPOOFED(lua_State* L) { struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_text"); return 0; } - lua_pushinteger(L, process_interaction(m, INTERACT_TEXT, o, interact_text)); + lua_pushboolean(L, process_interaction(m, INTERACT_TEXT, o, interact_text)); return 1; }