Skip to content

Commit

Permalink
Fixed menu state variables to read from stable global locations
Browse files Browse the repository at this point in the history
 - Was reading some from heap addresses, was fragile
  • Loading branch information
altf4 committed Jul 5, 2020
1 parent ca9e566 commit 222cd93
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 78 deletions.
Binary file modified Output/Console/g_core.bin
Binary file not shown.
Binary file modified Output/Console/g_core_porta.bin
Binary file not shown.
60 changes: 37 additions & 23 deletions Output/Netplay/GALE01r2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
60 changes: 37 additions & 23 deletions Output/Netplay/GALJ01r2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Recording/Recording.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
112 changes: 80 additions & 32 deletions Recording/SendMenuFrame.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 222cd93

Please sign in to comment.