Skip to content

Commit b1160a3

Browse files
committed
Merge 'Fix crash on Wii VC caused by Fado spawn hack for adult trade shuffle' (#2345)
2 parents ca58354 + deb0b8d commit b1160a3

File tree

9 files changed

+36747
-36712
lines changed

9 files changed

+36747
-36712
lines changed

ASM/build/asm_symbols.txt

Lines changed: 836 additions & 835 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/src/hacks.asm

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,16 +2599,6 @@ skip_bombchu_bowling_prize_switch:
25992599
;==================================================================================================
26002600
; Trade Quest Shuffle Flag Hooks
26012601
;==================================================================================================
2602-
; Control if Fado (blonde Kokiri girl) can spawn in Lost Woods
2603-
.orga 0xE538C4
2604-
or t3, $zero, $ra
2605-
jal check_fado_spawn_flags
2606-
.orga 0xE538D4
2607-
or $ra, $zero, t3
2608-
; Fix Fado's text id when trading in the odd potion out of order
2609-
.orga 0xE535E4
2610-
sh t2, 0x010E(s0)
2611-
26122602
; Control if Grog can spawn in Lost Woods
26132603
.orga 0xE20BC8
26142604
jal check_grog_spawn_flags
@@ -4156,6 +4146,7 @@ DemoEffect_DrawJewel_AfterHook:
41564146
.include "hacks/ovl_bg_haka_tubo.asm"
41574147
.include "hacks/ovl_bg_spot18_basket.asm"
41584148
.include "hacks/ovl_en_dns.asm"
4149+
.include "hacks/ovl_en_ko.asm"
41594150
.include "hacks/ovl_en_kz.asm"
41604151
.include "hacks/ovl_obj_mure3.asm"
41614152
.include "hacks/z_parameter.asm"

ASM/src/hacks/ovl_en_ko.asm

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.headersize (0x80AD1C20 - 0xE51A60)
2+
3+
; Control if Fado (blonde Kokiri girl) can spawn in Lost Woods
4+
.org 0x80AD3A84 ; Fado branch at end of EnKo_CanSpawn (called by EnKo_Init), override to always true
5+
addiu t5, $zero, 0x0031
6+
.org 0x80AD3EB0 ; end of EnKo_Init, controls Fado spawn
7+
jal check_fado_spawn_flags
8+
sw t8, 0x0180(s0)
9+
lw $ra, 0x001C($sp)
10+
lw s0, 0x0018($sp)
11+
jr $ra
12+
addiu $sp, $sp, 0x0020
13+
14+
; Fix Fado's text id when trading in the odd potion out of order
15+
.org 0x80AD37A4 ; vrom 0xE535E4
16+
sh t2, 0x010E(s0)
17+
18+
.headersize 0

ASM/src/trade_quests.asm

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,40 @@ check_fado_spawn_flags:
77
addiu sp, sp, -0x18
88
sw ra, 0x14(sp)
99

10-
; displaced code
11-
lbu t5, 0x0074(t4)
12-
addiu $at, $zero, 0x0031
10+
; Only change behavior for Fado actor
11+
; Vanilla EnKo_CanSpawn behavior checks if
12+
; the scene is Lost Woods and does not
13+
; check the EnKo type. No reason not to be
14+
; more specific since we have the option.
15+
lh t0, 0x1C(s0) ; s0 = EnKo* this pointer, 0x1C = Actor.params
16+
andi t1, t0, 0xFF ; filter actor params to those used for ENKO_TYPE macro
17+
li $at, 0xC ; 0xC = ENKO_TYPE_CHILD_FADO
18+
bne t1, $at, @@return_fado
19+
nop
20+
la t0, GLOBAL_CONTEXT
21+
lh t1, 0xA4(t0) ; play->sceneId
22+
li $at, 0x5B ; 0x5B = Lost Woods scene ID
23+
bne t1, $at, @@return_fado
24+
nop
1325

1426
; Spawns if Odd Potion owned but not turned in
1527
jal SaveFile_TradeItemIsOwned
1628
ori a0, $zero, 0x31
17-
beqz v0, @@return_fado
18-
ori t5, $zero, 0x0000 ; don't spawn
29+
beqz v0, @@kill_fado
30+
nop
1931

2032
jal SaveFile_TradeItemIsTraded
2133
ori a0, $zero, 0x31
22-
bnez v0, @@return_fado
23-
ori t5, $zero, 0x0000 ; don't spawn
24-
ori t5, $zero, 0x0031 ; spawn
34+
bnez v0, @@kill_fado
35+
nop
36+
b @@return_fado
37+
nop
2538

39+
@@kill_fado: ; you monster D:
40+
; Actor_Kill
41+
jal 0x80020EB4
42+
or a0, s0, $zero
2643
@@return_fado:
27-
; reset v1 in case it was modified
28-
or v1, $zero, $zero
2944
lw ra, 0x14(sp)
3045
jr ra
3146
addiu sp, sp, 0x18

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ issue. You should always Hard Reset to avoid this issue entirely.
137137
* Scarecrow's song is now in logic without ocarina buttons if `Free Scarecrow's Song` is on.
138138
* Fix a crash that could occur when doing certain sequences of actions in the treasure box shop with shuffled keys.
139139
* Fix the items in the “Haunted Wasteland Checks” Dual hint being listed reverse.
140+
* Fix a crash that could occur on Wii VC when entering the Skull Kid room in Lost Woods as adult.
140141

141142
#### New Speedups
142143
* The first text box from each carpenter in the Thieves' Hideout is skipped.

data/generated/patch_symbols.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)