mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-29 07:23:01 +00:00
Added more detailed lua error logs
This commit is contained in:
parent
faca15ae12
commit
80a5638bd1
6 changed files with 1379 additions and 1518 deletions
|
@ -115,9 +115,7 @@ $[BINDS]
|
||||||
param_vec3f_before_call = """
|
param_vec3f_before_call = """
|
||||||
f32* $[IDENTIFIER] = smlua_get_vec3f_from_buffer();
|
f32* $[IDENTIFIER] = smlua_get_vec3f_from_buffer();
|
||||||
$[IDENTIFIER][0] = smlua_get_number_field($[INDEX], "x");
|
$[IDENTIFIER][0] = smlua_get_number_field($[INDEX], "x");
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
$[IDENTIFIER][1] = smlua_get_number_field($[INDEX], "y");
|
$[IDENTIFIER][1] = smlua_get_number_field($[INDEX], "y");
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
$[IDENTIFIER][2] = smlua_get_number_field($[INDEX], "z");
|
$[IDENTIFIER][2] = smlua_get_number_field($[INDEX], "z");
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -135,9 +133,7 @@ param_override_build['Vec3f'] = {
|
||||||
param_vec3s_before_call = """
|
param_vec3s_before_call = """
|
||||||
s16* $[IDENTIFIER] = smlua_get_vec3s_from_buffer();
|
s16* $[IDENTIFIER] = smlua_get_vec3s_from_buffer();
|
||||||
$[IDENTIFIER][0] = smlua_get_integer_field($[INDEX], "x");
|
$[IDENTIFIER][0] = smlua_get_integer_field($[INDEX], "x");
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
$[IDENTIFIER][1] = smlua_get_integer_field($[INDEX], "y");
|
$[IDENTIFIER][1] = smlua_get_integer_field($[INDEX], "y");
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
$[IDENTIFIER][2] = smlua_get_integer_field($[INDEX], "z");
|
$[IDENTIFIER][2] = smlua_get_integer_field($[INDEX], "z");
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -401,7 +397,7 @@ def build_function(function, do_extern):
|
||||||
i = 1
|
i = 1
|
||||||
for param in function['params']:
|
for param in function['params']:
|
||||||
s += build_param(param, i)
|
s += build_param(param, i)
|
||||||
s += ' if (!gSmLuaConvertSuccess) { return 0; }\n'
|
s += ' if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %d"); return 0; }\n' % i
|
||||||
i += 1
|
i += 1
|
||||||
s += '\n'
|
s += '\n'
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,10 @@ static int smlua__get_field(lua_State* L) {
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
|
|
||||||
const char* key = smlua_to_string(L, 3);
|
const char* key = smlua_to_string(L, 3);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) {
|
||||||
|
LOG_LUA_LINE("Tried to get a non-string field of cobject");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (pointer == 0) {
|
if (pointer == 0) {
|
||||||
LOG_LUA_LINE("_get_field on null pointer");
|
LOG_LUA_LINE("_get_field on null pointer");
|
||||||
|
@ -413,7 +416,10 @@ static int smlua__set_field(lua_State* L) {
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
|
|
||||||
const char* key = smlua_to_string(L, 3);
|
const char* key = smlua_to_string(L, 3);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) {
|
||||||
|
LOG_LUA_LINE("Tried to set a non-string field of cobject");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (pointer == 0) {
|
if (pointer == 0) {
|
||||||
LOG_LUA_LINE("_set_field on null pointer");
|
LOG_LUA_LINE("_set_field on null pointer");
|
||||||
|
|
|
@ -36,7 +36,7 @@ int smlua_func_sins(lua_State* L) {
|
||||||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||||
|
|
||||||
f32 x = smlua_to_number(L, 1);
|
f32 x = smlua_to_number(L, 1);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||||
|
|
||||||
lua_pushnumber(L, sins(x));
|
lua_pushnumber(L, sins(x));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -46,7 +46,7 @@ int smlua_func_coss(lua_State* L) {
|
||||||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||||
|
|
||||||
f32 x = smlua_to_number(L, 1);
|
f32 x = smlua_to_number(L, 1);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||||
|
|
||||||
lua_pushnumber(L, coss(x));
|
lua_pushnumber(L, coss(x));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -56,9 +56,9 @@ int smlua_func_atan2s(lua_State* L) {
|
||||||
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
||||||
|
|
||||||
f32 y = smlua_to_number(L, 1);
|
f32 y = smlua_to_number(L, 1);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||||
f32 x = smlua_to_number(L, 2);
|
f32 x = smlua_to_number(L, 2);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||||
|
|
||||||
lua_pushinteger(L, atan2s(y, x));
|
lua_pushinteger(L, atan2s(y, x));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -95,10 +95,10 @@ int smlua_func_network_init_object(lua_State* L) {
|
||||||
if (!smlua_functions_valid_param_count(L, 3)) { return 0; }
|
if (!smlua_functions_valid_param_count(L, 3)) { return 0; }
|
||||||
|
|
||||||
struct Object* obj = smlua_to_cobject(L, 1, LOT_OBJECT);
|
struct Object* obj = smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||||
if (!gSmLuaConvertSuccess || obj == NULL) { return 0; }
|
if (!gSmLuaConvertSuccess || obj == NULL) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||||
|
|
||||||
bool standardSync = smlua_to_boolean(L, 2);
|
bool standardSync = smlua_to_boolean(L, 2);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||||
|
|
||||||
if (lua_type(L, 3) != LUA_TNIL && lua_type(L, 3) != LUA_TTABLE) {
|
if (lua_type(L, 3) != LUA_TNIL && lua_type(L, 3) != LUA_TTABLE) {
|
||||||
LOG_LUA_LINE("network_init_object() called with an invalid type for param 3: %u", lua_type(L, 3));
|
LOG_LUA_LINE("network_init_object() called with an invalid type for param 3: %u", lua_type(L, 3));
|
||||||
|
@ -159,10 +159,10 @@ int smlua_func_network_send_object(lua_State* L) {
|
||||||
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
||||||
|
|
||||||
struct Object* obj = smlua_to_cobject(L, 1, LOT_OBJECT);
|
struct Object* obj = smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||||
if (!gSmLuaConvertSuccess || obj == NULL) { return 0; }
|
if (!gSmLuaConvertSuccess || obj == NULL) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||||
|
|
||||||
bool reliable = smlua_to_boolean(L, 2);
|
bool reliable = smlua_to_boolean(L, 2);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||||
|
|
||||||
if (obj->oSyncID == 0 || gSyncObjects[obj->oSyncID].o != obj) {
|
if (obj->oSyncID == 0 || gSyncObjects[obj->oSyncID].o != obj) {
|
||||||
LOG_LUA_LINE("Failed to retrieve sync object.");
|
LOG_LUA_LINE("Failed to retrieve sync object.");
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -104,7 +104,10 @@ int smlua_hook_event(lua_State* L) {
|
||||||
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
||||||
|
|
||||||
u16 hookType = smlua_to_integer(L, -2);
|
u16 hookType = smlua_to_integer(L, -2);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) {
|
||||||
|
LOG_LUA_LINE("Invalid hook type given to hook_event(): %d", hookType);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (hookType >= HOOK_MAX) {
|
if (hookType >= HOOK_MAX) {
|
||||||
LOG_LUA_LINE("Hook Type: %d exceeds max!", hookType);
|
LOG_LUA_LINE("Hook Type: %d exceeds max!", hookType);
|
||||||
|
|
|
@ -26,12 +26,18 @@ void network_send_lua_custom(bool broadcast) {
|
||||||
LOG_LUA_LINE("Tried to send packet to invalid local index: %d", toLocalIndex)
|
LOG_LUA_LINE("Tried to send packet to invalid local index: %d", toLocalIndex)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!gSmLuaConvertSuccess) { return; }
|
if (!gSmLuaConvertSuccess) {
|
||||||
|
LOG_LUA("Invalid 'localIndex' type");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get reliability
|
// get reliability
|
||||||
bool reliability = smlua_to_boolean(L, paramIndex++);
|
bool reliability = smlua_to_boolean(L, paramIndex++);
|
||||||
if (!gSmLuaConvertSuccess) { return; }
|
if (!gSmLuaConvertSuccess) {
|
||||||
|
LOG_LUA("Invalid 'reliable' type");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// write packet header
|
// write packet header
|
||||||
struct Packet p = { 0 };
|
struct Packet p = { 0 };
|
||||||
|
|
Loading…
Reference in a new issue