Boot into TT cup selection screen [Melg]
#1
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
Reply
#2

Just in case the title was not super clear, here's what the code exactly does.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)