Math and link GBAJoyBoot

Former-commit-id: 88d36e8ec7
This commit is contained in:
Phillip Stephens 2023-03-29 21:34:08 -07:00
parent 4c2d5594ba
commit b6206bdf09
2 changed files with 35 additions and 8 deletions

View File

@ -1040,7 +1040,7 @@ LIBS = [
"objects": [ "objects": [
["Dolphin/GBA/GBA", True], ["Dolphin/GBA/GBA", True],
["Dolphin/GBA/GBAGetProcessStatus", False], ["Dolphin/GBA/GBAGetProcessStatus", False],
["Dolphin/GBA/GBAJoyBoot", False], ["Dolphin/GBA/GBAJoyBoot", True],
["Dolphin/GBA/GBARead", True], ["Dolphin/GBA/GBARead", True],
["Dolphin/GBA/GBAWrite", True], ["Dolphin/GBA/GBAWrite", True],
["Dolphin/GBA/GBAXfer", True], ["Dolphin/GBA/GBAXfer", True],

View File

@ -30,12 +30,36 @@ static u32 F72(u32 crc, u32 src, vu8* keyp) {
src >>= 1; src >>= 1;
} }
return crc;
} }
u32 F95(u32 src, vu8* keyp) { /*
return src * ((keyp[4] << keyp[0x11]) | keyp[1] | (keyp[4] << keyp[0x18]) | .fn F95, local
(keyp[3] << keyp[0x16])) - lbz r5, 0x4(keyp)
(keyp[7] - keyp[6]); lbz r0, 0x11(keyp)
lbz r7, 0x1(keyp)
slw r6, r5, r0
lbz r5, 0x4(keyp)
lbz r0, 0x18(keyp)
or r6, r7, r6
lbz r8, 0x3(keyp)
slw r0, r5, r0
lbz r7, 0x16(keyp)
or r0, r6, r0
lbz r6, 0x6(keyp)
slw r5, r8, r7
lbz r4, 0x7(keyp)
or r0, r5, r0
mullw r0, src, r0
subf src, r6, r4
subf src, src, r0
blr
.endfn F95
*/
static u32 F95(u32 src, vu8* keyp) {
src = (src * ((keyp[3] << keyp[0x16]) | ((keyp[1] | (keyp[4] << keyp[0x11])) | (keyp[4] << keyp[0x18])))) - (keyp[7] - keyp[6]);
return src;
} }
static void F104(s32 chan, s32 ret) { static void F104(s32 chan, s32 ret) {
@ -185,10 +209,13 @@ void __GBAX01(s32 chan, s32 ret) {
} }
static void F31(s32 chan, s32 ret) { static void F31(s32 chan, s32 ret) {
GBAControl* gba = &__GBA[chan]; GBAControl* gba;
GBABootInfo* bootInfo = &__GBA[chan].bootInfo; GBABootInfo* bootInfo;
u32 writeWord; u32 writeWord;
gba = &__GBA[chan];
bootInfo = &__GBA[chan].bootInfo;
if (ret == GBA_READY) { if (ret == GBA_READY) {
if (bootInfo->firstXfer != FALSE) { if (bootInfo->firstXfer != FALSE) {
bootInfo->firstXfer = FALSE; bootInfo->firstXfer = FALSE;