Skip to content

Commit

Permalink
Fix the sword issue that resets sword on b button. (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhlexPlexico authored Feb 25, 2024
1 parent ec5b5c9 commit 8ccac8a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 45 deletions.
14 changes: 1 addition & 13 deletions code/mm.ld
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SECTIONS{
*(.patch_DoNotResetPermFlags)
}

.patch_DoNotRemoveTradeItems 0x1c9aa8 : {
.patch_DoNotRemoveTradeItems 0x1c9AA8 : {
*(.patch_DoNotRemoveTradeItems)
}

Expand All @@ -99,18 +99,6 @@ SECTIONS{
*(.patch_DoNotGiveSwordBackOnReset)
}

.patch_RemoveSwordFlagSettingSoT 0x1C98F4 : {
*(.patch_RemoveSwordFlagSettingSoT)
}

.patch_RemoveItemBUsabilityOnReset 0x1C99F4 : {
*(.patch_RemoveItemBUsabilityOnReset)
}

.patch_RemoveSwordFlagsOnReset 0x1C9900 : {
*(.patch_RemoveSwordFlagsOnReset)
}

.patch_OverrideBomberTextID 0x1D2764 : {
*(.patch_OverrideBomberTextID)
}
Expand Down
10 changes: 0 additions & 10 deletions code/source/asm/patches.s
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@ patch_DoNotRemoveKeys:
nop
nop

.section .patch_RemoveItemBUsabilityOnReset
.global patch_RemoveItemBUsabilityOnReset
patch_RemoveItemBUsabilityOnReset:
bl hook_DoNotGiveSwordBackOnResetTwo

.section .patch_RemoveSwordFlagsOnReset
.global patch_RemoveSwordFlagsOnReset
patch_RemoveSwordFlagsOnReset:
nop

.section .patch_RemoveDekuMaskCheckSoT
.global patch_RemoveDekuMaskCheckSoT
patch_RemoveDekuMaskCheckSoT:
Expand Down
13 changes: 2 additions & 11 deletions code/source/asm/sword_hooks.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@
.text

.global hook_DoNotGiveSwordBackOnReset
hook_DoNotGiveSwordBackOnReset:
bhi 0x1C9958 @ original instruction, if gilded sword ignore these.
hook_DoNotGiveSwordBackOnReset:
push {r0-r12, lr}
bl SongOfTimeSwordPlacement @ See rnd/link.cpp
pop {r0-r12, lr}
bx lr

.global hook_DoNotGiveSwordBackOnResetTwo
hook_DoNotGiveSwordBackOnResetTwo:
push {r0-r12, lr}
bl SongOfTimeSwordPlacement @ See rnd/link.cpp
pop {r0-r12, lr}
bx lr

b 0x1C9958 @ original instruction, if gilded sword ignore these.

.global hook_GaboraCheckExtDataNotSword
hook_GaboraCheckExtDataNotSword:
Expand Down
11 changes: 1 addition & 10 deletions code/source/asm/sword_patches.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
patch_DoNotGiveSwordBackOnReset:
bl hook_DoNotGiveSwordBackOnReset

.section .patch_RemoveSwordFlagSettingSoT
.global patch_RemoveSwordFlagSettingSoT
patch_RemoveSwordFlagSettingSoT:
nop
nop
nop
nop

.section .patch_ForceSwordUpgradeOnHuman
.global patch_ForceSwordUpgradeOnHuman
patch_ForceSwordUpgradeOnHuman:
Expand Down Expand Up @@ -66,5 +58,4 @@ patch_DoNotRemoveSwordGabora:
.section .patch_DoNotRemoveSwordGaboraTwo
.global patch_DoNotRemoveSwordGaboraTwo
patch_DoNotRemoveSwordGaboraTwo:
nop

nop
8 changes: 7 additions & 1 deletion code/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ namespace rnd {

const u32 pressedButtons = gctx->pad_state.input.buttons.flags;
// const u32 newButtons = gctx->pad_state.input.new_buttons.flags;

#if defined ENABLE_DEBUG || defined DEBUG_PRINT
game::SaveData& saveData = game::GetCommonData().save;
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
if (pressedButtons == (u32)game::pad::Button::ZR)
rnd::util::Print("%s: Sword shield is %u, starting sword is %u\n", __func__, (u8)saveData.equipment.data[0].item_btn_b, gSettingsContext.startingKokiriSword);
#endif
#endif
if (gSettingsContext.customMaskButton != 0 && pressedButtons == gSettingsContext.customMaskButton) {
game::ui::OpenScreen(game::ui::ScreenType::Masks);
} else if (gSettingsContext.customItemButton != 0 && pressedButtons == gSettingsContext.customItemButton) {
Expand Down

0 comments on commit 8ccac8a

Please sign in to comment.