From 29cd4d5e599faf146551361c70d27b8fb6861126 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Wed, 12 Feb 2025 18:44:19 +1000 Subject: [PATCH] autogen fix compile --- autogen/common.py | 4 ++-- autogen/convert_structs.py | 20 +++++++++++--------- src/pc/lua/smlua_cobject_autogen.c | 8 ++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/autogen/common.py b/autogen/common.py index 8c91b29ee..340e75f18 100644 --- a/autogen/common.py +++ b/autogen/common.py @@ -94,8 +94,8 @@ def translate_type_to_lvt(ptype, allowArrays=False): if pointerLvl > 1: return "LVT_???" if pointerLvl == 1: - return "LVT_" + ptype.upper() + "_P" - return "LVT_" + ptype.upper() + return "LVT_" + type.upper() + "_P" + return "LVT_" + type.upper() if ptype in vec_types: if pointerLvl > 1: diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index b126713bc..7dd1c182b 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -264,6 +264,7 @@ def parse_struct(struct_str, sortFields = True): struct_name, body, trailing_name = match.groups() identifier = struct_name if struct_name else trailing_name struct['identifier'] = identifier + struct['typedef'] = 'typedef ' in struct_str body = struct_str.split('{', 1)[1].rsplit('}', 1)[0] body = strip_anonymous_blocks(body) @@ -495,21 +496,22 @@ def build_struct(struct): row = [] + struct_str = "struct " if not struct['typedef'] else "" startStr = '' endStr = ' },' if fid in override_field_version_excludes: startStr += '#ifndef ' + override_field_version_excludes[fid] + '\n' endStr += '\n#endif' startStr += ' { ' - row.append(startStr ) - row.append('"%s", ' % fid ) - row.append('%s, ' % lvt ) - row.append('offsetof(struct %s, %s), ' % (sid, field['identifier']) ) - row.append('%s, ' % fimmutable ) - row.append('%s, ' % lot ) - row.append('%s, ' % size ) - row.append('sizeof(%s)' % ftype ) - row.append(endStr ) + row.append(startStr ) + row.append('"%s", ' % fid ) + row.append('%s, ' % lvt ) + row.append('offsetof(%s%s, %s), ' % (struct_str, sid, field['identifier'])) + row.append('%s, ' % fimmutable ) + row.append('%s, ' % lot ) + row.append('%s, ' % size ) + row.append('sizeof(%s)' % ftype ) + row.append(endStr ) field_table.append(row) field_table_str, field_count = table_to_string(field_table) diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 98827be89..d43111008 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -392,8 +392,8 @@ static struct LuaObjectField sCameraFOVStatusFields[LUA_CAMERA_FOVSTATUS_FIELD_C #define LUA_CAMERA_OVERRIDE_FIELD_COUNT 2 static struct LuaObjectField sCameraOverrideFields[LUA_CAMERA_OVERRIDE_FIELD_COUNT] = { - { "override", LVT_BOOL, offsetof(struct CameraOverride, override), false, LOT_NONE, 1, sizeof(bool) }, - { "value", LVT_UNSIGNED INT, offsetof(struct CameraOverride, value), false, LOT_NONE, 1, sizeof(unsigned int) }, + { "override", LVT_BOOL, offsetof(struct CameraOverride, override), false, LOT_NONE, 1, sizeof(bool) }, + { "value", LVT_U32, offsetof(struct CameraOverride, value), false, LOT_NONE, 1, sizeof(unsigned int) }, }; #define LUA_CAMERA_STORED_INFO_FIELD_COUNT 4 @@ -2681,8 +2681,8 @@ static struct LuaObjectField sTransitionInfoFields[LUA_TRANSITION_INFO_FIELD_COU #define LUA_VTX__INTERP_FIELD_COUNT 2 static struct LuaObjectField sVtx_InterpFields[LUA_VTX__INTERP_FIELD_COUNT] = { - { "n", LVT_STRING, offsetof(struct Vtx_Interp, n), false, LOT_NONE, 1, sizeof(signed char) }, - { "ob", LVT_FLOAT, offsetof(struct Vtx_Interp, ob), false, LOT_NONE, 3, sizeof(float) }, + { "n", LVT_STRING, offsetof(Vtx_Interp, n), false, LOT_NONE, 1, sizeof(signed char) }, + { "ob", LVT_F32, offsetof(Vtx_Interp, ob), false, LOT_NONE, 3, sizeof(float) }, }; #define LUA_WALL_COLLISION_DATA_FIELD_COUNT 10