add code to resync seed before cpu init

This commit is contained in:
Jas Laferriere
2022-10-13 13:56:06 -04:00
parent 1596c1a4f7
commit 930d10bab1
5 changed files with 73 additions and 0 deletions

View File

@@ -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

View File

@@ -1524,6 +1524,12 @@
"Annotation": "",
"Tags": "[affects-gameplay]"
},
{
"InjectionAddress": "8016E2DC",
"Codetype": "Auto",
"Annotation": "",
"Tags": "[affects-gameplay]"
},
{
"InjectionAddress": "803761EC",
"Codetype": "04",

View File

@@ -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

View File

@@ -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

View File

@@ -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]"
}
]
},