fix nana determinism issue

This commit is contained in:
Jas Laferriere
2025-09-11 01:53:42 -04:00
parent 6cb07fb368
commit 95fb888b92
8 changed files with 82 additions and 78 deletions

View File

@@ -5,9 +5,14 @@
mr r29, r3 # replaced code line
# There is a scenario where r30 is undefined and is passed to a function at line 800ac754. This
# value then gets used for a stb in the called function and impacts Nana's inputs. The value when
# undefined often holds a memory address which doesn't make sense for stb. There is a fair chance
# this is a bug with Melee which causes it to be undeterministic. By initializing the value, we
# hopefully solve this problem
# There seems to be a bug in the game where undefined values are used for X/Y stick values
# under certain conditions when Nana is DI'ing a throw. This happens at lines 800ac74c and
# 800ac75c where r5 can be unset, r30 can also be unset which is loaded into r5 for the second call.
#
# If the gecko code list for one player is different than another (for example if they enable
# an option code), the undefined values can be different, causing a desync.
#
# By initializing r5 and r30 to 0, we ensure that the same values are used for both players.
li r5, 0
li r30, 0

View File

@@ -4,29 +4,29 @@
loc_0x0:
addi r3, r31, 0x488
lbz r15, 1380(r30)
cmpwi r15, 0xD4
lbz r12, 1380(r30)
cmpwi r12, 0xD4
beq- loc_0x14
b loc_0x5C
loc_0x14:
li r15, 0x91
stb r15, 1380(r30)
lis r15, 0x437F
stw r15, 1304(r30)
lis r15, 0xC200
stw r15, 1316(r30)
lis r15, 0x0
stw r15, 1308(r30)
stw r15, 1312(r30)
stw r15, 1320(r30)
stw r15, 1324(r30)
stw r15, 1328(r30)
lis r15, 0xC280
stw r15, 1332(r30)
lis r15, 0x800C
ori r15, r15, 0x150
mtctr r15
li r12, 0x91
stb r12, 1380(r30)
lis r12, 0x437F
stw r12, 1304(r30)
lis r12, 0xC200
stw r12, 1316(r30)
lis r12, 0x0
stw r12, 1308(r30)
stw r12, 1312(r30)
stw r12, 1320(r30)
stw r12, 1324(r30)
stw r12, 1328(r30)
lis r12, 0xC280
stw r12, 1332(r30)
lis r12, 0x800C
ori r12, r12, 0x150
mtctr r12
bctr
loc_0x5C:

View File

@@ -5,29 +5,28 @@
.include "Common/Common.s"
.include "Online/Online.s"
# Player slot is at 0xC(r5) r7 and r8 seem like they should be safe to use
# as they get overwitten in the GetLCancelStatus code
# Player slot is at 0xC(r5) r12 and r11 seem like they should be safe to use
# Ensure that this is an online in-game
getMinorMajor r7
cmpwi r7, SCENE_ONLINE_IN_GAME
getMinorMajor r12
cmpwi r12, SCENE_ONLINE_IN_GAME
bne CODE_START # If not online in game, run code as normal
# If we are online in game, let's make sure this port is the local player port
lwz r7, OFST_R13_ODB_ADDR(r13) # data buffer address
lbz r7, ODB_LOCAL_PLAYER_INDEX(r7)
lbz r8, 0xC(r5) # Load port of current character
cmpw r7, r8
lwz r12, OFST_R13_ODB_ADDR(r13) # data buffer address
lbz r12, ODB_LOCAL_PLAYER_INDEX(r12)
lbz r11, 0xC(r5) # Load port of current character
cmpw r12, r11
beq CODE_START
# If not our port, just set r5 and exit
lbz r5, 1663(r5)
lbz r5, 0x67F(r5)
b EXIT
CODE_START:
lbz r5, 1663(r5)
lbz r5, 0x67F(r5)
cmpwi r5, 0x7
blt- EXIT
li r15, 0xD4
stb r15, 1380(r3)
li r12, 0xD4
stb r12, 0x564(r3)
EXIT:

View File

@@ -752,8 +752,8 @@ BA8100B0 800100E4
4E800020 00000000
04005600 801910E0 #Common/ConsoleOverrides/SetGeckoStart.asm
C20AC5B8 00000002 #Common/NanaDeterminism/NanaDeterminism.asm
7C7D1B78 3BC00000
60000000 00000000
7C7D1B78 38A00000
3BC00000 00000000
C21D24FC 00000018 #Common/PSCameraIndependentMonitor/PSCameraIndependentMonitor.asm
48000018 4E800021
C2F00000 42F00000

Binary file not shown.

Binary file not shown.

View File

@@ -6965,8 +6965,8 @@ BA810008 80010104
7D8903A6 4E800420
60000000 00000000
C20AC5B8 00000002 #Common/NanaDeterminism/NanaDeterminism.asm
7C7D1B78 3BC00000
60000000 00000000
7C7D1B78 38A00000
3BC00000 00000000
C21D24FC 00000018 #Common/PSCameraIndependentMonitor/PSCameraIndependentMonitor.asm
48000018 4E800021
C2F00000 42F00000
@@ -7295,28 +7295,28 @@ $Optional: Flash Red on Failed L-Cancel [Achilles1515, Fizzi]
*When playing online, this will only affect your character ---------------------------
*Will not cause desyncs when playing online
C20C0148 0000000C #External/FlashRedFailedLCancel/ChangeColor.asm
387F0488 89FE0564
2C0F00D4 41820008
4800004C 39E00091
99FE0564 3DE0437F
91FE0518 3DE0C200
91FE0524 3DE00000
91FE051C 91FE0520
91FE0528 91FE052C
91FE0530 3DE0C280
91FE0534 3DE0800C
61EF0150 7DE903A6
387F0488 899E0564
2C0C00D4 41820008
4800004C 39800091
999E0564 3D80437F
919E0518 3D80C200
919E0524 3D800000
919E051C 919E0520
919E0528 919E052C
919E0530 3D80C280
919E0534 3D80800C
618C0150 7D8903A6
4E800420 00000000
C208D690 00000009 #External/FlashRedFailedLCancel/TriggerColor.asm
3CE08048 80E79D30
54E7443E 2C070208
40820020 80EDB61C
88E70000 8905000C
7C074000 4182000C
3D808048 818C9D30
558C443E 2C0C0208
40820020 818DB61C
898C0000 8965000C
7C0C5800 4182000C
88A5067F 48000018
88A5067F 2C050007
4180000C 39E000D4
99E30564 00000000
4180000C 398000D4
99830564 00000000
$Optional: Show Friendly Player Indicators [Fizzi, UnclePunch]
*When playing online, nametag YOU will show above your character. A heart will always be shown over your teammate. Helpful for colorblind players to keep track of the players.

View File

@@ -6964,8 +6964,8 @@ BA810008 80010104
7D8903A6 4E800420
60000000 00000000
C20AC5B8 00000002 #Common/NanaDeterminism/NanaDeterminism.asm
7C7D1B78 3BC00000
60000000 00000000
7C7D1B78 38A00000
3BC00000 00000000
C21D24FC 00000018 #Common/PSCameraIndependentMonitor/PSCameraIndependentMonitor.asm
48000018 4E800021
C2F00000 42F00000
@@ -7294,28 +7294,28 @@ $Optional: Flash Red on Failed L-Cancel [Achilles1515, Fizzi]
*When playing online, this will only affect your character ---------------------------
*Will not cause desyncs when playing online
C20C0148 0000000C #External/FlashRedFailedLCancel/ChangeColor.asm
387F0488 89FE0564
2C0F00D4 41820008
4800004C 39E00091
99FE0564 3DE0437F
91FE0518 3DE0C200
91FE0524 3DE00000
91FE051C 91FE0520
91FE0528 91FE052C
91FE0530 3DE0C280
91FE0534 3DE0800C
61EF0150 7DE903A6
387F0488 899E0564
2C0C00D4 41820008
4800004C 39800091
999E0564 3D80437F
919E0518 3D80C200
919E0524 3D800000
919E051C 919E0520
919E0528 919E052C
919E0530 3D80C280
919E0534 3D80800C
618C0150 7D8903A6
4E800420 00000000
C208D690 00000009 #External/FlashRedFailedLCancel/TriggerColor.asm
3CE08048 80E79D30
54E7443E 2C070208
40820020 80EDB61C
88E70000 8905000C
7C074000 4182000C
3D808048 818C9D30
558C443E 2C0C0208
40820020 818DB61C
898C0000 8965000C
7C0C5800 4182000C
88A5067F 48000018
88A5067F 2C050007
4180000C 39E000D4
99E30564 00000000
4180000C 398000D4
99830564 00000000
$Optional: Show Friendly Player Indicators [Fizzi, UnclePunch]
*When playing online, nametag YOU will show above your character. A heart will always be shown over your teammate. Helpful for colorblind players to keep track of the players.