add example rules change file

this rules change file will work as expected when watching the replay
This commit is contained in:
Jas Laferriere
2025-03-14 11:21:56 -04:00
parent a3f1d25d7d
commit df32ef5797
5 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
################################################################################
# Address: 0x8000c160 # Zero_AreaLength (see notes below)
################################################################################
.include "Common/Common.s"
.include "Online/Online.s"
.include "Recording/Recording.s"
# This is a jank injection location because we need to run this after InitOnlinePlay but
# before SendGameInfo. We are injecting here to hijack a function call from SendGameInfo.
# Overwriting the settings in this particular location is important because it happens
# after the online mode game block has been set up but before the game block is written
# to the replay file. This allows for the replays to play back with the correct settings.
# This injection is designed to only overwrite settings in direct and teams modes.
# Check if in an online in-game scene. If not, don't run the code
getMinorMajor r7
cmpwi r7, SCENE_ONLINE_IN_GAME
bne Exit
# If in ranked or unranked, don't run the code
lbz r7, OFST_R13_ONLINE_MODE(r13)
cmpwi r7, ONLINE_MODE_RANKED
beq Exit
cmpwi r7, ONLINE_MODE_UNRANKED
beq Exit
# This should check if we are in StartMelee by looking for the return loc in the stack.
# This means we will actually run the settings override multiple times including when
# we don't really need to but I don't think it's going to break anything. As long
# as it happens the one time we need it, that's all that matters.
lwz r7, 0x104(r1)
load r8, 0x8016e94c
cmpw r7, r8
bne Exit
# For every other online mode (direct, teams), run the code
EditRules:
.set GameInfoBlock, 0x80480530
.set ItemFrequency, 0xB
.set ItemsMedium, 0x02
load r8, GameInfoBlock
li r7, ItemsMedium
stb r7, ItemFrequency (r8)
Exit:
cmpwi r4, 0 # replaced code line

View File

@@ -2113,6 +2113,13 @@
"Codetype": "Auto",
"Annotation": "Online/Optional/ShowAllyIndicator/ShowAllyIndicator.asm",
"Tags": ""
},
{
"InjectionAddress": "8000C160",
"Name": "Optional: Rollback Items",
"Codetype": "Auto",
"Annotation": "External/CustomOnlineSettings/MediumItems.asm",
"Tags": ""
}
]
}

View File

@@ -7208,3 +7208,18 @@ C0230064 BA810008
BA810008 800100B4
382100B0 7C0803A6
60000000 00000000
$Optional: Rollback Items [Fizzi, Krohnos]
*Rollback items
C200C160 0000000B #External/CustomOnlineSettings/MediumItems.asm
3CE08048 80E79D30
54E7443E 2C070208
4082003C 88EDAFA0
2C070000 41820030
2C070001 41820028
80E10104 3D008016
6108E94C 7C074000
40820014 3D008048
61080530 38E00002
98E8000B 2C040000
60000000 00000000

View File

@@ -7207,3 +7207,18 @@ C0230064 BA810008
BA810008 800100B4
382100B0 7C0803A6
60000000 00000000
$Optional: Rollback Items [Fizzi, Krohnos]
*Rollback items
C200C160 0000000B #External/CustomOnlineSettings/MediumItems.asm
3CE08048 80E79D30
54E7443E 2C070208
4082003C 88EDAFA0
2C070000 41820030
2C070001 41820028
80E10104 3D008016
6108E94C 7C074000
40820014 3D008048
61080530 38E00002
98E8000B 2C040000
60000000 00000000

View File

@@ -521,6 +521,23 @@
"isRecursive": true
}
]
},
{
"name": "Optional: Rollback Items",
"authors": [
"Fizzi",
"Krohnos"
],
"description": [
"Rollback items"
],
"build": [
{
"type": "injectFolder",
"sourceFolder": "External/CustomOnlineSettings",
"isRecursive": true
}
]
}
]
}