From 222cd9395cad1b56cc54be79fcbaa5ef882bed9f Mon Sep 17 00:00:00 2001 From: AltF4 Date: Sat, 4 Jul 2020 19:17:39 -0700 Subject: [PATCH] Fixed menu state variables to read from stable global locations - Was reading some from heap addresses, was fragile --- Output/Console/g_core.bin | Bin 4720 -> 4832 bytes Output/Console/g_core_porta.bin | Bin 4720 -> 4832 bytes Output/Netplay/GALE01r2.ini | 60 ++++++++++------- Output/Netplay/GALJ01r2.ini | 60 ++++++++++------- Recording/Recording.s | 8 +++ Recording/SendMenuFrame.asm | 112 +++++++++++++++++++++++--------- 6 files changed, 162 insertions(+), 78 deletions(-) diff --git a/Output/Console/g_core.bin b/Output/Console/g_core.bin index fed642fffbee5c38992c8ad969519acc57f7ce0b..5482722c8c161f3cdafa0e02177f5db4d959feba 100644 GIT binary patch delta 338 zcmeyM@<4UNb}q))$ve1|>o@3dFmX6GF|DvjWU#PEW{?j_W-zg6V6dCf%)qdbnSs%! zp}{Mmh5JB53j>1=3j>2g6N7}!0tSYJr3?%c7BesdF}nu?gGj>?1|AR}NDF|(p!$yB z(8mo_!|%aR57)>I)yNOkcmjt;VW38FBnyS1`oy97&fw4|4b&%(q)!^Gk8$zlDsEFo mix8l0--MP51(0rw76t(*tpTMiK=g!W217J;o3HcCWCZ}Ai(Rk) delta 202 zcmaE$`axyGb}mN$$ve1|>m77Bm^d7pm@F(387wT48RSEf8B8o180=;=GcasqW?-~w zXcSCn>3!4C!oV=0nSmL~{{ZE)L-H{aqmW#n+NX=vD+(6VB(Jg*E3h_Tt7cP1+UjXXlm diff --git a/Output/Console/g_core_porta.bin b/Output/Console/g_core_porta.bin index fc6c5b197f53eeef0f5935a0462986c8edc57cfc..3f016d86f9da5a82ea248f19342c256932b284e6 100644 GIT binary patch delta 338 zcmeyM@<4UNb}q))$ve1|>o@3dFmX6GF|DvjWU#PEW{?j_W-zg6V6dCf%)qdbnSs%! zp}{Mmh5JB53j>1=3j>2g6N7}!0tSYJr3?%c7BesdF}nu?gGj>?1|AR}NDF|(p!$yB z(8mo_!|%aR57)>I)yNOkcmjt;VW38FBnyS1`oy97&fw4|4b&%(q)!^Gk8$zlDsEFo mix8l0--MP51(0rw76t(*tpTMiK=g!W217J;o3HcCWCZ}Ai(Rk) delta 202 zcmaE$`axyGb}mN$$ve1|>m77Bm^d7pm@F(387wT48RSEf8B8o180=;=GcasqW?-~w zXcSCn>3!4C!oV=0nSmL~{{ZE)L-H{aqmW#n+NX=vD+(6VB(Jg*E3h_Tt7cP1+UjXXlm diff --git a/Output/Netplay/GALE01r2.ini b/Output/Netplay/GALE01r2.ini index cd03ed78..98b561bf 100644 --- a/Output/Netplay/GALE01r2.ini +++ b/Output/Netplay/GALE01r2.ini @@ -887,32 +887,44 @@ A0640002 B07D0031 BA810008 800100B4 382100B0 7C0803A6 881F2219 00000000 -C21A4FA4 0000004F #Recording/SendMenuFrame.asm +C21A4FA4 0000005D #Recording/SendMenuFrame.asm 7C0802A6 90010004 9421FF6A BE810008 3D008048 81089D30 5508443E 2C080202 -41820240 2C080208 -41820238 38610038 +418202B0 2C080208 +418202A8 38610038 3863001F 54630034 3880003E 98830000 -B1030001 3C808111 -60848DEC 80840000 -90830003 3C808111 -60848DF0 80840000 -90830007 3C808111 -6084826C 80840000 -9083000B 3C808111 -60848270 80840000 -9083000F 3C808111 -608476EC 80840000 -90830013 3C808111 -608476F0 80840000 -90830017 3C808111 -6084674C 80840000 -9083001B 3C808111 -60846750 80840000 -9083001F 3C80804D +B1030001 3C80804A +60840BC0 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A30003 90A30007 +48000014 80A4000C +90A30003 80A40010 +90A30007 3C80804A +60840BC4 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A3000B 90A3000F +48000014 80A4000C +90A3000B 80A40010 +90A3000F 3C80804A +60840BC8 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A30013 90A30017 +48000014 80A4000C +90A30013 80A40010 +90A30017 3C80804A +60840BCC 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A3001B 90A3001F +48000014 80A4000C +90A3001B 80A40010 +90A3001F 3C80804D 60846CF2 88840000 98830023 3C80804D 60846CAD 88840000 @@ -950,12 +962,14 @@ B1030001 3C808111 3C800000 60840000 90830031 3C800000 60840000 90830035 -2C080102 40820044 -3C8080BD 6084A810 +2C080102 40820054 +3C80804D 60847820 +80840000 38840010 80840000 38840028 80840000 38840038 80840000 90830031 -3C8080BD 6084A810 +3C80804D 60847820 +80840000 38840010 80840000 38840028 80840000 3884003C 80840000 90830035 diff --git a/Output/Netplay/GALJ01r2.ini b/Output/Netplay/GALJ01r2.ini index 1c46e64d..928e6572 100644 --- a/Output/Netplay/GALJ01r2.ini +++ b/Output/Netplay/GALJ01r2.ini @@ -887,32 +887,44 @@ A0640002 B07D0031 BA810008 800100B4 382100B0 7C0803A6 881F2219 00000000 -C21A4FA4 0000004F #Recording/SendMenuFrame.asm +C21A4FA4 0000005D #Recording/SendMenuFrame.asm 7C0802A6 90010004 9421FF6A BE810008 3D008048 81089D30 5508443E 2C080202 -41820240 2C080208 -41820238 38610038 +418202B0 2C080208 +418202A8 38610038 3863001F 54630034 3880003E 98830000 -B1030001 3C808111 -60848DEC 80840000 -90830003 3C808111 -60848DF0 80840000 -90830007 3C808111 -6084826C 80840000 -9083000B 3C808111 -60848270 80840000 -9083000F 3C808111 -608476EC 80840000 -90830013 3C808111 -608476F0 80840000 -90830017 3C808111 -6084674C 80840000 -9083001B 3C808111 -60846750 80840000 -9083001F 3C80804D +B1030001 3C80804A +60840BC0 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A30003 90A30007 +48000014 80A4000C +90A30003 80A40010 +90A30007 3C80804A +60840BC4 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A3000B 90A3000F +48000014 80A4000C +90A3000B 80A40010 +90A3000F 3C80804A +60840BC8 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A30013 90A30017 +48000014 80A4000C +90A30013 80A40010 +90A30017 3C80804A +60840BCC 80840000 +2C040000 40820018 +3CA00000 60A50000 +90A3001B 90A3001F +48000014 80A4000C +90A3001B 80A40010 +90A3001F 3C80804D 60846CF2 88840000 98830023 3C80804D 60846CAD 88840000 @@ -950,12 +962,14 @@ B1030001 3C808111 3C800000 60840000 90830031 3C800000 60840000 90830035 -2C080102 40820044 -3C8080BD 6084A810 +2C080102 40820054 +3C80804D 60847820 +80840000 38840010 80840000 38840028 80840000 38840038 80840000 90830031 -3C8080BD 6084A810 +3C80804D 60847820 +80840000 38840010 80840000 38840028 80840000 3884003C 80840000 90830035 diff --git a/Recording/Recording.s b/Recording/Recording.s index b0fb0109..e109ab8e 100644 --- a/Recording/Recording.s +++ b/Recording/Recording.s @@ -62,3 +62,11 @@ ################################################################################ .set PlayerBlockSize,0x2600 .set LCancelStatus,0x25FF + +################################################################################ +# CSS Screen Player Cursor State Offsets +################################################################################ +.set CSS_CURSOR_STRUCT_PTR_P1, 0x804A0BC0 +.set CSS_CURSOR_STRUCT_PTR_P2, 0x804A0BC4 +.set CSS_CURSOR_STRUCT_PTR_P3, 0x804A0BC8 +.set CSS_CURSOR_STRUCT_PTR_P4, 0x804A0BCC diff --git a/Recording/SendMenuFrame.asm b/Recording/SendMenuFrame.asm index bc07ba0d..146b558e 100644 --- a/Recording/SendMenuFrame.asm +++ b/Recording/SendMenuFrame.asm @@ -37,44 +37,88 @@ stb r4, 0x0(r3) sth r8, 0x1(r3) # send player 1 cursor x position -load r4 0x81118DEC -lwz r4, 0(r4) -stw r4, 0x3(r3) +# Each player has a heap-allocated struct, make sure the ptr is not NULL before reading -# send player 1 cursor y position -load r4 0x81118DF0 +load r4, CSS_CURSOR_STRUCT_PTR_P1 lwz r4, 0(r4) -stw r4, 0x7(r3) - -# send player 2 cursor x position -load r4 0x8111826C +cmpwi r4, 0 +bne SendP1Cursor + +# set cursor values to 0 +load r5, 0x00000000 +stw r5, 0x3(r3) +stw r5, 0x7(r3) +b P2_Cursor + +SendP1Cursor: +# Load cursor x position +lwz r5, 0x0c(r4) +stw r5, 0x3(r3) +# Load cursor y position +lwz r5, 0x10(r4) +stw r5, 0x7(r3) + +P2_Cursor: +load r4, CSS_CURSOR_STRUCT_PTR_P2 lwz r4, 0(r4) -stw r4, 0xB(r3) - -# send player 2 cursor y position -load r4 0x81118270 +cmpwi r4, 0 +bne SendP2Cursor + +# set cursor values to 0 +load r5, 0x00000000 +stw r5, 0xB(r3) +stw r5, 0xF(r3) +b P3_Cursor + +SendP2Cursor: +# Load cursor x position +lwz r5, 0x0c(r4) +stw r5, 0xB(r3) +# Load cursor y position +lwz r5, 0x10(r4) +stw r5, 0xF(r3) + +P3_Cursor: +load r4, CSS_CURSOR_STRUCT_PTR_P3 lwz r4, 0(r4) -stw r4, 0xF(r3) - -# send player 3 cursor x position -load r4 0x811176EC +cmpwi r4, 0 +bne SendP3Cursor + +# set p1 cursor values to 0 +load r5, 0x00000000 +stw r5, 0x13(r3) +stw r5, 0x17(r3) +b P4_Cursor + +SendP3Cursor: +# Load cursor x position +lwz r5, 0x0c(r4) +stw r5, 0x13(r3) +# Load cursor y position +lwz r5, 0x10(r4) +stw r5, 0x17(r3) + +P4_Cursor: +load r4, CSS_CURSOR_STRUCT_PTR_P4 lwz r4, 0(r4) -stw r4, 0x13(r3) +cmpwi r4, 0 +bne SendP4Cursor -# send player 3 cursor y position -load r4 0x811176F0 -lwz r4, 0(r4) -stw r4, 0x17(r3) +# set p1 cursor values to 0 +load r5, 0x00000000 +stw r5, 0x1B(r3) +stw r5, 0x1F(r3) +b CURSORS_DONE -# send player 4 cursor x position -load r4 0x8111674C -lwz r4, 0(r4) -stw r4, 0x1B(r3) +SendP4Cursor: +# Load cursor x position +lwz r5, 0x0c(r4) +stw r5, 0x1B(r3) +# Load cursor y position +lwz r5, 0x10(r4) +stw r5, 0x1F(r3) -# send player 4 cursor y position -load r4 0x81116750 -lwz r4, 0(r4) -stw r4, 0x1F(r3) +CURSORS_DONE: # Ready to fight banner visible (one byte) # banner "swoops in" frame by frame @@ -187,7 +231,9 @@ bne Not_SSS # Stage Select Cursor X # 4-byte float -load r4 0x80bda810 +load r4 0x804D7820 +lwz r4, 0(r4) +addi r4, r4, 0x10 lwz r4, 0(r4) addi r4, r4, 0x28 lwz r4, 0(r4) @@ -197,7 +243,9 @@ stw r4, 0x31(r3) # Stage Select Cursor y # 4-byte float -load r4 0x80bda810 +load r4 0x804D7820 +lwz r4, 0(r4) +addi r4, r4, 0x10 lwz r4, 0(r4) addi r4, r4, 0x28 lwz r4, 0(r4)