Replace Item with Shared Item
#1
Replace Item with Shared Item

This code will replace an item that you receive from the roulette, to one of your choosing. I originally created it to avoid getting Thunder Clouds. It is undetectable if the item replaced is one that can legitimately be received in your current position.

(NTSC-U)
# Single Item
2834XXXX YYYYZZZZ
C27AB704 00000003
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
047AB704 90770020
E0000000 80008000

# Multiple Items
2834XXXX YYYYZZZZ
C27AB704 00000005
2C0300RR 40A2000C
386000WW 48000010
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
047AB704 90770020
E0000000 80008000

(PAL)
# Single Item
2834XXXX YYYYZZZZ
C27BA164 00000003
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
047BA164 90770020
E0000000 80008000

# Multiple Items
2834XXXX YYYYZZZZ
C27BA164 00000005
2C0300RR 40A2000C
386000WW 48000010
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
047BA164 90770020
E0000000 80008000

(NTSC-J)
# Single Item
2834XXXX YYYYZZZZ
C27B97D0 00000003
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
047B97D0 90770020
E0000000 80008000

# Multiple Items
2834XXXX YYYYZZZZ
C27B97D0 00000005
2C0300RR 40A2000C
386000WW 48000010
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
047B97D0 90770020
E0000000 80008000

(NTSC-K)
# Single Item
2833XXXX YYYYZZZZ
C27A8524 00000003
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2833XXXX YYYYZZZZ
047A8524 90770020
E0000000 80008000

# Multiple Items
2833XXXX YYYYZZZZ
C27A8524 00000005
2C0300RR 40A2000C
386000WW 48000010
2C0300RR 40A20008
386000WW 90770020
60000000 00000000
E0000000 00000000
2833XXXX YYYYZZZZ
047A8524 90770020
E0000000 80008000

[Values]
RR = Item to Replace
WW = Item Replaced With

00 = Green Shell
01 = Red Shell
02 = Banana
03 = Fake Item Box
04 = Mushroom
05 = Triple Mushroom
06 = Bob-omb
07 = Blue Shell
08 = Lightning
09 = Star
0A = Golden Mushroom
0B = Mega Mushroom
0C = Blooper
0D = POW Block
0E = Thunder Cloud
0F = Bullet Bill
10 = Triple Green Shells
11 = Triple Red Shells
12 = Triple Bananas
14 = No Item Available (Mushroom)



# Source
# r3 = Item player will receive
# Item Definitions
.set ITEM_GREENSHELL, 0x0
.set ITEM_REDSHELL, 0x1
.set ITEM_BANANA, 0x2
.set ITEM_FAKEITEMBOX, 0x3
.set ITEM_MUSHROOM, 0x4
.set ITEM_TRIPLEMUSHROOM, 0x5
.set ITEM_BOBOMB, 0x6
.set ITEM_BLUESHELL, 0x7
.set ITEM_LIGHTNING, 0x8
.set ITEM_STAR, 0x9
.set ITEM_GOLDENMUSHROOM, 0xA
.set ITEM_MEGAMUSHROOM, 0xB
.set ITEM_BLOOPER, 0xC
.set ITEM_POWBLOCK, 0xD
.set ITEM_THUNDERCLOUD, 0xE
.set ITEM_BULLETBILL, 0xF
.set ITEM_TRIPLEGREENSHELLS, 0x10
.set ITEM_TRIPLEREDSHELLS, 0x11
.set ITEM_TRIPLEBANANAS, 0x12
.set ITEM_NOITEM_MUSHROOM, 0x14

cmpwi r3, ITEM_TO_REPLACE # Compare the word in r3 (Item player will receive) to the item to replace
bne+ 0x8 # If it is not equal, branch
li r3, ITEM_REPLACED_WITH # If it is equal, load the value of the item we want into r3 (Item player will receive)
stw r3, 32(r23) # Store the word in r3 to the address in r23 offset by 32



Code Creator: Star
Code Credits: Guru (Shared Item Code)
Reply
#2
Good stuff. So its like Replace Item code but based on Shared code instead of Forced. Has this been tested against CTGP IIB? If not and you end up testing it and it fails, try using Anti-Item spy equipped.
Reply
#3
Correct. Just as the original Shared Item code, as long as the item replaced is a probability in the position, it is undetectable. The clans I have played against can vouch for that ;-).
Reply
#4
Updated to support both single and multiple items.
Reply
#5
Have you tested the multiple item version? And can the single item version be used multiple times in a GCT (I ask this because of the limitations with the Forced-based Replace Item Code)
Reply
#6
Yes, the multiple item version works as expected.
No, the single item version cannot be used multiple times in a GCT. The reason being is that it will overwrite the branch address each time it is added. You can see this in WiiRD.

The instruction is replaced:
807B97D0: 4B8490F8 b 0x800028c8

However when I apply the code again:
807B97D0: 4B849118 b 0x800028e8

The first code is still in RAM, but since the branch address is updated to the latter code, only that will be executed.
Reply
#7
For those who are wanting to use this code, it's best imo to run it without any activators/deactivators.
Reply
#8
Updated the multiple items version to improve performance. It still functions identical to the original version. The only difference is it will store the item immediately when it reaches your current item, rather than redundantly checking the rest of the items.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)