diff --git a/autogen/convert_header.py b/autogen/convert_header.py index fbe84bd65..a3e9964a9 100644 --- a/autogen/convert_header.py +++ b/autogen/convert_header.py @@ -202,6 +202,8 @@ def build_function(function): else: s = 'int smlua_func_%s(lua_State* L) {\n' % function['identifier'] + s += ' if(!smlua_functions_valid_param_count(L, %d)) { return 0; }\n\n' % len(function['params']) + i = 1 for param in function['params']: s += build_param(param, i) diff --git a/src/pc/lua/smlua_functions.c b/src/pc/lua/smlua_functions.c index 75b5d1c69..4801aa080 100644 --- a/src/pc/lua/smlua_functions.c +++ b/src/pc/lua/smlua_functions.c @@ -9,11 +9,23 @@ #include "object_fields.h" #include "engine/math_util.h" +bool smlua_functions_valid_param_count(lua_State* L, int expected) { + int top = lua_gettop(L); + if (top != expected) { + LOG_LUA("improper param count: expected %u, received %u", expected, top); + smlua_logline(); + return false; + } + return true; +} + ////////// // misc // ////////// int smlua_func_sins(lua_State* L) { + if (!smlua_functions_valid_param_count(L, 1)) { return 0; } + f32 x = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { return 0; } @@ -22,6 +34,8 @@ int smlua_func_sins(lua_State* L) { } int smlua_func_coss(lua_State* L) { + if (!smlua_functions_valid_param_count(L, 1)) { return 0; } + f32 x = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { return 0; } @@ -30,6 +44,8 @@ int smlua_func_coss(lua_State* L) { } int smlua_func_atan2s(lua_State* L) { + if (!smlua_functions_valid_param_count(L, 2)) { return 0; } + f32 y = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { return 0; } f32 x = smlua_to_number(L, 2); diff --git a/src/pc/lua/smlua_functions.h b/src/pc/lua/smlua_functions.h index 00bc838c1..60f0d69d5 100644 --- a/src/pc/lua/smlua_functions.h +++ b/src/pc/lua/smlua_functions.h @@ -1,6 +1,7 @@ #ifndef SMLUA_FUNCTIONS_H #define SMLUA_FUNCTIONS_H +bool smlua_functions_valid_param_count(lua_State* L, int expected); void smlua_bind_functions(void); #endif \ No newline at end of file diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index c2d668b20..ec9313f9c 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -17,6 +17,8 @@ ////////////// int smlua_func_set_camera_shake_from_hit(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + s16 shake = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } @@ -26,6 +28,8 @@ int smlua_func_set_camera_shake_from_hit(lua_State* L) { } int smlua_func_set_environmental_camera_shake(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + s16 shake = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } @@ -35,6 +39,8 @@ int smlua_func_set_environmental_camera_shake(lua_State* L) { } int smlua_func_set_camera_shake_from_point(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + s16 shake = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } f32 posX = smlua_to_number(L, 2); @@ -54,6 +60,8 @@ int smlua_func_set_camera_shake_from_point(lua_State* L) { //////////////// int smlua_func_play_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + s32 soundBits = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } @@ -79,6 +87,8 @@ int smlua_func_play_sound(lua_State* L) { ///////////// int smlua_func_is_anim_at_end(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -88,6 +98,8 @@ int smlua_func_is_anim_at_end(lua_State* L) { } int smlua_func_is_anim_past_end(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -97,6 +109,8 @@ int smlua_func_is_anim_past_end(lua_State* L) { } int smlua_func_set_mario_animation(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 targetAnimID = smlua_to_integer(L, 2); @@ -108,6 +122,8 @@ int smlua_func_set_mario_animation(lua_State* L) { } int smlua_func_set_mario_anim_with_accel(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 targetAnimID = smlua_to_integer(L, 2); @@ -121,6 +137,8 @@ int smlua_func_set_mario_anim_with_accel(lua_State* L) { } int smlua_func_set_anim_to_frame(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 animFrame = smlua_to_integer(L, 2); @@ -132,6 +150,8 @@ int smlua_func_set_anim_to_frame(lua_State* L) { } int smlua_func_is_anim_past_frame(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 animFrame = smlua_to_integer(L, 2); @@ -143,6 +163,8 @@ int smlua_func_is_anim_past_frame(lua_State* L) { } int smlua_func_find_mario_anim_flags_and_translation(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); if (!gSmLuaConvertSuccess) { return 0; } s32 yaw = smlua_to_integer(L, 2); @@ -166,6 +188,8 @@ int smlua_func_find_mario_anim_flags_and_translation(lua_State* L) { } int smlua_func_update_mario_pos_for_anim(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -175,6 +199,8 @@ int smlua_func_update_mario_pos_for_anim(lua_State* L) { } int smlua_func_return_mario_anim_y_translation(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -184,6 +210,8 @@ int smlua_func_return_mario_anim_y_translation(lua_State* L) { } int smlua_func_play_sound_if_no_flag(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -197,6 +225,8 @@ int smlua_func_play_sound_if_no_flag(lua_State* L) { } int smlua_func_play_mario_jump_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -206,6 +236,8 @@ int smlua_func_play_mario_jump_sound(lua_State* L) { } int smlua_func_adjust_sound_for_speed(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -215,6 +247,8 @@ int smlua_func_adjust_sound_for_speed(lua_State* L) { } int smlua_func_play_sound_and_spawn_particles(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -228,6 +262,8 @@ int smlua_func_play_sound_and_spawn_particles(lua_State* L) { } int smlua_func_play_mario_action_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -241,6 +277,8 @@ int smlua_func_play_mario_action_sound(lua_State* L) { } int smlua_func_play_mario_landing_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -252,6 +290,8 @@ int smlua_func_play_mario_landing_sound(lua_State* L) { } int smlua_func_play_mario_landing_sound_once(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -263,6 +303,8 @@ int smlua_func_play_mario_landing_sound_once(lua_State* L) { } int smlua_func_play_mario_heavy_landing_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -274,6 +316,8 @@ int smlua_func_play_mario_heavy_landing_sound(lua_State* L) { } int smlua_func_play_mario_heavy_landing_sound_once(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 soundBits = smlua_to_integer(L, 2); @@ -285,6 +329,8 @@ int smlua_func_play_mario_heavy_landing_sound_once(lua_State* L) { } int smlua_func_play_mario_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 primarySoundBits = smlua_to_integer(L, 2); @@ -298,6 +344,8 @@ int smlua_func_play_mario_sound(lua_State* L) { } int smlua_func_mario_set_bubbled(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -307,6 +355,8 @@ int smlua_func_mario_set_bubbled(lua_State* L) { } int smlua_func_mario_set_forward_vel(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 speed = smlua_to_number(L, 2); @@ -318,6 +368,8 @@ int smlua_func_mario_set_forward_vel(lua_State* L) { } int smlua_func_mario_get_floor_class(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -327,6 +379,8 @@ int smlua_func_mario_get_floor_class(lua_State* L) { } int smlua_func_mario_get_terrain_sound_addend(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -337,6 +391,8 @@ int smlua_func_mario_get_terrain_sound_addend(lua_State* L) { /* int smlua_func_resolve_and_return_wall_collisions(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); @@ -362,6 +418,8 @@ int smlua_func_resolve_and_return_wall_collisions(lua_State* L) { /* int smlua_func_vec3f_find_ceil(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); @@ -386,6 +444,8 @@ int smlua_func_vec3f_find_ceil(lua_State* L) { */ int smlua_func_mario_facing_downhill(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 turnYaw = smlua_to_integer(L, 2); @@ -397,6 +457,8 @@ int smlua_func_mario_facing_downhill(lua_State* L) { } int smlua_func_mario_floor_is_slippery(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -406,6 +468,8 @@ int smlua_func_mario_floor_is_slippery(lua_State* L) { } int smlua_func_mario_floor_is_slope(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -415,6 +479,8 @@ int smlua_func_mario_floor_is_slope(lua_State* L) { } int smlua_func_mario_floor_is_steep(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -424,6 +490,8 @@ int smlua_func_mario_floor_is_steep(lua_State* L) { } int smlua_func_find_floor_height_relative_polar(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 angleFromMario = smlua_to_integer(L, 2); @@ -437,6 +505,8 @@ int smlua_func_find_floor_height_relative_polar(lua_State* L) { } int smlua_func_find_floor_slope(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 yawOffset = smlua_to_integer(L, 2); @@ -448,6 +518,8 @@ int smlua_func_find_floor_slope(lua_State* L) { } int smlua_func_update_mario_sound_and_camera(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -457,6 +529,8 @@ int smlua_func_update_mario_sound_and_camera(lua_State* L) { } int smlua_func_set_steep_jump_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -466,6 +540,8 @@ int smlua_func_set_steep_jump_action(lua_State* L) { } int smlua_func_set_mario_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 action = smlua_to_integer(L, 2); @@ -479,6 +555,8 @@ int smlua_func_set_mario_action(lua_State* L) { } int smlua_func_set_jump_from_landing(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -488,6 +566,8 @@ int smlua_func_set_jump_from_landing(lua_State* L) { } int smlua_func_set_jumping_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 action = smlua_to_integer(L, 2); @@ -501,6 +581,8 @@ int smlua_func_set_jumping_action(lua_State* L) { } int smlua_func_drop_and_set_mario_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 action = smlua_to_integer(L, 2); @@ -514,6 +596,8 @@ int smlua_func_drop_and_set_mario_action(lua_State* L) { } int smlua_func_hurt_and_set_mario_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 action = smlua_to_integer(L, 2); @@ -529,6 +613,8 @@ int smlua_func_hurt_and_set_mario_action(lua_State* L) { } int smlua_func_check_common_action_exits(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -538,6 +624,8 @@ int smlua_func_check_common_action_exits(lua_State* L) { } int smlua_func_check_common_hold_action_exits(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -547,6 +635,8 @@ int smlua_func_check_common_hold_action_exits(lua_State* L) { } int smlua_func_transition_submerged_to_walking(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -556,6 +646,8 @@ int smlua_func_transition_submerged_to_walking(lua_State* L) { } int smlua_func_set_water_plunge_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -565,6 +657,8 @@ int smlua_func_set_water_plunge_action(lua_State* L) { } int smlua_func_execute_mario_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); if (!gSmLuaConvertSuccess) { return 0; } @@ -574,6 +668,8 @@ int smlua_func_execute_mario_action(lua_State* L) { } int smlua_func_force_idle_state(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -587,6 +683,8 @@ int smlua_func_force_idle_state(lua_State* L) { ////////////////////////////// int smlua_func_play_flip_sounds(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 frame1 = smlua_to_integer(L, 2); @@ -603,6 +701,8 @@ int smlua_func_play_flip_sounds(lua_State* L) { } int smlua_func_play_far_fall_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -613,6 +713,8 @@ int smlua_func_play_far_fall_sound(lua_State* L) { } int smlua_func_play_knockback_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -623,6 +725,8 @@ int smlua_func_play_knockback_sound(lua_State* L) { } int smlua_func_lava_boost_on_wall(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -633,6 +737,8 @@ int smlua_func_lava_boost_on_wall(lua_State* L) { } int smlua_func_check_fall_damage(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 hardFallAction = smlua_to_integer(L, 2); @@ -645,6 +751,8 @@ int smlua_func_check_fall_damage(lua_State* L) { } int smlua_func_check_kick_or_dive_in_air(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -655,6 +763,8 @@ int smlua_func_check_kick_or_dive_in_air(lua_State* L) { } int smlua_func_should_get_stuck_in_ground(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -665,6 +775,8 @@ int smlua_func_should_get_stuck_in_ground(lua_State* L) { } int smlua_func_check_fall_damage_or_get_stuck(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 hardFallAction = smlua_to_integer(L, 2); @@ -677,6 +789,8 @@ int smlua_func_check_fall_damage_or_get_stuck(lua_State* L) { } int smlua_func_check_horizontal_wind(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -687,6 +801,8 @@ int smlua_func_check_horizontal_wind(lua_State* L) { } int smlua_func_update_air_with_turn(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -697,6 +813,8 @@ int smlua_func_update_air_with_turn(lua_State* L) { } int smlua_func_update_air_without_turn(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -707,6 +825,8 @@ int smlua_func_update_air_without_turn(lua_State* L) { } int smlua_func_update_lava_boost_or_twirling(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -717,6 +837,8 @@ int smlua_func_update_lava_boost_or_twirling(lua_State* L) { } int smlua_func_update_flying_yaw(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -727,6 +849,8 @@ int smlua_func_update_flying_yaw(lua_State* L) { } int smlua_func_update_flying_pitch(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -737,6 +861,8 @@ int smlua_func_update_flying_pitch(lua_State* L) { } int smlua_func_update_flying(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -747,6 +873,8 @@ int smlua_func_update_flying(lua_State* L) { } int smlua_func_common_air_action_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 landAction = smlua_to_integer(L, 2); @@ -763,6 +891,8 @@ int smlua_func_common_air_action_step(lua_State* L) { } int smlua_func_act_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -773,6 +903,8 @@ int smlua_func_act_jump(lua_State* L) { } int smlua_func_act_double_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -783,6 +915,8 @@ int smlua_func_act_double_jump(lua_State* L) { } int smlua_func_act_triple_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -793,6 +927,8 @@ int smlua_func_act_triple_jump(lua_State* L) { } int smlua_func_act_backflip(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -803,6 +939,8 @@ int smlua_func_act_backflip(lua_State* L) { } int smlua_func_act_freefall(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -813,6 +951,8 @@ int smlua_func_act_freefall(lua_State* L) { } int smlua_func_act_hold_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -823,6 +963,8 @@ int smlua_func_act_hold_jump(lua_State* L) { } int smlua_func_act_hold_freefall(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -833,6 +975,8 @@ int smlua_func_act_hold_freefall(lua_State* L) { } int smlua_func_act_side_flip(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -843,6 +987,8 @@ int smlua_func_act_side_flip(lua_State* L) { } int smlua_func_act_wall_kick_air(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -853,6 +999,8 @@ int smlua_func_act_wall_kick_air(lua_State* L) { } int smlua_func_act_long_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -863,6 +1011,8 @@ int smlua_func_act_long_jump(lua_State* L) { } int smlua_func_act_riding_shell_air(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -873,6 +1023,8 @@ int smlua_func_act_riding_shell_air(lua_State* L) { } int smlua_func_act_twirling(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -883,6 +1035,8 @@ int smlua_func_act_twirling(lua_State* L) { } int smlua_func_act_dive(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -893,6 +1047,8 @@ int smlua_func_act_dive(lua_State* L) { } int smlua_func_act_air_throw(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -903,6 +1059,8 @@ int smlua_func_act_air_throw(lua_State* L) { } int smlua_func_act_water_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -913,6 +1071,8 @@ int smlua_func_act_water_jump(lua_State* L) { } int smlua_func_act_hold_water_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -923,6 +1083,8 @@ int smlua_func_act_hold_water_jump(lua_State* L) { } int smlua_func_act_steep_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -933,6 +1095,8 @@ int smlua_func_act_steep_jump(lua_State* L) { } int smlua_func_act_ground_pound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -943,6 +1107,8 @@ int smlua_func_act_ground_pound(lua_State* L) { } int smlua_func_act_burning_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -953,6 +1119,8 @@ int smlua_func_act_burning_jump(lua_State* L) { } int smlua_func_act_burning_fall(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -963,6 +1131,8 @@ int smlua_func_act_burning_fall(lua_State* L) { } int smlua_func_act_crazy_box_bounce(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -973,6 +1143,8 @@ int smlua_func_act_crazy_box_bounce(lua_State* L) { } int smlua_func_common_air_knockback_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 landAction = smlua_to_integer(L, 2); @@ -991,6 +1163,8 @@ int smlua_func_common_air_knockback_step(lua_State* L) { } int smlua_func_check_wall_kick(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1001,6 +1175,8 @@ int smlua_func_check_wall_kick(lua_State* L) { } int smlua_func_act_backward_air_kb(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1011,6 +1187,8 @@ int smlua_func_act_backward_air_kb(lua_State* L) { } int smlua_func_act_forward_air_kb(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1021,6 +1199,8 @@ int smlua_func_act_forward_air_kb(lua_State* L) { } int smlua_func_act_hard_backward_air_kb(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1031,6 +1211,8 @@ int smlua_func_act_hard_backward_air_kb(lua_State* L) { } int smlua_func_act_hard_forward_air_kb(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1041,6 +1223,8 @@ int smlua_func_act_hard_forward_air_kb(lua_State* L) { } int smlua_func_act_thrown_backward(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1051,6 +1235,8 @@ int smlua_func_act_thrown_backward(lua_State* L) { } int smlua_func_act_thrown_forward(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1061,6 +1247,8 @@ int smlua_func_act_thrown_forward(lua_State* L) { } int smlua_func_act_soft_bonk(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1071,6 +1259,8 @@ int smlua_func_act_soft_bonk(lua_State* L) { } int smlua_func_act_getting_blown(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1081,6 +1271,8 @@ int smlua_func_act_getting_blown(lua_State* L) { } int smlua_func_act_air_hit_wall(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1091,6 +1283,8 @@ int smlua_func_act_air_hit_wall(lua_State* L) { } int smlua_func_act_forward_rollout(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1101,6 +1295,8 @@ int smlua_func_act_forward_rollout(lua_State* L) { } int smlua_func_act_backward_rollout(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1111,6 +1307,8 @@ int smlua_func_act_backward_rollout(lua_State* L) { } int smlua_func_act_butt_slide_air(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1121,6 +1319,8 @@ int smlua_func_act_butt_slide_air(lua_State* L) { } int smlua_func_act_hold_butt_slide_air(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1131,6 +1331,8 @@ int smlua_func_act_hold_butt_slide_air(lua_State* L) { } int smlua_func_act_lava_boost(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1141,6 +1343,8 @@ int smlua_func_act_lava_boost(lua_State* L) { } int smlua_func_act_slide_kick(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1151,6 +1355,8 @@ int smlua_func_act_slide_kick(lua_State* L) { } int smlua_func_act_jump_kick(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1161,6 +1367,8 @@ int smlua_func_act_jump_kick(lua_State* L) { } int smlua_func_act_shot_from_cannon(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1171,6 +1379,8 @@ int smlua_func_act_shot_from_cannon(lua_State* L) { } int smlua_func_act_flying(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1181,6 +1391,8 @@ int smlua_func_act_flying(lua_State* L) { } int smlua_func_act_riding_hoot(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1191,6 +1403,8 @@ int smlua_func_act_riding_hoot(lua_State* L) { } int smlua_func_act_flying_triple_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1201,6 +1415,8 @@ int smlua_func_act_flying_triple_jump(lua_State* L) { } int smlua_func_act_top_of_pole_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1211,6 +1427,8 @@ int smlua_func_act_top_of_pole_jump(lua_State* L) { } int smlua_func_act_vertical_wind(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1221,6 +1439,8 @@ int smlua_func_act_vertical_wind(lua_State* L) { } int smlua_func_act_special_triple_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1231,6 +1451,8 @@ int smlua_func_act_special_triple_jump(lua_State* L) { } int smlua_func_check_common_airborne_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1241,6 +1463,8 @@ int smlua_func_check_common_airborne_cancels(lua_State* L) { } int smlua_func_mario_execute_airborne_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1255,6 +1479,8 @@ int smlua_func_mario_execute_airborne_action(lua_State* L) { /////////////////////////////// int smlua_func_add_tree_leaf_particles(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1265,6 +1491,8 @@ int smlua_func_add_tree_leaf_particles(lua_State* L) { } int smlua_func_play_climbing_sounds(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 b = smlua_to_integer(L, 2); @@ -1277,6 +1505,8 @@ int smlua_func_play_climbing_sounds(lua_State* L) { } int smlua_func_set_pole_position(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 offsetY = smlua_to_number(L, 2); @@ -1289,6 +1519,8 @@ int smlua_func_set_pole_position(lua_State* L) { } int smlua_func_act_holding_pole(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1299,6 +1531,8 @@ int smlua_func_act_holding_pole(lua_State* L) { } int smlua_func_act_climbing_pole(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1309,6 +1543,8 @@ int smlua_func_act_climbing_pole(lua_State* L) { } int smlua_func_act_grab_pole_slow(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1319,6 +1555,8 @@ int smlua_func_act_grab_pole_slow(lua_State* L) { } int smlua_func_act_grab_pole_fast(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1329,6 +1567,8 @@ int smlua_func_act_grab_pole_fast(lua_State* L) { } int smlua_func_act_top_of_pole_transition(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1339,6 +1579,8 @@ int smlua_func_act_top_of_pole_transition(lua_State* L) { } int smlua_func_act_top_of_pole(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1349,6 +1591,8 @@ int smlua_func_act_top_of_pole(lua_State* L) { } int smlua_func_perform_hanging_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1371,6 +1615,8 @@ int smlua_func_perform_hanging_step(lua_State* L) { } int smlua_func_update_hang_moving(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1381,6 +1627,8 @@ int smlua_func_update_hang_moving(lua_State* L) { } int smlua_func_update_hang_stationary(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1391,6 +1639,8 @@ int smlua_func_update_hang_stationary(lua_State* L) { } int smlua_func_act_start_hanging(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1401,6 +1651,8 @@ int smlua_func_act_start_hanging(lua_State* L) { } int smlua_func_act_hanging(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1411,6 +1663,8 @@ int smlua_func_act_hanging(lua_State* L) { } int smlua_func_act_hang_moving(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1421,6 +1675,8 @@ int smlua_func_act_hang_moving(lua_State* L) { } int smlua_func_let_go_of_ledge(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1431,6 +1687,8 @@ int smlua_func_let_go_of_ledge(lua_State* L) { } int smlua_func_climb_up_ledge(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1441,6 +1699,8 @@ int smlua_func_climb_up_ledge(lua_State* L) { } int smlua_func_update_ledge_climb_camera(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1451,6 +1711,8 @@ int smlua_func_update_ledge_climb_camera(lua_State* L) { } int smlua_func_update_ledge_climb(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 animation = smlua_to_integer(L, 2); @@ -1465,6 +1727,8 @@ int smlua_func_update_ledge_climb(lua_State* L) { } int smlua_func_act_ledge_grab(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1475,6 +1739,8 @@ int smlua_func_act_ledge_grab(lua_State* L) { } int smlua_func_act_ledge_climb_slow(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1485,6 +1751,8 @@ int smlua_func_act_ledge_climb_slow(lua_State* L) { } int smlua_func_act_ledge_climb_down(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1495,6 +1763,8 @@ int smlua_func_act_ledge_climb_down(lua_State* L) { } int smlua_func_act_ledge_climb_fast(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1505,6 +1775,8 @@ int smlua_func_act_ledge_climb_fast(lua_State* L) { } int smlua_func_act_grabbed(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1515,6 +1787,8 @@ int smlua_func_act_grabbed(lua_State* L) { } int smlua_func_act_in_cannon(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1525,6 +1799,8 @@ int smlua_func_act_in_cannon(lua_State* L) { } int smlua_func_act_tornado_twirling(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1535,6 +1811,8 @@ int smlua_func_act_tornado_twirling(lua_State* L) { } int smlua_func_act_bubbled(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1545,6 +1823,8 @@ int smlua_func_act_bubbled(lua_State* L) { } int smlua_func_check_common_automatic_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1555,6 +1835,8 @@ int smlua_func_check_common_automatic_cancels(lua_State* L) { } int smlua_func_mario_execute_automatic_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1569,6 +1851,8 @@ int smlua_func_mario_execute_automatic_action(lua_State* L) { ////////////////////////////// int smlua_func_print_displaying_credits_entry(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + extern void print_displaying_credits_entry(void); print_displaying_credits_entry(); @@ -1577,6 +1861,8 @@ int smlua_func_print_displaying_credits_entry(UNUSED lua_State* L) { } int smlua_func_bhv_end_peach_loop(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + extern void bhv_end_peach_loop(void); bhv_end_peach_loop(); @@ -1585,6 +1871,8 @@ int smlua_func_bhv_end_peach_loop(UNUSED lua_State* L) { } int smlua_func_bhv_end_toad_loop(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + extern void bhv_end_toad_loop(void); bhv_end_toad_loop(); @@ -1593,6 +1881,8 @@ int smlua_func_bhv_end_toad_loop(UNUSED lua_State* L) { } int smlua_func_handle_save_menu(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1604,6 +1894,8 @@ int smlua_func_handle_save_menu(lua_State* L) { /* int smlua_func_spawn_obj_at_mario_rel_yaw(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 model = smlua_to_integer(L, 2); @@ -1621,6 +1913,8 @@ int smlua_func_spawn_obj_at_mario_rel_yaw(lua_State* L) { */ int smlua_func_cutscene_take_cap_off(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1631,6 +1925,8 @@ int smlua_func_cutscene_take_cap_off(lua_State* L) { } int smlua_func_cutscene_put_cap_on(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1641,6 +1937,8 @@ int smlua_func_cutscene_put_cap_on(lua_State* L) { } int smlua_func_should_start_or_continue_dialog(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } struct Object* object = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); @@ -1653,6 +1951,8 @@ int smlua_func_should_start_or_continue_dialog(lua_State* L) { } int smlua_func_general_star_dance_handler(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 isInWater = smlua_to_integer(L, 2); @@ -1665,6 +1965,8 @@ int smlua_func_general_star_dance_handler(lua_State* L) { } int smlua_func_stuck_in_ground_handler(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 animation = smlua_to_integer(L, 2); @@ -1685,6 +1987,8 @@ int smlua_func_stuck_in_ground_handler(lua_State* L) { } int smlua_func_generate_yellow_sparkles(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + s16 x = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } s16 y = smlua_to_integer(L, 2); @@ -1705,6 +2009,8 @@ int smlua_func_generate_yellow_sparkles(lua_State* L) { //////////////////////////// int smlua_func_tilt_body_running(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1715,6 +2021,8 @@ int smlua_func_tilt_body_running(lua_State* L) { } int smlua_func_play_step_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 frame1 = smlua_to_integer(L, 2); @@ -1729,6 +2037,8 @@ int smlua_func_play_step_sound(lua_State* L) { } int smlua_func_align_with_floor(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1739,6 +2049,8 @@ int smlua_func_align_with_floor(lua_State* L) { } int smlua_func_begin_walking_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 forwardVel = smlua_to_number(L, 2); @@ -1755,6 +2067,8 @@ int smlua_func_begin_walking_action(lua_State* L) { } int smlua_func_check_ledge_climb_down(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1765,6 +2079,8 @@ int smlua_func_check_ledge_climb_down(lua_State* L) { } int smlua_func_slide_bonk(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 fastAction = smlua_to_integer(L, 2); @@ -1779,6 +2095,8 @@ int smlua_func_slide_bonk(lua_State* L) { } int smlua_func_set_triple_jump_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 action = smlua_to_integer(L, 2); @@ -1793,6 +2111,8 @@ int smlua_func_set_triple_jump_action(lua_State* L) { } int smlua_func_update_sliding_angle(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 accel = smlua_to_number(L, 2); @@ -1807,6 +2127,8 @@ int smlua_func_update_sliding_angle(lua_State* L) { } int smlua_func_update_sliding(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 stopSpeed = smlua_to_number(L, 2); @@ -1819,6 +2141,8 @@ int smlua_func_update_sliding(lua_State* L) { } int smlua_func_apply_slope_accel(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1829,6 +2153,8 @@ int smlua_func_apply_slope_accel(lua_State* L) { } int smlua_func_apply_landing_accel(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 frictionFactor = smlua_to_number(L, 2); @@ -1841,6 +2167,8 @@ int smlua_func_apply_landing_accel(lua_State* L) { } int smlua_func_update_shell_speed(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1851,6 +2179,8 @@ int smlua_func_update_shell_speed(lua_State* L) { } int smlua_func_apply_slope_decel(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 decelCoef = smlua_to_number(L, 2); @@ -1863,6 +2193,8 @@ int smlua_func_apply_slope_decel(lua_State* L) { } int smlua_func_update_decelerating_speed(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1873,6 +2205,8 @@ int smlua_func_update_decelerating_speed(lua_State* L) { } int smlua_func_update_walking_speed(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1883,6 +2217,8 @@ int smlua_func_update_walking_speed(lua_State* L) { } int smlua_func_should_begin_sliding(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1893,6 +2229,8 @@ int smlua_func_should_begin_sliding(lua_State* L) { } int smlua_func_analog_stick_held_back(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1903,6 +2241,8 @@ int smlua_func_analog_stick_held_back(lua_State* L) { } int smlua_func_check_ground_dive_or_punch(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1913,6 +2253,8 @@ int smlua_func_check_ground_dive_or_punch(lua_State* L) { } int smlua_func_begin_braking_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1923,6 +2265,8 @@ int smlua_func_begin_braking_action(lua_State* L) { } int smlua_func_anim_and_audio_for_walk(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1933,6 +2277,8 @@ int smlua_func_anim_and_audio_for_walk(lua_State* L) { } int smlua_func_anim_and_audio_for_hold_walk(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1943,6 +2289,8 @@ int smlua_func_anim_and_audio_for_hold_walk(lua_State* L) { } int smlua_func_anim_and_audio_for_heavy_walk(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1953,6 +2301,8 @@ int smlua_func_anim_and_audio_for_heavy_walk(lua_State* L) { } int smlua_func_push_or_sidle_wall(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -1975,6 +2325,8 @@ int smlua_func_push_or_sidle_wall(lua_State* L) { } int smlua_func_tilt_body_walking(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 startYaw = smlua_to_integer(L, 2); @@ -1987,6 +2339,8 @@ int smlua_func_tilt_body_walking(lua_State* L) { } int smlua_func_tilt_body_ground_shell(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 startYaw = smlua_to_integer(L, 2); @@ -1999,6 +2353,8 @@ int smlua_func_tilt_body_ground_shell(lua_State* L) { } int smlua_func_tilt_body_butt_slide(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2009,6 +2365,8 @@ int smlua_func_tilt_body_butt_slide(lua_State* L) { } int smlua_func_common_slide_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 endAction = smlua_to_integer(L, 2); @@ -2025,6 +2383,8 @@ int smlua_func_common_slide_action(lua_State* L) { } int smlua_func_common_slide_action_with_jump(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 stopAction = smlua_to_integer(L, 2); @@ -2043,6 +2403,8 @@ int smlua_func_common_slide_action_with_jump(lua_State* L) { } int smlua_func_stomach_slide_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 stopAction = smlua_to_integer(L, 2); @@ -2059,6 +2421,8 @@ int smlua_func_stomach_slide_action(lua_State* L) { } int smlua_func_common_ground_knockback_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 animation = smlua_to_integer(L, 2); @@ -2077,6 +2441,8 @@ int smlua_func_common_ground_knockback_action(lua_State* L) { } int smlua_func_common_landing_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 animation = smlua_to_integer(L, 2); @@ -2091,6 +2457,8 @@ int smlua_func_common_landing_action(lua_State* L) { } int smlua_func_quicksand_jump_land_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 animation1 = smlua_to_integer(L, 2); @@ -2109,6 +2477,8 @@ int smlua_func_quicksand_jump_land_action(lua_State* L) { } int smlua_func_check_common_moving_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2119,6 +2489,8 @@ int smlua_func_check_common_moving_cancels(lua_State* L) { } int smlua_func_mario_execute_moving_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2133,6 +2505,8 @@ int smlua_func_mario_execute_moving_action(lua_State* L) { //////////////////////////// int smlua_func_animated_stationary_ground_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 animation = smlua_to_integer(L, 2); @@ -2147,6 +2521,8 @@ int smlua_func_animated_stationary_ground_step(lua_State* L) { } int smlua_func_mario_update_punch_sequence(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2157,6 +2533,8 @@ int smlua_func_mario_update_punch_sequence(lua_State* L) { } int smlua_func_check_common_object_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2167,6 +2545,8 @@ int smlua_func_check_common_object_cancels(lua_State* L) { } int smlua_func_mario_execute_object_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2181,6 +2561,8 @@ int smlua_func_mario_execute_object_action(lua_State* L) { //////////////////////////////// int smlua_func_check_common_idle_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2191,6 +2573,8 @@ int smlua_func_check_common_idle_cancels(lua_State* L) { } int smlua_func_check_common_hold_idle_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2201,6 +2585,8 @@ int smlua_func_check_common_hold_idle_cancels(lua_State* L) { } int smlua_func_play_anim_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 actionState = smlua_to_integer(L, 2); @@ -2217,6 +2603,8 @@ int smlua_func_play_anim_sound(lua_State* L) { } int smlua_func_stopping_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 animID = smlua_to_integer(L, 2); @@ -2231,6 +2619,8 @@ int smlua_func_stopping_step(lua_State* L) { } int smlua_func_landing_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s32 arg1 = smlua_to_integer(L, 2); @@ -2245,6 +2635,8 @@ int smlua_func_landing_step(lua_State* L) { } int smlua_func_check_common_landing_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 action = smlua_to_integer(L, 2); @@ -2257,6 +2649,8 @@ int smlua_func_check_common_landing_cancels(lua_State* L) { } int smlua_func_check_common_stationary_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2267,6 +2661,8 @@ int smlua_func_check_common_stationary_cancels(lua_State* L) { } int smlua_func_mario_execute_stationary_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2281,6 +2677,8 @@ int smlua_func_mario_execute_stationary_action(lua_State* L) { /////////////////////////////// int smlua_func_set_swimming_at_surface_particles(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 particleFlag = smlua_to_integer(L, 2); @@ -2293,6 +2691,8 @@ int smlua_func_set_swimming_at_surface_particles(lua_State* L) { } int smlua_func_perform_water_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2303,6 +2703,8 @@ int smlua_func_perform_water_step(lua_State* L) { } int smlua_func_perform_water_full_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2325,6 +2727,8 @@ int smlua_func_perform_water_full_step(lua_State* L) { } int smlua_func_mario_execute_submerged_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2335,6 +2739,8 @@ int smlua_func_mario_execute_submerged_action(lua_State* L) { } int smlua_func_float_surface_gfx(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2345,6 +2751,8 @@ int smlua_func_float_surface_gfx(lua_State* L) { } int smlua_func_apply_water_current(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2371,6 +2779,8 @@ int smlua_func_apply_water_current(lua_State* L) { ////////////////// int smlua_func_get_additive_y_vel_for_jumps(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + lua_pushnumber(L, get_additive_y_vel_for_jumps()); @@ -2378,6 +2788,8 @@ int smlua_func_get_additive_y_vel_for_jumps(UNUSED lua_State* L) { } int smlua_func_mario_bonk_reflection(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 arg1 = smlua_to_integer(L, 2); @@ -2389,6 +2801,8 @@ int smlua_func_mario_bonk_reflection(lua_State* L) { } int smlua_func_mario_update_quicksand(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } f32 arg1 = smlua_to_number(L, 2); @@ -2400,6 +2814,8 @@ int smlua_func_mario_update_quicksand(lua_State* L) { } int smlua_func_mario_push_off_steep_floor(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 arg1 = smlua_to_integer(L, 2); @@ -2413,6 +2829,8 @@ int smlua_func_mario_push_off_steep_floor(lua_State* L) { } int smlua_func_mario_update_moving_sand(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2422,6 +2840,8 @@ int smlua_func_mario_update_moving_sand(lua_State* L) { } int smlua_func_mario_update_windy_ground(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2431,6 +2851,8 @@ int smlua_func_mario_update_windy_ground(lua_State* L) { } int smlua_func_stop_and_set_height_to_floor(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2440,6 +2862,8 @@ int smlua_func_stop_and_set_height_to_floor(lua_State* L) { } int smlua_func_stationary_ground_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2449,6 +2873,8 @@ int smlua_func_stationary_ground_step(lua_State* L) { } int smlua_func_perform_ground_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2458,6 +2884,8 @@ int smlua_func_perform_ground_step(lua_State* L) { } int smlua_func_perform_air_step(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } u32 arg1 = smlua_to_integer(L, 2); @@ -2469,6 +2897,8 @@ int smlua_func_perform_air_step(lua_State* L) { } int smlua_func_set_vel_from_pitch_and_yaw(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } @@ -2482,6 +2912,8 @@ int smlua_func_set_vel_from_pitch_and_yaw(lua_State* L) { /////////////// int smlua_func_queue_rumble_data(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + s16 a0 = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } s16 a1 = smlua_to_integer(L, 2); @@ -2494,6 +2926,8 @@ int smlua_func_queue_rumble_data(lua_State* L) { } int smlua_func_queue_rumble_data_object(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct Object* object = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); if (!gSmLuaConvertSuccess) { return 0; } s16 a0 = smlua_to_integer(L, 2); @@ -2508,6 +2942,8 @@ int smlua_func_queue_rumble_data_object(lua_State* L) { } int smlua_func_queue_rumble_data_mario(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIO_STATE); if (!gSmLuaConvertSuccess) { return 0; } s16 a0 = smlua_to_integer(L, 2); diff --git a/src/pc/lua/smlua_utils.c b/src/pc/lua/smlua_utils.c index f04ca5e9b..72a61a7b6 100644 --- a/src/pc/lua/smlua_utils.c +++ b/src/pc/lua/smlua_utils.c @@ -25,13 +25,13 @@ void smlua_bind_function(lua_State* L, const char* name, void* func) { lua_setglobal(L, name); } -static void smlua_logline(void) { +void smlua_logline(void) { lua_State* L = gLuaState; lua_Debug info; int level = 0; while (lua_getstack(L, level, &info)) { lua_getinfo(L, "nSl", &info); - LOG_INFO(" [%d] %s:%d -- %s [%s]\n", + LOG_INFO(" [%d] %s:%d -- %s [%s]", level, info.short_src, info.currentline, (info.name ? info.name : ""), info.what); ++level; diff --git a/src/pc/lua/smlua_utils.h b/src/pc/lua/smlua_utils.h index 5e35b114d..2a92ac1e5 100644 --- a/src/pc/lua/smlua_utils.h +++ b/src/pc/lua/smlua_utils.h @@ -7,6 +7,7 @@ f32* smlua_get_vec3f_from_buffer(void); s16* smlua_get_vec3s_from_buffer(void); void smlua_bind_function(lua_State* L, const char* name, void* func); +void smlua_logline(void); lua_Integer smlua_to_integer(lua_State* L, int index); lua_Number smlua_to_number(lua_State* L, int index);