Skip to content

Commit

Permalink
Feat: Include fast transform for masks as an option.
Browse files Browse the repository at this point in the history
Thanks, Crispy_Baldy from Discord for the initial AR codes!
  • Loading branch information
PhlexPlexico committed Apr 18, 2024
1 parent 450cee8 commit c0fc275
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/include/rnd/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ namespace rnd {
u8 enableFastOcarina;
u8 enableFastArrowSwap;
u8 twinmoldRestoration;
u8 enableNoAnimationTransform;

// Cutscene Skips
u8 skipHMSCutscenes;
Expand Down
25 changes: 25 additions & 0 deletions code/mm.ld
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,31 @@ SECTIONS{
*(.patch_OverrideBombersNotebook)
}

.patch_FastTransformPatchOne 0x1EB3B8 : {
*(.patch_FastTransformPatchOne)
}

.patch_FastTransformPatchTwo 0x1EB488 : {
*(.patch_FastTransformPatchTwo)
}

.patch_FastTransformPatchThree 0x1EB510 : {
*(.patch_FastTransformPatchThree)
}

.patch_RemoveFastTransformSound 0x1EB588 : {
*(.patch_RemoveFastTransformSound)
}

.patch_FastTransformPatchFour 0x1EC420 : {
*(.patch_FastTransformPatchFour)
}

.patch_FastTransformPatchFive 0x1EC524 : {
*(.patch_FastTransformPatchFive)
}


/*2bec9c GOOD DREAM */
/*
.patch_RemoveMeetMaskCutScene 0x2bec9c : {
Expand Down
96 changes: 96 additions & 0 deletions code/source/asm/fast_transform_hooks.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.arm
.text

.global hook_FastTransformPatchOne
hook_FastTransformPatchOne:
push {r0-r12, lr}
bl SettingsNoAnimationCheck
cmp r0,#0x0
pop {r0-r12, lr}
beq defaultAnimationOne
cmp r1,#0x0
strh r1,[r0,#0x92]
blt 0x1EB58C
mov r1,#0x0
b 0x1EB3C8
defaultAnimationOne:
cmp r1,#0xFF
bx lr

.global hook_FastTransformPatchTwo
hook_FastTransformPatchTwo:
push {r0-r12, lr}
bl SettingsNoAnimationCheck
cmp r0,#0x0
pop {r0-r12, lr}
beq defaultAnimationTwo
add r2,r1,#0x6
bx lr
defaultAnimationTwo:
add r2,r1,#0x1
bx lr

.global hook_FastTransformPatchThree
hook_FastTransformPatchThree:
push {r0-r12, lr}
bl SettingsNoAnimationCheck
cmp r0,#0x0
pop {r0-r12, lr}
beq defaultAnimationThree
tst r1,r2
bne 0x1EB58C
mov r2,#0xFD
mov r1,#0xDC
strh r2,[r0,#0x54]
strh r1,[r0,#0x56]
strh r1,[r0,#0x58]
strh r1,[r0,#0x5A]
cmp r10,#0x1
b 0x1EB530
defaultAnimationThree:
@ recheck the cmp value.
tst r1,r2
beq 0x1EB58C
bx lr

.global hook_RemoveFastTransformSound
hook_RemoveFastTransformSound:
push {r0-r12, lr}
bl SettingsNoAnimationCheck
cmp r0,#0x0
pop {r0-r12, lr}
beq playTransformSound
b 0x1EB58C
playTransformSound:
push {lr}
bl 0x1D2374
pop {lr}
bx lr

.global hook_FastTransformPatchFour
hook_FastTransformPatchFour:
push {r0-r12, lr}
bl SettingsNoAnimationCheck
cmp r0,#0x0
pop {r0-r12, lr}
beq defaultAnimationFour
add r1,r0,#0x3
bx lr
defaultAnimationFour:
add r1,r0,#0x1
bx lr

.global hook_FastTransformPatchFive
hook_FastTransformPatchFive:
push {r0-r12, lr}
bl SettingsNoAnimationCheck
cmp r0,#0x0
pop {r0-r12, lr}
beq defaultAnimationFive
tst r0,r1
bne 0x1EC53C
bx lr
defaultAnimationFive:
tst r0,r1
beq 0x1EC53C
bx lr
31 changes: 31 additions & 0 deletions code/source/asm/fast_transform_patches.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.arm

.section .patch_FastTransformPatchOne
.global patch_FastTransformPatchOne
patch_FastTransformPatchOne:
bl hook_FastTransformPatchOne

.section .patch_FastTransformPatchTwo
.global patch_FastTransformPatchTwo
patch_FastTransformPatchTwo:
bl hook_FastTransformPatchTwo

.section .patch_FastTransformPatchThree
.global patch_FastTransformPatchThree
patch_FastTransformPatchThree:
bl hook_FastTransformPatchThree

.section .patch_RemoveFastTransformSound
.global patch_RemoveFastTransformSound
patch_RemoveFastTransformSound:
bl hook_RemoveFastTransformSound

.section .patch_FastTransformPatchFour
.global patch_FastTransformPatchFour
patch_FastTransformPatchFour:
bl hook_FastTransformPatchFour

.section .patch_FastTransformPatchFive
.global patch_FastTransformPatchFive
patch_FastTransformPatchFive:
bl hook_FastTransformPatchFive
4 changes: 4 additions & 0 deletions code/source/rnd/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ namespace rnd {
return gSettingsContext.enableFastMaskTransform;
}
}

u8 SettingsNoAnimationCheck() {
return gSettingsContext.enableNoAnimationTransform;
}
}
// TODO: Change the addr
/* typedef void (*Health_ChangeBy_proc)(GlobalContext *arg1, u32 arg2);
Expand Down

0 comments on commit c0fc275

Please sign in to comment.