From 271a3755105c3ef3c12bf79d4837791714675fc4 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 3 Feb 2022 00:42:31 -0800 Subject: [PATCH] Added immutable strings to autogen, added djui_popup_create --- autogen/common.py | 15 +++ autogen/convert_functions.py | 3 + autogen/convert_structs.py | 2 +- docs/lua/functions.md | 22 ++++ docs/lua/structs.md | 2 + src/pc/djui/djui_popup.c | 3 +- src/pc/djui/djui_popup.h | 2 +- src/pc/lua/smlua_cobject.c | 1 + src/pc/lua/smlua_cobject.h | 1 + src/pc/lua/smlua_cobject_autogen.c | 164 +++++++++++++-------------- src/pc/lua/smlua_functions_autogen.c | 9 +- 11 files changed, 133 insertions(+), 91 deletions(-) diff --git a/autogen/common.py b/autogen/common.py index db706863..bab74293 100644 --- a/autogen/common.py +++ b/autogen/common.py @@ -15,6 +15,9 @@ def get_path(p): return os.path.dirname(os.path.realpath(__file__)) + '/../' + p def translate_type_to_lvt(ptype): + if ptype == 'char*' or ('char' in ptype and '[' in ptype): + return 'LVT_STRING' + if '[' in ptype or '{' in ptype: return 'LOT_???' if 'enum ' in ptype: @@ -33,9 +36,15 @@ def translate_type_to_lvt(ptype): if '*' in ptype: return 'LVT_COBJECT_P' return 'LVT_COBJECT' + return 'LVT_???' def translate_type_to_lot(ptype): + if ptype == 'const char*': + return 'LOT_NONE' + if ptype == 'char*' or ('char' in ptype and '[' in ptype): + return 'LOT_NONE' + if '[' in ptype or '{' in ptype: return 'LOT_???' if 'enum ' in ptype: @@ -72,6 +81,12 @@ def translate_type_to_lua(ptype): if ptype.startswith('struct '): return ptype.split(' ')[1].replace('*', ''), True + if ptype == 'const char*': + return 'string', False + + if ptype == 'char*' or ('char' in ptype and '[' in ptype): + return 'string', False + if 'Vec3' in ptype: return ptype, True diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 5b2bd86e..9912c9aa 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -67,6 +67,7 @@ template = """/* THIS FILE IS AUTOGENERATED */ #include "engine/math_util.h" #include "engine/surface_collision.h" #include "pc/network/network_utils.h" +#include "src/pc/djui/djui_popup.h" $[FUNCTIONS] @@ -159,6 +160,8 @@ def build_param(param, i): return ' %s %s = smlua_to_integer(L, %d);\n' % (ptype, pid, i) elif ptype in number_types: return ' %s %s = smlua_to_number(L, %d);\n' % (ptype, pid, i) + elif ptype == 'const char*': + return ' %s %s = smlua_to_string(L, %d);\n' % (ptype, pid, i) else: lot = translate_type_to_lot(ptype) s = ' %s %s = (%s)smlua_to_cobject(L, %d, %s);' % (ptype, pid, ptype, i, lot) diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index d35255a7..f9e5d2db 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -185,7 +185,7 @@ def get_struct_field_info(struct, field): lvt = translate_type_to_lvt(ftype) lot = translate_type_to_lot(ftype) - fimmutable = str(lvt == 'LVT_COBJECT' or lvt == 'LVT_COBJECT_P').lower() + fimmutable = str(lvt == 'LVT_COBJECT' or lvt == 'LVT_COBJECT_P' or lvt == 'LVT_STRING').lower() if sid in override_field_immutable: if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]: diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 74287c8e..7a9a82fa 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -21,6 +21,7 @@
- djui_popup.h + - [djui_popup_create](#djui_popup_create)
@@ -507,6 +508,27 @@
+## [djui_popup_create](#djui_popup_create) + +### Lua Example +`djui_popup_create(message, lines)` + +### Parameters +| Field | Type | +| ----- | ---- | +| message | string | +| lines | int | + +### Returns +- None + +### C Prototype +`void djui_popup_create(const char* message, int lines);` + +[:arrow_up_small:](#) + +
+ --- # functions from external.h diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 863bfb6f..e2b51d5a 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -169,6 +169,7 @@ | capModelId | integer | | capWingModelId | integer | | modelId | integer | +| name | string | | soundAttacked | integer | | soundCoughing1 | integer | | soundCoughing2 | integer | @@ -576,6 +577,7 @@ | lastSent | number | | localIndex | integer | | modelIndex | integer | +| name | string | | onRxSeqId | integer | | paletteIndex | integer | | type | integer | diff --git a/src/pc/djui/djui_popup.c b/src/pc/djui/djui_popup.c index d1d10554..b16b4547 100644 --- a/src/pc/djui/djui_popup.c +++ b/src/pc/djui/djui_popup.c @@ -33,7 +33,7 @@ static void djui_popup_destroy(struct DjuiBase* base) { free(popup); } -struct DjuiPopup* djui_popup_create(const char* message, int lines) { +void djui_popup_create(const char* message, int lines) { struct DjuiPopup* popup = calloc(1, sizeof(struct DjuiPopup)); struct DjuiBase* base = &popup->base; @@ -57,7 +57,6 @@ struct DjuiPopup* djui_popup_create(const char* message, int lines) { sPopupListY -= height + 4; djui_popup_add_to_list(popup); play_sound(SOUND_MENU_PINCH_MARIO_FACE, gDefaultSoundArgs); - return popup; } void djui_popup_update(void) { diff --git a/src/pc/djui/djui_popup.h b/src/pc/djui/djui_popup.h index 66c130fd..7795f5cb 100644 --- a/src/pc/djui/djui_popup.h +++ b/src/pc/djui/djui_popup.h @@ -7,5 +7,5 @@ struct DjuiPopup { struct DjuiText* text; }; -struct DjuiPopup* djui_popup_create(const char* message, int lines); +void djui_popup_create(const char* message, int lines); void djui_popup_update(void); diff --git a/src/pc/lua/smlua_cobject.c b/src/pc/lua/smlua_cobject.c index 59ced761..47ae8e1a 100644 --- a/src/pc/lua/smlua_cobject.c +++ b/src/pc/lua/smlua_cobject.c @@ -92,6 +92,7 @@ static int smlua__get_field(lua_State* L) { case LVT_F32: lua_pushnumber( L, *(f32*)p); break; case LVT_COBJECT: smlua_push_object(L, data->lot, p); break; case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p); break; + case LVT_STRING: lua_pushstring(L, (char*)p); break; default: LOG_LUA("_get_field on unimplemented type '%d', key '%s'", data->valueType, key); return 0; diff --git a/src/pc/lua/smlua_cobject.h b/src/pc/lua/smlua_cobject.h index 8a9ce98c..16ae3cbc 100644 --- a/src/pc/lua/smlua_cobject.h +++ b/src/pc/lua/smlua_cobject.h @@ -12,6 +12,7 @@ enum LuaValueType { LVT_F32, LVT_COBJECT, LVT_COBJECT_P, + LVT_STRING, }; enum LuaObjectType { diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index c022666c..d474de19 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -95,68 +95,68 @@ static struct LuaObjectField sCameraTriggerFields[LUA_CAMERA_TRIGGER_FIELD_COUNT // { "event", LVT_???, offsetof(struct CameraTrigger, event), false, LOT_??? }, <--- UNIMPLEMENTED }; -#define LUA_CHARACTER_FIELD_COUNT 55 +#define LUA_CHARACTER_FIELD_COUNT 56 static struct LuaObjectField sCharacterFields[LUA_CHARACTER_FIELD_COUNT] = { - { "animOffsetEnabled", LVT_U8, offsetof(struct Character, animOffsetEnabled), true, LOT_NONE }, - { "animOffsetFeet", LVT_F32, offsetof(struct Character, animOffsetFeet), true, LOT_NONE }, - { "animOffsetHand", LVT_F32, offsetof(struct Character, animOffsetHand), true, LOT_NONE }, - { "animOffsetLowYPoint", LVT_F32, offsetof(struct Character, animOffsetLowYPoint), true, LOT_NONE }, - { "cameraHudHead", LVT_U32, offsetof(struct Character, cameraHudHead), true, LOT_NONE }, -// { "capEnemyDecalGfx", LVT_???, offsetof(struct Character, capEnemyDecalGfx), true, LOT_??? }, <--- UNIMPLEMENTED -// { "capEnemyGfx", LVT_???, offsetof(struct Character, capEnemyGfx), true, LOT_??? }, <--- UNIMPLEMENTED - { "capEnemyLayer", LVT_U8, offsetof(struct Character, capEnemyLayer), true, LOT_NONE }, - { "capMetalModelId", LVT_U32, offsetof(struct Character, capMetalModelId), true, LOT_NONE }, - { "capMetalWingModelId", LVT_U32, offsetof(struct Character, capMetalWingModelId), true, LOT_NONE }, - { "capModelId", LVT_U32, offsetof(struct Character, capModelId), true, LOT_NONE }, - { "capWingModelId", LVT_U32, offsetof(struct Character, capWingModelId), true, LOT_NONE }, -// { "hudHead", LVT_???, offsetof(struct Character, hudHead), true, LOT_??? }, <--- UNIMPLEMENTED -// { "hudHeadTexture", LVT_???, offsetof(struct Character, hudHeadTexture), true, LOT_??? }, <--- UNIMPLEMENTED - { "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE }, -// { "name", LVT_???, offsetof(struct Character, name), true, LOT_??? }, <--- UNIMPLEMENTED - { "soundAttacked", LVT_S32, offsetof(struct Character, soundAttacked), true, LOT_NONE }, - { "soundCoughing1", LVT_S32, offsetof(struct Character, soundCoughing1), true, LOT_NONE }, - { "soundCoughing2", LVT_S32, offsetof(struct Character, soundCoughing2), true, LOT_NONE }, - { "soundCoughing3", LVT_S32, offsetof(struct Character, soundCoughing3), true, LOT_NONE }, - { "soundDoh", LVT_S32, offsetof(struct Character, soundDoh), true, LOT_NONE }, - { "soundDrowning", LVT_S32, offsetof(struct Character, soundDrowning), true, LOT_NONE }, - { "soundDying", LVT_S32, offsetof(struct Character, soundDying), true, LOT_NONE }, - { "soundEeuh", LVT_S32, offsetof(struct Character, soundEeuh), true, LOT_NONE }, - { "soundFreqScale", LVT_F32, offsetof(struct Character, soundFreqScale), true, LOT_NONE }, - { "soundGameOver", LVT_S32, offsetof(struct Character, soundGameOver), true, LOT_NONE }, - { "soundGroundPoundWah", LVT_S32, offsetof(struct Character, soundGroundPoundWah), true, LOT_NONE }, - { "soundHaha", LVT_S32, offsetof(struct Character, soundHaha), true, LOT_NONE }, - { "soundHaha_2", LVT_S32, offsetof(struct Character, soundHaha_2), true, LOT_NONE }, - { "soundHello", LVT_S32, offsetof(struct Character, soundHello), true, LOT_NONE }, - { "soundHereWeGo", LVT_S32, offsetof(struct Character, soundHereWeGo), true, LOT_NONE }, - { "soundHoohoo", LVT_S32, offsetof(struct Character, soundHoohoo), true, LOT_NONE }, - { "soundHrmm", LVT_S32, offsetof(struct Character, soundHrmm), true, LOT_NONE }, - { "soundImaTired", LVT_S32, offsetof(struct Character, soundImaTired), true, LOT_NONE }, - { "soundMamaMia", LVT_S32, offsetof(struct Character, soundMamaMia), true, LOT_NONE }, - { "soundOnFire", LVT_S32, offsetof(struct Character, soundOnFire), true, LOT_NONE }, - { "soundOoof", LVT_S32, offsetof(struct Character, soundOoof), true, LOT_NONE }, - { "soundOoof2", LVT_S32, offsetof(struct Character, soundOoof2), true, LOT_NONE }, - { "soundPanting", LVT_S32, offsetof(struct Character, soundPanting), true, LOT_NONE }, - { "soundPantingCold", LVT_S32, offsetof(struct Character, soundPantingCold), true, LOT_NONE }, - { "soundPressStartToPlay", LVT_S32, offsetof(struct Character, soundPressStartToPlay), true, LOT_NONE }, - { "soundPunchHoo", LVT_S32, offsetof(struct Character, soundPunchHoo), true, LOT_NONE }, - { "soundPunchWah", LVT_S32, offsetof(struct Character, soundPunchWah), true, LOT_NONE }, - { "soundPunchYah", LVT_S32, offsetof(struct Character, soundPunchYah), true, LOT_NONE }, - { "soundSnoring1", LVT_S32, offsetof(struct Character, soundSnoring1), true, LOT_NONE }, - { "soundSnoring2", LVT_S32, offsetof(struct Character, soundSnoring2), true, LOT_NONE }, - { "soundSnoring3", LVT_S32, offsetof(struct Character, soundSnoring3), true, LOT_NONE }, - { "soundSoLongaBowser", LVT_S32, offsetof(struct Character, soundSoLongaBowser), true, LOT_NONE }, - { "soundTwirlBounce", LVT_S32, offsetof(struct Character, soundTwirlBounce), true, LOT_NONE }, - { "soundUh", LVT_S32, offsetof(struct Character, soundUh), true, LOT_NONE }, - { "soundUh2", LVT_S32, offsetof(struct Character, soundUh2), true, LOT_NONE }, - { "soundUh2_2", LVT_S32, offsetof(struct Character, soundUh2_2), true, LOT_NONE }, - { "soundWaaaooow", LVT_S32, offsetof(struct Character, soundWaaaooow), true, LOT_NONE }, - { "soundWah2", LVT_S32, offsetof(struct Character, soundWah2), true, LOT_NONE }, - { "soundWhoa", LVT_S32, offsetof(struct Character, soundWhoa), true, LOT_NONE }, - { "soundYahWahHoo", LVT_S32, offsetof(struct Character, soundYahWahHoo), true, LOT_NONE }, - { "soundYahoo", LVT_S32, offsetof(struct Character, soundYahoo), true, LOT_NONE }, - { "soundYahooWahaYippee", LVT_S32, offsetof(struct Character, soundYahooWahaYippee), true, LOT_NONE }, - { "soundYawning", LVT_S32, offsetof(struct Character, soundYawning), true, LOT_NONE }, - { "type", LVT_S32, offsetof(struct Character, type), true, LOT_NONE }, + { "animOffsetEnabled", LVT_U8, offsetof(struct Character, animOffsetEnabled), true, LOT_NONE }, + { "animOffsetFeet", LVT_F32, offsetof(struct Character, animOffsetFeet), true, LOT_NONE }, + { "animOffsetHand", LVT_F32, offsetof(struct Character, animOffsetHand), true, LOT_NONE }, + { "animOffsetLowYPoint", LVT_F32, offsetof(struct Character, animOffsetLowYPoint), true, LOT_NONE }, + { "cameraHudHead", LVT_U32, offsetof(struct Character, cameraHudHead), true, LOT_NONE }, +// { "capEnemyDecalGfx", LVT_???, offsetof(struct Character, capEnemyDecalGfx), true, LOT_??? }, <--- UNIMPLEMENTED +// { "capEnemyGfx", LVT_???, offsetof(struct Character, capEnemyGfx), true, LOT_??? }, <--- UNIMPLEMENTED + { "capEnemyLayer", LVT_U8, offsetof(struct Character, capEnemyLayer), true, LOT_NONE }, + { "capMetalModelId", LVT_U32, offsetof(struct Character, capMetalModelId), true, LOT_NONE }, + { "capMetalWingModelId", LVT_U32, offsetof(struct Character, capMetalWingModelId), true, LOT_NONE }, + { "capModelId", LVT_U32, offsetof(struct Character, capModelId), true, LOT_NONE }, + { "capWingModelId", LVT_U32, offsetof(struct Character, capWingModelId), true, LOT_NONE }, +// { "hudHead", LVT_???, offsetof(struct Character, hudHead), true, LOT_??? }, <--- UNIMPLEMENTED +// { "hudHeadTexture", LVT_???, offsetof(struct Character, hudHeadTexture), true, LOT_??? }, <--- UNIMPLEMENTED + { "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE }, + { "name", LVT_STRING, offsetof(struct Character, name), true, LOT_NONE }, + { "soundAttacked", LVT_S32, offsetof(struct Character, soundAttacked), true, LOT_NONE }, + { "soundCoughing1", LVT_S32, offsetof(struct Character, soundCoughing1), true, LOT_NONE }, + { "soundCoughing2", LVT_S32, offsetof(struct Character, soundCoughing2), true, LOT_NONE }, + { "soundCoughing3", LVT_S32, offsetof(struct Character, soundCoughing3), true, LOT_NONE }, + { "soundDoh", LVT_S32, offsetof(struct Character, soundDoh), true, LOT_NONE }, + { "soundDrowning", LVT_S32, offsetof(struct Character, soundDrowning), true, LOT_NONE }, + { "soundDying", LVT_S32, offsetof(struct Character, soundDying), true, LOT_NONE }, + { "soundEeuh", LVT_S32, offsetof(struct Character, soundEeuh), true, LOT_NONE }, + { "soundFreqScale", LVT_F32, offsetof(struct Character, soundFreqScale), true, LOT_NONE }, + { "soundGameOver", LVT_S32, offsetof(struct Character, soundGameOver), true, LOT_NONE }, + { "soundGroundPoundWah", LVT_S32, offsetof(struct Character, soundGroundPoundWah), true, LOT_NONE }, + { "soundHaha", LVT_S32, offsetof(struct Character, soundHaha), true, LOT_NONE }, + { "soundHaha_2", LVT_S32, offsetof(struct Character, soundHaha_2), true, LOT_NONE }, + { "soundHello", LVT_S32, offsetof(struct Character, soundHello), true, LOT_NONE }, + { "soundHereWeGo", LVT_S32, offsetof(struct Character, soundHereWeGo), true, LOT_NONE }, + { "soundHoohoo", LVT_S32, offsetof(struct Character, soundHoohoo), true, LOT_NONE }, + { "soundHrmm", LVT_S32, offsetof(struct Character, soundHrmm), true, LOT_NONE }, + { "soundImaTired", LVT_S32, offsetof(struct Character, soundImaTired), true, LOT_NONE }, + { "soundMamaMia", LVT_S32, offsetof(struct Character, soundMamaMia), true, LOT_NONE }, + { "soundOnFire", LVT_S32, offsetof(struct Character, soundOnFire), true, LOT_NONE }, + { "soundOoof", LVT_S32, offsetof(struct Character, soundOoof), true, LOT_NONE }, + { "soundOoof2", LVT_S32, offsetof(struct Character, soundOoof2), true, LOT_NONE }, + { "soundPanting", LVT_S32, offsetof(struct Character, soundPanting), true, LOT_NONE }, + { "soundPantingCold", LVT_S32, offsetof(struct Character, soundPantingCold), true, LOT_NONE }, + { "soundPressStartToPlay", LVT_S32, offsetof(struct Character, soundPressStartToPlay), true, LOT_NONE }, + { "soundPunchHoo", LVT_S32, offsetof(struct Character, soundPunchHoo), true, LOT_NONE }, + { "soundPunchWah", LVT_S32, offsetof(struct Character, soundPunchWah), true, LOT_NONE }, + { "soundPunchYah", LVT_S32, offsetof(struct Character, soundPunchYah), true, LOT_NONE }, + { "soundSnoring1", LVT_S32, offsetof(struct Character, soundSnoring1), true, LOT_NONE }, + { "soundSnoring2", LVT_S32, offsetof(struct Character, soundSnoring2), true, LOT_NONE }, + { "soundSnoring3", LVT_S32, offsetof(struct Character, soundSnoring3), true, LOT_NONE }, + { "soundSoLongaBowser", LVT_S32, offsetof(struct Character, soundSoLongaBowser), true, LOT_NONE }, + { "soundTwirlBounce", LVT_S32, offsetof(struct Character, soundTwirlBounce), true, LOT_NONE }, + { "soundUh", LVT_S32, offsetof(struct Character, soundUh), true, LOT_NONE }, + { "soundUh2", LVT_S32, offsetof(struct Character, soundUh2), true, LOT_NONE }, + { "soundUh2_2", LVT_S32, offsetof(struct Character, soundUh2_2), true, LOT_NONE }, + { "soundWaaaooow", LVT_S32, offsetof(struct Character, soundWaaaooow), true, LOT_NONE }, + { "soundWah2", LVT_S32, offsetof(struct Character, soundWah2), true, LOT_NONE }, + { "soundWhoa", LVT_S32, offsetof(struct Character, soundWhoa), true, LOT_NONE }, + { "soundYahWahHoo", LVT_S32, offsetof(struct Character, soundYahWahHoo), true, LOT_NONE }, + { "soundYahoo", LVT_S32, offsetof(struct Character, soundYahoo), true, LOT_NONE }, + { "soundYahooWahaYippee", LVT_S32, offsetof(struct Character, soundYahooWahaYippee), true, LOT_NONE }, + { "soundYawning", LVT_S32, offsetof(struct Character, soundYawning), true, LOT_NONE }, + { "type", LVT_S32, offsetof(struct Character, type), true, LOT_NONE }, }; #define LUA_CONTROLLER_FIELD_COUNT 10 @@ -434,28 +434,28 @@ static struct LuaObjectField sModeTransitionInfoFields[LUA_MODE_TRANSITION_INFO_ { "transitionStart", LVT_COBJECT, offsetof(struct ModeTransitionInfo, transitionStart), true, LOT_LINEARTRANSITIONPOINT }, }; -#define LUA_NETWORK_PLAYER_FIELD_COUNT 17 +#define LUA_NETWORK_PLAYER_FIELD_COUNT 18 static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT] = { - { "connected", LVT_BOOL, offsetof(struct NetworkPlayer, connected), true, LOT_NONE }, - { "currActNum", LVT_S16, offsetof(struct NetworkPlayer, currActNum), true, LOT_NONE }, - { "currAreaIndex", LVT_S16, offsetof(struct NetworkPlayer, currAreaIndex), true, LOT_NONE }, - { "currAreaSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currAreaSyncValid), true, LOT_NONE }, - { "currCourseNum", LVT_S16, offsetof(struct NetworkPlayer, currCourseNum), true, LOT_NONE }, - { "currLevelAreaSeqId", LVT_U16, offsetof(struct NetworkPlayer, currLevelAreaSeqId), true, LOT_NONE }, - { "currLevelNum", LVT_S16, offsetof(struct NetworkPlayer, currLevelNum), true, LOT_NONE }, - { "currLevelSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currLevelSyncValid), true, LOT_NONE }, - { "fadeOpacity", LVT_U8, offsetof(struct NetworkPlayer, fadeOpacity), true, LOT_NONE }, - { "globalIndex", LVT_U8, offsetof(struct NetworkPlayer, globalIndex), true, LOT_NONE }, - { "lastReceived", LVT_F32, offsetof(struct NetworkPlayer, lastReceived), true, LOT_NONE }, - { "lastSent", LVT_F32, offsetof(struct NetworkPlayer, lastSent), true, LOT_NONE }, - { "localIndex", LVT_U8, offsetof(struct NetworkPlayer, localIndex), true, LOT_NONE }, - { "modelIndex", LVT_U8, offsetof(struct NetworkPlayer, modelIndex), true, LOT_NONE }, -// { "name", LOT_???, offsetof(struct NetworkPlayer, name), true, LOT_??? }, <--- UNIMPLEMENTED - { "onRxSeqId", LVT_U8, offsetof(struct NetworkPlayer, onRxSeqId), true, LOT_NONE }, - { "paletteIndex", LVT_U8, offsetof(struct NetworkPlayer, paletteIndex), true, LOT_NONE }, -// { "rxPacketHash", LOT_???, offsetof(struct NetworkPlayer, rxPacketHash), true, LOT_??? }, <--- UNIMPLEMENTED -// { "rxSeqIds", LOT_???, offsetof(struct NetworkPlayer, rxSeqIds), true, LOT_??? }, <--- UNIMPLEMENTED - { "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE }, + { "connected", LVT_BOOL, offsetof(struct NetworkPlayer, connected), true, LOT_NONE }, + { "currActNum", LVT_S16, offsetof(struct NetworkPlayer, currActNum), true, LOT_NONE }, + { "currAreaIndex", LVT_S16, offsetof(struct NetworkPlayer, currAreaIndex), true, LOT_NONE }, + { "currAreaSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currAreaSyncValid), true, LOT_NONE }, + { "currCourseNum", LVT_S16, offsetof(struct NetworkPlayer, currCourseNum), true, LOT_NONE }, + { "currLevelAreaSeqId", LVT_U16, offsetof(struct NetworkPlayer, currLevelAreaSeqId), true, LOT_NONE }, + { "currLevelNum", LVT_S16, offsetof(struct NetworkPlayer, currLevelNum), true, LOT_NONE }, + { "currLevelSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currLevelSyncValid), true, LOT_NONE }, + { "fadeOpacity", LVT_U8, offsetof(struct NetworkPlayer, fadeOpacity), true, LOT_NONE }, + { "globalIndex", LVT_U8, offsetof(struct NetworkPlayer, globalIndex), true, LOT_NONE }, + { "lastReceived", LVT_F32, offsetof(struct NetworkPlayer, lastReceived), true, LOT_NONE }, + { "lastSent", LVT_F32, offsetof(struct NetworkPlayer, lastSent), true, LOT_NONE }, + { "localIndex", LVT_U8, offsetof(struct NetworkPlayer, localIndex), true, LOT_NONE }, + { "modelIndex", LVT_U8, offsetof(struct NetworkPlayer, modelIndex), true, LOT_NONE }, + { "name", LVT_STRING, offsetof(struct NetworkPlayer, name), true, LOT_NONE }, + { "onRxSeqId", LVT_U8, offsetof(struct NetworkPlayer, onRxSeqId), true, LOT_NONE }, + { "paletteIndex", LVT_U8, offsetof(struct NetworkPlayer, paletteIndex), true, LOT_NONE }, +// { "rxPacketHash", LOT_???, offsetof(struct NetworkPlayer, rxPacketHash), true, LOT_??? }, <--- UNIMPLEMENTED +// { "rxSeqIds", LOT_???, offsetof(struct NetworkPlayer, rxSeqIds), true, LOT_??? }, <--- UNIMPLEMENTED + { "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE }, }; #define LUA_OBJECT_FIELD_COUNT 22 diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 9368702e..bb1ef1e9 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -13,6 +13,7 @@ #include "engine/math_util.h" #include "engine/surface_collision.h" #include "pc/network/network_utils.h" +#include "src/pc/djui/djui_popup.h" ////////////// // camera.h // @@ -188,20 +189,18 @@ int smlua_func_update_character_anim_offset(lua_State* L) { // djui_popup.h // ////////////////// -/* int smlua_func_djui_popup_create(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } -// const char* message = (const char*)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED + const char* message = smlua_to_string(L, 1); if (!gSmLuaConvertSuccess) { return 0; } int lines = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } - UNIMPLEMENTED -->(L, djui_popup_create(message, lines)); + djui_popup_create(message, lines); return 1; } -*/ //////////////// // external.h // @@ -2906,7 +2905,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "update_character_anim_offset", smlua_func_update_character_anim_offset); // djui_popup.h - //smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create); <--- UNIMPLEMENTED + smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create); // external.h smlua_bind_function(L, "fade_volume_scale", smlua_func_fade_volume_scale);