@gaialabs/iog-baserom 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/baserom/auto-use-items/CellKeysAutoUse.patch.asm +30 -0
  2. package/baserom/auto-use-items/CrystalBallAutoUse.patch.asm +131 -0
  3. package/baserom/auto-use-items/DiamondBlockAutoUse.patch.asm +50 -0
  4. package/baserom/auto-use-items/ElevatorKeyAutoUse.patch.asm +26 -0
  5. package/baserom/auto-use-items/GorgonFlowerAutoUse.patch.asm +153 -0
  6. package/baserom/auto-use-items/HieroglyphPuzzle.patch.asm +1187 -0
  7. package/baserom/auto-use-items/HopeStatueAutoUse.patch.asm +99 -0
  8. package/baserom/auto-use-items/IncanStatueAutoUse.patch.asm +75 -0
  9. package/baserom/auto-use-items/ItemUseStub.patch.asm +24 -0
  10. package/baserom/auto-use-items/MagicPowerAutoUse.patch.asm +55 -0
  11. package/baserom/auto-use-items/MeatAutoUse.patch.asm +33 -0
  12. package/baserom/auto-use-items/MushroomDropAutoUse.patch.asm +100 -0
  13. package/baserom/auto-use-items/PalaceKeyAutoUse.patch.asm +52 -0
  14. package/baserom/auto-use-items/PrisonKeyAutoUse.patch.asm +84 -0
  15. package/baserom/auto-use-items/PurificationStoneAutoUse.patch.asm +49 -0
  16. package/baserom/auto-use-items/RamaStatueAutoUse.patch.asm +100 -0
  17. package/baserom/auto-use-items/TearpotAutoUse.patch.asm +41 -0
  18. package/baserom/{spritemaps → boot-logo}/spm_boot_logos.sprite.asm +10 -0
  19. package/baserom/collectible-system/RelicMenu.patch.asm +250 -0
  20. package/baserom/collectible-system/key_item_core.asm +445 -0
  21. package/baserom/{patches → equipped-icon}/EquippedIcon.patch.asm +41 -46
  22. package/baserom/equipped-icon/ItemSwapping.patch.asm +99 -0
  23. package/baserom/{palettes → equipped-icon}/pal_item_exprite2.pal +0 -0
  24. package/baserom/{spritemaps → equipped-icon}/spm_sc02_main_characters.sprite.asm +10 -0
  25. package/baserom/equipped-icon/spriteset_aura.asm +131 -0
  26. package/baserom/equipped-icon/spriteset_dark_friar.asm +277 -0
  27. package/baserom/equipped-icon/spriteset_darkgaia_projectile.asm +233 -0
  28. package/baserom/fixes-tweaks/BCDHex.patch.asm +60 -0
  29. package/baserom/fixes-tweaks/HudRedesign.patch.asm +108 -0
  30. package/baserom/fixes-tweaks/NeilsFatherFix.patch.asm +26 -0
  31. package/baserom/fixes-tweaks/PyramidPortalExit.patch.asm +41 -0
  32. package/baserom/fixes-tweaks/SceneTitles.patch.asm +84 -0
  33. package/baserom/fixes-tweaks/ThankfulFlower.patch.asm +28 -0
  34. package/baserom/fixes-tweaks/Utils.patch.asm +111 -0
  35. package/baserom/{spritemaps → fixes-tweaks}/spm_goldship_sprites.sprite.asm +11 -0
  36. package/baserom/fonts/EnhancedOverworldText.patch.asm +44 -0
  37. package/baserom/fonts/EnhancedPrologueText.patch.asm +252 -0
  38. package/baserom/{graphics → fonts}/gfx_fonts.bin +0 -0
  39. package/baserom/fonts/gfx_overworld_font.bin +0 -0
  40. package/baserom/inventory/EnhancedSlotActor.patch.asm +50 -0
  41. package/baserom/inventory/InventoryCounters.patch.asm +407 -0
  42. package/baserom/inventory/InventoryManagement.patch.asm +390 -0
  43. package/baserom/kara-run/gfx_castle_sprites.bin +0 -0
  44. package/baserom/new-game-plus/NGPEpilogueSwitch.patch.asm +52 -0
  45. package/baserom/{patches → new-game-plus}/NewGamePlus.patch.asm +42 -23
  46. package/baserom/oakton/map_fr30.map +0 -0
  47. package/baserom/oakton/map_fr30_effect.map +0 -0
  48. package/baserom/options-menu/EnhancedInvItemPicker.patch.asm +130 -0
  49. package/baserom/options-menu/MinimalHudOption.patch.asm +109 -0
  50. package/baserom/options-menu/OptionsMenu.patch.asm +218 -0
  51. package/baserom/options-menu/TextSpeedOption.patch.asm +108 -0
  52. package/baserom/options-menu/options_input_remap.asm +373 -0
  53. package/baserom/options-menu/options_menu_core.asm +1221 -0
  54. package/baserom/patches/APUWaitFixes.patch.asm +30 -17
  55. package/baserom/patches/AccentMap.patch.asm +16 -5
  56. package/baserom/patches/MusicTransitions.patch.asm +41 -24
  57. package/baserom/player-input/MergeInputFlags.patch.asm +146 -0
  58. package/baserom/player-input/PlayerInput.patch.asm +51 -0
  59. package/baserom/red-jewels/AnnSparkle.patch.asm +28 -0
  60. package/baserom/red-jewels/ChestFlaggedHiddenRedJewel.patch.asm +50 -0
  61. package/baserom/red-jewels/FishermanRedJewel.patch.asm +55 -0
  62. package/baserom/red-jewels/LanceSparkle.patch.asm +38 -0
  63. package/baserom/red-jewels/RedJewelSparkle.patch.asm +49 -0
  64. package/baserom/red-jewels/SnakePanicSparkle.patch.asm +45 -0
  65. package/baserom/red-jewels/SparkleAlways.patch.asm.example +19 -0
  66. package/baserom/red-jewels/StoneGirlSparkle.patch.asm +26 -0
  67. package/baserom/red-jewels/TrappedSlaveSparkle.patch.asm +63 -0
  68. package/baserom/red-jewels/generic_sparkle.asm +57 -0
  69. package/baserom/run-button/RunButtonCore.patch.asm +89 -0
  70. package/baserom/run-button/RunButtonOption.patch.asm +50 -0
  71. package/baserom/{patches/BitmapPatch.patch.asm → scene-load/BitmapLoad.patch.asm} +27 -12
  72. package/baserom/scene-load/Cop51Decompress.patch.asm +98 -0
  73. package/baserom/scene-load/ExpriteLoader.patch.asm +82 -0
  74. package/baserom/scene-load/MapNameLookup.patch.asm +27 -0
  75. package/baserom/scene-load/MenuBGLoad.patch.asm +70 -0
  76. package/baserom/scene-load/SFXTable.patch.asm +92 -0
  77. package/baserom/scene-load/SceneMetaLoad.patch.asm +68 -0
  78. package/baserom/scene-load/SpritemapLoad.patch.asm +61 -0
  79. package/baserom/scene-load/TilemapLoad.patch.asm +109 -0
  80. package/baserom/scene-load/TilesetLoad.patch.asm +41 -0
  81. package/baserom/set_overworld.set +0 -0
  82. package/baserom/seths-jewel/SethsJewelGoldShip.patch.asm +22 -0
  83. package/baserom/seths-jewel/SethsJewelIcon.patch.asm +22 -0
  84. package/baserom/seths-jewel/SethsJewelItem.patch.asm +62 -0
  85. package/baserom/seths-jewel/SethsJewelSprites.patch.asm +49 -0
  86. package/baserom/{patches → sky-delivery}/SouthCapeDeliveryman.patch.asm +12 -3
  87. package/baserom/sky-delivery/WatermiaDeliveryman.patch.asm +15 -0
  88. package/dist/index.cjs +10159 -964
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +9 -1
  91. package/dist/index.d.cts.map +1 -1
  92. package/dist/index.d.mts +9 -1
  93. package/dist/index.d.mts.map +1 -1
  94. package/dist/index.mjs +10161 -967
  95. package/dist/index.mjs.map +1 -1
  96. package/package.json +10 -8
  97. package/baserom/asm/spriteset_aura.asm +0 -122
  98. package/baserom/asm/spriteset_dark_friar.asm +0 -268
  99. package/baserom/asm/spriteset_will_projectile.asm +0 -224
  100. package/baserom/patches/Cop51Patch.patch.asm +0 -81
  101. package/baserom/patches/DPShop.asm.old +0 -328
  102. package/baserom/patches/DeathWarp.asm.old +0 -174
  103. package/baserom/patches/ExpandedHealthBars.old +0 -203
  104. package/baserom/patches/ExpriteLoader.patch.asm +0 -66
  105. package/baserom/patches/GemShop.asm.old +0 -345
  106. package/baserom/patches/InventoryCounters.patch.asm +0 -292
  107. package/baserom/patches/InventoryManagement.patch.asm +0 -324
  108. package/baserom/patches/InventoryScript.asm.old +0 -319
  109. package/baserom/patches/ItemDictionary.asm.old +0 -86
  110. package/baserom/patches/ItemRewards.asm.old +0 -49
  111. package/baserom/patches/ItemSwapping.patch.asm +0 -80
  112. package/baserom/patches/MapNameLookup.patch.asm +0 -13
  113. package/baserom/patches/MenuBGPatch.patch.asm +0 -54
  114. package/baserom/patches/NGPEpilogueSwitch.patch.asm +0 -44
  115. package/baserom/patches/PixelConverter.patch.asm.old +0 -60
  116. package/baserom/patches/QuickScripts.asm.old +0 -210
  117. package/baserom/patches/RunButton.patch.asm +0 -79
  118. package/baserom/patches/SFXTable.patch.asm +0 -73
  119. package/baserom/patches/SceneLoadPatch.patch.asm +0 -52
  120. package/baserom/patches/SpritemapPatch.patch.asm +0 -45
  121. package/baserom/patches/Teleporter.patch.asm.old +0 -203
  122. package/baserom/patches/TilemapPatch.patch.asm +0 -94
  123. package/baserom/patches/TilesetPatch.patch.asm +0 -27
  124. package/baserom/patches/Utils.patch.asm +0 -414
  125. package/baserom/patches/WatermiaDeliveryman.patch.asm +0 -2
  126. /package/baserom/{graphics → boot-logo}/gfx_boot_exprite.raw.bin +0 -0
  127. /package/baserom/{graphics → boot-logo}/gfx_boot_logos.bin +0 -0
  128. /package/baserom/{palettes → boot-logo}/pal_boot_logos.pal +0 -0
  129. /package/baserom/{palettes → equipped-icon}/fx_palette_198000.pal +0 -0
  130. /package/baserom/{graphics → equipped-icon}/gfx_item_exprite.raw.bin +0 -0
  131. /package/baserom/{graphics → equipped-icon}/misc_fx_1CD580.bin +0 -0
  132. /package/baserom/{palettes → equipped-icon}/pal_item_exprite.pal +0 -0
  133. /package/baserom/{palettes → equipped-icon}/pal_sc02_main_characters.pal +0 -0
  134. /package/baserom/{graphics → fonts}/gfx_credits_font.bin +0 -0
  135. /package/baserom/{graphics → inventory}/gfx_inventory_sprites.bin +0 -0
@@ -1,4 +1,17 @@
1
1
  
2
+ ; ==============================================================================
3
+ ; APU wait before music - cutscene and item-get sequences
4
+ ; ==============================================================================
5
+ ; What it does: Before playing BGM track $17 (or after SPC upload), polls MSU
6
+ ; register $2000 bit 4 or APUIO1=$FF so jingles and long COP chains finish
7
+ ; after the SPC is ready (chunk $1B gate via $0D72/$0D73).
8
+ ; Vanilla behavior: Scripts proceed immediately after COP music/item commands.
9
+ ; Hooks (overrides): music_actors, warps_interaction, item_use_system flute,
10
+ ; sc06_lola, dm47_sam, sp5C_stone_coffin, sE6_gaia aura paths, ir1D_wind_melody.
11
+ ; Depends on: music COP C1 wait, IsMusicPlaying JSL where present.
12
+ ; State: $0D72 track id, $0D73 MSU flag, $2141 APUIO1, $2000 MSU status.
13
+ ; Hazards/notes: Joypad masked during waits; COP spawn paths preserve actor Y.
14
+ ; ==============================================================================
2
15
 
3
16
  !joypad_mask_std 065A
4
17
  !player_actor 09AA
@@ -10,7 +23,7 @@
10
23
  ?INCLUDE 'warps_interaction'
11
24
  -----------------------------------------
12
25
 
13
- loc_02A07D! {
26
+ music_actors.MusicJingleRenderSync! {
14
27
  COP [9C] ( @MusicRenderSync, #$2000 )
15
28
  LDA $20
16
29
  STA $0020, Y
@@ -34,7 +47,7 @@ loc_02A07D! {
34
47
  LDA $2000
35
48
  AND #$10
36
49
  REP #$20
37
- BEQ loc_02A0A9
50
+ BEQ MusicJingleSpcReady
38
51
  RTL
39
52
 
40
53
  chunk_halt_test:
@@ -44,13 +57,13 @@ loc_02A07D! {
44
57
  REP #$20
45
58
  AND #$00FF
46
59
  CMP #$00FF
47
- BEQ loc_02A0A9
60
+ BEQ MusicJingleSpcReady
48
61
  RTL
49
62
  }
50
63
 
51
64
  -----------------------------------------
52
65
 
53
- loc_02A813! {
66
+ warps_interaction.loc_02A813! {
54
67
  COP [9C] ( @ChestDialogueActor, #$2000 )
55
68
  LDA $24
56
69
  STA $0024, Y
@@ -92,7 +105,7 @@ loc_02A813! {
92
105
  ?INCLUDE 'chunk_038000'
93
106
  -----------------------------------------
94
107
 
95
- loc_03A029! {
108
+ item_use_system.FlutePlaybackPhase! {
96
109
  LDA $0D73
97
110
  AND #$00FF
98
111
  BEQ chunk_halt_test3
@@ -125,7 +138,7 @@ loc_03A029! {
125
138
  ?INCLUDE 'sc06_lola'
126
139
  -----------------------------------------
127
140
 
128
- code_049985! {
141
+ sc06_lola.code_049985! {
129
142
  LDA #$FFF0
130
143
  TSB $joypadMaskStd
131
144
  COP [CC] ( #35 )
@@ -165,7 +178,7 @@ code_049985! {
165
178
  ?INCLUDE 'dm47_sam'
166
179
  -----------------------------------------
167
180
 
168
- loc_05D24B! {
181
+ dm47_sam.loc_05D24B! {
169
182
  COP [C0] ( &code_05D29E )
170
183
  COP [D2] ( #5E, #01 )
171
184
  LDA #$FFF0
@@ -205,13 +218,13 @@ loc_05D24B! {
205
218
  ?INCLUDE 'sp5C_stone_coffin'
206
219
  -----------------------------------------
207
220
 
208
- code_0691BE! {
221
+ sp5C_stone_coffin.code_0691BE! {
209
222
  COP [D2] ( #02, #01 )
210
223
  LDA #$CFF0
211
224
  TSB $joypadMaskStd
212
225
  LDA #$2000
213
226
  TRB $10
214
- COP [88] ( @spriteset_enemies )
227
+ COP [88] ( @spriteset_pickups_effects )
215
228
  LDY $player_actor
216
229
  LDA $0014, Y
217
230
  STA $14
@@ -289,7 +302,7 @@ code_0691BE! {
289
302
  ?INCLUDE 'sE6_gaia'
290
303
  -----------------------------------------
291
304
 
292
- loc_08DCAF! {
305
+ sE6_gaia.GaiaAuraGiftSequence! {
293
306
  COP [D6] ( #24, &GaiaHint_AuraDesc )
294
307
  COP [D4] ( #24, &GaiaHint_AuraFull )
295
308
  COP [BF] ( &dialogstring_08E66C )
@@ -313,7 +326,7 @@ loc_08DCAF! {
313
326
  LDA $2000
314
327
  AND #$10
315
328
  REP #$20
316
- BEQ loc_08DCDF
329
+ BEQ GaiaAuraFanfareDone
317
330
  RTL
318
331
 
319
332
  gaia_halt_test:
@@ -323,13 +336,13 @@ loc_08DCAF! {
323
336
  REP #$20
324
337
  AND #$00FF
325
338
  CMP #$00FF
326
- BEQ loc_08DCDF
339
+ BEQ GaiaAuraFanfareDone
327
340
  RTL
328
341
  }
329
342
 
330
343
  ---------------------------------------------
331
344
 
332
- loc_08EAAA! {
345
+ sE6_gaia.AbilityGrantSequence! {
333
346
  COP [CA] ( #08 )
334
347
  LDA #$FFF0
335
348
  TSB $joypadMaskStd
@@ -373,7 +386,7 @@ loc_08EAAA! {
373
386
  LDA $2000
374
387
  AND #$10
375
388
  REP #$20
376
- BEQ loc_08EB0D
389
+ BEQ AbilityGrantFanfareDone
377
390
  RTL
378
391
 
379
392
  gaia_halt_test2:
@@ -383,13 +396,13 @@ loc_08EAAA! {
383
396
  REP #$20
384
397
  AND #$00FF
385
398
  CMP #$00FF
386
- BEQ loc_08EB0D
399
+ BEQ AbilityGrantFanfareDone
387
400
  RTL
388
401
  }
389
402
 
390
403
  -----------------------------------------
391
404
 
392
- AuraItemGrant! {
405
+ sE6_gaia.AuraItemGrant! {
393
406
  LDA #$FFF0
394
407
  TSB $joypadMaskStd
395
408
  COP [DA] ( #05 )
@@ -447,7 +460,7 @@ AuraItemGrant! {
447
460
  ?INCLUDE 'ir1D_wind_melody'
448
461
  ------------------------------------------
449
462
 
450
- code_09C58D! {
463
+ ir1D_wind_melody.code_09C58D! {
451
464
  LDA #$EFF0
452
465
  TSB $joypadMaskStd
453
466
  COP [DA] ( #1D )
@@ -1,11 +1,22 @@
1
1
 
2
+ ; ==============================================================================
3
+ ; Dialog string renderer - extended accent glyph table
4
+ ; ==============================================================================
5
+ ; What it does: Bytes $E0-$FF map through accent_table to font tile pairs in
6
+ ; the VRAM dialog buffer instead of passing through as raw tile indices.
7
+ ; Vanilla behavior: $E0+ treated like ordinary characters in loc_03E27C path.
8
+ ; Hooks (overrides): DialogStringRenderer entry, CharLoop, loc_03E27C; adds
9
+ ; do_accent_table branch and accent_table data in bank 03.
10
+ ; Depends on: chunk_03BAE1, DialogStringCommandTable for $C0-$DF commands.
11
+ ; State: $0998 VRAM write index, $0986/$0987 palette attrs, $7F0200/$7F0240 rows.
12
+ ; Hazards/notes: CharLoop RTS dispatch unchanged for $C0-$DF; accent uses SEP ORA.
13
+ ; ==============================================================================
14
+
2
15
  -------------------------------------------
3
16
  ?INCLUDE 'chunk_03BAE1'
4
17
  -------------------------------------------
5
18
 
6
- ;Characters >= 0xE0 will use the accent table
7
-
8
- DialogStringRenderer! {
19
+ DialogStringRenderer.DialogStringRenderer! {
9
20
  PHP
10
21
  PHD
11
22
  PHX
@@ -13,7 +24,7 @@ DialogStringRenderer! {
13
24
  TCD
14
25
  LDX $0998
15
26
 
16
- DialogString_CharLoop!:
27
+ DialogStringRenderer.DialogString_CharLoop!:
17
28
  SEP #$20
18
29
  LDA $0000, Y
19
30
  CMP #$E0
@@ -34,7 +45,7 @@ DialogStringRenderer! {
34
45
  RTS
35
46
  }
36
47
 
37
- loc_03E27C! {
48
+ DialogStringRenderer.loc_03E27C! {
38
49
  REP #$20
39
50
  AND #$00FF
40
51
  INY
@@ -1,4 +1,21 @@
1
- ?BANK 03
1
+ 
2
+ ; ==============================================================================
3
+ ; Music transitions - MSU-1 overlay and scene-change fades
4
+ ; ==============================================================================
5
+ ; What it does: Detects MSU hardware at boot, routes COP APUIO0 and scene-meta
6
+ ; music loads through MSU registers when $0D73 set; fades on scene change
7
+ ; when BGM table entries differ; extends transition effect loops for fade sync.
8
+ ; Vanilla behavior: SPC-only IPL load, immediate music thinker handshakes, no
9
+ ; cross-scene fade token in ExecuteSceneTransition.
10
+ ; Hooks (overrides): cop_handlers_audio WriteApuIo0; spc_transfer boot load;
11
+ ; scene_lifecycle transition paths; hdma_dma_spc music thinker chain;
12
+ ; scene_script SpcMusicLoadCmd / loc_028B91 loader.
13
+ ; Adds: bgm_table, bgm_track_map, bgm_loop_map, count_check, bgm_load_exit.
14
+ ; Depends on: spc_transfer, scene_meta music tags, token $00E6 scratch.
15
+ ; State: $0D72/$0D73/$06F2 music, $2004-$2007 MSU, $0642/$0644 scene meta ids.
16
+ ; Hazards/notes: ExecuteSceneTransition still calls ScreenExitTransition; MSU
17
+ ; path skips some APUIO halt steps; loc_028B91 reached via JML from loader.
18
+ ; ==============================================================================
2
19
 
3
20
  ?INCLUDE 'cop_handlers_audio'
4
21
  ?INCLUDE 'chunk_03BAE1'
@@ -89,12 +106,12 @@ count_check {
89
106
 
90
107
  count_ret:
91
108
  PLA
92
- RTS
109
+ RTL
93
110
  }
94
111
 
95
112
  ---------------------------------------
96
113
 
97
- WriteApuIo0! {
114
+ cop_handlers_audio.WriteApuIo0! {
98
115
  SEP #$20
99
116
  LDA msu_flag
100
117
  BEQ cop0A_normal ;Normal process when no MSU
@@ -141,7 +158,7 @@ WriteApuIo0! {
141
158
  --------------------------------------
142
159
  ;Hook for SPC init
143
160
 
144
- SpcLoadBuiltinEngine! {
161
+ spc_transfer.SpcLoadBuiltinEngine! {
145
162
  REP #$20
146
163
 
147
164
  LDA $2002
@@ -175,7 +192,7 @@ SpcLoadBuiltinEngine! {
175
192
  --------------------------------------
176
193
  ;Hook for checking track changes before screen transition
177
194
 
178
- ExecuteSceneTransition! {
195
+ scene_lifecycle.ExecuteSceneTransition! {
179
196
  LDA $0654
180
197
  BMI loc_03DA03
181
198
  BEQ loc_03DA00
@@ -223,7 +240,7 @@ ExecuteSceneTransition! {
223
240
 
224
241
  -----------------------------------------------
225
242
 
226
- loc_03DADC! {
243
+ scene_lifecycle.loc_03DADC! {
227
244
  JSL $@UpdateFrameDialogue
228
245
  LDA $0DB6
229
246
  BEQ loc_03DAF1
@@ -231,7 +248,7 @@ loc_03DADC! {
231
248
  BPL loc_03DADC
232
249
  STA $INIDISP
233
250
 
234
- JSR count_check
251
+ JSL count_check
235
252
  DEC
236
253
  STA $0DB6
237
254
  BPL loc_03DAD5
@@ -239,7 +256,7 @@ loc_03DADC! {
239
256
 
240
257
  ----------------------------------------------
241
258
 
242
- loc_03DAF2! {
259
+ scene_lifecycle.loc_03DAF2! {
243
260
  LDA token
244
261
  BEQ immed_skip
245
262
  BMI immed_bgm
@@ -262,7 +279,7 @@ loc_03DAF2! {
262
279
  -------------------------------------------
263
280
  ;Mosaic mode
264
281
 
265
- loc_03DB05! {
282
+ scene_lifecycle.loc_03DB05! {
266
283
  JSL $@UpdateFrameDialogue
267
284
  DEX
268
285
  BPL loc_03DB05
@@ -277,7 +294,7 @@ loc_03DB05! {
277
294
  STA $MOSAIC
278
295
  PLA
279
296
 
280
- JSR count_check
297
+ JSL count_check
281
298
  DEC
282
299
  BPL loc_03DAFC ;This loops through 0
283
300
  RTS
@@ -285,7 +302,7 @@ loc_03DB05! {
285
302
 
286
303
  --------------------------------------------
287
304
 
288
- loc_03DB6F! {
305
+ scene_lifecycle.loc_03DB6F! {
289
306
  LDA $006E
290
307
  STA $00
291
308
  PHA
@@ -302,7 +319,7 @@ loc_03DB6F! {
302
319
  BNE loc_03DB6F
303
320
  LDA $01, S
304
321
 
305
- JSR count_check
322
+ JSL count_check
306
323
  DEC
307
324
  STA $01, S
308
325
  STA $INIDISP
@@ -318,7 +335,7 @@ loc_03DB6F! {
318
335
 
319
336
  -------------------------------------------------
320
337
 
321
- loc_03DBBC! {
338
+ scene_lifecycle.loc_03DBBC! {
322
339
  INC $006E
323
340
  STA $00
324
341
  PHA
@@ -336,7 +353,7 @@ loc_03DBBC! {
336
353
  STA $01, S
337
354
  LDA $02, S
338
355
 
339
- JSR count_check
356
+ JSL count_check
340
357
  DEC
341
358
  STA $02, S
342
359
  STA $INIDISP
@@ -353,7 +370,7 @@ loc_03DBBC! {
353
370
  ---------------------------------------------
354
371
  ;Hook for fading music via COP 05
355
372
 
356
- SpcCheckMusicReady! {
373
+ hdma_dma_spc.SpcFadeOutHandshake! {
357
374
  SEP #$20
358
375
  LDA msu_flag
359
376
  BEQ cop_fade_normal ;Assume normal process when no MSU
@@ -384,7 +401,7 @@ SpcCheckMusicReady! {
384
401
  }
385
402
 
386
403
 
387
- loc_03E1C1! {
404
+ hdma_dma_spc.loc_03E1C1! {
388
405
  SEP #$20
389
406
  LDA #$01
390
407
  STA $APUIO0
@@ -400,7 +417,7 @@ loc_03E1C1! {
400
417
  ---------------------------------------------
401
418
  ;Hook for stopping music via COP 04/05
402
419
 
403
- SpcTransferMusicData! {
420
+ hdma_dma_spc.SpcTransferMusicData! {
404
421
  SEP #$20
405
422
  LDA msu_flag
406
423
  BEQ bgm_load_wait ;Always skip APU silent since we are always branching to the standard load process
@@ -425,7 +442,7 @@ SpcTransferMusicData! {
425
442
  ;RTL
426
443
  }
427
444
 
428
- loc_03E1EB! {
445
+ hdma_dma_spc.loc_03E1EB! {
429
446
  ;COP [C2]
430
447
  ;SEP #$20
431
448
  ;LDA #$FF
@@ -442,7 +459,7 @@ loc_03E1EB! {
442
459
  RTL
443
460
  }
444
461
 
445
- loc_03E208! {
462
+ hdma_dma_spc.loc_03E208! {
446
463
  COP [DA] ( #01 )
447
464
  ;SEP #$20
448
465
  ;LDA #$01
@@ -456,7 +473,7 @@ loc_03E208! {
456
473
 
457
474
  ---------------------------------------------
458
475
 
459
- LoadMusicFromTransitionState! {
476
+ hdma_dma_spc.LoadMusicFromTransitionState! {
460
477
  LDX $06FA
461
478
  BEQ loc_03E254
462
479
  BMI loc_03E254
@@ -510,14 +527,14 @@ LoadMusicFromTransitionState! {
510
527
  }
511
528
 
512
529
 
513
- loc_03E254! {
530
+ hdma_dma_spc.loc_03E254! {
514
531
  RTL
515
532
  }
516
533
 
517
534
  ---------------------------------------------
518
535
  ;Hook for music asset loading (from scene_meta)
519
536
 
520
- SpcMusicLoadCmd! {
537
+ scene_script.SpcMusicLoadCmd! {
521
538
  JSR $&ReadScriptByte
522
539
  PHA
523
540
  JSR $&ReadScriptByte
@@ -531,7 +548,7 @@ SpcMusicLoadCmd! {
531
548
  RTS
532
549
  }
533
550
 
534
- loc_028B88! {
551
+ scene_script.loc_028B88! {
535
552
  PLA
536
553
  STA $06F2
537
554
  LDX #$0687
@@ -540,7 +557,7 @@ loc_028B88! {
540
557
  RTS
541
558
  }
542
559
 
543
- loc_028B91! {
560
+ scene_script.loc_028B91! {
544
561
  LDA $06F2
545
562
  BEQ bgm_check ;Always branch to halt when reset is loading
546
563
 
@@ -0,0 +1,146 @@
1
+ ; ==============================================================================
2
+ ; MergeInputFlags - remap-aware joypad merging at engine read sites
3
+ ; ==============================================================================
4
+ ; What it does: ORs set bits from joypadCurrent through the $0DA6-$0DB4 remap
5
+ ; table into a merged action word; patches save/dialog/attack/init paths to use it.
6
+ ; Vanilla behavior: Each site used joypadCurrent masks directly (fixed bit layout).
7
+ ; Hooks (overrides): GlobalInputHandler.loc_03803B (inventory open after Select);
8
+ ; inventory_overlay.SaveGameState (snapshot/clear pads during save);
9
+ ; DialogStringRenderer.DialogCmd_WaitForButton / WaitForAnyInput (+ wait loops);
10
+ ; player_character.AttackInit; global_ambient_dispatcher.GlobalAmbientOnInteractPress.
11
+ ; Adds: MergeInputFlags (JSL entry, clobbers X/Y/$00).
12
+ ; Depends on: GlobalInputHandler, vblank_joypad, inventory_overlay includes.
13
+ ; State: remapR $0DA6 base; joypadCurrent $0656, joypadHeld $0658, joypadMaskStd;
14
+ ; save snapshot $7E38AC-$7E38B0; activeActorCount -> $0DBE during save.
15
+ ; Hazards: MergeInputFlags clobbers X/Y; SaveGameState clears live pad state;
16
+ ; dialog waits still poll raw joypadCurrent each frame after TSB joypadHeld.
17
+ ; ==============================================================================
18
+
19
+ ?INCLUDE 'GlobalInputHandler'
20
+
21
+ !remapR 0DA6
22
+
23
+ ---------------------------------------------
24
+
25
+ ;Merges all input remap flags that match at least one
26
+ ;Clobbers X, Y, and $0000
27
+
28
+ MergeInputFlags {
29
+ PHA
30
+ STZ $0000
31
+ LDY #$0008
32
+ LDX #$0000
33
+
34
+ mif_loop:
35
+ DEY
36
+ BMI mif_done
37
+ LDA $remapR, X
38
+ INX
39
+ INX
40
+ AND $01, S
41
+ BEQ mif_loop
42
+ LDA $remapR-2, X
43
+ TSB $0000
44
+ BRA mif_loop
45
+
46
+ mif_done:
47
+ PLA
48
+ LDA $0000
49
+ RTL
50
+ }
51
+
52
+
53
+ GlobalInputHandler.loc_03803B!:
54
+ LDA #$2000
55
+ TSB $joypadHeld
56
+ JSL $@vblank_joypad.VBlankWaitAndJoypad
57
+ JSL $@inventory_overlay.OpenInventoryScreen
58
+ JSL $@vblank_joypad.DisableNmiKeepJoypad
59
+ LDA $joypadCurrent
60
+ AND #$6000
61
+ JSL $@MergeInputFlags
62
+ TSB $joypadHeld
63
+ PLP
64
+ RTL
65
+
66
+
67
+ inventory_overlay.SaveGameState!:
68
+ PHP
69
+ PHB
70
+ REP #$20
71
+ LDA $joypadCurrent
72
+ STZ $joypadCurrent
73
+ STA $7E38AC
74
+ LDA $joypadHeld
75
+ STA $7E38AE
76
+ LDA #$FFFF
77
+ STA $joypadHeld
78
+ LDA $joypadMaskStd
79
+ STZ $joypadMaskStd
80
+ STA $7E38B0
81
+ LDA $activeActorCount
82
+ STA $0DBE
83
+ LDX #$0000
84
+
85
+ DialogStringRenderer.DialogCmd_WaitForButton! {
86
+ LDA $joypadCurrent
87
+ TSB $joypadHeld
88
+
89
+ DialogStringRenderer.loc_03E6AA!:
90
+ JSR $&WaitOneFrame
91
+ LDA $joypadCurrent
92
+ BIT #$C0CC
93
+ BNE loc_03E6C1
94
+ SEC
95
+ JSR $&DrawDialogueCursor
96
+ LDA #$0001
97
+ TSB $displayModeFlags
98
+ BRA loc_03E6AA
99
+
100
+ DialogStringRenderer.loc_03E6C1!:
101
+ TRB $joypadCurrent
102
+ TSB $joypadHeld
103
+ CLC
104
+ JSR $&DrawDialogueCursor
105
+ LDA #$0001
106
+ TSB $displayModeFlags
107
+ JSR $&DialogCmd_ClearBox
108
+ RTS
109
+ }
110
+
111
+ DialogStringRenderer.DialogCmd_WaitForAnyInput! {
112
+ LDA $joypadCurrent
113
+ TSB $joypadHeld
114
+
115
+ DialogStringRenderer.loc_03E6D8!:
116
+ JSR $&WaitOneFrame
117
+ LDA $joypadCurrent
118
+ BIT #$C0CC
119
+ BEQ loc_03E6D8
120
+ TRB $joypadCurrent
121
+ TSB $joypadHeld
122
+ RTS
123
+ }
124
+
125
+ player_character.AttackInit! {
126
+ LDA $joypadCurrent
127
+ AND #$CF88
128
+ TSB $joypadHeld
129
+ AND #$0F00
130
+ STA $joypadCurrent
131
+ LDA #$0100
132
+ TRB $10
133
+ LDA $characterForm
134
+ BEQ loc_02CF0B
135
+ COP [PlaySoundCh2] ( #02 )
136
+ RTS
137
+ }
138
+
139
+ global_ambient_dispatcher.GlobalAmbientOnInteractPress! {
140
+ LDA #$8000
141
+ TSB $joypadHeld
142
+ JSL $@GetPlayerFacingDirection
143
+ BCC GlobalAmbientFacingValid
144
+ PLD
145
+ RTL
146
+ }
@@ -0,0 +1,51 @@
1
+ ; ==============================================================================
2
+ ; Player input hook host - AttackSystemEntry extension point
3
+ ; ==============================================================================
4
+ ; What it does: Defines an empty PlayerInputHooks chain (RTL sentinel) and runs
5
+ ; it from AttackSystemEntry every frame before vanilla attack polling gates.
6
+ ; Vanilla behavior: AttackSystemEntry cleared combat-lock bit $0008 on playerFlags
7
+ ; then ran attack input only; no module hook.
8
+ ; Hooks (overrides): attack_ability_system.AttackSystemEntry (JSL to hooks before
9
+ ; idle/attack paths); attack_ability_system.code_02B7BD (same JSL on idle path).
10
+ ; Adds: PlayerInputHooks / PlayerInputHooksEnd (other patches chain with PlayerInputHooks+).
11
+ ; Depends on: attack_ability_system.
12
+ ; State: Reads playerFlags $09AE bit 3 ($0008 combat lock).
13
+ ; Hazards: JSL from actor context; hooks must preserve COP register rules if they
14
+ ; call COP (X = actor slot); AttackSystemEntry override must keep vanilla gates.
15
+ ; ==============================================================================
16
+ ?INCLUDE 'attack_ability_system'
17
+
18
+ !playerFlags 09AE
19
+
20
+ --------------------------------------
21
+
22
+ PlayerInputHooks {
23
+ }
24
+
25
+ PlayerInputHooksEnd {
26
+ RTL
27
+ }
28
+
29
+ --------------------------------------
30
+
31
+ ;Call site of the player input hook chain (registry: player_input_core.asm).
32
+ ;Identical to the original block except for the JSL: it runs right after the
33
+ ;companion's per-frame re-entry point, before the attack polling gates.
34
+
35
+ attack_ability_system.AttackSystemEntry! {
36
+ LDA $playerFlags
37
+ BIT #$0008
38
+ BEQ code_02B7BD
39
+ JSL $@PlayerInputHooks
40
+ RTL
41
+
42
+ attack_ability_system.code_02B7BD!:
43
+ LDA #$0001
44
+ TRB $playerFlags
45
+ COP [SetEntryHere]
46
+ JSL $@PlayerInputHooks
47
+ LDA $playerFlags
48
+ BIT #$2A00
49
+ BEQ loc_02B7CE
50
+ RTL
51
+ }
@@ -0,0 +1,28 @@
1
+ ; ==============================================================================
2
+ ; Rolek Mansion Ann - Red Jewel for Gorgon Flower trade sparkle
3
+ ; ==============================================================================
4
+ ; What it does: Before flags $E3/$E4 block the trade, spawns generic_sparkle on init;
5
+ ; successful interact removes item $28, gives Red Jewel, sets $E5, kills sparkle child.
6
+ ; Vanilla behavior: eu95_ann code_07DF07 init and code_07DF43 trade script without sparkle.
7
+ ; Hooks (overrides): eu95_ann.code_07DF07- insert; code_07DF43! interact replace.
8
+ ; Depends on: generic_sparkle; flag bytes $D6, $E3-$E5; RemoveItem #28 / GiveItem #01.
9
+ ; ==============================================================================
10
+
11
+ eu95_ann.code_07DF07- {
12
+ COP [BranchOnFlagByte] ( #D6, #01, &code_07DF07 )
13
+ COP [SpawnAfterOffset] ( @generic_sparkle, #$0000, #$FFF8 )
14
+ STY $26
15
+ }
16
+
17
+ eu95_ann.code_07DF43! {
18
+ COP [BranchOnFlagByte] ( #E3, #00, &code_07DF63 )
19
+ COP [BranchOnFlagByte] ( #E4, #00, &code_07DF68 )
20
+ COP [RemoveItem] ( #28 )
21
+ COP [GiveItem] ( #01, &code_07DF5F )
22
+ LDY $26
23
+ LDA #$0001
24
+ STA $0026, Y
25
+ COP [PrintDialogString] ( &dialogstring_07E10A )
26
+ COP [SetFlagByte] ( #E5 )
27
+ RTL
28
+ }
@@ -0,0 +1,50 @@
1
+ ; ==============================================================================
2
+ ; Sky Garden missed Red Jewel makeup (Nazca Plain)
3
+ ; ==============================================================================
4
+ ; What it does: Spawns flag-gated hidden Red Jewels on scene $4B (Nazca Plain) for Sky
5
+ ; Garden chests $4D ($0C) and $52 ($0F) when Viper is beaten but chest event flags stay clear.
6
+ ; Vanilla behavior: No such actors; Sky Garden jewels could become permanently inaccessible.
7
+ ; Hooks (overrides): scene_actors.scene_4B_actors+= two spawns (type bytes #19 / #1F -> $0E $0C / $0F).
8
+ ; Adds: chest_flagged_hidden_red_jewel actor; interact jumps to RedJewelSparkle hrji_complete on success.
9
+ ; Depends on: generic_sparkle; flag_helpers TestFlagRaw $F9, Test/SetEventFlag_0200; HiddenRedJewelInventoryFull.
10
+ ; State: Mystic statue flag $F9; chest flags via event $0200+$0E; sets same flag on pickup.
11
+ ; Hazards/notes: Spawn record type >> 1 must match intended chest flag index in $0E.
12
+ ; ==============================================================================
13
+
14
+ chest_flagged_hidden_red_jewel [
15
+ actor-def < #00, #00, #30, {
16
+
17
+ LDA #$00F9
18
+ JSL $@flag_helpers.TestFlagRaw
19
+ BCC cfhrj_die
20
+ LDA $0E
21
+ JSL $@flag_helpers.TestEventFlag_0200
22
+ BCS cfhrj_die
23
+
24
+ COP [SpawnAfterOffset] ( @generic_sparkle, #$0000, #$FFFC )
25
+ STY $26
26
+
27
+ COP [SetInteractHandler] ( &cfhrj_interact )
28
+ COP [SetMetasprite] ( @spriteset_pickups_effects )
29
+ COP [StageSprAndHitbox] ( #00 )
30
+ COP [SetEntryHere]
31
+ RTL
32
+
33
+ cfhrj_die:
34
+ COP [Die]
35
+
36
+ cfhrj_interact:
37
+ COP [GiveItem] ( #01, &cfhrj_full )
38
+ LDA $0E
39
+ JSL $@flag_helpers.SetEventFlag_0200
40
+ JML $@hrji_complete
41
+
42
+ cfhrj_full:
43
+ JML $@HiddenRedJewelInventoryFull
44
+ } >
45
+ ]
46
+
47
+ scene_actors.scene_4B_actors+= [
48
+ actor-spawn < #1D, #2E, #19, @chest_flagged_hidden_red_jewel > ; Sky Garden 4D chest ($0C)
49
+ actor-spawn < #1F, #2E, #1F, @chest_flagged_hidden_red_jewel > ; Sky Garden 52 chest ($0F)
50
+ ]