Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Common/CPUInitSeedReset/CPUInitSeedReset.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
################################################################################
# Address: 8016e2dc
# Tags: [affects-gameplay]
################################################################################

.include "Common/Common.s"
.include "Online/Online.s"
.include "Playback/Playback.s"

# Some skins can cause stage initialization to run extra RNG calls, this can then throw off
# the seed when Nana's CPU logic counter is initialized around 800a123c. This code resyncs the
# seed prior to initializing the players to ensure that the logic counter is initialized identically

getMinorMajor r3
cmpwi r3, SCENE_PLAYBACK_IN_GAME
beq HANDLE_PLAYBACK
cmpwi r3, SCENE_ONLINE_IN_GAME
beq HANDLE_ONLINE
b EXIT

# We have to handle the playback scene in this code because if this code is added as a dynamic
# code, it will affect initialization during replay load as well, but the seed is stored in a
# different place during playback so we can't run the same logic
HANDLE_PLAYBACK:
lwz r3, primaryDataBuffer(r13) # load directory buffer location
lwz r3, PDB_EXI_BUF_ADDR(r3)
lwz r3, InfoRNGSeed(r3)
lis r4, 0x804D
stw r3, 0x5F90(r4) #store random seed
b EXIT

HANDLE_ONLINE:
lwz r3, OFST_R13_ODB_ADDR(r13) # data buffer address
lwz r3, ODB_RNG_OFFSET(r3)
lis r4, 0x804D
stw r3, 0x5F90(r4) # overwrite seed

EXIT:
lbz r0, 0x0007(r31) # replaced code
6 changes: 6 additions & 0 deletions Output/InjectionLists/list_netplay.json
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,12 @@
"Annotation": "",
"Tags": "[affects-gameplay]"
},
{
"InjectionAddress": "8016E2DC",
"Codetype": "Auto",
"Annotation": "",
"Tags": "[affects-gameplay]"
},
{
"InjectionAddress": "803761EC",
"Codetype": "04",
Expand Down
11 changes: 11 additions & 0 deletions Output/Netplay/GALE01r2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6841,6 +6841,17 @@ C03D000C FC020840
BA8100B0 800100E4
382100E0 7C0803A6
60000000 00000000
C216E2DC 0000000A #Common/CPUInitSeedReset/CPUInitSeedReset.asm
3C608048 80639D30
5463443E 2C03010E
41820010 2C030208
41820020 4800002C
806DB64C 80630000
80630001 3C80804D
90645F90 48000014
806DB61C 80630007
3C80804D 90645F90
881F0007 00000000

$Recommended: Normal Lag Reduction [Hannes Mann]
*Reduces input lag
Expand Down
11 changes: 11 additions & 0 deletions Output/Netplay/GALJ01r2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6841,6 +6841,17 @@ C03D000C FC020840
BA8100B0 800100E4
382100E0 7C0803A6
60000000 00000000
C216E2DC 0000000A #Common/CPUInitSeedReset/CPUInitSeedReset.asm
3C608048 80639D30
5463443E 2C03010E
41820010 2C030208
41820020 4800002C
806DB64C 80630000
80630001 3C80804D
90645F90 48000014
806DB61C 80630007
3C80804D 90645F90
881F0007 00000000

$Recommended: Normal Lag Reduction [Hannes Mann]
*Reduces input lag
Expand Down
6 changes: 6 additions & 0 deletions netplay.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@
"sourceFolder": "Common/PSCameraIndependentMonitor",
"isRecursive": true,
"annotation": "Avoids PS + Widescreen desyncs [Fizzi]"
},
{
"type": "injectFolder",
"sourceFolder": "Common/CPUInitSeedReset",
"isRecursive": true,
"annotation": "Resets seed prior to Nana CPU logic counter init [Fizzi, UnclePunch]"
}
]
},
Expand Down