Add HOOK_ON_MODS_LOADED

This commit is contained in:
Agent X 2024-06-29 16:00:42 -04:00
parent 32a05a2626
commit 8a5a23a8a6
6 changed files with 31 additions and 6 deletions

View File

@ -4069,6 +4069,15 @@ MARIO_SPAWN_UNKNOWN_03 = 0x03
--- @type integer
MARIO_SPAWN_UNKNOWN_27 = 0x27
--- @type integer
PAINTING_WARP_INDEX_END = 0x2D
--- @type integer
PAINTING_WARP_INDEX_FA = 0x2A
--- @type integer
PAINTING_WARP_INDEX_START = 0x00
--- @type integer
PRESS_START_DEMO_TIMER = 800
@ -9231,7 +9240,10 @@ HOOK_ON_ATTACK_OBJECT = 43
HOOK_ON_LANGUAGE_CHANGED = 44
--- @type LuaHookedEventType
HOOK_MAX = 45
HOOK_ON_MODS_LOADED = 45
--- @type LuaHookedEventType
HOOK_MAX = 46
--- @class LuaModMenuElementType
@ -12564,7 +12576,7 @@ MINOR_VERSION_NUMBER = 0
PATCH_VERSION_NUMBER = 0
--- @type string
SM64COOPDX_VERSION = "v1.0"
SM64COOPDX_VERSION = "Prerelease_4"
--- @type integer
VERSION_NUMBER = 37

View File

@ -1428,6 +1428,9 @@
- MARIO_SPAWN_UNKNOWN_02
- MARIO_SPAWN_UNKNOWN_03
- MARIO_SPAWN_UNKNOWN_27
- PAINTING_WARP_INDEX_END
- PAINTING_WARP_INDEX_FA
- PAINTING_WARP_INDEX_START
- PRESS_START_DEMO_TIMER
- SPECIAL_WARP_CAKE
- SPECIAL_WARP_GODDARD
@ -3295,7 +3298,8 @@
| HOOK_ON_SEQ_LOAD | 42 |
| HOOK_ON_ATTACK_OBJECT | 43 |
| HOOK_ON_LANGUAGE_CHANGED | 44 |
| HOOK_MAX | 45 |
| HOOK_ON_MODS_LOADED | 45 |
| HOOK_MAX | 46 |
### [enum LuaModMenuElementType](#LuaModMenuElementType)
| Identifier | Value |

View File

@ -136,6 +136,7 @@ The lua functions sent to `hook_event()` will be automatically called by SM64 wh
| HOOK_ON_SEQ_LOAD | Called when a sequence is going to play, return a `SEQ_*` constant to override the sequence. `SEQ_SOUND_PLAYER` (0) is silence. | `integer` player, `integer` seqID |
| HOOK_ON_ATTACK_OBJECT | Called when a player attacks an object. May be double-fired in some cases, you'll need to write special code for this | [MarioState](structs.md#MarioState) attacker, [Object](structs.md#Object) victim, `integer` interactionId |
| HOOK_ON_LANGUAGE_CHANGED | Called when the language is changed | `string` language |
| HOOK_ON_MODS_LOADED | Called directly after every mod file is loaded in by smlua | None |
### Parameters

View File

@ -333,6 +333,8 @@ void smlua_init(void) {
gLuaActiveMod = NULL;
gLuaLoadingMod = NULL;
}
smlua_call_event_hooks(HOOK_ON_MODS_LOADED);
}
void smlua_update(void) {

View File

@ -1626,6 +1626,9 @@ char gSmluaConstants[] = ""
"WARP_TYPE_CHANGE_AREA = 2\n"
"WARP_TYPE_SAME_AREA = 3\n"
"PRESS_START_DEMO_TIMER = 800\n"
"PAINTING_WARP_INDEX_START = 0x00\n"
"PAINTING_WARP_INDEX_FA = 0x2A\n"
"PAINTING_WARP_INDEX_END = 0x2D\n"
"HUD_DISPLAY_FLAG_LIVES = 0x0001\n"
"HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002\n"
"HUD_DISPLAY_FLAG_STAR_COUNT = 0x0004\n"
@ -3292,7 +3295,8 @@ char gSmluaConstants[] = ""
"HOOK_ON_SEQ_LOAD = 42\n"
"HOOK_ON_ATTACK_OBJECT = 43\n"
"HOOK_ON_LANGUAGE_CHANGED = 44\n"
"HOOK_MAX = 45\n"
"HOOK_ON_MODS_LOADED = 45\n"
"HOOK_MAX = 46\n"
"ACTION_HOOK_EVERY_FRAME = 0\n"
"ACTION_HOOK_GRAVITY = 1\n"
"ACTION_HOOK_MAX = 2\n"
@ -3850,7 +3854,6 @@ char gSmluaConstants[] = ""
"SOUND_MARIO_GROUND_POUND_WAH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x22, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_MARIO_DROWNING = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x23, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_MARIO_PUNCH_WAH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x24, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_MARIO_LETS_A_GO = SOUND_MENU_STAR_SOUND_LETS_A_GO\n"
"SOUND_PEACH_DEAR_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x28, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_MARIO_YAHOO_WAHA_YIPPEE = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x2B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_MARIO_DOH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x30, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
@ -3869,6 +3872,7 @@ char gSmluaConstants[] = ""
"SOUND_PEACH_BAKE_A_CAKE = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3D, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_PEACH_FOR_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3E, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_PEACH_MARIO2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3F, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n"
"SOUND_MARIO_LETS_A_GO = SOUND_MENU_STAR_SOUND_LETS_A_GO\n"
"SOUND_GENERAL_ACTIVATE_CAP_SWITCH = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x00, 0x80, SOUND_DISCRETE)\n"
"SOUND_GENERAL_FLAME_OUT = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x03, 0x80, SOUND_DISCRETE)\n"
"SOUND_GENERAL_OPEN_WOOD_DOOR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x04, 0xC0, SOUND_DISCRETE)\n"
@ -4399,7 +4403,7 @@ char gSmluaConstants[] = ""
"COOP_OBJ_FLAG_LUA = (1 << 1)\n"
"COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n"
"COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n"
"SM64COOPDX_VERSION = 'v1.0'\n"
"SM64COOPDX_VERSION = 'Prerelease_4'\n"
"VERSION_TEXT = 'v'\n"
"VERSION_NUMBER = 37\n"
"MINOR_VERSION_NUMBER = 0\n"

View File

@ -56,6 +56,7 @@ enum LuaHookedEventType {
HOOK_ON_SEQ_LOAD,
HOOK_ON_ATTACK_OBJECT,
HOOK_ON_LANGUAGE_CHANGED,
HOOK_ON_MODS_LOADED,
HOOK_MAX,
};
@ -105,6 +106,7 @@ static const char* LuaHookedEventTypeName[] = {
"HOOK_ON_SEQ_LOAD",
"HOOK_ON_ATTACK_OBJECT",
"HOOK_ON_LANGUAGE_CHANGED",
"HOOK_ON_MODS_LOADED",
"HOOK_MAX"
};