mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Added CPointers to Lua/autogen
This commit is contained in:
parent
f862b3ac21
commit
941375718b
13 changed files with 240 additions and 137 deletions
|
@ -15,23 +15,33 @@ def get_path(p):
|
|||
return os.path.dirname(os.path.realpath(__file__)) + '/../' + p
|
||||
|
||||
def translate_type_to_lvt(ptype):
|
||||
if ptype == 'char':
|
||||
ptype = 'u8'
|
||||
|
||||
if ('char' in ptype and '[' in ptype):
|
||||
return 'LVT_STRING'
|
||||
|
||||
if ptype == 'char*':
|
||||
return 'LVT_STRING_P'
|
||||
|
||||
if '[' in ptype or '{' in ptype:
|
||||
return 'LOT_???'
|
||||
|
||||
if 'enum ' in ptype:
|
||||
return 'LVT_S32'
|
||||
|
||||
if ptype == 'bool':
|
||||
return 'LVT_BOOL'
|
||||
|
||||
if ptype in usf_types:
|
||||
return 'LVT_' + ptype.upper()
|
||||
|
||||
if ptype in vec3_types:
|
||||
return 'LVT_COBJECT'
|
||||
|
||||
if ptype == 'float':
|
||||
return 'LVT_F32'
|
||||
|
||||
if 'struct' in ptype:
|
||||
if ptype.count('*') > 1:
|
||||
return 'LVT_???'
|
||||
|
@ -39,26 +49,41 @@ def translate_type_to_lvt(ptype):
|
|||
return 'LVT_COBJECT_P'
|
||||
return 'LVT_COBJECT'
|
||||
|
||||
if ptype.count('*') == 1 and '(' not in ptype and '[' not in ptype:
|
||||
ptype = ptype.replace('const', '').replace('*', '').strip()
|
||||
if ptype in usf_types:
|
||||
return 'LVT_%s_P' % ptype.upper()
|
||||
|
||||
return 'LVT_???'
|
||||
|
||||
def translate_type_to_lot(ptype):
|
||||
if ptype == 'char':
|
||||
ptype = 'u8'
|
||||
|
||||
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:
|
||||
return 'LOT_NONE'
|
||||
|
||||
if ptype == 'bool':
|
||||
return 'LOT_NONE'
|
||||
|
||||
if ptype in usf_types:
|
||||
return 'LOT_NONE'
|
||||
|
||||
if ptype in vec3_types:
|
||||
return 'LOT_' + ptype.upper()
|
||||
|
||||
if ptype == 'float':
|
||||
return 'LOT_NONE'
|
||||
|
||||
if 'struct' in ptype:
|
||||
if ptype.count('*') > 1:
|
||||
return 'LVT_???'
|
||||
|
@ -67,17 +92,10 @@ def translate_type_to_lot(ptype):
|
|||
return 'LOT_???'
|
||||
return 'LOT_' + struct_id.upper()
|
||||
|
||||
return 'LOT_???'
|
||||
if ptype.count('*') == 1 and '???' not in translate_type_to_lvt(ptype):
|
||||
return 'LOT_POINTER'
|
||||
|
||||
def gen_comment_header(f):
|
||||
comment_h = "// " + f + " //"
|
||||
comment_l = "/" * len(comment_h)
|
||||
s = ""
|
||||
s += " " + comment_l + "\n"
|
||||
s += " " + comment_h + "\n"
|
||||
s += "" + comment_l + "\n"
|
||||
s += "\n"
|
||||
return s
|
||||
return 'LOT_???'
|
||||
|
||||
def translate_type_to_lua(ptype):
|
||||
if ptype.startswith('struct '):
|
||||
|
@ -104,4 +122,19 @@ def translate_type_to_lua(ptype):
|
|||
if 'void' == ptype:
|
||||
return None, False
|
||||
|
||||
if ptype.count('*') == 1 and '???' not in translate_type_to_lvt(ptype):
|
||||
ptype = ptype.replace('const', '').replace('*', '').strip()
|
||||
s = 'Pointer <%s>' % translate_type_to_lua(ptype)[0]
|
||||
return s, False
|
||||
|
||||
return ptype, False
|
||||
|
||||
def gen_comment_header(f):
|
||||
comment_h = "// " + f + " //"
|
||||
comment_l = "/" * len(comment_h)
|
||||
s = ""
|
||||
s += " " + comment_l + "\n"
|
||||
s += " " + comment_h + "\n"
|
||||
s += "" + comment_l + "\n"
|
||||
s += "\n"
|
||||
return s
|
||||
|
|
|
@ -36,16 +36,16 @@ in_files = [
|
|||
]
|
||||
|
||||
override_allowed_functions = {
|
||||
"src/audio/external.h": [ " play_", "fade" ],
|
||||
"src/game/camera.h": [ "set_.*camera_.*shake" ],
|
||||
"src/game/thread6.c": [ "queue_rumble_"],
|
||||
"src/pc/djui/djui_popup.h" : [ "create" ],
|
||||
"src/game/save_file.h": [ "save_file_get_" ],
|
||||
"src/audio/external.h": [ " play_", "fade" ],
|
||||
"src/game/camera.h": [ "set_.*camera_.*shake" ],
|
||||
"src/game/thread6.c": [ "queue_rumble_"],
|
||||
"src/pc/djui/djui_popup.h" : [ "create" ],
|
||||
"src/game/save_file.h": [ "save_file_get_" ],
|
||||
}
|
||||
|
||||
override_disallowed_functions = {
|
||||
"src/audio/external.h": [ " func_" ],
|
||||
"src/engine/surface_collision.h": [ " debug_" ],
|
||||
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
|
||||
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_" ],
|
||||
|
@ -56,9 +56,9 @@ override_disallowed_functions = {
|
|||
"src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed"],
|
||||
"src/game/mario.h": [ " init_mario" ],
|
||||
"src/pc/djui/djui_chat_message.h": [ "create_from" ],
|
||||
#"src/game/print.h": [ "_fmt_", "render_" ],
|
||||
"src/game/interaction.h": [ "process_interactions", "_handle_" ],
|
||||
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
|
||||
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
|
||||
}
|
||||
|
||||
###########################################################
|
||||
|
|
|
@ -188,7 +188,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' or lvt == 'LVT_STRING' or lvt == 'LVT_STRING_P').lower()
|
||||
fimmutable = str(lvt == 'LVT_COBJECT' or lvt.endswith('_P')).lower()
|
||||
|
||||
if sid in override_field_immutable:
|
||||
if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]:
|
||||
|
|
|
@ -10,6 +10,20 @@ _CObject = {
|
|||
end
|
||||
}
|
||||
|
||||
_CPointer = {
|
||||
__index = function (t,k)
|
||||
return nil
|
||||
end,
|
||||
__newindex = function (t,k,v)
|
||||
end,
|
||||
__tostring = function(t)
|
||||
return 'CPointer: ' .. t['_lvt'] .. ', [' .. string.format('0x%08X', t['_pointer']) .. ']'
|
||||
end,
|
||||
__eq = function (a, b)
|
||||
return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil
|
||||
end
|
||||
}
|
||||
|
||||
_SyncTable = {
|
||||
__index = function (t,k)
|
||||
local _table = rawget(t, '_table')
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
- [characters.h](#characters.h)
|
||||
- [CharacterSound](#CharacterSound)
|
||||
- [CharacterType](#CharacterType)
|
||||
- [djui_gfx_utils.h](#djui_gfx_utils.h)
|
||||
- [DjuiFontType](#DjuiFontType)
|
||||
- [GfxUtilsResolution](#GfxUtilsResolution)
|
||||
- [interaction.c](#interaction.c)
|
||||
- [InteractionFlag](#InteractionFlag)
|
||||
- [mario_animation_ids.h](#mario_animation_ids.h)
|
||||
|
@ -742,6 +745,25 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [djui_gfx_utils.h](#djui_gfx_utils.h)
|
||||
|
||||
### [enum DjuiFontType](#DjuiFontType)
|
||||
| Identifier | Value |
|
||||
| :--------- | :---- |
|
||||
| FONT_NORMAL | 0 |
|
||||
| FONT_MENU | 1 |
|
||||
| FONT_HUD | 2 |
|
||||
| FONT_COUNT | 3 |
|
||||
|
||||
### [enum GfxUtilsResolution](#GfxUtilsResolution)
|
||||
| Identifier | Value |
|
||||
| :--------- | :---- |
|
||||
| RESOLUTION_DJUI | 0 |
|
||||
| RESOLUTION_N64 | 1 |
|
||||
| RESOLUTION_COUNT | 2 |
|
||||
|
||||
<br />
|
||||
|
||||
## [interaction.c](#interaction.c)
|
||||
- INT_ANY_ATTACK
|
||||
- INT_ATTACK_NOT_FROM_BELOW
|
||||
|
@ -1413,7 +1435,8 @@
|
|||
| HOOK_ON_PVP_ATTACK | 5 |
|
||||
| HOOK_ON_PLAYER_CONNECTED | 6 |
|
||||
| HOOK_ON_PLAYER_DISCONNECTED | 7 |
|
||||
| HOOK_MAX | 8 |
|
||||
| HOOK_ON_HUD_RENDER | 8 |
|
||||
| HOOK_MAX | 9 |
|
||||
|
||||
<br />
|
||||
|
||||
|
|
|
@ -56,12 +56,14 @@
|
|||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| flags | integer | |
|
||||
| index | Pointer <integer> | read-only |
|
||||
| length | integer | |
|
||||
| animYTransDivisor | integer | |
|
||||
| startFrame | integer | |
|
||||
| loopStart | integer | |
|
||||
| loopEnd | integer | |
|
||||
| unusedBoneCount | integer | |
|
||||
| values | Pointer <integer> | read-only |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
@ -75,10 +77,13 @@
|
|||
| flags | integer | |
|
||||
| index | integer | |
|
||||
| instantWarps | [InstantWarp](#InstantWarp) | read-only |
|
||||
| macroObjects | Pointer <integer> | read-only |
|
||||
| musicParam | integer | |
|
||||
| musicParam2 | integer | |
|
||||
| objectSpawnInfos | [SpawnInfo](#SpawnInfo) | read-only |
|
||||
| paintingWarpNodes | [WarpNode](#WarpNode) | read-only |
|
||||
| surfaceRooms | Pointer <integer> | read-only |
|
||||
| terrainData | Pointer <integer> | read-only |
|
||||
| terrainType | integer | |
|
||||
| warpNodes | [ObjectWarpNode](#ObjectWarpNode) | read-only |
|
||||
|
||||
|
@ -168,6 +173,8 @@
|
|||
| capMetalWingModelId | integer | read-only |
|
||||
| capModelId | integer | read-only |
|
||||
| capWingModelId | integer | read-only |
|
||||
| hudHead | char | read-only |
|
||||
| hudHeadTexture | Pointer <integer> | read-only |
|
||||
| modelId | integer | read-only |
|
||||
| name | string | read-only |
|
||||
| soundAttacked | integer | read-only |
|
||||
|
@ -437,6 +444,7 @@
|
|||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| currentAnimAddr | Pointer <integer> | read-only |
|
||||
| targetAnim | [Animation](#Animation) | read-only |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
|
|
@ -21,9 +21,9 @@ static struct LuaObjectField sVec3fFields[LUA_VEC3F_FIELD_COUNT] = {
|
|||
};
|
||||
|
||||
struct LuaObjectTable sLuaObjectTable[LOT_MAX] = {
|
||||
{ LOT_NONE, NULL, 0 },
|
||||
{ LOT_VEC3S, sVec3sFields, LUA_VEC3S_FIELD_COUNT },
|
||||
{ LOT_VEC3F, sVec3fFields, LUA_VEC3F_FIELD_COUNT },
|
||||
{ LOT_NONE, NULL, 0 },
|
||||
{ LOT_VEC3S, sVec3sFields, LUA_VEC3S_FIELD_COUNT },
|
||||
{ LOT_VEC3F, sVec3fFields, LUA_VEC3F_FIELD_COUNT },
|
||||
};
|
||||
|
||||
static struct LuaObjectField* smlua_get_object_field(u16 lot, const char* key) {
|
||||
|
@ -98,6 +98,18 @@ static int smlua__get_field(lua_State* L) {
|
|||
case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p); break;
|
||||
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
||||
case LVT_STRING_P: lua_pushstring(L, *(char**)p); break;
|
||||
|
||||
// pointers
|
||||
case LVT_U8_P:
|
||||
case LVT_U16_P:
|
||||
case LVT_U32_P:
|
||||
case LVT_S8_P:
|
||||
case LVT_S16_P:
|
||||
case LVT_S32_P:
|
||||
case LVT_F32_P:
|
||||
smlua_push_pointer(L, data->valueType, p);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_LUA("_get_field on unimplemented type '%d', key '%s'", data->valueType, key);
|
||||
smlua_logline();
|
||||
|
|
|
@ -4,22 +4,31 @@
|
|||
enum LuaValueType {
|
||||
LVT_BOOL,
|
||||
LVT_U8,
|
||||
LVT_U8_P,
|
||||
LVT_U16,
|
||||
LVT_U16_P,
|
||||
LVT_U32,
|
||||
LVT_U32_P,
|
||||
LVT_S8,
|
||||
LVT_S8_P,
|
||||
LVT_S16,
|
||||
LVT_S16_P,
|
||||
LVT_S32,
|
||||
LVT_S32_P,
|
||||
LVT_F32,
|
||||
LVT_F32_P,
|
||||
LVT_COBJECT,
|
||||
LVT_COBJECT_P,
|
||||
LVT_STRING,
|
||||
LVT_STRING_P,
|
||||
LVT_POINTER,
|
||||
};
|
||||
|
||||
enum LuaObjectType {
|
||||
LOT_NONE = 0,
|
||||
LOT_VEC3S,
|
||||
LOT_VEC3F,
|
||||
LOT_POINTER,
|
||||
LOT_MAX,
|
||||
};
|
||||
|
||||
|
|
|
@ -8,20 +8,20 @@
|
|||
#include "src/engine/surface_collision.h"
|
||||
#include "src/pc/network/network_player.h"
|
||||
|
||||
#define LUA_ANIMATION_FIELD_COUNT 7
|
||||
#define LUA_ANIMATION_FIELD_COUNT 9
|
||||
static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = {
|
||||
{ "flags", LVT_S16, offsetof(struct Animation, flags), false, LOT_NONE },
|
||||
// { "index", LVT_???, offsetof(struct Animation, index), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "length", LVT_U32, offsetof(struct Animation, length), false, LOT_NONE },
|
||||
{ "animYTransDivisor", LVT_S16, offsetof(struct Animation, unk02), false, LOT_NONE },
|
||||
{ "startFrame", LVT_S16, offsetof(struct Animation, unk04), false, LOT_NONE },
|
||||
{ "loopStart", LVT_S16, offsetof(struct Animation, unk06), false, LOT_NONE },
|
||||
{ "loopEnd", LVT_S16, offsetof(struct Animation, unk08), false, LOT_NONE },
|
||||
{ "unusedBoneCount", LVT_S16, offsetof(struct Animation, unk0A), false, LOT_NONE },
|
||||
// { "values", LVT_???, offsetof(struct Animation, values), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "flags", LVT_S16, offsetof(struct Animation, flags), false, LOT_NONE },
|
||||
{ "index", LVT_U16_P, offsetof(struct Animation, index), true, LOT_POINTER },
|
||||
{ "length", LVT_U32, offsetof(struct Animation, length), false, LOT_NONE },
|
||||
{ "animYTransDivisor", LVT_S16, offsetof(struct Animation, unk02), false, LOT_NONE },
|
||||
{ "startFrame", LVT_S16, offsetof(struct Animation, unk04), false, LOT_NONE },
|
||||
{ "loopStart", LVT_S16, offsetof(struct Animation, unk06), false, LOT_NONE },
|
||||
{ "loopEnd", LVT_S16, offsetof(struct Animation, unk08), false, LOT_NONE },
|
||||
{ "unusedBoneCount", LVT_S16, offsetof(struct Animation, unk0A), false, LOT_NONE },
|
||||
{ "values", LVT_S16_P, offsetof(struct Animation, values), true, LOT_POINTER },
|
||||
};
|
||||
|
||||
#define LUA_AREA_FIELD_COUNT 10
|
||||
#define LUA_AREA_FIELD_COUNT 13
|
||||
static struct LuaObjectField sAreaFields[LUA_AREA_FIELD_COUNT] = {
|
||||
// { "cachedBehaviors", LOT_???, offsetof(struct Area, cachedBehaviors), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "cachedPositions", LOT_???, offsetof(struct Area, cachedPositions), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
|
@ -30,13 +30,13 @@ static struct LuaObjectField sAreaFields[LUA_AREA_FIELD_COUNT] = {
|
|||
{ "flags", LVT_S8, offsetof(struct Area, flags), false, LOT_NONE },
|
||||
{ "index", LVT_S8, offsetof(struct Area, index), false, LOT_NONE },
|
||||
{ "instantWarps", LVT_COBJECT_P, offsetof(struct Area, instantWarps), true, LOT_INSTANTWARP },
|
||||
// { "macroObjects", LVT_???, offsetof(struct Area, macroObjects), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "macroObjects", LVT_S16_P, offsetof(struct Area, macroObjects), true, LOT_POINTER },
|
||||
{ "musicParam", LVT_U16, offsetof(struct Area, musicParam), false, LOT_NONE },
|
||||
{ "musicParam2", LVT_U16, offsetof(struct Area, musicParam2), false, LOT_NONE },
|
||||
{ "objectSpawnInfos", LVT_COBJECT_P, offsetof(struct Area, objectSpawnInfos), true, LOT_SPAWNINFO },
|
||||
{ "paintingWarpNodes", LVT_COBJECT_P, offsetof(struct Area, paintingWarpNodes), true, LOT_WARPNODE },
|
||||
// { "surfaceRooms", LVT_???, offsetof(struct Area, surfaceRooms), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "terrainData", LVT_???, offsetof(struct Area, terrainData), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "surfaceRooms", LVT_S8_P, offsetof(struct Area, surfaceRooms), true, LOT_POINTER },
|
||||
{ "terrainData", LVT_S16_P, offsetof(struct Area, terrainData), true, LOT_POINTER },
|
||||
{ "terrainType", LVT_U16, offsetof(struct Area, terrainType), false, LOT_NONE },
|
||||
// { "unk04", LVT_COBJECT_P, offsetof(struct Area, unk04), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "unused28", LVT_COBJECT_P, offsetof(struct Area, unused28), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
|
@ -95,69 +95,69 @@ static struct LuaObjectField sCameraTriggerFields[LUA_CAMERA_TRIGGER_FIELD_COUNT
|
|||
// { "event", LVT_???, offsetof(struct CameraTrigger, event), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
};
|
||||
|
||||
#define LUA_CHARACTER_FIELD_COUNT 57
|
||||
#define LUA_CHARACTER_FIELD_COUNT 59
|
||||
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_STRING_P, 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 },
|
||||
{ "torsoRotMult", LVT_F32, offsetof(struct Character, torsoRotMult), 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_U8, offsetof(struct Character, hudHead), true, LOT_NONE },
|
||||
{ "hudHeadTexture", LVT_U8_P, offsetof(struct Character, hudHeadTexture), true, LOT_POINTER },
|
||||
{ "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE },
|
||||
{ "name", LVT_STRING_P, 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 },
|
||||
{ "torsoRotMult", LVT_F32, offsetof(struct Character, torsoRotMult), true, LOT_NONE },
|
||||
{ "type", LVT_S32, offsetof(struct Character, type), true, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_CONTROLLER_FIELD_COUNT 10
|
||||
|
@ -323,10 +323,10 @@ static struct LuaObjectField sLinearTransitionPointFields[LUA_LINEAR_TRANSITION_
|
|||
{ "yaw", LVT_S16, offsetof(struct LinearTransitionPoint, yaw), false, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_MARIO_ANIMATION_FIELD_COUNT 1
|
||||
#define LUA_MARIO_ANIMATION_FIELD_COUNT 2
|
||||
static struct LuaObjectField sMarioAnimationFields[LUA_MARIO_ANIMATION_FIELD_COUNT] = {
|
||||
// { "animDmaTable", LVT_COBJECT_P, offsetof(struct MarioAnimation, animDmaTable), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "currentAnimAddr", LVT_???, offsetof(struct MarioAnimation, currentAnimAddr), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "currentAnimAddr", LVT_U8_P, offsetof(struct MarioAnimation, currentAnimAddr), true, LOT_POINTER },
|
||||
// { "padding", LOT_???, offsetof(struct MarioAnimation, padding), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "targetAnim", LVT_COBJECT_P, offsetof(struct MarioAnimation, targetAnim), true, LOT_ANIMATION },
|
||||
};
|
||||
|
|
|
@ -10,6 +10,19 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_lot'] == b['_lot'] and a['_pointer'] ~= nil and a['_lot'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"_CPointer = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" return nil\n"
|
||||
" end,\n"
|
||||
" __newindex = function (t,k,v)\n"
|
||||
" end,\n"
|
||||
" __tostring = function(t)\n"
|
||||
" return 'CPointer: ' .. t['_lvt'] .. ', [' .. string.format('0x%08X', t['_pointer']) .. ']'\n"
|
||||
" end,\n"
|
||||
" __eq = function (a, b)\n"
|
||||
" return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"_SyncTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -832,6 +845,13 @@ char gSmluaConstants[] = ""
|
|||
"CHAR_SOUND_SO_LONGA_BOWSER = 40\n"
|
||||
"CHAR_SOUND_IMA_TIRED = 41\n"
|
||||
"CHAR_SOUND_MAX = 42\n"
|
||||
"RESOLUTION_DJUI = 0\n"
|
||||
"RESOLUTION_N64 = 1\n"
|
||||
"RESOLUTION_COUNT = 2\n"
|
||||
"FONT_NORMAL = 0\n"
|
||||
"FONT_MENU = 1\n"
|
||||
"FONT_HUD = 2\n"
|
||||
"FONT_COUNT = 3\n"
|
||||
"INT_GROUND_POUND_OR_TWIRL = (1 << 0)\n"
|
||||
"INT_PUNCH = (1 << 1)\n"
|
||||
"INT_KICK = (1 << 2)\n"
|
||||
|
@ -1466,7 +1486,8 @@ char gSmluaConstants[] = ""
|
|||
"HOOK_ON_PVP_ATTACK = 5\n"
|
||||
"HOOK_ON_PLAYER_CONNECTED = 6\n"
|
||||
"HOOK_ON_PLAYER_DISCONNECTED = 7\n"
|
||||
"HOOK_MAX = 8\n"
|
||||
"HOOK_ON_HUD_RENDER = 8\n"
|
||||
"HOOK_MAX = 9\n"
|
||||
"SPTASK_STATE_NOT_STARTED = 0\n"
|
||||
"SPTASK_STATE_RUNNING = 1\n"
|
||||
"SPTASK_STATE_INTERRUPTED = 2\n"
|
||||
|
|
|
@ -2897,19 +2897,6 @@ int smlua_func_stop_and_set_height_to_floor(lua_State* L) {
|
|||
// network_utils.h //
|
||||
/////////////////////
|
||||
|
||||
/*
|
||||
int smlua_func_network_get_player_text_color(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
u8 localIndex = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
UNIMPLEMENTED -->(L, network_get_player_text_color(localIndex));
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int smlua_func_network_get_player_text_color_string(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
|
@ -3241,27 +3228,6 @@ int smlua_func_stop_shell_music(UNUSED lua_State* L) {
|
|||
// surface_collision.h //
|
||||
/////////////////////////
|
||||
|
||||
/*
|
||||
int smlua_func_f32_find_wall_collision(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
|
||||
|
||||
// f32 * xPtr = (f32 *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
// f32 * yPtr = (f32 *)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
// f32 * zPtr = (f32 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
f32 offsetY = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
f32 radius = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
lua_pushinteger(L, f32_find_wall_collision(xPtr, yPtr, zPtr, offsetY, radius));
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int smlua_func_find_ceil(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
|
||||
|
@ -3718,7 +3684,6 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "stop_and_set_height_to_floor", smlua_func_stop_and_set_height_to_floor);
|
||||
|
||||
// network_utils.h
|
||||
//smlua_bind_function(L, "network_get_player_text_color", smlua_func_network_get_player_text_color); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "network_get_player_text_color_string", smlua_func_network_get_player_text_color_string);
|
||||
smlua_bind_function(L, "network_global_index_from_local", smlua_func_network_global_index_from_local);
|
||||
smlua_bind_function(L, "network_is_server", smlua_func_network_is_server);
|
||||
|
@ -3754,7 +3719,6 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "stop_shell_music", smlua_func_stop_shell_music);
|
||||
|
||||
// surface_collision.h
|
||||
//smlua_bind_function(L, "f32_find_wall_collision", smlua_func_f32_find_wall_collision); <--- UNIMPLEMENTED
|
||||
//smlua_bind_function(L, "find_ceil", smlua_func_find_ceil); <--- UNIMPLEMENTED
|
||||
//smlua_bind_function(L, "find_floor", smlua_func_find_floor); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "find_floor_height", smlua_func_find_floor_height);
|
||||
|
|
|
@ -209,6 +209,24 @@ void smlua_push_object(lua_State* L, u16 lot, void* p) {
|
|||
lua_pop(L, 1); // pop global table
|
||||
}
|
||||
|
||||
void smlua_push_pointer(lua_State* L, u16 lvt, void* p) {
|
||||
if (p == NULL) {
|
||||
lua_pushnil(L);
|
||||
return;
|
||||
}
|
||||
// TODO: add to allowlist
|
||||
//smlua_cobject_allowlist_add(lot, (u64)(intptr_t)p);
|
||||
|
||||
lua_newtable(L);
|
||||
int t = lua_gettop(L);
|
||||
smlua_push_integer_field(t, "_lvt", lvt);
|
||||
smlua_push_integer_field(t, "_pointer", (u64)(intptr_t)p);
|
||||
lua_pushglobaltable(L);
|
||||
lua_getfield(gLuaState, -1, "_CPointer");
|
||||
lua_setmetatable(L, -3);
|
||||
lua_pop(L, 1); // pop global table
|
||||
}
|
||||
|
||||
void smlua_push_integer_field(int index, char* name, lua_Integer val) {
|
||||
lua_pushinteger(gLuaState, val);
|
||||
lua_setfield(gLuaState, index, name);
|
||||
|
|
|
@ -17,6 +17,7 @@ void* smlua_to_cobject(lua_State* L, int index, u16 lot);
|
|||
struct LSTNetworkType smlua_to_lnt(lua_State* L, int index);
|
||||
|
||||
void smlua_push_object(lua_State* L, u16 lot, void* p);
|
||||
void smlua_push_pointer(lua_State* L, u16 lvt, void* p);
|
||||
void smlua_push_integer_field(int index, char* name, lua_Integer val);
|
||||
void smlua_push_number_field(int index, char* name, lua_Number val);
|
||||
void smlua_push_string_field(int index, char* name, const char* val);
|
||||
|
|
Loading…
Reference in a new issue