Allow mods to do -- ignore-script-warnings: true
This commit is contained in:
parent
d23c6f0ac5
commit
7c01e405e0
|
@ -234,6 +234,9 @@
|
|||
--- @field public shakeSpeed integer
|
||||
--- @field public unusedIsSleeping integer
|
||||
|
||||
--- @class CameraOverride
|
||||
--- @field public override boolean
|
||||
|
||||
--- @class CameraStoredInfo
|
||||
--- @field public cannonYOffset number
|
||||
--- @field public focus Vec3f
|
||||
|
@ -1052,6 +1055,7 @@
|
|||
--- @field public description string
|
||||
--- @field public enabled boolean
|
||||
--- @field public fileCount integer
|
||||
--- @field public ignoreScriptWarnings boolean
|
||||
--- @field public incompatible string
|
||||
--- @field public index integer
|
||||
--- @field public isDirectory boolean
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
- [BullyCollisionData](#BullyCollisionData)
|
||||
- [Camera](#Camera)
|
||||
- [CameraFOVStatus](#CameraFOVStatus)
|
||||
- [CameraOverride](#CameraOverride)
|
||||
- [CameraStoredInfo](#CameraStoredInfo)
|
||||
- [CameraTrigger](#CameraTrigger)
|
||||
- [ChainSegment](#ChainSegment)
|
||||
|
@ -391,6 +392,16 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [CameraOverride](#CameraOverride)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| override | `boolean` | |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [CameraStoredInfo](#CameraStoredInfo)
|
||||
|
||||
| Field | Type | Access |
|
||||
|
@ -1420,6 +1431,7 @@
|
|||
| description | `string` | read-only |
|
||||
| enabled | `boolean` | read-only |
|
||||
| fileCount | `integer` | read-only |
|
||||
| ignoreScriptWarnings | `boolean` | read-only |
|
||||
| incompatible | `string` | read-only |
|
||||
| index | `integer` | read-only |
|
||||
| isDirectory | `boolean` | read-only |
|
||||
|
|
|
@ -31,6 +31,7 @@ void smlua_mod_warning(void) {
|
|||
struct Mod* mod = gLuaActiveMod;
|
||||
if (mod == NULL) { mod = gLuaLastHookMod; }
|
||||
if (mod == NULL) { return; }
|
||||
if (mod->ignoreScriptWarnings) { return; }
|
||||
char txt[255] = { 0 };
|
||||
snprintf(txt, 254, "'%s\\#ffe600\\' is using deprecated functions!", mod->name);
|
||||
static const struct DjuiColor color = { 255, 230, 0, 255 };
|
||||
|
|
|
@ -287,6 +287,12 @@ static struct LuaObjectField sCameraFOVStatusFields[LUA_CAMERA_FOVSTATUS_FIELD_C
|
|||
{ "unusedIsSleeping", LVT_U32, offsetof(struct CameraFOVStatus, unusedIsSleeping), false, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_CAMERA_OVERRIDE_FIELD_COUNT 1
|
||||
static struct LuaObjectField sCameraOverrideFields[LUA_CAMERA_OVERRIDE_FIELD_COUNT] = {
|
||||
{ "override", LVT_BOOL, offsetof(struct CameraOverride, override), false, LOT_NONE },
|
||||
// { "value", LVT_???, offsetof(struct CameraOverride, value), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
};
|
||||
|
||||
#define LUA_CAMERA_STORED_INFO_FIELD_COUNT 4
|
||||
static struct LuaObjectField sCameraStoredInfoFields[LUA_CAMERA_STORED_INFO_FIELD_COUNT] = {
|
||||
{ "cannonYOffset", LVT_F32, offsetof(struct CameraStoredInfo, cannonYOffset), false, LOT_NONE },
|
||||
|
@ -1172,22 +1178,23 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
|
|||
{ "waterLevel", LVT_S16, offsetof(struct MarioState, waterLevel), false, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_MOD_FIELD_COUNT 13
|
||||
#define LUA_MOD_FIELD_COUNT 14
|
||||
static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
||||
{ "basePath", LVT_STRING, offsetof(struct Mod, basePath), true, LOT_NONE },
|
||||
{ "customBehaviorIndex", LVT_U8, offsetof(struct Mod, customBehaviorIndex), true, LOT_NONE },
|
||||
{ "description", LVT_STRING_P, offsetof(struct Mod, description), true, LOT_NONE },
|
||||
{ "enabled", LVT_BOOL, offsetof(struct Mod, enabled), true, LOT_NONE },
|
||||
{ "fileCount", LVT_U16, offsetof(struct Mod, fileCount), true, LOT_NONE },
|
||||
{ "incompatible", LVT_STRING_P, offsetof(struct Mod, incompatible), true, LOT_NONE },
|
||||
{ "index", LVT_S32, offsetof(struct Mod, index), true, LOT_NONE },
|
||||
{ "isDirectory", LVT_BOOL, offsetof(struct Mod, isDirectory), true, LOT_NONE },
|
||||
{ "name", LVT_STRING_P, offsetof(struct Mod, name), true, LOT_NONE },
|
||||
{ "pausable", LVT_BOOL, offsetof(struct Mod, pausable), true, LOT_NONE },
|
||||
{ "relativePath", LVT_STRING, offsetof(struct Mod, relativePath), true, LOT_NONE },
|
||||
{ "renderBehindHud", LVT_BOOL, offsetof(struct Mod, renderBehindHud), true, LOT_NONE },
|
||||
{ "selectable", LVT_BOOL, offsetof(struct Mod, selectable), true, LOT_NONE },
|
||||
// { "size", LVT_???, offsetof(struct Mod, size), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "basePath", LVT_STRING, offsetof(struct Mod, basePath), true, LOT_NONE },
|
||||
{ "customBehaviorIndex", LVT_U8, offsetof(struct Mod, customBehaviorIndex), true, LOT_NONE },
|
||||
{ "description", LVT_STRING_P, offsetof(struct Mod, description), true, LOT_NONE },
|
||||
{ "enabled", LVT_BOOL, offsetof(struct Mod, enabled), true, LOT_NONE },
|
||||
{ "fileCount", LVT_U16, offsetof(struct Mod, fileCount), true, LOT_NONE },
|
||||
{ "ignoreScriptWarnings", LVT_BOOL, offsetof(struct Mod, ignoreScriptWarnings), true, LOT_NONE },
|
||||
{ "incompatible", LVT_STRING_P, offsetof(struct Mod, incompatible), true, LOT_NONE },
|
||||
{ "index", LVT_S32, offsetof(struct Mod, index), true, LOT_NONE },
|
||||
{ "isDirectory", LVT_BOOL, offsetof(struct Mod, isDirectory), true, LOT_NONE },
|
||||
{ "name", LVT_STRING_P, offsetof(struct Mod, name), true, LOT_NONE },
|
||||
{ "pausable", LVT_BOOL, offsetof(struct Mod, pausable), true, LOT_NONE },
|
||||
{ "relativePath", LVT_STRING, offsetof(struct Mod, relativePath), true, LOT_NONE },
|
||||
{ "renderBehindHud", LVT_BOOL, offsetof(struct Mod, renderBehindHud), true, LOT_NONE },
|
||||
{ "selectable", LVT_BOOL, offsetof(struct Mod, selectable), true, LOT_NONE },
|
||||
// { "size", LVT_???, offsetof(struct Mod, size), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
};
|
||||
|
||||
#define LUA_MOD_AUDIO_FIELD_COUNT 3
|
||||
|
@ -2429,6 +2436,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
|
|||
{ LOT_BULLYCOLLISIONDATA, sBullyCollisionDataFields, LUA_BULLY_COLLISION_DATA_FIELD_COUNT },
|
||||
{ LOT_CAMERA, sCameraFields, LUA_CAMERA_FIELD_COUNT },
|
||||
{ LOT_CAMERAFOVSTATUS, sCameraFOVStatusFields, LUA_CAMERA_FOVSTATUS_FIELD_COUNT },
|
||||
{ LOT_CAMERAOVERRIDE, sCameraOverrideFields, LUA_CAMERA_OVERRIDE_FIELD_COUNT },
|
||||
{ LOT_CAMERASTOREDINFO, sCameraStoredInfoFields, LUA_CAMERA_STORED_INFO_FIELD_COUNT },
|
||||
{ LOT_CAMERATRIGGER, sCameraTriggerFields, LUA_CAMERA_TRIGGER_FIELD_COUNT },
|
||||
{ LOT_CHAINSEGMENT, sChainSegmentFields, LUA_CHAIN_SEGMENT_FIELD_COUNT },
|
||||
|
|
|
@ -15,6 +15,7 @@ enum LuaObjectAutogenType {
|
|||
LOT_BULLYCOLLISIONDATA,
|
||||
LOT_CAMERA,
|
||||
LOT_CAMERAFOVSTATUS,
|
||||
LOT_CAMERAOVERRIDE,
|
||||
LOT_CAMERASTOREDINFO,
|
||||
LOT_CAMERATRIGGER,
|
||||
LOT_CHAINSEGMENT,
|
||||
|
|
|
@ -434,6 +434,8 @@ static void mod_extract_fields(struct Mod* mod) {
|
|||
}
|
||||
} else if (!mod->pausable && (extracted = extract_lua_field("-- pausable:", buffer))) {
|
||||
mod->pausable = !strcmp(extracted, "true");
|
||||
} else if (!mod->ignoreScriptWarnings && (extracted = extract_lua_field("-- ignore-script-warnings:", buffer))) {
|
||||
mod->ignoreScriptWarnings = !strcmp(extracted, "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ struct Mod {
|
|||
bool selectable;
|
||||
bool renderBehindHud;
|
||||
bool pausable;
|
||||
bool ignoreScriptWarnings;
|
||||
size_t size;
|
||||
u8 customBehaviorIndex;
|
||||
};
|
||||
|
|
|
@ -85,6 +85,7 @@ void network_send_mod_list(void) {
|
|||
packet_write(&p, &modSize, sizeof(u64));
|
||||
packet_write(&p, &mod->isDirectory, sizeof(u8));
|
||||
packet_write(&p, &mod->pausable, sizeof(u8));
|
||||
packet_write(&p, &mod->ignoreScriptWarnings, sizeof(u8));
|
||||
packet_write(&p, &mod->fileCount, sizeof(u16));
|
||||
network_send_to(0, &p);
|
||||
LOG_INFO(" '%s': %llu", mod->name, (u64)mod->size);
|
||||
|
@ -224,6 +225,7 @@ void network_receive_mod_list_entry(struct Packet* p) {
|
|||
packet_read(p, &mod->size, sizeof(u64));
|
||||
packet_read(p, &mod->isDirectory, sizeof(u8));
|
||||
packet_read(p, &mod->pausable, sizeof(u8));
|
||||
packet_read(p, &mod->ignoreScriptWarnings, sizeof(u8));
|
||||
normalize_path(mod->relativePath);
|
||||
LOG_INFO(" '%s': %llu", mod->name, (u64)mod->size);
|
||||
|
||||
|
|
Loading…
Reference in New Issue