Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 78 online users. » 0 Member(s) | 75 Guest(s) Applebot, Bing, Google
|
Latest Threads |
Show Ice Cube on Online P...
Forum: Online Non-Item
Last Post: _Ro
2 hours ago
» Replies: 0
» Views: 12
|
CPU Control Cycler [Ro]
Forum: Offline Non-Item
Last Post: _Ro
2 hours ago
» Replies: 7
» Views: 986
|
Thunder Cloud Effect Modi...
Forum: Offline; Item
Last Post: JerryHatrick
11 hours ago
» Replies: 11
» Views: 1,059
|
MKW Coder/Developer of th...
Forum: Coding & Hacking General Discussion
Last Post: Vega
Yesterday, 09:10 PM
» Replies: 10
» Views: 13,813
|
Make it to 10,000
Forum: General Discussion
Last Post: Vega
Yesterday, 08:15 PM
» Replies: 7,338
» Views: 5,669,361
|
Miniturbos and Inside Dri...
Forum: Coding & Hacking General Discussion
Last Post: JerryHatrick
Yesterday, 09:54 AM
» Replies: 1
» Views: 856
|
Code request???
Forum: Code Support / Help / Requests
Last Post: DrTap
01-09-2025, 06:06 PM
» Replies: 3
» Views: 4,949
|
CPUs/Online Players Have ...
Forum: Visual & Sound Effects
Last Post: Zeraora
01-09-2025, 02:26 AM
» Replies: 2
» Views: 501
|
Offline Hide and Seek
Forum: Code Support / Help / Requests
Last Post: FelX
01-08-2025, 03:43 PM
» Replies: 11
» Views: 731
|
Show Nametags During Coun...
Forum: Visual & Sound Effects
Last Post: _Ro
01-08-2025, 07:48 AM
» Replies: 1
» Views: 666
|
|
|
Boot into TT cup selection screen [Melg] |
Posted by: Melg - 04-10-2022, 02:47 PM - Forum: Misc/Other
- Replies (3)
|
|
This code boots the game directly into the Time Trial mode, in the cup selection screen, with the character and vehicle of your choice. This is an example of how to initiate values for https://mariokartwii.com/showthread.php?tid=1949
Code:
NTSC-U
C261F85C 0000000E
3F80809C 809C8F68
38840C18 38A00002
90A40B44 38A40010
38000005 38C0000B
940500F0 34C6FFFF
4082FFF8 38A000VV
38C000HH 90A40008
90C4000C 809CD508
80840098 90A4013C
90C4012C 48000019
2D733133 32202D6C
3L202D70 CCCCCCCC
00000000 7F8802A6
93830098 00000000
0462055C 3860004A
C251FF68 00000007
3C60809C 8063D508
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
PAL
C25b9368 0000000E
3F80809C 809CD728
38840C18 38A00002
90A40B44 38A40010
38000005 38C0000B
940500F0 34C6FFFF
4082FFF8 38A000VV
38C000HH 90A40008
90C4000C 809C1E38
80840098 90A4013C
90C4012C 48000019
2D733133 32202D6C
3L202D70 CCCCCCCC
00000000 7F8802A6
93830098 00000000
045BA068 3860004A
C25243dc 00000007
3C60809C 80631E38
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
NTSC-J
C25B8CE8 0000000E
3F80809C 809CC788
38840C18 38A00002
90A40B44 38A40010
38000005 38C0000B
940500F0 34C6FFFF
4082FFF8 38A000VV
38C000HH 90A40008
90C4000C 809C0E98
80840098 90A4013C
90C4012C 48000019
2D733133 32202D6C
3L202D70 CCCCCCCC
00000000 7F8802A6
93830098 00000000
045B99E8 3860004A
C2523D5C 00000007
3C60809C 80630E98
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
NTSC-K
C25A73C0 0000000E
3F80809B 809CBD68
38840C18 38A00002
90A40B44 38A40010
38000005 38C0000B
940500F0 34C6FFFF
4082FFF8 38A000VV
38C000HH 90A40008
90C4000C 809C0478
80840098 90A4013C
90C4012C 48000019
2D733133 32202D6C
3L202D70 CCCCCCCC
00000000 7F8802A6
93830098 00000000
045A80C0 3860004A
C2512400 00000007
3C60809B 80630478
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
Values to fill:
VV = which vehicle to use: https://wiki.tockdom.com/wiki/List_of_Id...s#Vehicles
HH = which character to use: https://wiki.tockdom.com/wiki/List_of_Id...Characters
L = which license to boot into:
0 = Top-Left
1 = Top-Right
2 = Bottom-Left
3 = Bottom-Right
CCCCCCCC = which controller and slot to use; the physical slot for GCN, and the light that is turned on for the wiimote based ones (which in most cases is just the first one):
GCN Controller
32393200 slot 1
35343800 slot 2
38303400 slot 3
31303630 slot 4
Wii Wheel
32373300 slot 1
35323900 slot 2
37383500 slot 3
31303431 slot 4
Nunchuck:
32373400 slot 1
35333000 slot 2
37383600 slot 3
31303432 slot 4
Classic Controller:
32373500 slot 1
35333100 slot 2
37383700 slot 3
31303433 slot 4
Source:
Code: #1st ASM
#inject(0x805b9368)\n\n (PAL)
#inject(0x8061F85C)\n\n (NTSC-U)
#inject(0x805B8CE8)\n\n (NTSC-J)
#inject(0x805A73C0)\n\n (NTSC-K)
.set region, 'P' #Must set region value, or else source will not compile
.if (region == 'P')
.set RACEDATA, 0x809bd728
.set MENUDATA, 0x809c1e38
.elseif (region == 'E')
.set RACEDATA, 0x809b8f68
.set MENUDATA, 0x809bd508
.elseif (region == 'J')
.set RACEDATA, 0x809bc788
.set MENUDATA, 0x809c0e98
.elseif (region == 'K')
.set RACEDATA, 0x809abd68
.set MENUDATA, 0x809B0478
.else
.err
.endif
#Args: r3 = SystemManager::StaticInstance
#We boot into menu 0x4A, which is single player coming from TT change course. The first screen displayed by that menu is obviously, the course selection, so by booting into this menu we effectively boot into that screen.
#Initiate all the values that aren't because we boot directly into the course selection.
lis r28, RACEDATA@ha
lwz r4, RACEDATA@l (r28)
addi r4, r4, 0xC18 #Get into scenario[1], each player array is 0xF0 bytes long
li r5, 0x2 #Gamemode = TT
stw r5, 0xB44 (r4)
addi r5, r4, 0x10 #Align with PlayerType of RaceData->main.scenario[1].players[0]
li r0, 0x5 #PlayerType = None
li r6, 0xB #Slot 0 is an actual player, so only 11 PlayerType to fill
Loop:
stwu r0, 0xF0 (r5) #Store the PlayerType, and update r5 to the next RaceData->main.scenario[1].players
subic. r6, r6, 1
bne+ Loop
li r5, 0x17 #Vehicle ID
li r6, 0x16 #Character ID, both of these used to choose which combo you get in race
stw r5, 0x8 (r4)
stw r6, 0xC (r4)
lwz r4, MENUDATA@l (r28)
lwz r4, 0x98 (r4)
stw r5, 0x13C (r4) #Same but this type for the combo displayed in the menus
stw r6, 0x12C (r4)
bl string
.string "-s132 -l0 -p292" #-p set to GCN just for compiling purposes; you can get the decimal values by converting the ASCIII strings provided above
.byte 00
.align 2
string:
mflr r28
stw r28, 0x98 (r3) #Store pointer to string, which will be used by the function later; the default instruction is lwz r28 from the same address. If that address does not contain a pointer, the game boots as it usually would. So we both store in memory and load the value into r28 in one instruction.
Code: #inject(0x805243dc)\n\n (PAL)
#inject(0x8051FF68)\n\n (NTSC-U)
#inject(0x80523D5C)\n\n (NTSC-J)
#inject(0x80512400)\n\n (NTSC-K)
.set region, 'P' #Must set region value, or else source will not compile
.if (region == 'P')
.set MENUDATA, 0x809c1e38
.elseif (region == 'E')
.set MENUDATA, 0x809bd508
.elseif (region == 'J')
.set MENUDATA, 0x809c0e98
.elseif (region == 'K')
.set MENUDATA, 0x809B0478
.else
.err
.endif
#Fixes controller not being properly initiated since we skip the title screen "Press A". Stores the correct InputData substruct pointers depending on the controller. Without this, the correct controller buttons are displayed but the game does not fetch the inputs from the right place.
#r30 = INPUTDATA
lis r3, MENUDATA@ha
lwz r3, MENUDATA@l (r3)
lbz r4, 0x3B (r3) #Get the controllerType from MenuDataSub
cmpwi r4, 0x24 #Check if it's a GCN
addi r4, r30, 0x1720
li r5, 0x920
bne+ end
addi r4, r30, 0x3ba0
li r5, 0xB0
end:
lbz r3, 0x3A (r3) #Get the slot
subi r3, r3, 0x1
mullw r3, r3, r5
add r4, r4, r3 #Correct pointer depending on controller and slot
Code Creator: Melg
|
|
|
Boot into any menu [Melg] |
Posted by: Melg - 04-10-2022, 02:32 PM - Forum: Misc/Other
- Replies (5)
|
|
This code boots the game into a specified menu. By intelligently selecting which menu to boot into, you can start the game directly into a screen of your choice. For example menu 0x49 "Single Player (coming from Time Trial Change Character)" will boot the game directly into that screen.
Please note that the code should be seen as a base. Some menus will work as is, by just changing the menu ID, but others will need some values (such as character, vehicle, number of races, etc...) to be initiated. Considering the sheet amount of menus (roughly 150), I did not make a version of the code for every single one of them.
Refer to: https://mariokartwii.com/showthread.php?tid=1950 for an example on how values should be initiated. The exact hook and method will differ depending on the menu, but it still gives a good idea of what to do.
Code:
NTSC-U
C261F85C 00000005
48000019 2D733133
32202D6C 3L202D70
CCCCCCCC 00000000
7F8802A6 93830098
60000000 00000000
0462055C 386000MM
C251FF68 00000007
3C60809C 8063D508
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
PAL
C25b9368 00000005
48000019 2D733133
32202D6C 3L202D70
CCCCCCCC 00000000
7F8802A6 93830098
60000000 00000000
045BA068 386000MM
C25243dc 00000007
3C60809C 80631E38
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
NTSC-J
C25B8CE8 00000005
48000019 2D733133
32202D6C 30202D70
CCCCCCCC 00000000
7F8802A6 93830098
60000000 00000000
045B99E8 386000MM
C2523D5C 00000007
3C60809C 80630E98
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
NTSC-K
C25A73C0 00000005
48000019 2D733133
32202D6C 30202D70
CCCCCCCC 00000000
7F8802A6 93830098
60000000 00000000
045A80C0 386000MM
C2512400 00000007
3C60809B 80630478
8883003B 2C040024
389E1720 38A00920
40A2000C 389E3BA0
38A000B0 8863003A
3863FFFF 7C6329D6
7C841A14 00000000
Values to fill:
MM = which menu to use: https://wiki.tockdom.com/wiki/List_of_Id...dentifiers
L = which license to boot into:
0 = Top-Left
1 = Top-Right
2 = Bottom-Left
3 = Bottom-Right
CCCCCCCC = which controller and slot to use; the physical slot for GCN, and the light that is turned on for the wiimote based ones (which in most cases is just the first one):
GCN Controller
32393200 slot 1
35343800 slot 2
38303400 slot 3
31303630 slot 4
Wii Wheel
32373300 slot 1
35323900 slot 2
37383500 slot 3
31303431 slot 4
Nunchuck:
32373400 slot 1
35333000 slot 2
37383600 slot 3
31303432 slot 4
Classic Controller:
32373500 slot 1
35333100 slot 2
37383700 slot 3
31303433 slot 4
Source:
Code: #1st ASM:
#inject(0x805b9368)\n\n (PAL)
#inject(0x8061F85C)\n\n (NTSC-U)
#inject(0x805B8CE8)\n\n (NTSC-J)
#inject(0x805A73C0)\n\n (NTSC-K)
#Args: r3 = SystemManager::StaticInstance
bl string
.string "-s132 -l0 -p292" #-p set to GCN just for compiling purposes; you can get the decimal values by converting the ASCIII strings provided above
.byte 00
.align 2
string:
mflr r28
stw r28, 0x98 (r3)
#Store pointer to string, which will be used by the function later, also loads the pointer into r28; this hook is followed by a cmpwi r28
#The function this hooks into returns the menu ID to boot into (-1 usually, but the 04 changes it)
Code: #inject(0x805243dc)\n\n (PAL)
#inject(0x8051FF68)\n\n (NTSC-U)
#inject(0x80523D5C)\n\n (NTSC-J)
#inject(0x80512400)\n\n (NTSC-K)
.set region, 'P' #Must set region value, or else source will not compile
.if (region == 'P')
.set MENUDATA, 0x809c1e38
.elseif (region == 'E')
.set MENUDATA, 0x809bd508
.elseif (region == 'J')
.set MENUDATA, 0x809c0e98
.elseif (region == 'K')
.set MENUDATA, 0x809B0478
.else
.err
.endif
#Fixes controller not being properly initiated since we skip the title screen "Press A". Stores the correct InputData substruct pointers depending on the controller. Without this, the correct controller buttons are displayed but the game does not fetch the inputs from the right place.
#r30 = INPUTDATA
lis r3, MENUDATA@ha
lwz r3, MENUDATA@l (r3)
lbz r4, 0x3B (r3) #Get the controllerType from MenuDataSub
cmpwi r4, 0x24 #Check if it's a GCN
addi r4, r30, 0x1720
li r5, 0x920
bne+ end
addi r4, r30, 0x3ba0
li r5, 0xB0
end:
lbz r3, 0x3A (r3) #Get the slot
subi r3, r3, 0x1
mullw r3, r3, r5
add r4, r4, r3 #Correct pointer depending on controller and slot
Code Creator: Melg
|
|
|
Track Music SpeedUp on Final Lap [Melg, MrBean, CLF78] |
Posted by: Melg - 04-09-2022, 04:39 PM - Forum: Visual & Sound Effects
- Replies (4)
|
|
This code replaces the usual transition to the fast lap BRSTM (*_f.brstm) by a SpeedUp of the version over 5s. This is especially great for people who use long soundtracks as their custom music and do not get to hear it all in most normal races. The final lap jingle still plays, but the music does not cut and keeps going. Please note that this only affects track music and all other sounds are kept unchanged.
The code is always enabled by default, but you can disable it on select BRSTMs. The code achieves that by editing MrBean35000vr's "Use Byte 0x3F as the volume setting" code and also loading and storing the byte at 0x3E (which is padding).
Instructions:
-If you want your music to speed up on final lap, you just have to add the codes
-For BRSTMs of tracks which you want to behave as per usual, you need to edit the byte at 0x3E of the _n.brstm version and change to exactly 01
This code also effectively means that you do not need to include the _F version of the BRSTMs in your MyStuff/ISO as they are never used.
If you want all your soundtracks to speed up, then you can remove everything starting at the third C2.
Code:
NTSC-U
C2704914 00000012
2C9F0001 41860084
3C80809C 80848F68
88840B8D 7C84F840
40A60070 80850014
38840004 8063003C
38BFFFFE 1CA5000C
7CA32A14 3861FFF6
3D808084 618C23FC
7D8903A6 4E800421
3861FFF6 A0830004
2C840000 41850034
88830006 2C840005
41A50028 807D005C
80630034 80630004
8883FF8E 2C840001
41860010 8083FF4C
3884068D 9083FF4C
881D00DB 00000000
04704930 4186002c
C2704940 00000002
388000DA 40A20008
38800074 00000000
C20a52B0 00000008
80610074 881D003F
2C000000 41A20020
901D0044 3800007F
901D0048 E03D4044
10410CE0 EC211024
D023FFA4 807E0000
881D003E 9803FF8E
807E0000 00000000
PAL
C270B2b8 00000012
2C9F0001 41860084
3C80809C 8084D728
88840B8D 7C84F840
40A60070 80850014
38840004 8063003C
38BFFFFE 1CA5000C
7CA32A14 3861FFF6
3D80807E 618CE860
7D8903A6 4E800421
3861FFF6 A0830004
2C840000 41850034
88830006 2C840005
41A50028 807D005C
80630034 80630004
8883FF8E 2C840001
41860010 8083FF4C
3884068D 9083FF4C
881D00DB 00000000
0470B2D4 4186002c
C270b2e4 00000002
388000DA 40A20008
38800074 00000000
C20a5350 00000008
80610074 881D003F
2C000000 41A20020
901D0044 3800007F
901D0048 E03D4044
10410CE0 EC211024
D023FFA4 807E0000
881D003E 9803FF8E
807E0000 00000000
NTSC-J
C270a924 00000012
2C9F0001 41860084
3C80809C 8084C788
88840B8D 7C84F840
40A60070 80850014
38840004 8063003C
38BFFFFE 1CA5000C
7CA32A14 3861FFF6
3D80807E 618CDECC
7D8903A6 4E800421
3861FFF6 A0830004
2C840000 41850034
88830006 2C840005
41A50028 807D005C
80630034 80630004
8883FF8E 2C840001
41860010 8083FF4C
3884068D 9083FF4C
881D00DB 00000000
0470A940 4186002c
C270A950 00000002
388000DA 40A20008
38800074 00000000
C20a5270 00000008
80610074 881D003F
2C000000 41A20020
901D0044 3800007F
901D0048 E03D4044
10410CE0 EC211024
D023FFA4 807E0000
881D003E 9803FF8E
807E0000 00000000
NTSC-K
C26f9660 00000012
2C9F0001 41860084
3C80809B 8084BD68
88840B8D 7C84F840
40A60070 80850014
38840004 8063003C
38BFFFFE 1CA5000C
7CA32A14 3861FFF6
3D80807D 618CCC20
7D8903A6 4E800421
3861FFF6 A0830004
2C840000 41850034
88830006 2C840005
41A50028 807D005C
80630034 80630004
8883FF8E 2C840001
41860010 8083FF4C
3884068D 9083FF4C
881D00DB 00000000
046F967C 4186002c
C26F968C 00000002
388000DA 40A20008
38800074 00000000
C20a53B0 00000008
80610074 881D003F
2C000000 41A20020
901D0044 3800007F
901D0048 E03D4044
10410CE0 EC211024
D023FFA4 807E0000
881D003E 9803FF8E
807E0000 00000000
SOURCE:
Code: First ASM: Check if the conditions (lap, timer, flag) are met and then executes the speedup
#inject(0x8070B2b8)\n\n (PAL)
#inject(0x80704914)\n\n (NTSC-U)
#inject(0x8070a924)\n\n (NTSC-J)
#inject(0x806f9660)\n\n (NTSC-K)
.set region, 'P'
.if (region == 'P' || region == 'p') # RMCP
.set RACEINFO, 0x809BD730
.set RACEDATA, 0x809bd728
.set SOUNDDATA, 0x809C2898
.set SubtractTimers, 0x807ee860
.elseif (region == 'E' || region == 'e') # RMCE
.set RACEDATA, 0x809B8F68
.set SubtractTimers, 0x808423FC
.elseif (region == 'J' || region == 'j') # RMCJ
.set RACEDATA, 0x809BC788
.set SubtractTimers, 0x807EDECC
.elseif (region == 'K' || region == 'k') # RMCk
.set RACEDATA, 0x809abd68
.set SubtractTimers, 0x807DCC20
.else # Invalid Region
.abort
.endif
#r3 = RaceInfoPlayer[LocalPlayer0], r5 = RACEINFO, r29 = PlayerHolder->PlayerArray[LocalPlayer0 ID]->PlayerPointers->Field 0x1C, r31 = MaxLap of LocalPlayer0
#cr1 = CR bit used later in the function to swap (or not) to the _F version of the brstm
cmpwi cr1, r31, 1 #Check if currentLap>1 (if it's first lap then no laps have been stored in RaceInfo)
beq- cr1, end
lis r4, RACEDATA@ha
lwz r4, RACEDATA@l (r4)
lbz r4, 0xb8d (r4) #LapCount
cmplw cr1, r4, r31 #If MaxLap = LapCount, we are on final lap
bne+ cr1, end
lwz r4, 0x14 (r5) #RaceInfo->TimerManager
addi r4, r4, 0x4 #Align with the minutes
lwz r3, 0x3C (r3) #RaceInfoPlayer[Me]->lapFinishTimes Array
subi r5, r31, 2 #First position of that array gets stored on the transition from lap 1 to 2 (ie MaxLap = 2=
mulli r5, r5, 0xC #Each array element is 0xC long
add r5, r3, r5 #Get the correct array element depending on the lap
subi r3, sp, 10 #Buffer for the function
lis r12, SubtractTimers@h #Calculates the time elapsed since the player last crossed the line
ori r12, r12, SubtractTimers@l
mtctr r12
bctrl
subi r3, sp, 10
lhz r4, 0x4 (r3) #Minutes elapsed
cmpwi cr1, r4, 0 #End if 1m or more
bgt- cr1, end
lbz r4, 0x6 (r3) #Seconds elapsed
cmpwi cr1, r4, 5 #Only execute the speedup for the first 5s
bgt+ cr1, end
lwz r3, 0x5C (r29) #0x809C2898 -> Field 0x5BC which gets stored when PlayerHolder gets constructed on loading.
lwz r3, 0x34 (r3)
lwz r3, 0x4 (r3)
lbz r4, -0x72 (r3) #SpeedupFlag, initially byte 0x3E of the BRSTM
cmpwi cr1, r4, 1 #If it's 1, skip the speedup
beq- cr1, end
lwz r4, -0xB4 (r3)
addi r4, r4, 0x68D #Additive speedup
stw r4, -0xB4 (r3)
end:
lbz r0, 0xDB (r29) #Default
------------------------------------------------------------------------------------
Followed a few instructions later by beq- cr1, 0x2c (the 04 in the code). The game has already checked that we are on a lap transition. If the branch is taken, then normal behaviour will occur.
Code: Second ASM: in the same function as the first ASM.
#inject(0x8070b2e4)\n\n (PAL)
#inject(0x80704940)\n\n (NTSC-U)
#inject(0x8070A950)\n\n (NTSC-J)
#inject(0x806F968C)\n\n (NTSC-K)
#Changes the BRSAR sound ID arg that the game will use for the lap jingle. Before this ASM, there is a "compare current lap with lap count", hence the bne+
li r4, 0xda #If on final lap, play the normal lap jingle
bne+ end
li r4, 0x74 #Else, play the normal lap jingle
end:
Code: Third ASM: Keeps the volume part from MrBean's initial code, and now also load and store byte 0x3E
#inject(0x800a5350)\n\n (PAL)
#inject(0x800a52B0)\n\n (NTSC-U)
#inject(0x800a5270)\n\n (NTSC-J)
#inject(0x800a53B0)\n\n (NTSC-K)
#The game has already checked that it has correctly loaded the BRSTM Header.
#r29 points to the BRSTM header
lwz r3, 0x74(sp) #Pointer to a structure where a bunch of music related settings are stored, including volume and speed
lbz r0, 0x3F(r29) #Get the volume byte
cmpwi r0, 0 #If the byte hasn't been changed, return
beq+ end
stw r0, 0x44(r29) #Store values in the stack, free space as BRSTM headers are only 0x40 bytes
li r0, 0x7F
stw r0, 0x48(r29)
psq_l f1, 0x44(r29), 0, 4 #Reload floats using paired singles
ps_merge11 f2, f1, f1 #Move f1 ps1 to f2
fdivs f1, f1, f2
stfs f1, -0x5C(r3)
end:
lwz r3, 0(r30) #Original instruction default
lbz r0, 0x3E (r29)
stb r0, -0x72 (r3)
lwz r3, 0 (r30) #Default
Code Creator: Melg (first and second ASM, modifications of the third ASM to add a second flag), MrBean (third ASM), CLF78 (suggested using paired singles for the float conversion then wrote a better code than me, also gave the initial idea for the code https://mariokartwii.com/showthread.php?tid=1648)
|
|
|
Staff Ghosts Swapper [Melg] |
Posted by: Melg - 04-09-2022, 02:58 PM - Forum: Time Trials & Battle
- Replies (1)
|
|
This code allows you to easily replace staff ghosts with ghosts of your choice. If used for recording purposes, it is best used with this code: https://mariokartwii.com/showthread.php?tid=63
Benefits over replacing the ghosts manually in the ISO or changing the ghosts in your save game:
-Allows you to have more than 1 ghost per track. The number you use for the rkg does not have to match any sort of track ID. You can for example use 00.rkg for N64 Bowser's Castle.
-Much faster and more practical to use.
-Since there are 64 staff ghosts, allows you to use up to 64 custom ghosts.
-The NAND version is dynamic; the staff ghosts get loaded when you press "Single Player", so you can change the staff ghosts even after the game is launched.
-You just have to rename the rkgs to XX.rkg, where XX is a number from 00 to 63, no matter the track. The code and the game will place the ghosts on their correct track for you.
-You do not need to have unlocked the expert staff ghosts.
Limitations:
-The Ghost List Manager (Screen 0xA7: https://wiki.tockdom.com/wiki/List_of_Identifiers) gets constructed with an array of 38 elements for the ghosts. That means that the sum "Personal Best Times + Downloaded Ghosts + Custom ghosts from this code" is limited to 38. It shouldn't be a problem except if you want 50 ghosts on one track for some reason. This limitation isn't specific to this code however.
Instructions:
This code comes in two variants:
-The NAND variant fetches the ghosts from the root of the NAND. It is destined to be used on Dolphin. Create a folder named "Ghosts" in "Documents/Dolphin Emulator/Wii", download your RKGs, rename them to any number from 00 to 63, and dump them in the folder.
-The DISC variant gets the ghosts from the files. Create a folder named "Ghosts" int he files of your ISO, download your RKGs, rename them to any number from 00 to 63, and dump them in the folder. This works on both dolphin and console. For console, you can easily achieve that by using Riivolution, creating a Ghosts folder on the root of your SD (or anywhere you mention in the XML), and adding this patch to your XML:
Code: <patch id="LoadGhosts">
<folder external="/Ghosts" disc="/Ghosts" create="true"/>
</patch>
NAND Variant:
NTSC-U
C200B510 00000013
907F0050 48000015
2F47686F 7374732F
30302E72 6B670000
887F0016 2C030031
7C6802A6 A09F0024
40A2001C 3884CFD0
5480EFFF 38840302
41A20008 388400F6
38843030 B0830008
38800001 3D808016
618CADBC 7D8903A6
4E800421 2C030000
41800034 809F004C
7C7F1B78 38A02800
3D808016 618CB15C
7D8903A6 4E800421
7FE3FB78 3D808016
618CB2E4 7D8903A6
4E800421 00000000
C253D2A4 0000000C
3C80809C 8084D508
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045CC5A0 38600002
PAL
C200B5B0 00000013
907F0050 48000015
2F47686F 7374732F
30302E72 6B670000
887F0016 2C030031
7C6802A6 A09F0024
40A2001C 3884CFD0
5480EFFF 38840302
41A20008 388400F6
38843030 B0830008
38800001 3D808016
618CAE5C 7D8903A6
4E800421 2C030000
41800034 809F004C
7C7F1B78 38A02800
3D808016 618CB1FC
7D8903A6 4E800421
7FE3FB78 3D808016
618CB384 7D8903A6
4E800421 00000000
C25427e0 0000000C
3C80809C 80841E38
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045E237C 38600002
NTSC-J
C200B4D4 00000013
907F0050 48000015
2F47686F 7374732F
30302E72 6B670000
887F0016 2C030031
7C6802A6 A09F0024
40A2001C 3884CFD0
5480EFFF 38840302
41A20008 388400F6
38843030 B0830008
38800001 3D808016
618CAD7C 7D8903A6
4E800421 2C030000
41800034 809F004C
7C7F1B78 38A02800
3D808016 618CB11C
7D8903A6 4E800421
7FE3FB78 3D808016
618CB2A4 7D8903A6
4E800421 00000000
C2542160 0000000C
3C80809C 80840E98
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045E1C58 38600002
NTSC-K
C200B65C 00000013
907F0050 48000015
2F47686F 7374732F
30302E72 6B670000
887F0016 2C030031
7C6802A6 A09F0024
40A2001C 3884CFD0
5480EFFF 38840302
41A20008 388400F6
38843030 B0830008
38800001 3D808016
618CAEF8 7D8903A6
4E800421 2C030000
41800034 809F004C
7C7F1B78 38A02800
3D808016 618CB298
7D8903A6 4E800421
7FE3FB78 3D808016
618CB420 7D8903A6
4E800421 00000000
C2530838 0000000C
3C80809B 80840478
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045D0518 38600002
DISC Variant:
NTSC-U
C200B4F4 0000000F
48000015 2F47686F
7374732F 30302E72
6B670000 A07F0016
2C030031 A07F0024
40A2001C 3863CFD0
5460EFFF 38630302
41A20008 386300F6
38633030 7FE802A6
B07F0008 7C6802A6
3D808015 618CDEAC
7D8903A6 4E800421
2C03FFFF 7FE3FB78
83ED9400 809F004C
40820008 7FE3FB78
60000000 00000000
C253D2A4 0000000C
3C80809C 8084D508
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045CC5A0 38600002
PAL
C200B594 0000000F
48000015 2F47686F
7374732F 30302E72
6B670000 A07F0016
2C030031 A07F0024
40A2001C 3863CFD0
5460EFFF 38630302
41A20008 386300F6
38633030 7FE802A6
B07F0008 7C6802A6
3D808015 618CDF4C
7D8903A6 4E800421
2C03FFFF 7FE3FB78
83ED9400 809F004C
40820008 7FE3FB78
60000000 00000000
C25427e0 0000000C
3C80809C 80841E38
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045E237C 38600002
NTSC-J
C200B4B8 0000000F
48000015 2F47686F
7374732F 30302E72
6B670000 A07F0016
2C030031 A07F0024
40A2001C 3863CFD0
5460EFFF 38630302
41A20008 386300F6
38633030 7FE802A6
B07F0008 7C6802A6
3D808015 618CDE6C
7D8903A6 4E800421
2C03FFFF 7FE3FB78
83ED9400 809F004C
40820008 7FE3FB78
60000000 00000000
C2542160 0000000C
3C80809C 80840E98
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045E1C58 38600002
NTSC-K
C200B640 0000000F
48000015 2F47686F
7374732F 30302E72
6B670000 A07F0016
2C030031 A07F0024
40A2001C 3863CFD0
5460EFFF 38630302
41A20008 386300F6
38633030 7FE802A6
B07F0008 7C6802A6
3D808015 618CDE6C
7D8903A6 4E800421
2C03FFFF 7FE3FB78
83ED9400 809F004C
40820008 7FE3FB78
60000000 00000000
C2530838 0000000C
3C80809B 80840478
80840000 808401CC
80641918 8084191C
54842036 7C83202E
80630264 80A30068
80C3006C 8065000C
3BC00002 7C632050
28031A28 40A10010
8066000C 3BC00001
7C632050 388000D8
7C632396 2C1E0002
60000000 00000000
045D0518 38600002
SOURCE:
NAND Variant: Load the file from the NAND:
Code: #inject(0x8000B5B0)\n\n (PAL)
#inject(0x8000B510)\n\n (NTSC-U)
#inject(0x8000B4D4)\n\n (NTSC-J)
#inject(0x8000B65C)\n\n (NTSC-K)
.set region, 'P'
.if (region == 'P' || region == 'p') # RMCP
.set ISFSOpen, 0x8016AE5C
.set ISFSClose, 0x8016B384
.set ISFSRead, 0x8016B1FC
.elseif (region == 'E' || region == 'e') # RMCE
.set ISFSOpen, 0x8016ADBC
.set ISFSClose, 0x8016B2E4
.set ISFSRead, 0x8016B15C
.elseif (region == 'J' || region == 'j') # RMCE
.set ISFSOpen, 0x8016AD7C
.set ISFSClose, 0x8016B2A4
.set ISFSRead, 0x8016B11C
.elseif (region == 'K' || region == 'k') # RMCE
.set ISFSOpen, 0x8016AEF8
.set ISFSClose, 0x8016B420
.set ISFSRead, 0x8016B298
.else # Invalid Region
.abort
.endif
.macro Call register, function
lis \register, \function@h
ori \register, \register, \function@l
mtctr \register
bctrl
.endm
#r31 = SystemManager::StaticInstance, path of the file at 0x0
stw r3, 0x50 (r31) #Default, saves buffer pointer
bl Path
.string "/Ghosts/00.rkg"
.align 2
Path:
lbz r3, 0x16 (r31) #Get Staff Ghost type by checking the folder the normal file is in (ghost1 vs ghost2)
cmpwi r3, 0x31 #Check if easy
mflr r3 #Pointer to the path
lhz r4, 0x24 (r31) #Get saveindex ID of the normal ghost as an ASCII formatted int
bne+ NotAnEasy
subi r4, r4, 0x3030 #Weird ASCII to hex to ASCII conversion to add 32 if the ghost is normally an expert
extrwi. r0, r4, 1, 28 #Check if last digit is 8 or 9 as adding 32 changes the tens value
addi r4, r4, 0x0302 #Add 32 to the file number
beq+ Convert
addi r4, r4, 0xF6 #If last digit is 8 or 9, correction factor
Convert:
addi r4, r4, 0x3030 #Back to ASCII
NotAnEasy:
sth r4, 0x8 (r3) #Store which custom RKG to load
li r4, 1
Call r12, ISFSOpen #ISFSOpen to open rkg, r3 already has the path
cmpwi r3, 0 #check if the file exists
blt- end
lwz r4, 0x4C (r31) #RKG buffer
mr r31, r3 #r31 no longer used, save fd
li r5, 0x2800 #RKG length, dump the whole file in the buffer
Call r12, ISFSRead #Dump RKG into the buffer
mr r3, r31 #Close the file
Call r12, ISFSClose
end:
DISC Variant: Load the file from the disc
Code: #inject(0x8000B594)\n\n (PAL)
#inject(0x8000B4F4)\n\n (NTSC-U)
#inject(0x8000B4B8)\n\n (NTSC-J)
#inject(0x8000B640)\n\n (NTSC-K)
.set region, 'P'
.if (region == 'P' || region == 'p') # RMCP
.set DVDConvertPathToEntrynum, 0x8015DF4C
.set SysManagerR13offset, -0x6C00
.elseif (region == 'E' || region == 'e') # RMCE
.set DVDConvertPathToEntrynum, 0x8015DEAC
.set SysManagerR13offset, -0x6C00
.elseif (region == 'J' || region == 'j') # RMCP
.set DVDConvertPathToEntrynum, 0x8015DE6C
.set SysManagerR13offset, -0x6C00
.elseif (region == 'K' || region == 'k') # RMCE
.set DVDConvertPathToEntrynum, 0x8015DFC4
.set SysManagerR13offset, -0x6BE0
.else # Invalid Region
.abort
.endif
.macro Call register, function
lis \register, \function@h
ori \register, \register, \function@l
mtctr \register
bctrl
.endm
#r31 = SystemManager::StaticInstance, path of the file at 0x0, the game loads the file from the disc right after this hook
bl Path
.string "/Ghosts/00.rkg"
.align 2
Path:
lhz r3, 0x16 (r31) #Get Staff Ghost type by checking the folder the normal file is in (ghost1 vs ghost2)
cmpwi r3, 0x31 #Check if easy
lhz r3, 0x24 (r31) #Get saveindex ID as a formatted ASCII int
bne+ NotAnEasy #Get saveindex ID of the normal ghost as an ASCII formatted int
subi r3, r3, 0x3030 #Weird ASCII to hex to ASCII conversion to add 32 if the ghost is normally an expert
extrwi. r0, r3, 1, 28 #Check if last digit is 8 or 9 as adding 32 changes the tens value
addi r3, r3, 0x0302 #Add 32 to the file number
beq+ Convert
addi r3, r3, 0xF6 #If last digit is 8 or 9, correction factor
Convert:
addi r3, r3, 0x3030 #Back to ASCII
NotAnEasy:
mflr r31 #Pointer to the path in r31, will be needed later
sth r3, 0x8 (r31)
mflr r3 #Pointer to the path
Call r12, DVDConvertPathToEntrynum #Check if the file exists
cmpwi r3, -1
mr r3, r31 #r3 (the path arg for the upcoming function call) is changed to the custom path
lwz r31, SysManagerR13offset (r13) #Get r31 back to its initial value, SystemManager::StaticInstance
lwz r4, 0x4C (r31) #RKG buffer, default instruction
bne- Exists
mr r3, r31 #r3 will point to the normal path as the file does not exit
Exists:
COMMON CODE to both variants, corrects the savegameID the game uses to load the ghost in game, as well as the ghost type. This essentially is the code that makes sure the correct ghost is loaded and allows users to have multiple ghosts per track without caring about the name.
Code: #inject(0x805427e0)\n\n (PAL)
#inject(0x8053D2A4)\n\n (NTSC-U)
#inject(0x80542160)\n\n (NTSC-J)
#inject(0x80530838)\n\n (NTSC-K)
.set region, 'P' #Must set region value, or else source will not compile
.if (region == 'P' || region == 'p') # RMCP
.set MENUDATA, 0x809c1e38
.elseif (region == 'E' || region == 'e') # RMCE
.set MENUDATA, 0x809bd508
.elseif (region == 'J' || region == 'j') # RMCE
.set MENUDATA, 0x809c0e98
.elseif (region == 'K' || region == 'k') # RMCE
.set MENUDATA, 0x809B0478
.else
.err
.endif
.macro Call register, function
lis \register, \function@h
ori \register, \register, \function@l
mtctr \register
bctrl
.endm
lis r4, MENUDATA@ha
lwz r4, MENUDATA@l (r4)
lwz r4, 0 (r4) #Current Scene
lwz r4, 0x1CC (r4) #screens[0x71] which is the selectGhost screen
lwz r3, 0x1918 (r4) #Pointer to RKG Header list for the selected track ghosts, ordered by button
lwz r4, 0x191C (r4) #Which button was pressed from 1 to amount of ghosts on selected track
slwi r4, r4, 4
lwzx r4, r3, r4 #Get the RKG Header corresponding to the button pressed from the list
/* This part is needed for people who have not unlocked every expert staff ghost. This determines whether the custom ghost loaded replaces an expert or an easy, and then gets the corresponding save index ID by determining which entry it is in the list of all 32 easy/expert ghosts*/
lwz r3, 0x264 (r3) #Screen 0xA7, Ghost List Manager
lwz r5, 0x68 (r3) #Pointer to substruct related to Easy Staff Ghosts
lwz r6, 0x6C (r3) #Pointer to substruct related to Expert Staff Ghosts
lwz r3, 0xC (r5) #RKG Header list of all the easy staff ghosts
li r30, 0x2 #Set GhostType to Easy
sub r3, r4, r3 #Calculates offset from the beginning of the easy ghosts list
cmplwi r3, 0x1A28 #This is 0xD8 * 31 since there are 32 entries and each is 0xD8 bytes long
ble+ Divide #If we selected an easy, go straight to the division
lwz r3, 0xC (r6) #RKG Header list of all the expert staff ghosts
li r30, 0x1 #Set GhostType to Expert
sub r3, r4, r3 #Calculates offset from the beginning of the expert ghosts list
Divide:
li r4, 0xD8 #Each ghost entry is 0xD8 bytes long
divwu r3, r3, r4 #Offset to beginning of the list/Size of each entry = position of the selected ghost = the savegame ID used in the path
cmpwi r30, 0x2 #Default instruction, leads to different path being used depending on the ghost type.
Code creator: Melg
|
|
|
Always Display Easy and Expert Staff Ghosts [Melg] |
Posted by: Melg - 04-09-2022, 02:22 PM - Forum: Time Trials & Battle
- No Replies
|
|
This code allows you to see and to race all the easy and expert staff ghosts even if you have not (or already have) unlocked the expert. This works on all licenses
NTSC-U
045CC584 38600001
045CC5A0 38600002
PAL
045E2360 38600001
045E237C 38600002
NTSC-J
045E1C3C 38600001
045E1C58 38600002
NTSC-K
045D04FC 38600001
045D0518 38600002
"SOURCE":
This replaces two of the same function call that returns 0x1 or 0x2 if the staff ghost is respectively an easy or an expert.
Code creator: Melg
|
|
|
Item Tracker [Bully] |
Posted by: jawa - 04-08-2022, 01:32 PM - Forum: Code Support / Help / Requests
- Replies (2)
|
|
Stores your current item at 0x8000XXXX.
Item values:
Nothing = 14
Green Shell = 0
Red Shell = 1
Banana = 2
Fake Item Box = 3
Mushroom = 4
Triple Mushroom = 5
Bob-omb = 6
Blue Shell = 7
Lightning = 8
Star = 9
Golden Mushroom = A
Mega Mushroom = B
Blooper = C
POW = D
Cloud = E
Bullet Bill = F
Triple Green Shell = 10
Triple Red Shell = 11
Triple Banana = 12
NTSC-U:
C27ADEE8 00000002
3D808000 988CXXXX
90830004 00000000
PAL:
C27BC948 00000002
3D808000 988CXXXX
90830004 00000000
NTSC-J:
C27BBFB4 00000002
3D808000 988CXXXX
90830004 00000000
NTSC-K:
C27ADD08 00000002
3D808000 988CXXXX
90830004 00000000
Source:
Code: #inject at 0x807ADEE8 NTSC-U
#inject at 0x807BC948 PAL
#inject at 0x807BBFB4 NTSC-J
#inject at 0x807AAD08 NTSC-K
lis r12, 0x8000 #prepare r12 for addreses
stb r4, 0xXXXX(r12) #store item at your desired offset
stw r4, 4(r3) #default instruction
|
|
|
Need Help With Battle Code |
Posted by: Zeem - 03-14-2022, 07:50 PM - Forum: Code Support / Help / Requests
- Replies (8)
|
|
I'm looking for someone to fix this code made by Ro (he gave me permission to post it here). This code turns the team mode into FFA mode, but it has some bugs. I'm not sure if this is all I need to share, but here's the code:
NTSC-U:
C252BA24 00000002
38E00000 90FF0B90
911F00F4 00000000
Here are the bugs I found when testing the code:
-You start at the same spot as someone else
-You don't lose points from hitting yourself when you have 1 balloon left
-It still shows team results, and the results screen is really messed up
Ro also has a "get points from hitting teammates" code but it crashes on console. If you want to see that code, I can post it here.
Help would be very appreciated!
|
|
|
Hello! |
Posted by: Zeem - 03-12-2022, 11:46 PM - Forum: Introductions
- Replies (2)
|
|
I joined this forum because I'm interested in trying to learn how to create my own codes. I'm not sure how successful I'll be, but I figured it's worth a try. I'm working on a battle mod called Bob-omb Blast Revolution, a very skill-based battle mode where you can only get bob-ombs. I completed the alpha version (it may be released soon), and I have some ambitious goals for the beta version. I might drop a code request soon; help would be appreciated!
|
|
|
Fix TC Glitch [CLF78] |
Posted by: CLF78 - 03-06-2022, 01:16 PM - Forum: Offline; Item
- No Replies
|
|
Fixes the commonly known TC glitch.
NTSC-U
C27D83C0 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000
PAL
C27B096C 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000
NTSC-J
C27AFFD8 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000
NTSC-K
C279ED2C 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000
Source:
Code: # Original instruction
mulli r0, r0, 0x248
# Note: the following loop is for mods where players can have multiple TCs on their heads
# Get active tc count (plus 1 to take the tc being deleted into account)
lwz r5, 0x250(r4)
addi r5, r5, 1
mtctr r5
# Get tc object array
lwz r5, 0x244(r4)
subi r5, r5, 4
# Get associated player
lwz r6, 0x1A0(r3)
# Check if the tc is the same as the one we're hooking in
loop:
lwzu r7, 0x4(r5)
cmpw r7, r3
beq skip
# Check if the tc's associated player is the same as the one we're checking
lwz r7, 0x1A0(r7)
cmpw r7, r6
beq exitLoop
# Continue loop
skip:
bdnz+ loop
# No other tcs found, mask tc flag in PlayerSub1c
lwz r6, 0(r6)
lwz r6, 0x4(r6)
lwz r7, 0xC(r6)
rlwinm r7, r7, 0, 3, 1
stw r7, 0xC(r6)
# Return
exitLoop:
Code created by: CLF78
|
|
|
|