Perfect Item Code [Vega]
#1
Perfect Item Code [Vega]

This code will increase the odds of you getting your desired item to 100% as long as you can get that item 100% legitimately (position, room size, what others are holding, etc etc).

How the code works~
When you hit a box, your latest updated item probability table is backed up (copied over to an unused spot in memory)
The code checks if the item you want can be had in your position (compares probability of said item on current 'position row' to value of zero)
If not zero, code executes, your odds of getting said item to increase to max value that game allows
If zero, code simply doesn't execute

NTSC-U
C27ACB64 00000005
3868FFFE 3C808165
396000E4 A5830002
B5840002 356BFFFF
4082FFF4 7FE3FB78
60000000 00000000
C27ACBC4 00000008
80850004 3D808164
818C0000 2C0C0000
40A2002C 3984FFFE
396000E4 7D6903A6
3D608165 A6EC0002
B6EB0002 4200FFF8
3D808164 39600001
916C0000 00000000
2834XXXX YYYYZZZZ
C27ACBC8 00000007
3D808165 618C0002
7D8C1A14 396000WW
7D8B6214 A18C0000
2C0C0000 41820014
7EE41A14 7D8BBA14
39607FFF B16C0000
2C000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
C27ACBC8 00000005
3964FFFE 3D808165
3AE000E4 7EE903A6
A6EC0002 B6EB0002
4200FFF8 2C000000
60000000 00000000
E0000000 80008000

PAL
C27BB5C4 00000005
3868FFFE 3C808165
396000E4 A5830002
B5840002 356BFFFF
4082FFF4 7FE3FB78
60000000 00000000
C27BB624 00000008
80850004 3D808164
818C0000 2C0C0000
40A2002C 3984FFFE
396000E4 7D6903A6
3D608165 A6EC0002
B6EB0002 4200FFF8
3D808164 39600001
916C0000 00000000
2834XXXX YYYYZZZZ
C27BB628 00000007
3D808165 618C0002
7D8C1A14 396000WW
7D8B6214 A18C0000
2C0C0000 41820014
7EE41A14 7D8BBA14
39607FFF B16C0000
2C000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
C27BB628 00000005
3964FFFE 3D808165
3AE000E4 7EE903A6
A6EC0002 B6EB0002
4200FFF8 2C000000
60000000 00000000
E0000000 80008000

NTSC-J
C27BAC30 00000005
3868FFFE 3C808165
396000E4 A5830002
B5840002 356BFFFF
4082FFF4 7FE3FB78
60000000 00000000
C27BAC90 00000008
80850004 3D808164
818C0000 2C0C0000
40A2002C 3984FFFE
396000E4 7D6903A6
3D608165 A6EC0002
B6EB0002 4200FFF8
3D808164 39600001
916C0000 00000000
2834XXXX YYYYZZZZ
C27BAC94 00000007
3D808165 618C0002
7D8C1A14 396000WW
7D8B6214 A18C0000
2C0C0000 41820014
7EE41A14 7D8BBA14
39607FFF B16C0000
2C000000 00000000
E0000000 00000000
2834XXXX YYYYZZZZ
C27BAC94 00000005
3964FFFE 3D808165
3AE000E4 7EE903A6
A6EC0002 B6EB0002
4200FFF8 2C000000
60000000 00000000
E0000000 80008000

NTSC-K
C27A9984 00000005
3868FFFE 3C808165
396000E4 A5830002
B5840002 356BFFFF
4082FFF4 7FE3FB78
60000000 00000000
C27A99E4 00000008
80850004 3D808164
818C0000 2C0C0000
40A2002C 3984FFFE
396000E4 7D6903A6
3D608165 A6EC0002
B6EB0002 4200FFF8
3D808164 39600001
916C0000 00000000
2833XXXX YYYYZZZZ
C27A99E8 00000007
3D808165 618C0002
7D8C1A14 396000WW
7D8B6214 A18C0000
2C0C0000 41820014
7EE41A14 7D8BBA14
39607FFF B16C0000
2C000000 00000000
E0000000 00000000
2833XXXX YYYYZZZZ
C27A99E8 00000005
3964FFFE 3D808165
3AE000E4 7EE903A6
A6EC0002 B6EB0002
4200FFF8 2C000000
60000000 00000000
E0000000 80008000

WW Item Values:
Green = 00
Red = 02
Banana = 04
Fib = 06
Shroom = 08
Triple Shroom = 0A
Bomb = 0C
Blue = 0E
Shock = 10
Star = 12
Golden = 14
Mega = 16
Blooper = 18
Pow = 1A
TC = 1C
Bullet Bill = 1E
Triple Green = 20
Triple Red = 22
Triple Banana = 24



List of ASM Sources:
Source (1st ASM; re-backup Game's Item Table if In-Race Room Size decreases during Race):
##################
##START ASSEMBLY##
##################

#

###############################
##Loop Loading Address Config##
###############################

addi r3, r8, -0x0002 #Do a minus -0x2 on the mem location of r8 and store it in r3. this mem location is exactly -0x2 away from the very first halfword for the item probability table which is the halfword for 1st place Green Shell probability

####################################
##Item Table Mem 81 Address Config##
####################################

lis r4, 0x8165 #Set 1st half address for where the overwritten table will be stored if room size ever decreases during race

#########################################
##Subic. Loop Countdown Register Config##
#########################################

li r11, 0xE4 #Load E4 in r11, there are a total of E4 halfwords for the entire item probability table

###################
##De_crement Loop##
###################

de_crement:
lhzu r12, 0x0002 (r3) #First, load the first halfword of the item table, increase mem location by 0x2 every time this ASM is done to load the next halfword of the table
sthu r12, 0x0002 (r4) #First, store the current halfword item probability value to mem location 0x81650002. The address will increase by 0x2 every time this ASM is done so each halfword it in its own space.
subic. r11, r11, 1 #Subtract one from r11 every time this ASM is done. Thus this will cause exactly E4 amount of halfwords to be loaded and stored
bne+ de_crement #If r11 does NOT equal 0, jump backwards to lhzu and repeat. If r11 does equal 0, continue down to next ASM

###############
##Default ASM##
###############

mr r3, r31 #Default ASM

#####################################################
##Notes About Using Registers 3 & 4 w/o Restoration##
#####################################################

##In the default ASM, r3 gets written to after this entire code is executed, so it is safe for use##
##The next function at the following address, r4 gets written with the variables of r31 and integer 24##

#

##################
###END ASSEMBLY###
##################



Source (2nd ASM; backup Game's entire Item Table. Please note that if in-race room size decreases before you grab first box, that it is not an issue. As this ASM will be executed after the 1st ASM):
##################
##START ASSEMBLY##
##################

#

###############
##Default ASM##
###############

lwz r4, 0x0004 (r5) #Default ASM


######################
##Load Status Number##
######################

lis r12, 0x8164 #Set up first half address for where the status check number will be read/stored
lwz r12, 0 (r12) #Load the status check number from mem location 0x81640000. If the ASM is being executed for the very first time of race, this number will always be 0, thus the first/original version of the item table for that race room size for the exact time when you pick up your first box

##############################
##Status Number Verification##
##############################

cmpwi r12, 0x0 #Compare status check number value to 0
bne+ dont_backuptable #If NOT equal to 0, skip entire code, don't backup first/original item table

############################
##Loop Load Address Config##
############################

addi r12, r4, -0x0002 #Add -0x2 to mem location of r4, store result into r15. The mem location on r15 will be exactly -0x2 away from the very first halfword for the item table which is the halfword for 1st place Green Shell probability

##############
##CTR Config##
##############

li r11, 0xE4 #Load E4 in r11, there are a total of E4 halfwords for the entire item probability table
mtctr r11 #Copy the value of r11 to the CTR

####################################
##Item Table Mem 81 Address Config##
####################################

lis r11, 0x8165 #Set 1st half address for where the first/original table will be stored (this will be whatever the table is configured as when you pick up your first box)

###################
##De_crement Loop##
###################

de_crement:
lhzu r23, 0x0002 (r12) #First, load the first halfword of the game's item table, increase mem location by 0x2 every time this ASM is done to load the next halfword of the table
sthu r23, 0x0002 (r11) #First, store the current halfword item probability value to mem location 0x81650002. The address will increase by 0x2 every time this ASM is done so each halfword it in its own space.
bdnz+ de_crement #If CTR is not 0, branch back to the start of the loop and repeat

#############################
##Status Number Application##
#############################

lis r12, 0x8164 #Set up first half address for where the status check number will be read/stored
li r11, 0x1 #Now that first/original table is stored. We don't want this code to execute again for the rest of the race. Load 1 into r11 for new status check number
stw r11, 0 (r12) #Store status check number of 1 (don't execute again for rest of race) to mem location 0x81640000. Pls note that Mem 81 is reset by the game every race (cleared), no need for a deactivator for this ASM

dont_backuptable:

########################################
##Note about using r23 w/o restoration##
########################################

##r23 gets written to at a later address with the function add r23, r4, r3##
##Therefore, it is safe to use freely##

#

##################
###END ASSEMBLY###
##################



Source (3rd ASM; Check to see if the Item can be legitimately received for the current in-race room size position. If not, don't execute code. If so, max out Desired Item's Probability; code activated.):
####################
###START ASSEMBLY###
####################

#

####################################
##Setup Item Table Mem 81 Location##
####################################

lis r12, 0x8165
ori r12, 12, 0x0002

########################################################
##Locate Your 'Positional Row' On Backed up Item Table##
########################################################

add r12, r12, r3 #Add r3 and r12 together. Result (stored back into r12) will hold the address to the green shell halfword for whatever position you are in.

########################
##Load Your Item Value##
########################

li r11, 0xWW #Load User's Item Value (WW)

#################################################################
##Locate Your Exact Item Prob. Halfword Spot on Backed up Table##
#################################################################

add r12, r11, r12 #Add r11 and r12 together. You will now be located at your item's halfword location for your position on the item table

#################################
##Item Probability Load & Check##
#################################

lhz r12, 0 (r12) #Load Halfword (Item Probability) from Item Table
cmpwi r12, 0x0 #Compare Item Probability Value to 0
beq- no_go #If Item's Probability is 0, we know you cannot get the item for that position for the current in-race room size. Jump to no_go label

################################################
##Locate Your 'Positional Row' On Game's Table##
################################################

add r23, r4, r3 #Add r3 and r4 together. You are now at the green shell halfword for your current position on the game's item table

##############################################################
##Locate Your Exact Item Prob. Halfword Spot on Game's Table##
##############################################################

add r12, r11, r23 #Add r23 and r11 (Item value) to get exact item's halfword prob. location on the game's table

###############################
##Max Item Probability (7FFF)##
###############################

li r11, 0x7FFF #Load 0x7FFF into r11

#######################################################################
##Execute Code; Store 7FFF to Item's Probability Spot on Game's Table##
#######################################################################

sth r11, 0 (r12) #Store halfword of r11 (Maxed Out Item Prob.) to exact spot in Game's Table. Code now executed!

############################
##No_Go Label; Default ASM##
############################

no_go:
cmpwi r0, 0 #Default ASM

#

##################
###END ASSEMBLY###
##################



Source (4th ASM; restore latest revision of Game's Table. Code de-activated.):
####################
###START ASSEMBLY###
####################

#

#############################
##Loop Store Address Config##
#############################

addi r11, r4, -0x2 #Add -0x2 to mem location of r4, store result into r11. The mem location on r11 will be exactly -0x2 away from the very first halfword for the item table which is the halfword for 1st place Green Shell probability

####################################
##Item Table Mem 81 Address Config##
####################################

lis r12, 0x8165 #Set 1st half address from where the current item table will be restored

###############################
##Count Register (CTR) Config##
###############################

li r23, 0xE4 #Load E4 in r17, there are a total of E4 halfwords for the entire item probability table
mtctr r23 #Copy r23's value to the PowerPC dedicated count register

###################
##De_crement Loop##
###################

de_crement:
lhzu r23, 0x0002 (r12) #First, load the first halfword of the backed up item table, increase mem location by 0x2 every time this ASM is done to load the next halfword of the backed up table
sthu r23, 0x0002 (r11) #First, store the current halfword backed up item probability value to the halfword value location of the current edited table. The address will increase by 0x2 every time this ASM is done so each halfword it in its own space.
bdnz+ de_crement #Subtract 1 from the CTR every time this loop is done. If the CTR is not equal to zero, jump back to beginning of de_crement loop

###############
##Default ASM##
###############

cmpwi r0, 0 #Default ASM

#########################################
##Notes about using r23 w/o restoration##
#########################################

##The default ASM writes to r23 after this whole code is executed, so it is safe for use w/o restoration##

#

##################
###END ASSEMBLY###
##################



Code creator: Vega
Code credits: XeR (address founder of 2nd, 3rd and 4th ASMs)
Reply


Messages In This Thread
Perfect Item Code [Vega] - by Vega - 10-27-2018, 10:43 PM
RE: Perfect Item Code [Vega] - by CLF78 - 06-12-2020, 12:48 PM
RE: Perfect Item Code [Vega] - by 1superchip - 06-17-2020, 01:10 PM
RE: Perfect Item Code [Vega] - by coolio - 06-17-2020, 01:45 PM
RE: Perfect Item Code [Vega] - by Unnamed - 07-21-2023, 12:09 PM
RE: Perfect Item Code [Vega] - by Vega - 07-21-2023, 05:25 PM
RE: Perfect Item Code [Vega] - by Unnamed - 07-21-2023, 08:33 PM
RE: Perfect Item Code [Vega] - by Vega - 07-21-2023, 09:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)