autogen fix integer type detection

This commit is contained in:
Isaac0-dev 2025-02-12 17:46:24 +10:00
parent ff83d6a037
commit bb768ef55b
4 changed files with 9 additions and 4 deletions

View file

@ -123,7 +123,7 @@ def translate_type_to_lvt(ptype, allowArrays=False):
if pointerLvl == 1 and "(" not in ptype and "[" not in ptype:
ptype = ptype.replace("const", "").replace("*", "").strip()
if ptype in usf_types or ptype in typedef_pointers:
if ptype in usf_types or extract_integer_datatype(ptype) or ptype in typedef_pointers:
return "LVT_%s_P" % ptype.upper()
return "LVT_???"
@ -160,6 +160,9 @@ def translate_type_to_lot(ptype, allowArrays=True):
if ptype in usf_types:
return 'LOT_NONE'
if extract_integer_datatype(ptype):
return 'LOT_NONE'
# Strip out our pointer stars to get the true type.
if "*" in ptype:
# Count how many stars there is for our pointer level.
@ -220,7 +223,7 @@ def translate_type_to_lua(ptype):
if ptype.startswith('enum '):
return ptype, 'constants.md#%s' % ptype.replace(' ', '-')
if ptype in usf_types:
if ptype in usf_types or extract_integer_datatype(ptype):
if ptype.startswith('f'):
return '`number`', None
return '`integer`', None

View file

@ -241,6 +241,7 @@
--- @class CameraOverride
--- @field public override boolean
--- @field public value integer
--- @class CameraStoredInfo
--- @field public cannonYOffset number

View file

@ -434,6 +434,7 @@
| Field | Type | Access |
| ----- | ---- | ------ |
| override | `boolean` | |
| value | `integer` | |
[:arrow_up_small:](#)

View file

@ -390,10 +390,10 @@ static struct LuaObjectField sCameraFOVStatusFields[LUA_CAMERA_FOVSTATUS_FIELD_C
{ "unusedIsSleeping", LVT_U32, offsetof(struct CameraFOVStatus, unusedIsSleeping), false, LOT_NONE, 1, sizeof(u32) },
};
#define LUA_CAMERA_OVERRIDE_FIELD_COUNT 1
#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_???, 1, sizeof(unsigned int) }, <--- UNIMPLEMENTED
{ "value", LVT_UNSIGNED INT, offsetof(struct CameraOverride, value), false, LOT_NONE, 1, sizeof(unsigned int) },
};
#define LUA_CAMERA_STORED_INFO_FIELD_COUNT 4