Pretty In Game Item Spy plus Item Warning Online [Unnamed]
#1
Pretty In Game Item Spy plus Item Warning Online [Unnamed]

online only


I was tired if using Item Spy codes that only display a certain hex value to me and I need to think about it first what Item this is. So I decided to use stebler's speedometer source to create a HUD to display the items as real UNICODE strings - and now I want to present you the outcome.

This code will do the following for you:
1. It shows the Item in Inventory of every player as word, as part of a new HUD element.
2. It shows you specific Items (more on this later) in specific colors. So this code can act as an Item Warning code too.
3. The player slots are shown as numbers of the timer version. In addition, your (local) slot is shown as normal number, so you know your slot immediately.

To use this code, choose the BODY of your region and combine it with one of the TAILs (region free). The default TAIL has the following symbols and colors:

" Unused      " white (means the slot is not active)
" Green      " yellow
" Red        " yellow
" Banana      " yellow
" Fake Box    " yellow
" Shroom      " yellow
" 3 Shrooms  " yellow
" Bomb        " yellow
" Blue        " dark blue (Item warning color)
" Shock      " red (Item warning color)
" Star        " yellow
" Golden      " yellow
" Mega        " yellow
" Blooper    " yellow
" POW        " yellow
" Cloud      " yellow
" Bullet      " green (Item warning color)
" 3 Greens    " yellow
" 3 Reds      " yellow
" 3 Nanas    " yellow
" Nothing    " yellow


If I have enough time, I will prepare a customizable TAIL where you can put in your own colors and your own UNICODE symbols (even japanese symbols are possible).

NOTE: For the dump of the string and the TAIL I chose a memory region of ExRAM (0x91000000). So far I had no problems with confilcting adresses. If you ever notice weird symbols, please tell me here and we need to find another region for the TAIL.
Another NOTE: Please make sure that no other code are using the adresses 0x91000000 to 0x9100042B.
And finally one last NOTE: Only PAL is tested, I would appreciate if you test the other regions for me. Thank you already in advance.


This is the ultimate Item Spy/Item Warning code. Have fun.


BODY - NTSC-U (untested):
C25DDB7C 00000008
80A30004 2C05000C
41820028 2C05000E
41820020 2C050012
41820018 2C050040
41820010 2C050042
41820008 48000008
38840001 7C852378
60000000 00000000
C2836A48 00000007
560004E7 40820030
806F0004 2C03000C
41820020 2C03000E
41820018 2C030012
41820010 2C030040
41820008 2C030042
4C421042 00000000
C25C1214 00000009
2C040000 4082003C
3D004330 91010070
91010078 7C721B78
3A600000 3F008089
3B18EED0 90A10020
38A00001 90A10010
3CA0805C 60A512E8
7CA803A6 4E800020
80040000 00000000
C2575B44 0000001D
807D0000 80630000
88630010 3C80809C
80848F68 88840B84
7C032000 40820120
3C60809C 8063D508
80630000 83830038
2C1C0000 40820044
8383003C 2C1C0000
40820038 83830040
2C1C0000 4082002C
83830050 2C1C0000
40820020 83830108
2C1C0000 40820014
83830110 2C1C0000
40820008 4800006C
3CA09100 807C005C
3C804220 3CC08038
80C61C80 80C60058
2C060001 41820008
3C804220 9083004C
3C80C240 90830050
3C803F60 90830058
3C804020 9083005C
38800000 98830080
38C00000 80630114
80E30000 98C70100
3D80805C 618C11E0
7D8903A6 4E800421
83E1007C 00000000
C2658828 00000014
9421FFEC BFA10008
3BE00000 1D9F0028
3D8C9100 3FA0001A
63BD0800 93AC0000
3D609100 616B01DE
A7AB0002 3FBD0001
93AC0004 2C1F000A
3BBF2460 3FBD2460
4180000C 3BBF2456
3FBD2461 93AC0008
398C000A 3BC00000
A7AB0002 B7AC0002
3BDE0001 2C1E000D
4180FFF0 2C1F000B
3BA00000 41820008
3BA0000A B3AC0002
3BFF0001 2C1F000C
4180FF84 BBA10008
38210014 9903001F
60000000 00000000
C265EE14 00000010
88030001 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
2C16000A 3BB60030
3FBD0030 41A0000C
3BB60026 3FBD0031
93AC0008 398C000A
3BE00000 A7AB0002
B7AC0002 3BFF0001
2C1F000D 4180FFF0
BBA10008 38210014
60000000 00000000
C265EE30 0000000C
88100011 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
398C000A 3BE00000
A7AB0002 B7AC0002
3BFF0001 2C1F000D
4180FFF0 BBA10008
38210014 00000000


BODY - PAL:
C260245C 00000008
80A30004 2C05000C
41820028 2C05000E
41820020 2C050012
41820018 2C050040
41820010 2C050042
41820008 48000008
38840001 7C852378
60000000 00000000
C28584D8 00000007
560004E7 40820030
806F0004 2C03000C
41820020 2C03000E
41820018 2C030012
41820010 2C030040
41820008 2C030042
4C421042 00000000
C25CDD34 00000009
2C040000 4082003C
3D004330 91010070
91010078 7C721B78
3A600000 3F008089
3B183E70 90A10020
38A00001 90A10010
3CA0805C 60A5DE08
7CA803A6 4E800020
80040000 00000000
C257C3A8 0000001D
807D0000 80630000
88630010 3C80809C
8084D728 88840B84
7C032000 408200C4
3C60809C 80631E38
80630000 83830038
2C1C0000 40820044
8383003C 2C1C0000
40820038 83830040
2C1C0000 4082002C
83830050 2C1C0000
40820020 83830108
2C1C0000 40820014
83830110 2C1C0000
40820008 4800006C
3CA09100 807C005C
3C804220 3CC08038
80C66000 80C60058
2C060001 41820008
3C804220 9083004C
3C80C240 90830050
3C803F60 90830058
3C804020 9083005C
38800000 98830080
38C00000 80630114
80E30000 98C70100
3D80805C 618CDD00
7D8903A6 4E800421
83E1007C 00000000
C2660764 00000014
9421FFEC BFA10008
3BE00000 1D9F0028
3D8C9100 3FA0001A
63BD0800 93AC0000
3D609100 616B01DE
A7AB0002 3FBD0001
93AC0004 2C1F000A
3BBF2460 3FBD2460
4180000C 3BBF2456
3FBD2461 93AC0008
398C000A 3BC00000
A7AB0002 B7AC0002
3BDE0001 2C1E000D
4180FFF0 2C1F000B
3BA00000 41820008
3BA0000A B3AC0002
3BFF0001 2C1F000C
4180FF84 BBA10008
38210014 9903001F
60000000 00000000
C265E18C 00000010
88030001 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
2C16000A 3BB60030
3FBD0030 41A0000C
3BB60026 3FBD0031
93AC0008 398C000A
3BE00000 A7AB0002
B7AC0002 3BFF0001
2C1F000D 4180FFF0
BBA10008 38210014
60000000 00000000
C265E1A8 0000000C
88100011 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
398C000A 3BE00000
A7AB0002 B7AC0002
3BFF0001 2C1F000D
4180FFF0 BBA10008
38210014 00000000


BODY - NTSC-J (untested) :
C2601BD0 00000008
80A30004 2C05000C
41820028 2C05000E
41820020 2C050012
41820018 2C050040
41820010 2C050042
41820008 48000008
38840001 7C852378
60000000 00000000
C2857B44 00000007
560004E7 40820030
806F0004 2C03000C
41820020 2C03000E
41820018 2C030012
41820010 2C030040
41820008 2C030042
4C421042 00000000
C25CD610 00000009
2C040000 4082003C
3D004330 91010070
91010078 7C721B78
3A600000 3F008089
3B1834C0 90A10020
38A00001 90A10010
3CA0805C 60A5D6E4
7CA803A6 4E800020
80040000 00000000
C257BD28 0000001D
807D0000 80630000
88630010 3C80809C
8084C788 88840B84
7C032000 40820120
3C60809C 80630E98
80630000 83830038
2C1C0000 40820044
8383003C 2C1C0000
40820038 83830040
2C1C0000 4082002C
83830050 2C1C0000
40820020 83830108
2C1C0000 40820014
83830110 2C1C0000
40820008 4800006C
3CA09100 807C005C
3C804220 3CC08038
80C65980 80C60058
2C060001 41820008
3C804220 9083004C
3C80C240 90830050
3C803F60 90830058
3C804020 9083005C
38800000 98830080
38C00000 80630114
80E30000 98C70100
3D80805C 618CD5DC
7D8903A6 4E800421
83E1007C 00000000
C265FDD0 00000014
9421FFEC BFA10008
3BE00000 1D9F0028
3D8C9100 3FA0001A
63BD0800 93AC0000
3D609100 616B01DE
A7AB0002 3FBD0001
93AC0004 2C1F000A
3BBF2460 3FBD2460
4180000C 3BBF2456
3FBD2461 93AC0008
398C000A 3BC00000
A7AB0002 B7AC0002
3BDE0001 2C1E000D
4180FFF0 2C1F000B
3BA00000 41820008
3BA0000A B3AC0002
3BFF0001 2C1F000C
4180FF84 BBA10008
38210014 9903001F
60000000 00000000
C265D7F8 00000010
88030001 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
2C16000A 3BB60030
3FBD0030 41A0000C
3BB60026 3FBD0031
93AC0008 398C000A
3BE00000 A7AB0002
B7AC0002 3BFF0001
2C1F000D 4180FFF0
BBA10008 38210014
60000000 00000000
C265D814 0000000C
88100011 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
398C000A 3BE00000
A7AB0002 B7AC0002
3BFF0001 2C1F000D
4180FFF0 BBA10008
38210014 00000000


BODY - NTSC-K (untested):
C25F087C 00000008
80A30004 2C05000C
41820028 2C05000E
41820020 2C050012
41820018 2C050040
41820010 2C050042
41820008 48000008
38840001 7C852378
60000000 00000000
C2846898 00000007
560004E7 40820030
806F0004 2C03000C
41820020 2C03000E
41820018 2C030012
41820010 2C030040
41820008 2C030042
4C421042 00000000
C25BBCF4 00000009
2C040000 4082003C
3D004330 91010070
91010078 7C721B78
3A600000 3F008088
3B182280 90A10020
38A00001 90A10010
3CA0805B 60A5BDC8
7CA803A6 4E800020
80040000 00000000
C256A400 0000001D
807D0000 80630000
88630010 3C80809B
8084BD68 88840B84
7C032000 40820120
3C60809B 80630478
80630000 83830038
2C1C0000 40820044
8383003C 2C1C0000
40820038 83830040
2C1C0000 4082002C
83830050 2C1C0000
40820020 83830108
2C1C0000 40820014
83830110 2C1C0000
40820008 4800006C
3CA09100 807C005C
3C804220 3CC08037
80C64020 80C60058
2C060001 41820008
3C804220 9083004C
3C80C240 90830050
3C803F60 90830058
3C804020 9083005C
38800000 98830080
38C00000 80630114
80E30000 98C70100
3D80805B 618CBCC0
7D8903A6 4E800421
83E1007C 00000000
C264EA7C 00000014
9421FFEC BFA10008
3BE00000 1D9F0028
3D8C9100 3FA0001A
63BD0800 93AC0000
3D609100 616B01DE
A7AB0002 3FBD0001
93AC0004 2C1F000A
3BBF2460 3FBD2460
4180000C 3BBF2456
3FBD2461 93AC0008
398C000A 3BC00000
A7AB0002 B7AC0002
3BDE0001 2C1E000D
4180FFF0 2C1F000B
3BA00000 41820008
3BA0000A B3AC0002
3BFF0001 2C1F000C
4180FF84 BBA10008
38210014 9903001F
60000000 00000000
C264C4A4 00000010
88030001 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
2C16000A 3BB60030
3FBD0030 41A0000C
3BB60026 3FBD0031
93AC0008 398C000A
3BE00000 A7AB0002
B7AC0002 3BFF0001
2C1F000D 4180FFF0
BBA10008 38210014
60000000 00000000
C264C4C0 0000000C
88100011 9421FFEC
BFA10008 2C000013
7C0B0378 41800008
39600013 1D6B001C
1D960028 3D6B9100
396B01FA 3D8C9100
A7AB0002 B3AC0006
398C000A 3BE00000
A7AB0002 B7AC0002
3BFF0001 2C1F000D
4180FFF0 BBA10008
38210014 00000000


TAIL (Default):
4A000000 91000000
160001E0 0000024C
00020020 0055006E
00750073 00650064
00200020 00200020
00200020 00300020
00470072 00650065
006E0020 00200020
00200020 00200020
00300020 00520065
00640020 00200020
00200020 00200020
00200020 00300020
00420061 006E0061
006E0061 00200020
00200020 00200020
00300020 00460061
006B0065 00200042
006F0078 00200020
00200020 00300020
00530068 0072006F
006F006D 00200020
00200020 00200020
00300020 00330020
00530068 0072006F
006F006D 00730020
00200020 00300020
0042006F 006D0062
00200020 00200020
00200020 00200020
00310020 0042006C
00750065 00200020
00200020 00200020
00200020 00320020
00530068 006F0063
006B0020 00200020
00200020 00200020
00300020 00530074
00610072 00200020
00200020 00200020
00200020 00300020
0047006F 006C0064
0065006E 00200020
00200020 00200020
00300020 004D0065
00670061 00200020
00200020 00200020
00200020 00300020
0042006C 006F006F
00700065 00720020
00200020 00200020
00300020 0050004F
00570020 00200020
00200020 00200020
00200020 00300020
0043006C 006F0075
00640020 00200020
00200020 00200020
00330020 00420075
006C006C 00650074
00200020 00200020
00200020 00300020
00330020 00470072
00650065 006E0073
00200020 00200020
00300020 00330020
00520065 00640073
00200020 00200020
00200020 00300020
00330020 004E0061
006E0061 00730020
00200020 00200020
00300020 004E006F
00740068 0069006E
00670020 00200020
00200020 00000000
E0000000 80008000


Source:


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
############################
### Adress Map: ###
### 0x91000000 to 0x910001DF: Formatted player strings for output
### 0x910001E0 to 0x:9100042B: UNICODE-Symbols for the Items, including unused slot
############################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
############################
### Format of the individual player strings ###
### Length: 20 Halfwords (40 Bytes), including ###
### Bytes 0x00 - 0x07 (4 Halfwords): BMG Escape Sequence (001A 0800 0001 XXXX), XXXX is the Color
### Bytes 0x08 - 0x0B (2 Halfwords): Player Slots
### Bytes 0x0C - 0x25 (13 Halfwords): Symbols
### Bytes 0x26 - 0x27 (1 Halfword): Newline (0x0A) or if last player slot null byte (0x00)
############################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
############################
### Format of the Tail (individual item UNICODE symbols plus color) ###
### Length: 14 Halfwords (28 Bytes), including ###
### Bytes 0x00 - 0x01 (1 Halfword): Color of the item
### Bytes 0x02 - 0x1B (13 Halfwords): Symbols
############################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#



Code:
############################################################
############ Child count increment #########################
###### inject at 8060245c (PAL)
###### inject at 805ddb7c (NTSC-U)
######  inject at 80601bd0 (NTSC-J)
######  inject at 805f087c (NTSC-K)
lwz r5, 0x4 (r3)
cmpwi r5, 0xc # grand prix
beq increment
cmpwi r5, 0xe # 1 player offline vs
beq increment
cmpwi r5, 0x12 # 1 player battle
beq increment
cmpwi r5, 0x40 # 1 player ww/regional vs
beq increment
cmpwi r5, 0x42 # 1 player friend room vs
beq increment
b end
increment:
addi r4, r4, 0x1
end:
mr r5, r4 # original instruction


#############################################################
### Add the "GHOST DATA CANNOT BE SAVED" element  ###########
#####  inject at 808584d8 (PAL)
##### inject at 80836a48 (NTSC-U)
##### inject at 80857b44 (NTSC-J)
##### inject at 80846898 (NTSC-K)
rlwinm. r0, r16, 0x0, 19, 19 # original instruction
bne end
lwz r3, 0x4 (r15)
cmpwi r3, 0xc # grand prix
beq invert
cmpwi r3, 0xe # 1 player offline vs
beq invert
cmpwi r3, 0x12 # 1 player battle
beq invert
cmpwi r3, 0x40 # 1 player ww/regional vs
beq invert
cmpwi r3, 0x42 # 1 player friend room vs
invert:
crnot 4 * cr0 + eq, 4 * cr0 + eq
end:


#############################################################
############## Extend setTextSrc method  ####################
###### inject at 805cdd34 (PAL)
###### inject at 805c1214 (NTSC-U)
###### inject at 805cd610 (NTSC-J)
###### inject at 805bbcf4 (NTSC-K)
.set region, ''
.if (region == 'P')
        .set ptr_consts, 0x80893e70
        .set target, 0x805cde08
.elseif (region == 'E')
        .set ptr_consts, 0x8088eed0
        .set target, 0x805c12e8
.elseif (region == 'J')
        .set ptr_consts, 0x808934c0
        .set target, 0x805cd6e4
.elseif (region == 'K')
        .set ptr_consts, 0x80882280
        .set target, 0x805bbdc8
.else
        .err
.endif
# check if custom text is enabled
cmpwi r4, 0x0
bne end
# some registers are initialized in the middle of the bmg loading stuff we are skipping, so we have
# to do it here instead
lis r8, 0x4330
stw r8, 0x70 (r1)
stw r8, 0x78 (r1)
mr r18, r3
li r19, 0x0
lis r24, ptr_consts@ha
addi r24, r24, ptr_consts@l
# load the custom string
stw r5, 0x20 (r1)
li r5, 0x1
stw r5, 0x10 (r1)
# jump to the end of the bmg loading stuff
lis r5, target@h
ori r5, r5, target@l
mtlr r5
blr
end:
lwz r0, 0x0 (r4) # original instruction


#############################################################
############ Set adress, make text visible ##################
###### inject at 8057c3a8 (PAL)
###### inject at 80575b44 (NTSC-U)
###### inject at 8057bd28 (NTSC-J)
###### inject at 8056a400 (NTSC-K)
.set region, ''
.if (region == 'P')
        .set ptr_raceData, 0x809bd728
        .set ptr_menuData, 0x809c1e38
        .set ptr_unk, 0x80386000
        .set ScreenElement_setTextSrc, 0x805cdd00
.elseif (region == 'E')
        .set ptr_raceData, 0x809b8f68
        .set ptr_menuData, 0x809bd508
        .set ptr_unk, 0x80381c80
        .set ScreenElement_setTextSrc, 0x805c11e0
.elseif (region == 'J')
        .set ptr_raceData, 0x809bc788
        .set ptr_menuData, 0x809c0e98
        .set ptr_unk, 0x80385980
        .set ScreenElement_setTextSrc, 0x805cd5dc
.elseif (region == 'K')
        .set ptr_raceData, 0x809abd68
        .set ptr_menuData, 0x809b0478
        .set ptr_unk, 0x80374020
        .set ScreenElement_setTextSrc, 0x805bbcc0
.else
        .err
.endif
# get the player index of the player on which the hooked function is working
lwz r3, 0x0 (r29)
lwz r3, 0x0 (r3)
lbz r3, 0x10 (r3)
# get the player index from the first hud slot
lis r4, ptr_raceData@ha
lwz r4, ptr_raceData@l (r4)
lbz r4, 0xb84 (r4)
# if they don't match, don't update
cmpw r3, r4
bne end
# check if a single player gameplay screen is active
lis r3, ptr_menuData@ha
lwz r3, ptr_menuData@l (r3)
lwz r3, 0x0 (r3)
lwz r28, 0x38 (r3) # grand prix
cmpwi r28, 0x0
bne found
lwz r28, 0x3c (r3) # time trial
cmpwi r28, 0x0
bne found
lwz r28, 0x40 (r3) # 1 player offline vs
cmpwi r28, 0x0
bne found
lwz r28, 0x50 (r3) # 1 player battle
cmpwi r28, 0x0
bne found
lwz r28, 0x108 (r3) # 1 player ww/regional vs
cmpwi r28, 0x0
bne found
lwz r28, 0x110 (r3) # 1 player friend room vs
cmpwi r28, 0x0
bne found
b end
found:
lis r5, 0x9100 # prepare adress for displaying the string
lwz r3, 0x5c (r28)
# set the position of the hud element
lis r4, 0x4220
lis r6, ptr_unk@ha
lwz r6, ptr_unk@l (r6)
lwz r6, 0x58 (r6)
cmpwi r6, 0x1
beq widescreen
lis r4, 0x4220
widescreen:
stw r4, 0x4c (r3)
# y-position and scales
lis r4, 0xC240 # y position
stw r4, 0x50 (r3)
lis r4, 0x3f60 # x scale
stw r4, 0x58 (r3)
lis r4, 0x4020 # y scale
stw r4, 0x5c (r3)
# make the element visible
li r4, 0x0
stb r4, 0x80 (r3)
# align the text to the left
li r6, 0x0
lwz r3, 0x114 (r3)
lwz r7, 0x0 (r3)
stb r6, 0x100 (r7)
lis r12, ScreenElement_setTextSrc@h
ori r12, r12, ScreenElement_setTextSrc@l
mtctr r12
bctrl
end:
lwz r31, 0x7c (r1) # original instruction


#############################################################
############################
### inject at 80658828 #####
### inject at 80660764 #####
### inject at 8065FDD0 #####
### inject at 8064EA7C #####
############################
############################
### This adress is called right after you voted your track in online race. ##############
### We want to setup the formatted string that is called in race. All strings will be set to "unused" #############
### If a player slot is then active in race, it will be overwritten ###########
############################
stwu r1, -0x14(r1)                  ##### make small stack frame
stmw r29, 8(r1)
li r31, 0                         ####### initialize player index
player_index_loop:
mulli r12, r31, 0x28               ####### multiply player index by 40. Each player has a total amount of 20 halfwords string length
addis r12, r12, 0x9100             ####### add offset where the strings will be dumped to (0x91000000)
lis r29, 0x1a
ori r29, r29, 0x800                ###### prepare BMG escape sequence for each player
stw r29, 0(r12)                      ###### store first word of BMG escape sequence
lis r11, 0x9100
ori r11, r11, 0x1de
lhzu r29, 2(r11)                  ###### second word contains the color (XXXX). We want to load our color from the "unused" configuration of our Tail.
addis r29, r29, 1                 ###### add the upper 0001 from the escape sequence to the color
stw r29, 4(r12)                   ###### store second word, the BMG escape sequence is now done for the player
cmpwi r31, 0xa                   ###### Now we need to setup the player slot strings, so compare the player index to 10
addi r29, r31, 0x2460
addis r29, r29, 0x2460             ###### Add the UNICODE prefix of the timer versions
blt store_player_slot             ###### If smaller than 10, we are done
addi r29, r31, 0x2456             ###### If 10 or higher, add the prefix - 10 to the index...
addis r29, r29, 0x2461            ###### ... and set the tens digit to one
store_player_slot:
stw r29, 8(r12)                  ###### store the player slot string
addi r12, r12, 0xa                ###### now prepare store adress for the UNICODE store loop
li r30, 0                        ###### initialize UNICODE_index
UNICODE_index_loop:
lhzu r29, 2(r11)                  ##### load UNICODE halfword of "unused" configuration and update adress to next halfword
sthu r29, 2(r12)                  ##### store UNICODE halfword to player slot and update adress to next halfword
addi r30, r30, 1                 ##### increment UNICODE_index
cmpwi r30, 0xd                   ###### after 13 symbols, we are done
blt UNICODE_index_loop
cmpwi r31, 0xB                   ###### one halfword left: the Newline or Null Byte, so compare player slot to 11
li r29, 0                         ##### prepare null byte
beq store_final_player_slot_halfword
li r29, 0xA                      ##### if not equal, replace with newline
store_final_player_slot_halfword:
sth r29, 2(r12)                  ##### store it to last spot of player string, now we are finished for one player
addi r31, r31, 1                 ##### increment player_index
cmpwi r31, 0xC
blt player_index_loop            ##### do this for 12 players, after this we are done with setup
lmw r29, 8(r1)
addi r1, r1, 0x14
stb r8, 0x1f(r3)                 ##### default instruction


############################
### inject at 8065EE14 #####
### inject at 8065E18C #####
### inject at 8065D7F8 #####
### inject at 8064C4A4 #####
############################
############################
### Local Item Spy ASM, here we want to load the UNICODE-symbols of the items depending ############################
### on the item in inventory (NOTE: we don't need a player index here, because this subroutine is ############################
### called for each player slot (Combining local and away item spy) #########################
############################
lbz r0, 1(r3)             ##### default instruction, load the item in r0
stwu r1, -0x14(r1)        ##### make small stack frame
stmw r29, 8(r1)
cmpwi r0, 0x13
mr r11, r0                ##### copy the item to r11
blt skip_replace_nothing
li r11, 0x13              ##### if we have a 0x14 (no Item) we have to replace it with 0x13 because we want to have a fixed offset.
skip_replace_nothing:
mulli r11, r11, 0x1c      ##### multiply item by 28 to prepare the adress for the UNICODE symbols
mulli r12, r22, 0x28      ##### r22 helds player slot, so multiply player slot by 40 to prepare the store adress for the player strings
addis r11, r11, 0x9100
addi r11, r11, 0x1fa      ##### add offset of the color and the UNICODE symbols from our Tail of the current read item
addis r12, r12, 0x9100    ##### add offset of the player strings of the current player
lhzu r29, 2(r11)          ##### load the color of the current read item from our Tail...
sth r29, 6(r12)           ##### ... and store it to the correct spot of the player string
cmpwi r22, 0xa            ##### this part is for changing the timer number of your slot to normal number, what makes it easier to detect your slot in race
addi r29, r22, 0x30       ###### Add the UNICODE prefix of the normal number versions
addis r29, r29, 0x30      ###### If smaller than 10, we are done
blt store_player_slot
addi r29, r22, 0x26       ###### If 10 or higher, add the prefix - 10 to the index...
addis r29, r29, 0x31      ###### ... and set the tens digit to 1 (normal version)
store_player_slot
stw r29, 8(r12)           ###### store the player slot string, it will overwrite the timer number for your slot
addi r12, r12, 0xa        ###### now prepare store adress for the UNICODE store loop
li r31, 0                 ###### initialize UNICODE_index
UNICODE_index_loop:
lhzu r29, 2(r11)           ##### load UNICODE halfword of read item and update adress to next halfword
sthu r29, 2(r12)           ##### store UNICODE halfword to player slot and update adress to next halfword
addi r31, r31, 1           ##### increment UNICODE_index
cmpwi r31, 0xd
blt UNICODE_index_loop     ###### after 13 symbols, we are done
lmw r29, 8(r1)
addi r1, r1, 0x14


############################
### inject at 8065EE30 #####
### inject at 8065E1A8 #####
### inject at 8065D814 #####
### inject at 8064C4C0 #####
############################
############################
### Away Item Spy ASM, here we want to load the UNICODE-symbols of the items depending ############################
### on the item in inventory, NOTE: we don't need a player index here, because this subroutine is ############################
### called for each player slot (Combining local and away item spy) #########################
############################
lbz r0, 0x11(r16)              ##### default instruction, load the item in r0
stwu r1, -0x14(r1)             ##### make small stack frame
stmw r29, 8(r1)
cmpwi r0, 0x13
mr r11, r0                     ##### copy the item to r11
blt skip_replace_nothing
li r11, 0x13                   ##### if we have a 0x14 (no Item) we have to replace it with 0x13 because we want to have a fixed offset.
skip_replace_nothing:
mulli r11, r11, 0x1c           ##### multiply item by 28 to prepare the adress for the UNICODE symbols
mulli r12, r22, 0x28           ##### r22 helds player slot, so multiply player slot by 40 to prepare the store adress for the player strings
addis r11, r11, 0x9100
addi r11, r11, 0x1fa           ##### add offset of the color and the UNICODE symbols from our Tail of the current read item
addis r12, r12, 0x9100         ##### add offset of the player strings of the current player
lhzu r29, 2(r11)               ##### load the color of the current read item from our Tail...
sth r29, 6(r12)                ##### ... and store it to the correct spot of the player string
addi r12, r12, 0xa             ###### now prepare store adress for the UNICODE store loop
li r31, 0                      ###### initialize UNICODE_index
UNICODE_index_loop:
lhzu r29, 2(r11)               ##### load UNICODE halfword of read item and update adress to next halfword
sthu r29, 2(r12)               ##### store UNICODE halfword to player slot and update adress to next halfword
addi r31, r31, 1               ##### increment UNICODE_index
cmpwi r31, 0xd
blt UNICODE_index_loop         ###### after 13 symbols, we are done
lmw r29, 8(r1)
addi r1, r1, 0x14


Code Creator: Unnamed
Code Credits: stebler (pretty speedometer source), Bully (Item-Spy ASMs), Vega (adress that is called in between races)
Reply
#2
Can confirm NTSC-U does not work: it crashes right before the race loads, PAL ofc worked perfect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)