Call Item Function Anytime [Unnamed]
#1
Call Item Function Anytime [Unnamed]

This Code lets you call any item function you want, including Shroom, Star, Mega, POW, Bullet, Blooper and Shock. You can activate w/o item in inventory, but if you have one you will lose it because this code is server sided.

Note: This code uses the adresses 0x80000A00 and 0x80000A01. Make sure no other codes are using those adresses.


NTSC-U
C279093C 00000016
3D808034 A18CXXXX
718CZZZZ 41A2007C
3D808000 A18C0A00
2C0C0000 4082006C
9421FFB0 BDC10008
7C0F0378 7C701B78
7C912378 3C60809C
8083EE20 80638F68
80840014 88630B84
1C630248 7C641A14
3A600001 92630090
3A6000II 1E73001C
3E40809C 6252EEB0
7E52982E 7E4903A6
4E800421 7DE07B78
7E038378 7E248B78
B9C10008 38210050
3D808034 A18CXXXX
39600001 718CZZZZ
40820008 39600000
3D808000 B16C0A00
7C630214 00000000

PAL
C2799948 00000016
3D80803Q A18CXXXX
718CZZZZ 41A2007C
3D808000 A18C0A00
2C0C0000 4082006C
9421FFB0 BDC10008
7C0F0378 7C701B78
7C912378 3C60809C
80833618 8063D728
80840014 88630B84
1C630248 7C641A14
3A600001 92630090
3A6000II 1E73001C
3E40809C 625236B8
7E52982E 7E4903A6
4E800421 7DE07B78
7E038378 7E248B78
B9C10008 38210050
3D80803Q A18CXXXX
39600001 718CZZZZ
40820008 39600000
3D808000 B16C0A00
7C630214 00000000

NTSC-J
C2798FB4 00000016
3D808034 A18CXXXX
718CZZZZ 41A2007C
3D808000 A18C0A00
2C0C0000 4082006C
9421FFB0 BDC10008
7C0F0378 7C701B78
7C912378 3C60809C
80832678 8063C788
80840014 88630B84
1C630248 7C641A14
3A600001 92630090
3A6000II 1E73001C
3E40809C 62522718
7E52982E 7E4903A6
4E800421 7DE07B78
7E038378 7E248B78
B9C10008 38210050
3D808034 A18CXXXX
39600001 718CZZZZ
40820008 39600000
3D808000 B16C0A00
7C630214 00000000

NTSC-K
C2787D08 00000016
3D808033 A18CXXXX
718CZZZZ 41A2007C
3D808000 A18C0A00
2C0C0000 4082006C
9421FFB0 BDC10008
7C0F0378 7C701B78
7C912378 3C60809B
80831C58 8063BD68
80840014 88630B84
1C630248 7C641A14
3A600001 92630090
3A6000II 1E73001C
3E40809B 62521CF8
7E52982E 7E4903A6
4E800421 7DE07B78
7E038378 7E248B78
B9C10008 38210050
3D808033 A18CXXXX
39600001 718CZZZZ
40820008 39600000
3D808000 B16C0A00
7C630214 00000000

XXXX = Controller Adress

Q Values:
4 for non GCN Controller
5 for GCN Controller

ZZZZ = Button Activator

II Item Values:
04 = Mushroom
08 = Shock
09 = Star
0B = Mega
0C = Blooper
0D = Pow
0F = Bullet


Source:

### Adresses ####

# 8079093C  # NTSC-U
# 80799948  # PAL
# 80798FB4  # NTSC-J
# 80787D08  # NTSC-K


###########################################
#### Pointers ####

## PlayerHolder ##
# 809BEE20 # NTSC-U
# 809C3618 # PAL
# 809C2678 # NTSC-J
# 809B1C58 # NTSC-K

## RaceData ##
# 809B8F68 # NTSC-U
# 809BD728 # PAL
# 809BC788 # NTSC-J
# 809ABD68 # NTSC-K

## ItemFunctions ##
# 809BEEB0 # NTSC-U
# 809C36B8 # PAL
# 809C2718 # NTSC-J
# 809B1CF8 # NTSC-K


###########################################

lis r12, 0x803Q
lhz r12, 0xXXXX (r12) # load Halfword from Controller adress
andi. r12, r12, 0xZZZZ # compare anded halfword to 0
beq+ skip_maincode # if 0, button is not pressed, skip the code
##
lis r12, 0x8000
lhz r12, 0x0A00 (r12) # load Pressed Status
cmpwi r12, 0
bne- skip_maincode # only execute if the status was NOT pressed, we don't want to execute if this was pressed before
##
## Main code ####
stwu r1,-80(r1)
stmw r14,8(r1) # Push Stack
mr r15,r0
mr r16,r3
mr r17,r4 # Backup registers
lis r3, PlayerHolderUpper
lwz r4, PlayerHolderLower (r3)
lwz r3, RaceDataLower (r3)
lwz r4, 0x14 (r4) # load Item Pointer
lbz r3, 0x0B84 (r3) # load Player Slot
mulli r3, r3, 0x248
add r3, r4, r3 # Prepare r3 for Item Function call
li r19, 1
stw r19, 0x90 (r3) # Overwrite Item Number to only make item use once
li r19, 0xII  # load Item in r19
mulli r19, r19, 0x1C # prepare Item offset
lis r18, ItemFunctionsUpper
ori r18, r18, ItemFunctionsLower
lwzx r18, r18, r19 # load the Adress of Item Function
mtctr r18
bctrl # call Item Function
mr r0,r15
mr r3,r16
mr r4,r17 # restore backed up registers
lmw r14,8(r1)
addi r1,r1,80 # pop stack
##
skip_maincode:
lis r12, 0x803Q
lhz r12, 0xXXXX (r12)
li r11, 1 # pressed means status value 1
andi. r12, r12, 0xZZZZ # compare anded halfword to 0
bne- Skip_not_pressed # if not 0, button is pressed, so skip status value change
##
Not_pressed:
li r11, 0 # no press status means value 0
##
Skip_not_pressed:
lis r12, 0x8000
sth r11, 0x0A00 (r12) # store Pressed Status to Exception Vector, this is to avoid Rapid Fire

## default Instruction ##

add r3,r3,r0

###########################


Code Creator: Unnamed
Code Credits: Fishguy
Reply
#2
This code feels familiar
Reply
#3
Yeah, it has the same format like the "Drop items on command" code from Fishguy. I noticed that the code is working with the adresses he used for this code. That's why I gave him Credits.
Reply
#4
I saw that the second controller adress/button activator was still not replaced with XXXX/ZZZZ values, so I updated them. Now all versions should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)