Mario Kart Wii Gecko Codes, Cheats, & Hacks
Graphical Item Warning Online [Vega] - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51)
+--- Forum: Online; Item (https://mariokartwii.com/forumdisplay.php?fid=57)
+--- Thread: Graphical Item Warning Online [Vega] (/showthread.php?tid=1069)



Graphical Item Warning Online [Vega] - Vega - 02-11-2019

Graphical Item Warning Online [Vega]

NOTE: It's recommended to also include this code to eliminate frame flickers -> https://mkwii.com/showthread.php?tid=1530

Works Online only.

This code will place a graphical image on the bottom on your screen saying "ALERT!" whenever someone is holding an item (in inventory) that you have chosen in the code to monitor.

XX Value = Item to Monitor

XX Values:
00 = Green Shell
01 = Red Shell
02 = Banana
03 = Fib
04 = Shroom
05 = Triple Shrooms
06 = Bomb
07 = Blue Shell
08 = Shock
09 = Star
0A = Golden
0B = Mega
0C = Blooper
0D = POW
0E = TC
0F = Bullet Bill
10 = Triple Greens
11 = Triple Reds
12 = Triple Nanas
14 = Nothing / No Item Available

NOTE: This code makes use of the following memory addresses...
0x81660000 thru 0x8166002F
0x81670000 thru 0x81670003

Make sure no other codes in your GCT/Cheat-Manager are using those addresses.

NTSC-U
C200A3F0 00000007
9421FF80 BC610008
806DA358 80630044
80630000 3D808002
618C23E0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009640 00000011
3D808167 818C0000
2C0C0000 41820074
9421FF80 BC610008
3DC08165 61CEFFFC
39E000XX 3A00000C
862E0004 7C117800
41820010 3610FFFF
4082FFF0 4800003C
4800000D 414C4552
54210000 7CC802A6
38600080 388000D8
38A00001 3FE08002
63EC1DF0 7D8803A6
4E800021 63EC1DD0
7D8803A6 4E800021
B8610008 38210080
81830000 00000000
C265EE14 00000003
88030001 1D960004
3D8C8166 900C0000
60000000 00000000
C265EE30 00000004
88100011 1D960004
3D8C8166 900C0000
3D608167 920B0000
60000000 00000000

PAL
C200A430 00000007
9421FF80 BC610008
806DA360 80630044
80630000 3D808002
618C2480 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009680 00000011
3D808167 818C0000
2C0C0000 41820074
9421FF80 BC610008
3DC08165 61CEFFFC
39E000XX 3A00000C
862E0004 7C117800
41820010 3610FFFF
4082FFF0 4800003C
4800000D 414C4552
54210000 7CC802A6
38600080 388000D8
38A00001 3FE08002
63EC1E90 7D8803A6
4E800021 63EC1E70
7D8803A6 4E800021
B8610008 38210080
81830000 00000000
C265E18C 00000003
88030001 1D960004
3D8C8166 900C0000
60000000 00000000
C265E1A8 00000004
88100011 1D960004
3D8C8166 900C0000
3D608167 920B0000
60000000 00000000

NTSC-J
C200A38C 00000007
9421FF80 BC610008
806DA360 80630044
80630000 3D808002
618C23A0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C20095DC 00000011
3D808167 818C0000
2C0C0000 41820074
9421FF80 BC610008
3DC08165 61CEFFFC
39E000XX 3A00000C
862E0004 7C117800
41820010 3610FFFF
4082FFF0 4800003C
4800000D 414C4552
54210000 7CC802A6
38600080 388000D8
38A00001 3FE08002
63EC1DB0 7D8803A6
4E800021 63EC1D90
7D8803A6 4E800021
B8610008 38210080
81830000 00000000
C265D7F8 00000003
88030001 1D960004
3D8C8166 900C0000
60000000 00000000
C265D814 00000004
88100011 1D960004
3D8C8166 900C0000
3D608167 920B0000
60000000 00000000

NTSC-K
C200A538 00000007
9421FF80 BC610008
806DA380 80630044
80630000 3D808002
618C24E0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009788 00000011
3D808167 818C0000
2C0C0000 41820074
9421FF80 BC610008
3DC08165 61CEFFFC
39E000XX 3A00000C
862E0004 7C117800
41820010 3610FFFF
4082FFF0 4800003C
4800000D 414C4552
54210000 7CC802A6
38600080 388000D8
38A00001 3FE08002
63EC1EF0 7D8803A6
4E800021 63EC1ED0
7D8803A6 4E800021
B8610008 38210080
81830000 00000000
C264C4A4 00000003
88030001 1D960004
3D8C8166 900C0000
60000000 00000000
C264C4C0 00000004
88100011 1D960004
3D8C8166 900C0000
3D608167 920B0000
60000000 00000000



List of Sources:
1st ASM (When Game loads StaticR.rel, Get Render Mode & Call Direct Print Setup Frame Buffer)

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#       Register Notes:      #
# No need to backup r0 or LR #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~#
# Macros & Statements #
#~~~~~~~~~~~~~~~~~~~~~#

.macro push_stack
stwu r1, -0x80 (r1)
stmw r3, 0x8 (r1)
.endm

.macro pop_stack
lmw r3, 0x8 (r1)
addi r1, r1, 0x80
.endm

.macro call_link address
lis r12, \address@h
ori r12, r12, \address@l
mtlr r12
blrl
.endm

.macro default_instruction
lwz r0, 0x0014 (r1)
.endm

.set region, '' #Must set region value, or else source will not compile

.if (region == 'E' || region == 'e') # RMCE
.set nw4r_db_DirectPrint_SetupFB, 0x800223E0
.elseif (region == 'P' || region == 'p') # RMCP
.set nw4r_db_DirectPrint_SetupFB, 0x80022480
.elseif (region == 'J' || region == 'j') # RMCJ
.set nw4r_db_DirectPrint_SetupFB, 0x800223A0
.elseif (region == 'K' || region == 'k') # RMCK
.set nw4r_db_DirectPrint_SetupFB, 0x800224E0
.else # Invalid Region
.abort
.endif

#~~~~~~~~~~~~~~~~~~~~~~~#
# Start Register Safety #
#~~~~~~~~~~~~~~~~~~~~~~~#

push_stack

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Get Render Mode (RKSystem->mpVideo()->pRenderMode) #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

.if (region == 'E' || region == 'e') # RMCE
lwz r3, -0x5CA8(r13)
.elseif (region == 'P' || region == 'p') # RMCP
lwz r3, -0x5CA0(r13)
.elseif (region == 'J' || region == 'j') # RMCJ
lwz r3, -0x5CA0(r13)
.elseif (region == 'K' || region == 'k') # RMCK
lwz r3, -0x5C80(r13)
.endif

lwz r3, 0x0044(r3)
lwz r3, 0x0 (r3)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Call nw4r::db: DirectPrint_SetupFB #
#         r3 = Render Mode           #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

call_link nw4r_db_DirectPrint_SetupFB

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# End Register Safety; Default Instruction #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

pop_stack
default_instruction

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#

==========

2nd ASM Source:

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#      Register Notes:      #
# No need to backup r0 or LR #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~#
# Macros & Statements #
#~~~~~~~~~~~~~~~~~~~~~#

.macro push_stack
stwu r1, -0x80 (r1)
stmw r3, 0x8 (r1)
.endm

.macro pop_stack
lmw r3, 0x8 (r1)
addi r1, r1, 0x80
.endm

.macro call_nw4r address
ori r12, r31, \address@l
mtlr r12
blrl
.endm

.macro default_instruction
lwz r12, 0x0 (r3)
.endm

.set region, '' #Must set region value, or else source will not compile

.if (region == 'E' || region == 'e') # RMCE

.set nw4r_db_DirectPrint_Printf, 0x1DF0
.set nw4r_db_DirectPrint_StoreCache, 0x1DD0

.elseif (region == 'P' || region == 'p') # RMCP

.set nw4r_db_DirectPrint_Printf, 0x1E90
.set nw4r_db_DirectPrint_StoreCache, 0x1E70

.elseif (region == 'J' || region == 'j') # RMCJ

.set nw4r_db_DirectPrint_Printf, 0x1DB0
.set nw4r_db_DirectPrint_StoreCache, 0x1D90

.elseif (region == 'K' || region == 'k') # RMCK

.set nw4r_db_DirectPrint_Printf, 0x1EF0
.set nw4r_db_DirectPrint_StoreCache, 0x1ED0

.else # Invalid Region
.err
.endif

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#    Check to See if a Race is Active:    #
#      Load Status Word from Mem 81      #
# If not zero, we know to execute the code #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x8167
lwz r12, 0x0 (r12)
cmpwi r12, 0x0
beq- dont_execute

#~~~~~~~~~~~~~~~~~~~~~~~#
# Start Register Safety #
#~~~~~~~~~~~~~~~~~~~~~~~#

push_stack

#~~~~~~~~~~~~~~~~~#
# Pre-Loop Config #
#~~~~~~~~~~~~~~~~~#

lis r14, 0x8165 #Set address 0x4 before player slot 0 item word address location of 0x81660000
ori r14, r14, 0xFFFC
li r15, 0xXX #User's set item value to Monitor; set a value here when compiling
li r16, 0xC #Run loop max of 12 times for 12 possible players

#~~~~~~#
# Loop #
#~~~~~~#

the_loop:
lwzu r17, 0x0004 (r14)
cmpw r17, r15 #Compare item value of current read player to monitored item value
beq- item_found #If item monitored is held by opponent, jump to item_found label
subic. r16, r16, 1
bne+ the_loop

b not_found #Item not found, skip rest of code, go to pop_stack

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Item Found, Create ASCII String #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

item_found:
bl ascii_string

.llong 0x414C455254210000 #String for "ALERT!"

ascii_string:
mflr r6 #4th Argument set for DirectPrint Printf

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#              DirectPrint Printf & Store Cache              #
#            r3 = X coordinate (starts far left)            #
#          r4 = Y coordinate (starts at very top)            #
#                  r5 = 0 No Wrap; 1 Wrap                    #
# r6 = Address Pointer to String that will be Drawn on Screen #
#              r7 thru r10 printf format args                #
#            f1 thru f13 printf float format args            #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r3, 0x80
li r4, 0xD8
li r5, 0x1

lis r31, 0x8002 #For nw4r macro

call_nw4r nw4r_db_DirectPrint_Printf
call_nw4r nw4r_db_DirectPrint_StoreCache

#~~~~~~~~~~~~~~~~~~~~~#
# End Register Safety #
#~~~~~~~~~~~~~~~~~~~~~#

not_found:
pop_stack

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# dont_execute label; Default Instruction #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

dont_execute:
default_instruction

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#

==========

3rd ASM Source:
lbz r0, 0x1 (r3) #Default instruction
mulli r12, r22, 0x4 #Multiple Player slot by 4, store in r12. Thus lower 16 bits of r12 will hold second half of mem81 address
addis r12, r12, 0x8166 #Add 0x8166 to upper 16 bits of r12. The player slot will increment/separate the address by 0x4 depending on slot value
stw r0, 0x0 (r12) #Store current read player's item to r12 plus offset 0x0193 (address for that player's item is now finalized)

==========

4th ASM Source:
lbz r0, 0x0011 (r16) #Default instruction
mulli r12, r22, 0x4 #Multiple Player slot by 4, store in r12. Thus lower 16 bits of r12 will hold second half of mem81 address
addis r12, r12, 0x8166 #Add 0x8166 to upper 16 bits of r12. The player slot will increment/separate the address by 0x4 depending on slot value
stw r0, 0x0 (r12) #Store current read player's item to r12 plus offset 0x0193 (address for that player's item is now finalized)
lis r11, 0x8167 #Set 1st Half Address for Race-Status Word Check
stw r16, 0 (r11) #We need anything not zero at 0x81670000, store r16 to that spot



Code creator: Vega
Code credits: Star & RiiDefi (Draw Text to Screen Code); Bully (Both Item Spy ASMs)