Selective Item Max Probability [Vega]
#1
Selective Item Max Probability [Vega]

This code will increase the odds of you getting your desired item to 100%. This doesn't guarantee your item, but if the item is available, you will get it.

The only 'flaw' in this particular code is that you can get an available item in an illegitimate position. If you are looking for a "Perfect" version of this, go to this thread - https://mkwii.com/showthread.php?tid=928

How the code works~
When you hit a box, your item probability table is modified for your desired item to it's highest possible value the game allows.

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 00000004
7EE41A14 398000WW
7D776214 39807FFF
B18B0000 2C000000
60000000 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 00000004
7EE41A14 398000WW
7D776214 39807FFF
B18B0000 2C000000
60000000 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 00000004
7EE41A14 398000WW
7D776214 39807FFF
B18B0000 2C000000
60000000 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 00000004
7EE41A14 398000WW
7D776214 39807FFF
B18B0000 2C000000
60000000 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, Max Out Desired Item's Probability. Code activated.):
##################
##START ASSEMBLY##
##################

#

##############################################################
##Navigate to your 'Positional Row' on the Game's Item Table##
##############################################################

add r23, r4, r3 #Add contents of item table first halfword location and r3, this will put you on the halfword location for green shell for whatever position you are in when you grab a box. Result is stored in r23.

#######################
##Set Your Item Value##
#######################

li r12, 0xWW #Load user's desired item value (WW)

##############################################################
##Find Your Item Halfword Location On Current Positional Row##
##############################################################

add r11, r23, r12 #Take item value and add it to the mem address of the location for green sheel on the current 'positional row' of the item table. You will now be at your item's exact spot on the item table based on your current position

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

li r12, 0x7FFF #Load 0x7FFF into r12
sth r12, 0 (r11) #Store 0x7FFF value to address of r11

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

cmpwi r0, 0

#

################
##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
Selective Item Max Probability [Vega] - by Vega - 09-30-2018, 01:09 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)