Roll Itembox Anytime [1superchip]
#1
Roll Itembox Anytime [1superchip]

Allows user to roll item roulette anytime they press their chosen button activator, does not allow for hacked items unless probabilities are modified. Works everywhere.
This code can cause the mushroom bug.

XXXX = Controller Address
ZZZZ = Button Value

NTSC-U
C0000000 00000010
3C608034 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809C
8063EE20 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809C
80848F68 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808078
618CFC2C 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000

PAL:
C0000000 00000010
3C608034 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809C
80633618 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809C
8084D728 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808079
618C8C38 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000

NTSC-J:
C0000000 00000010
3C608034 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809C
80632678 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809C
8084C788 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808079
618C82A4 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000

NTSC-K:
C0000000 00000010
3C608033 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809B
80631C58 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809B
8084BD68 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808078
618C6FF8 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000


Source:

#C0 asm

.set region, ''

.if (region == 'E' || region == 'e') # RMCE
    .set ItemFunction, 0x8078fc2c
    .set ItemHolder, 0x809bee20
    .set Racedata, 0x809B8F68
    lis r3, 0x8034
.elseif (region == 'P' || region == 'p') # RMCP
    .set ItemFunction, 0x80798c38
    .set ItemHolder, 0x809C3618
    .set Racedata, 0x809BD728
    lis r3, 0x8034
.elseif (region == 'J' || region == 'j') # RMCJ
    .set ItemFunction, 0x807982a4
    .set ItemHolder, 0x809C2678
    .set Racedata, 0x809BC788
    lis r3, 0x8034
.elseif (region == 'K' || region == 'k') # RMCK
    .set ItemFunction, 0x80786ff8
    .set ItemHolder, 0x809B1C58
    .set Racedata, 0x809ABD68
    lis r3, 0x8033
.else # Invalid Region
    .err
.endif

ori r3, r3, 0xXXXX #controller address
lhz r3, 0 (r3)
li r11, 0xZZZZ #button value
and r0, r11, r3
cmpw r0, r11
bne+ end

lis r3, ItemHolder@ha
lwz r3, ItemHolder@l (r3)

cmpwi r3, 0
beq+ end

stwu sp, -0x0080 (sp) #Make stack frame
mflr r12 #Backup LR because C0
stmw r3, 0x8 (sp)

lwz r3, 0x14 (r3)
lis r4, Racedata@ha
lwz r4, Racedata@l (r4)
lbz r4, 0xb84 (r4) #get player id, will work everywhere
mulli r4, r4, 0x248
add r3, r3, r4

#set parameters as NTSC-U 0x8081527c
li r4, 0
li r5, 0
li r6, 0

lis r12, ItemFunction@h
ori r12, r12, ItemFunction@l
mtlr r12
blrl

lmw r3, 0x8 (sp) #Pop stack frame
mtlr r12 #Recover LR because c0
addi sp, sp, 0x0080

end:
blr


Code Creator: 1superchip
Code Credits: Seeky (RaceData player id)
Reply


Messages In This Thread
Roll Itembox Anytime [1superchip] - by 1superchip - 04-23-2021, 01:53 AM
RE: Roll Itembox Anytime [1superchip] - by Vega - 04-23-2021, 09:15 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)