Accurate Item Roulette [CLF78]
#1
This code makes the item roulette only show items you can actually get. Works both online and offline.

NTSC-U
C27ACE70 00000009
3D80809C 818C8F70
818C0018 398CFFFF
7D8560AE 3CC0809C
80C6EE20 80C60014
1CEC0248 7CC63A14
81060054 88C60019
38E00001 3D80807A
618CC9CC 7D8903A6
4E800420 00000000

PAL
C27BB8D0 00000009
3D80809C 818CD730
818C0018 398CFFFF
7D8560AE 3CC0809C
80C63618 80C60014
1CEC0248 7CC63A14
81060054 88C60019
38E00001 3D80807B
618CB42C 7D8903A6
4E800420 00000000

NTSC-J
C27BAF3C 00000009
3D80809C 818CC790
818C0018 398CFFFF
7D8560AE 3CC0809C
80C62678 80C60014
1CEC0248 7CC63A14
81060054 88C60019
38E00001 3D80807B
618CAA98 7D8903A6
4E800420 00000000

NTSC-K
C27A9C90 00000009
3D80809B 818CBD70
818C0018 398CFFFF
7D8560AE 3CC0809B
80C61C58 80C60014
1CEC0248 7CC63A14
81060054 88C60019
38E00001 3D80807A
618C97EC 7D8903A6
4E800420 00000000

Source:
Code:
# Hook = 0x807BB8D0 PAL, 0x807ACE70 NTSC-U, 0x807BAF3C NTSC-J, 0x807A9C90 NTSC-K

# Address ports
.set REGION, ''
.if (REGION == 'P' || REGION == 'p')
.set DecideItem, 0x807BB42C
.set ItemHolder, 0x809C3618
.set Raceinfo, 0x809BD730
.elseif (REGION == 'U' || REGION == 'u' || REGION == 'E' || REGION == 'e')
.set DecideItem, 0x807AC9CC
.set ItemHolder, 0x809BEE20
.set Raceinfo, 0x809B8F70
.elseif (REGION == 'J' || REGION == 'j')
.set DecideItem, 0x807BAA98
.set ItemHolder, 0x809C2678
.set Raceinfo, 0x809BC790
.elseif (REGION == 'K' || REGION == 'k')
.set DecideItem, 0x807A97EC
.set ItemHolder, 0x809B1C58
    .set Raceinfo, 0x809ABD70
.else
    .err
.endif

# Function Args:
# r3 = ItemSlotData (already filled)
# r4 = Itembox setting (already filled)
# r5 = Position (already filled)
# r6 = IsHuman
# r7 = Unk (usually always 1)
# r8 = ItemHolderPlayer

# Get pid from position
lis r12, Raceinfo@ha
lwz r12, Raceinfo@l(r12)
lwz r12, 0x18(r12)
subi r12, r12, 1
lbzx r12, r5, r12

# Get IsHuman value and ItemHolderPlayer
lis r6, ItemHolder@ha
lwz r6, ItemHolder@l(r6)
lwz r6, 0x14(r6)
mulli r7, r12, 0x248
add r6, r6, r7
lwz r8, 0x54(r6)
lbz r6, 0x19(r6)

# Set r7 to 1
li r7, 1

# Call function (does not return)
lis r12, DecideItem@h
ori r12, r12, DecideItem@l
mtctr r12
bctr

Code created by: CLF78
Reply
#2
This is cool.
Reply
#3
Awesome code !
[Image: GiVNKqR.png]
Reply
#4
I presume this doesn't take into consideration item rules. For example item cool down times, you can't get triple nanas or shells if trailing them and mushroom bug
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)