Skip to content

Commit 18ba775

Browse files
committed
Clean assembly patches
1 parent fd04305 commit 18ba775

File tree

8 files changed

+395
-381
lines changed

8 files changed

+395
-381
lines changed

include/game_structs.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,35 @@ namespace ksys::phys {
636636
};
637637
}
638638

639+
struct BaseProcLink {
640+
BEType<uint32_t> baseProcLinkData;
641+
BEType<uint32_t> idAndPadding3;
642+
BEType<uint32_t> engaged;
643+
};
644+
645+
struct InlineParamVec3 {
646+
BEType<uint32_t> intOrFloatOrBool;
647+
BaseProcLink procLink;
648+
BEVec3 value;
649+
BEType<uint8_t> gap1C[16];
650+
BEType<uint32_t> type;
651+
BEType<uint32_t> keyPtr;
652+
};
653+
654+
struct InlineParamBool {
655+
BEType<uint8_t> value;
656+
BEType<uint8_t> gap1[3];
657+
BaseProcLink procLink;
658+
BEType<uint8_t> gap1C[16+4+4+4];
659+
BEType<uint32_t> type;
660+
BEType<uint32_t> keyPtr;
661+
};
662+
663+
static_assert(sizeof(InlineParamVec3) == 0x34, "InlineParamVec3 size mismatch");
664+
static_assert(sizeof(InlineParamBool) == 0x34, "InlineParamBool size mismatch");
665+
666+
667+
639668
#pragma pack(pop)
640669

641670
inline std::string contactLayerNames[] = {

resources/BreathOfTheWild_BetterVR/patch_CTRL_FixScreenChecks.asm

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ moduleMatches = 0x6267BFD0
33

44
.origin = codecave
55

6-
; disable agl::fx::Cloud::drawSunOcc which uses texture readback
7-
;0x0340425C = cmpwi r1, 0
6+
; --------------------------------------------------------------------------------
7+
; Hook the uniform buffer that is used to test the screen position (normally centered) for the magnesis target
88

9-
; disable peekTexture_checksQueuedRegions to narrow down interesting readback function
10-
;0x030F1B78 = nop
11-
12-
; hook GX2SetPixelUniformBlock to hook the right pixels
139
hook_GX2SetPixelUniformBlock:
1410
mflr r0
1511
stwu r1, -0x20(r1)
@@ -43,4 +39,41 @@ addi r1, r1, 0x20
4339
mtlr r0
4440
blr
4541

46-
0x038B2B2C = bla hook_GX2SetPixelUniformBlock
42+
0x038B2B2C = bla hook_GX2SetPixelUniformBlock
43+
44+
; --------------------------------------------------------------------------------
45+
; Fix the stamina gauge position that's normally attached to the player position
46+
47+
0x02FB2468 = orig_StaminaGaugeScreenPositionFn:
48+
49+
hook_fixStaminaGaugeToScreenPosition:
50+
mflr r0
51+
stwu r1, -0x20(r1)
52+
stw r0, 0x24(r1)
53+
stw r3, 0x1C(r1)
54+
stw r4, 0x18(r1)
55+
stw r5, 0x14(r1)
56+
57+
lis r3, orig_StaminaGaugeScreenPositionFn@ha
58+
addi r3, r3, orig_StaminaGaugeScreenPositionFn@l
59+
mtctr r3
60+
lwz r3, 0x1C(r1)
61+
bctrl ; call original function to get the original screen position
62+
63+
lwz r4, 0x18(r1) ; r4 is a pointer to the 2D screen position that we need to overwrite
64+
lwz r5, 0x14(r1) ; r5 is a pointer to the world position
65+
bla import.coreinit.hook_FixStaminaGaugeScreenPosition
66+
67+
lwz r5, 0x14(r1)
68+
lwz r4, 0x18(r1)
69+
lwz r3, 0x1C(r1)
70+
lwz r0, 0x24(r1)
71+
addi r1, r1, 0x20
72+
mtlr r0
73+
blr
74+
75+
; replace the player pos to screen position with static screen coords
76+
0x02FB2608 = bla hook_fixStaminaGaugeToScreenPosition
77+
78+
; force extra stamina gauge icons to just stay in place instead of dynamically hanging onto the regular stamina wheel once it appears
79+
0x02FB2760 = bla import.coreinit.hook_FixExtraStaminaGaugeIconPositions

resources/BreathOfTheWild_BetterVR/patch_CTRL_HookWeaponHands.asm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ moduleMatches = 0x6267BFD0
33

44
.origin = codecave
55

6-
0x1046CF88 = Camera__sInstance:
7-
0x03191B70 = Camera__getLookAtCamera:
8-
96
0x020081AC = PlayerOrEnemy__dropWeapon:
107
0x033BCD9C = ActorWeapons__resetBaseProc:
118

resources/BreathOfTheWild_BetterVR/patch_Misc.asm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ moduleMatches = 0x6267BFD0
33

44
.origin = codecave
55

6+
; disable agl::fx::Cloud::drawSunOcc which uses texture readback
7+
;0x0340425C = cmpwi r1, 0
8+
9+
; disable peekTexture_checksQueuedRegions to narrow down interesting readback function
10+
;0x030F1B78 = nop
11+
612
; disable AutoExposure
713
; 0x039D99A4 = li r3, 0
814

0 commit comments

Comments
 (0)