@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
@@ -0,0 +1,130 @@
1
+
2
+ ; ==============================================================================
3
+ ; Enhanced inventory item picker - Run-mask reorder in Items tab
4
+ ; ==============================================================================
5
+ ; What it does: In the Items tab, holding Run ($0044) while confirming starts a
6
+ ; two-cursor swap (same flow as vanilla Arrange, remapped button masks).
7
+ ; Vanilla behavior: UseItemRefreshCursor only handled equip confirm and D-pad;
8
+ ; ArrangePickTarget used Run on a different mask ($C040 in ROM, remapped elsewhere).
9
+ ; Hooks (overrides): inventory_menu.UseItemRefreshCursor (add Run -> reorder);
10
+ ; inventory_menu.ArrangePickTarget / ArrangeTargetLoop / ArrangePerformSwap
11
+ ; (Run confirm mask $8044, equipped-index fixups); loc_02E631 branch label.
12
+ ; Adds: None (reuses SelectionCursorActor, PositionGridCursor, InventoryMainLoop).
13
+ ; Depends on: inventory_menu labels, system_strings console scripts.
14
+ ; State: $1A equip slot, $22 grid cursor, $2E saved source slot, $2C saved Y.
15
+ ; Hazards: 8-bit slot swap like vanilla; COP loop uses PEA return address; X must
16
+ ; stay actor id across COP calls; PerformSwap falls through without RTL (verify
17
+ ; against OptionsMenu.patch reorder if both layers enabled).
18
+ ; ==============================================================================
19
+
20
+ ; Override UseItemRefreshCursor to add the reorder COP line.
21
+ ; This sub-label contains the cursor positioning + button dispatch loop.
22
+ ; The transform already changed #$C040 → #$0080 in the extracted code,
23
+ ; but the override replaces the block entirely, so we use the new masks here.
24
+ inventory_menu.UseItemRefreshCursor! {
25
+ JSR $&PositionEquipCursor
26
+ COP [RunBg3Script] ( @system_strings.consolestring_01E912 )
27
+ LDY $1A
28
+ LDA $inventorySlots, Y
29
+ AND #$00FF
30
+ STA $itemAbilityIndex
31
+ COP [RunBg3Script] ( @system_strings.consolestring_01E9D0 )
32
+ COP [SetEntryHereAndYield]
33
+ COP [BranchIfPressed] ( #$C000, &UseItemConfirm )
34
+ COP [BranchIfPressed] ( #$0044, &ArrangePickTarget )
35
+ COP [BranchIfPressed] ( #$0800, &UseItemCursorUp )
36
+ COP [BranchIfPressed] ( #$0400, &UseItemCursorDown )
37
+ COP [BranchIfPressed] ( #$0200, &UseItemCursorLeft )
38
+ COP [BranchIfPressed] ( #$0100, &UseItemCursorRight )
39
+ RTL
40
+ }
41
+
42
+
43
+ inventory_menu.ArrangePickTarget! {
44
+ COP [PlaySoundCh2] ( #11 ) ; Source slot picked — play confirm sound
45
+ LDA #$8000
46
+ TSB $joypadHeld
47
+ LDA $20 ; Save source cursor Y ($2C) and slot ($2E)
48
+ STA $2C
49
+ LDA $22
50
+ STA $2E
51
+ COP [SpawnAfterFlags] ( @SelectionCursorActor, #$0802 ) ; Spawn second cursor for swap target
52
+ STY $20
53
+ COP [RunBg3Script] ( @system_strings.consolestring_01E90B )
54
+ COP [RunBg3Script] ( @system_strings.consolestring_01EA14 )
55
+ COP [RunBg3Script] ( @system_strings.consolestring_01E9A6 )
56
+
57
+ inventory_menu.ArrangeTargetLoop!:
58
+ JSR $&PositionGridCursor ; Position target cursor during swap pick
59
+ COP [SetEntryHereAndYield]
60
+ COP [BranchIfPressed] ( #$4000, &ArrangeCancelTarget ) ; Cancel target pick (Y/X)
61
+ COP [BranchIfPressed] ( #$8044, &ArrangePerformSwap ) ; B confirms swap destination slot
62
+ PEA $&ArrangeTargetLoop-1
63
+ COP [BranchIfPressed] ( #$0800, &GridCursorUp )
64
+ COP [BranchIfPressed] ( #$0400, &GridCursorDown )
65
+ COP [BranchIfPressed] ( #$0200, &GridCursorLeft )
66
+ COP [BranchIfPressed] ( #$0100, &GridCursorRight )
67
+ PLA
68
+ RTL
69
+ }
70
+
71
+ inventory_menu.ArrangePerformSwap! {
72
+ LDA #$8000 ; Swap: consume B; skip if source equals target
73
+ TSB $joypadHeld
74
+ LDA $22
75
+ CMP $2E
76
+ BEQ ArrangeTargetLoop
77
+ COP [PlaySoundCh2] ( #11 )
78
+ LDY $22 ; Swap inventory slot bytes (8-bit hi/lo pairs)
79
+ SEP #$20
80
+ LDA $inventorySlots, Y
81
+ XBA
82
+ LDY $2E
83
+ LDA $inventorySlots, Y
84
+ XBA
85
+ STA $inventorySlots, Y
86
+ XBA
87
+ LDY $22
88
+ STA $inventorySlots, Y
89
+ REP #$20
90
+ LDY $2E ; Refresh target slot actor sprite after swap
91
+ LDA $inventorySlots, Y
92
+ AND #$00FF
93
+ PHA
94
+ TYA
95
+ JSR $&UpdateSlotActorSprite
96
+ PLA
97
+ STA $0028, Y
98
+ LDY $22 ; Refresh source slot actor sprite after swap
99
+ LDA $inventorySlots, Y
100
+ AND #$00FF
101
+ PHA
102
+ TYA
103
+ JSR $&UpdateSlotActorSprite
104
+ PLA
105
+ STA $0028, Y
106
+ TYA ; Equipped index was target slot — follow to source
107
+ CMP $inventoryEquippedIndex
108
+ BNE loc_02E631
109
+ LDA $2E
110
+ STA $inventoryEquippedIndex
111
+ BRA loc_02E63D
112
+
113
+ inventory_menu.loc_02E631!:
114
+ LDA $2E ; Equipped index was source slot — follow to target
115
+ CMP $inventoryEquippedIndex
116
+ BNE loc_02E63D
117
+ LDA $22
118
+ STA $inventoryEquippedIndex
119
+
120
+ ; loc_02E63D!:
121
+ ; PHX ; Kill saved source cursor actor via MarkDeath
122
+ ; PHD
123
+ ; LDA $2C
124
+ ; TAX
125
+ ; TCD
126
+ ; COP [MarkDeath]
127
+ ; PLD
128
+ ; PLX
129
+ ; JMP $&ArrangeSourceReset
130
+ }
@@ -0,0 +1,109 @@
1
+ ; ==============================================================================
2
+ ; Minimal HUD option - hide player HUD outside combat areas
3
+ ; ==============================================================================
4
+ ; What it does: Options setting (On/Off) skips HUD tilemap upload and per-frame
5
+ ; HUD stat redraw in non-combat scenes when On; cutscene full suppress unchanged.
6
+ ; Vanilla behavior: LoadHudTilemap and UpdateHUD always ran unless $09ED bit 6
7
+ ; cleared them (cutscenes); combat lock bit on playerFlags was not consulted.
8
+ ; Hooks (overrides): scene_lifecycle.LoadHudTilemap (early-out before loc_03DED5);
9
+ ; system_core.UpdateHUD (early-out before UpdateHUD_Active).
10
+ ; Adds: OptionSettingPreset- record (packed bit in $0B3A); choice strings/tables.
11
+ ; Depends on: options_menu_core registry; system_core include for UpdateHUD tail.
12
+ ; State: $0B3A bit 5 (1 = Minimal HUD off); temp $0BF6; reads playerFlags $09AE
13
+ ; bit 3 ($0008 combat lock), hud_disable_flag $09ED bit 6 ($40).
14
+ ; Hazards: LoadHudTilemap entry expects M=8 like vanilla; full suppress still
15
+ ; clears equipped-icon cache $00DA; minimal path preserves $00DA.
16
+ ; ==============================================================================
17
+
18
+ !minimal_hud_setting 0B3A
19
+ !minimal_hud_off_bit 20
20
+ !hud_disable_flag 09ED
21
+ !hud_icon_cache 00DA
22
+ !combat_lock_bit 08
23
+ !hud_full_suppress_bit 40
24
+
25
+ ---------------------------------------------
26
+ ; Options menu strings. The value row shows the choice picked through the temp
27
+ ; word at $0BF6 (TBL index), and the description appears while the cursor is on
28
+ ; the setting.
29
+
30
+ MinimalHudChoices [
31
+ &minimal_hud_on
32
+ &minimal_hud_off
33
+ ]
34
+
35
+ minimal_hud_on |On|
36
+ minimal_hud_off |Off|
37
+
38
+ optstr_minimal_hud |[PAL:0]Minimal HUD[N] [PAL:14][TBL:@MinimalHudChoices,BF6][PAL:0]|
39
+ optstr_minimal_hud_desc |[PAL:0][POS:96,5]Minimal Player HUD[DBL]Only displays when[DBL]in a combat area.|
40
+
41
+ ---------------------------------------------
42
+ ; Scene setup / inventory close: stage the HUD tilemap.
43
+ ;
44
+ ; Entry: M = 8-bit (same as the original routine)
45
+ ; Exit: RTL without staging anything when the HUD is suppressed
46
+ ;
47
+ ; Full suppress (cutscene) also clears the equipped-icon cache ($00DA), matching
48
+ ; the EquippedIcon patch. Minimal HUD skips only the tilemap and keeps $00DA so
49
+ ; the item icon survives the non-combat area.
50
+ ;
51
+ ; loc_03DED5 is the original loader, which immediately follows this block.
52
+
53
+ scene_lifecycle.LoadHudTilemap! {
54
+ LDA $hud_disable_flag
55
+ BIT #$hud_full_suppress_bit
56
+ BEQ hud_check_option
57
+ STZ $hud_icon_cache ; Full suppress (cutscene): clear icon too
58
+ RTL
59
+
60
+ hud_check_option:
61
+ LDA $minimal_hud_setting
62
+ BIT #$minimal_hud_off_bit
63
+ BNE loc_03DED5 ; Minimal HUD off → load HUD normally
64
+ LDA $playerFlags
65
+ BIT #$combat_lock_bit ; Bit 3 = combat lock (non-combat area)
66
+ BEQ loc_03DED5 ; Combat area → load HUD normally
67
+ RTL ; Non-combat → skip HUD, keep icon ($00DA preserved)
68
+ }
69
+
70
+ --------------------------------------------------------
71
+ ?INCLUDE 'system_core'
72
+ --------------------------------------------------------
73
+ ; Per-frame HUD update (HP recovery, stat redraw, enemy health bar).
74
+ ;
75
+ ; Entry: M = 8-bit (same as the original routine)
76
+ ; Exit: RTL without touching the HUD when suppressed; otherwise falls into the
77
+ ; original body at UpdateHUD_Active, which immediately follows this block.
78
+
79
+ system_core.UpdateHUD! {
80
+ LDA $hud_disable_flag
81
+ BIT #$hud_full_suppress_bit ; Bit 6 = full HUD suppression (cutscene)
82
+ BNE hud_update_suppress
83
+ LDA $minimal_hud_setting
84
+ BIT #$minimal_hud_off_bit
85
+ BNE UpdateHUD_Active ; Minimal HUD off → proceed with HUD update
86
+ LDA $playerFlags
87
+ BIT #$combat_lock_bit ; Bit 3 = combat lock (non-combat area)
88
+ BEQ UpdateHUD_Active ; Combat area → proceed with HUD update
89
+
90
+ hud_update_suppress:
91
+ RTL
92
+ }
93
+
94
+ ---------------------------------------------
95
+ ; Registration of the Minimal HUD setting (must stay after the overrides above)
96
+
97
+ OptionSettingPreset- [
98
+ @optstr_minimal_hud ;+00 render
99
+ @optstr_minimal_hud_desc ;+03 desc
100
+ #$0BF6 ;+06 temp
101
+ #$0B3A ;+08 store
102
+ #$0005 ;+0A shift
103
+ #$0001 ;+0C mask
104
+ #$0000 ;+0E xor (stored 0 = On = choice 0)
105
+ #$0002 ;+10 count
106
+ #$0000 ;+12 load (packed bits)
107
+ #$0000 ;+14 change
108
+ #$0000 ;+16 commit (packed bits)
109
+ ]
@@ -0,0 +1,218 @@
1
+ ; ==============================================================================
2
+ ; Options Menu (module) - inventory tabs, item reorder, save-load remap hook
3
+ ; ==============================================================================
4
+ ; What it does: Replaces the four inventory tabs with Items / Remove / Status /
5
+ ; Optn.; wires the Optn. tab to options_menu_core; adds Run+confirm item
6
+ ; reorder in the Items tab; rebuilds joypad remap words after diary load.
7
+ ; Vanilla behavior: Tabs were Items / Order / Remove / Cond.; no in-inventory
8
+ ; button UI; ApplySoundAndRemap set legacy Type-1/2 remap bytes from $0B26 only.
9
+ ; Hooks (overrides): system_strings.consolestring_01E8E9 (tab labels);
10
+ ; inventory_menu.TabHoverDispatch / TabActionDispatch (fourth tab -> Optn.);
11
+ ; inventory_menu.UseItemCursorRight+ (anchor for reorder helpers);
12
+ ; sFA_diary_menu.ApplySoundAndRemap_ButtonTypeSelect / ApplySoundAndRemap_ButtonType2 (ApplySoundAndRemap tail ->
13
+ ; DetectAndInitButtonMap + ApplyButtonMapping).
14
+ ; Adds: TabHoverStatusClear, UseItemReorderStart/Confirm/Cancel (reorder flow).
15
+ ; Depends on: options_menu_core, options_input_remap, inventory_menu,
16
+ ; inventory_overlay, save_system, sFA_diary_menu, system_init.
17
+ ; State: Button map bytes $0B34-$0B39 (save block); tab index $0AFA unchanged.
18
+ ; Hazards: COP paths need X = actor slot; reorder uses $2E/$22 scratch like vanilla
19
+ ; Arrange flow; save hook must run after LoadGameState succeeds (diary paths).
20
+ ; ==============================================================================
21
+
22
+ ?INCLUDE 'options_menu_core'
23
+ ?INCLUDE 'options_input_remap'
24
+ ?INCLUDE 'inventory_menu'
25
+ ?INCLUDE 'inventory_overlay'
26
+ ?INCLUDE 'system_strings'
27
+ ?INCLUDE 'vblank_joypad'
28
+ ?INCLUDE 'save_system'
29
+ ?INCLUDE 'sFA_diary_menu'
30
+ ?INCLUDE 'system_init'
31
+
32
+
33
+ !btnMapA 0B34
34
+ !btnMapB 0B35
35
+ !btnMapX 0B36
36
+ !btnMapY 0B37
37
+ !btnMapL 0B38
38
+ !btnMapR 0B39
39
+
40
+ ; =============================================================================
41
+ ; PHASE 0: Save byte defaults for new games
42
+ ; =============================================================================
43
+
44
+ ; Save bytes $0B34-$0B39 store the user's button assignments in compressed
45
+ ; form for persistence across save/load.
46
+ ; Note that this is not necessary, leaving them empty will allow the new game diary
47
+ ; load process to replace them with ones defined by DefaultButtonMap/AlternateButtonMap
48
+
49
+ ;SystemInitConstants+ [
50
+ ; wram-init < #$0B34, #$42A0 > ; Save: A=$A0(Cnf+Ark), B=$42(Cnc+Itm)
51
+ ; wram-init < #$0B36, #$1001 > ; Save: X=$01(Cycle), Y=$10(Run)
52
+ ; wram-init < #$0B38, #$0408 > ; Save: L=$08(Cycle), R=$04(Block)
53
+ ;]
54
+
55
+ ; =============================================================================
56
+ ; PHASE 1: Menu Restructure — 4 tabs
57
+ ; =============================================================================
58
+
59
+ ; --- Tab sidebar labels ---
60
+ ; Old: " Items / Order / Remove / Cond."
61
+ ; New: " Items / Remove / Cond. / Optn."
62
+ system_strings.consolestring_01E8E9! |[PAL:0][POS:84,5] Items[DBL] Relics[DBL] Status[DBL] Option|
63
+
64
+ ; --- Tab hover dispatch (4 entries) ---
65
+ ; TabHoverStatus does not clear the upper panel BG3 content on its own.
66
+ ; TabHoverStatusClear wraps it to clear Options/other residual BG3 tiles.
67
+ inventory_menu.TabHoverDispatch! [
68
+ &TabHoverUse ;00 Items
69
+ &TabHoverDiscard ;01 Remove
70
+ &TabHoverStatusClear ;02 Cond.
71
+ &options_menu_core.TabHoverOptions ;03 Optn.
72
+ ]
73
+
74
+ ; Clear wrapper: clears upper panel BG3 (rows 4-14) then runs original handler.
75
+ TabHoverStatusClear {
76
+ COP [RunBg3Script] ( @system_strings.consolestring_01E8E2 )
77
+ JMP $&TabHoverStatus
78
+ }
79
+
80
+ ; --- Tab action dispatch ---
81
+ inventory_menu.TabActionDispatch! [
82
+ &UseItemTab ;00 Items
83
+ &DiscardItemTab ;01 Remove
84
+ &StatusViewTab ;02 Cond.
85
+ &options_menu_core.OptionsTab ;03 Optn.
86
+ ]
87
+
88
+
89
+
90
+ ; Place the following content after UseItemCursorRight to avoid branch distance issues
91
+ inventory_menu.UseItemCursorRight+ { }
92
+
93
+ ; --- Reorder: pick source slot ---
94
+ UseItemReorderStart {
95
+ LDA #$0044
96
+ TSB $joypadHeld
97
+ COP [PlaySoundCh2] ( #11 )
98
+
99
+ ; Save source position
100
+ LDA $1A
101
+ STA $2E
102
+
103
+ ; Spawn second cursor for target selection
104
+ COP [SpawnAfterFlags] ( @SelectionCursorActor, #$0802 )
105
+ STY $20
106
+
107
+ ; Copy source slot to grid cursor
108
+ LDA $2E
109
+ STA $22
110
+
111
+ COP [RunBg3Script] ( @system_strings.consolestring_01E90B )
112
+ COP [RunBg3Script] ( @system_strings.consolestring_01EA02 )
113
+
114
+ uir_target_loop:
115
+ JSR $&PositionGridCursor
116
+ COP [SetEntryHereAndYield]
117
+ COP [BranchIfPressed] ( #$8044, &UseItemReorderConfirm )
118
+ COP [BranchIfPressed] ( #$4000, &UseItemReorderCancel )
119
+ PEA $&uir_target_loop-1
120
+ COP [BranchIfPressed] ( #$0800, &GridCursorUp )
121
+ COP [BranchIfPressed] ( #$0400, &GridCursorDown )
122
+ COP [BranchIfPressed] ( #$0200, &GridCursorLeft )
123
+ COP [BranchIfPressed] ( #$0100, &GridCursorRight )
124
+ PLA
125
+ RTL
126
+ }
127
+
128
+
129
+ ; --- Reorder: confirm swap ---
130
+ UseItemReorderConfirm {
131
+ LDA #$8044
132
+ TSB $joypadHeld
133
+ LDA $22
134
+ CMP $2E
135
+ BEQ uir_cancel_silent
136
+
137
+ COP [PlaySoundCh2] ( #11 )
138
+
139
+ ; Perform 8-bit byte swap of inventory slots
140
+ LDY $22
141
+ SEP #$20
142
+ LDA $inventorySlots, Y
143
+ XBA
144
+ LDY $2E
145
+ LDA $inventorySlots, Y
146
+ XBA
147
+ STA $inventorySlots, Y
148
+ XBA
149
+ LDY $22
150
+ STA $inventorySlots, Y
151
+ REP #$20
152
+
153
+ ; Refresh target slot actor sprite
154
+ LDY $2E
155
+ LDA $inventorySlots, Y
156
+ AND #$00FF
157
+ PHA
158
+ TYA
159
+ JSR $&UpdateSlotActorSprite
160
+ PLA
161
+ STA $0028, Y
162
+
163
+ ; Refresh source slot actor sprite
164
+ LDY $22
165
+ LDA $inventorySlots, Y
166
+ AND #$00FF
167
+ PHA
168
+ TYA
169
+ JSR $&UpdateSlotActorSprite
170
+ PLA
171
+ STA $0028, Y
172
+
173
+ ; Track equipped index across swap
174
+ TYA
175
+ CMP $inventoryEquippedIndex
176
+ BNE uirc_check_source
177
+ LDA $2E
178
+ STA $inventoryEquippedIndex
179
+ BRA uirc_done
180
+
181
+ uirc_check_source:
182
+ LDA $2E
183
+ CMP $inventoryEquippedIndex
184
+ BNE uirc_done
185
+ LDA $22
186
+ STA $inventoryEquippedIndex
187
+
188
+ uirc_done:
189
+ LDA $22
190
+ STA $1A
191
+
192
+ uir_cancel_silent:
193
+ COP [KillNext]
194
+ JMP $&InventoryMainLoop
195
+ }
196
+
197
+ ; --- Reorder: cancel ---
198
+ UseItemReorderCancel {
199
+ LDA #$4000
200
+ TSB $joypadHeld
201
+ COP [PlaySoundCh2] ( #0D )
202
+ COP [KillNext]
203
+ JMP $&InventoryMainLoop
204
+ }
205
+
206
+ ; =============================================================================
207
+ ; PHASE 3: Save data persistence
208
+ ; =============================================================================
209
+
210
+ ; Override ApplySoundAndRemap to call ApplyButtonMapping after sound setup.
211
+ ; This module override supersedes the baserom InputRemap's sound-only version.
212
+ sFA_diary_menu.ApplySoundAndRemap_ButtonTypeSelect!:
213
+ sFA_diary_menu.ApplySoundAndRemap_ButtonType2! {
214
+ JSL $@options_input_remap.DetectAndInitButtonMap
215
+ JSL $@options_input_remap.ApplyButtonMapping
216
+ RTS
217
+ }
218
+
@@ -0,0 +1,108 @@
1
+ ; ==============================================================================
2
+ ; Text Speed option - dialogue per-character delay from options menu
3
+ ; ==============================================================================
4
+ ; What it does: Four speed modes adjust WaitNFrames_PerChar delay; Run-Instant
5
+ ; uses joypadCurrent bit 6 ($0040) for instant text while Run is held.
6
+ ; Vanilla behavior: WaitNFrames_PerChar waited frames from script delay $007E only.
7
+ ; Hooks (overrides): DialogStringRenderer.WaitNFrames_PerChar (calls TextSpeedAdjust
8
+ ; then falls through to loc_03E7C2 or skips wait at loc_03E7D4).
9
+ ; Adds: TextSpeedAdjust (JSL from hook); OptionSettingPreset- record; strings.
10
+ ; Depends on: options_menu_core registry.
11
+ ; State: Packed $0B3A bits 0-1; temp $0BE2; reads $007E, $0656 joypadCurrent.
12
+ ; Hazards: TextSpeedAdjust preserves X/Y; hook uses SEP #$20 around JSL.
13
+ ; ==============================================================================
14
+
15
+ !joypadCurrent 0656
16
+ !text_speed_setting 0B3A
17
+ !text_speed_delay 007E
18
+
19
+ ---------------------------------------------
20
+ ; Options menu strings. The value row shows the choice picked through the temp
21
+ ; word at $0BE2 (TBL index), and the description appears while the cursor is on
22
+ ; the setting.
23
+
24
+ TextSpeedChoices [
25
+ &text_speed_normal
26
+ &text_speed_fast
27
+ &text_speed_instant
28
+ &text_speed_runinstant
29
+ ]
30
+
31
+ text_speed_normal |Normal|
32
+ text_speed_fast |Fast|
33
+ text_speed_instant |Instant|
34
+ text_speed_runinstant |Run Instant|
35
+
36
+ optstr_text_speed |[PAL:0]Text Speed[N] [PAL:14][TBL:@TextSpeedChoices,BE2][PAL:0]|
37
+ optstr_text_speed_desc |[PAL:0][POS:96,5]Dialogue text speed.[DBL]Run Instant: instant[DBL]while Run is held.|
38
+
39
+
40
+ ---------------------------------------------
41
+ ; Entry: M = 8-bit
42
+ ; Exit: A = frames to wait per character (0 = instant), Z set accordingly
43
+ ; (the flags reflect the last operation before RTL)
44
+ ; Preserves X, Y.
45
+
46
+ TextSpeedAdjust {
47
+ LDA $text_speed_delay
48
+ BEQ tsa_return ; script already wants instant text
49
+ PHA
50
+ LDA $text_speed_setting
51
+ AND #$03
52
+ BEQ tsa_normal
53
+ CMP #$02
54
+ BEQ tsa_instant
55
+ BCS tsa_run
56
+
57
+ ; 1 = Fast
58
+ PLA
59
+ INC
60
+ LSR
61
+ RTL
62
+
63
+ tsa_run:
64
+ LDA $joypadCurrent
65
+ AND #$40
66
+ BEQ tsa_normal
67
+
68
+ tsa_instant:
69
+ PLA
70
+ LDA #$00
71
+ RTL
72
+
73
+ tsa_normal:
74
+ PLA
75
+
76
+ tsa_return:
77
+ RTL
78
+ }
79
+
80
+ ---------------------------------------------
81
+ ; Hook: WaitNFrames_PerChar normally loads the delay straight from $007E.
82
+ ; The replacement asks TextSpeedAdjust for the effective delay instead. Zero
83
+ ; skips the wait entirely; non-zero falls through to the original wait loop
84
+ ; (loc_03E7C2) which is left untouched.
85
+
86
+ DialogStringRenderer.WaitNFrames_PerChar! {
87
+ PHP
88
+ SEP #$20
89
+ JSL $@TextSpeedAdjust
90
+ BEQ loc_03E7D4
91
+ }
92
+
93
+ ---------------------------------------------
94
+ ; Registration (must stay after the override above, see options_menu_core.asm)
95
+
96
+ OptionSettingPreset- [
97
+ @optstr_text_speed ;+00 render
98
+ @optstr_text_speed_desc ;+03 desc
99
+ #$0BE2 ;+06 temp
100
+ #$0B3A ;+08 store
101
+ #$0000 ;+0A shift
102
+ #$0003 ;+0C mask
103
+ #$0000 ;+0E xor
104
+ #$0004 ;+10 count
105
+ #$0000 ;+12 load (packed bits)
106
+ #$0000 ;+14 change
107
+ #$0000 ;+16 commit (packed bits)
108
+ ]