Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added patches/ips/trimmed_fanfare.ips
Binary file not shown.
3 changes: 2 additions & 1 deletion patches/rom_map/Bank 84.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ F580 - F58D: ; mb_left_entrance.asm
F590 - F59D: ; horizontal_door_fix.asm
F5A0 - F5B5: ; energy_station_reserves.asm
F5C0 - F62F: ; wall_doors.asm
F630 - F6CF: [FREE]
F630 - F68F: ; trimmed_fanfare.asm
F690 - F6CF: [FREE]
F6D0 - F6F9: ; missile_refill_all.asm
F700 - F721: ; nothing_item.asm
F730 - F7F1: ; stats.asm
Expand Down
3 changes: 2 additions & 1 deletion patches/rom_map/RAM.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ $7EF596: vanilla_bugfixes.asm
$7EF597-$7EF599: split_speed.asm
$7EF59A-$7EF59C: reserve_backward_fill.asm
$7EF59C-$7EF59E: crash_handle_xmode.asm
$7EF59E-$7EFE00: [FREE]
$7EF59E-$7EF5A0: trimmed_fanfare.asm
$7EF5A0-$7EFE00: [FREE]
$7EFE00: map area (copy of $1F5B to be saved to SRAM)
$7EFE02: map area explored mask
$7EFE04: copy of $1F5D (to be saved to SRAM for escape autosave)
Expand Down
63 changes: 63 additions & 0 deletions patches/src/trimmed_fanfare.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
; Fanfare fix by Stag Shot / nn44
;
; Fixes potential fanfare overlap with trimmed setting in rooms with two items.

lorom

!bank_84_free_space_start = $84F630
!bank_84_free_space_end = $84F68F

!ram_music_backup = $7EF59E

org $82e126
jml check_music
nop #3

org $848c01
jsl clear_music

org $858491
dw $00F0 ; 4s

org !bank_84_free_space_start
check_music:
lda !ram_music_backup
cmp #$ffff ; music backup active?
bne .normal_ret
jml $82e134 ; skip rest of func

.normal_ret
lda #$0000 ; replaced code
jsl $808ff7 ;
jml $82e12d

clear_music:
phy
pha ; music track
cmp #$0002
bne .leave ; fanfare?
lda $7f5 ; current music
cmp #$0002
bne .leave_2 ; in middle of previous fanfare?
lda #$0000
jsl $808fc1 ; stop music (8-frame delay)
pla
jsl $808fc1 ; fanfare (8-frame delay)
lda !ram_music_backup ; previous music
ldy #$0168 ; 6s
jsl $808ff7 ; music (delayed)
lda #$ffff ; clear music track
sta !ram_music_backup
bra .leave_3

.leave
lda $7f5
.leave_2
sta !ram_music_backup ; save music track
pla ; music track
jsl $808fc1 ; replaced code
.leave_3
ply
rtl

assert pc() <= !bank_84_free_space_end
3 changes: 2 additions & 1 deletion rust/maprando/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ impl Patcher<'_> {
}
Fanfares::Trimmed => {
// reduce fanfare dialogue box duration (240 frames)
self.rom.write_u16(snes2pc(0x858491), 0xF0)?;
patches.push("trimmed_fanfare");
patches.push("vanilla_fanfare_stop_sounds");
}
Fanfares::Off => {
patches.push("itemsounds");
Expand Down
4 changes: 4 additions & 0 deletions scripts/build_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def check_range(filename, other_filename, overlap_start, overlap_end):
['hud_expansion_opaque', 0xB6CE00, 0xB6D000],
['hud_expansion_opaque', 0xB6E800, 0xB6F000]
],
'trimmed_fanfare': [
['itemsounds', 0x82E126, 0x82E12C],
['itemsounds', 0x858491, 0x858493],
],
}

failed = False
Expand Down
Loading