Example of Modifying ItemSlot.bin
#1
Example Of Modifying ItemSlot.bin

NOTE: Wiimmfi has security patches that will block you from connecting if you have a modified ItemSlot.bin.

NOTE: This guide is written for Linux Users (in regards to using Wiimm's WIT/SZS Tools for ISO/WBFS extraction and rebuilding). If one is experienced enough with WIT/SZS Tools, he/she can 'alter' the WIT Tools commands to work on Windows.


Requirements:
Have Wiimm's WIT Tools plus SZS Tools installed and know how to use the Tools
Have a Hex Editor installed and know how to use it (HxD via Wine emulation is used in this guide)




Chapter 1: Intro

The ItemSlot.bin file (a binary file within Common.szs) is the file that holds the Item Probability Values for all Modes including Online VS. For Online VS, this file has the Item Probabilities for every item of every position in a 12 player room. Item Probabilities for rooms less than 12 players are calculated based on the values for a 12 player room. To see all the Item Probability Values for every room size in Online VS, visit this page - http://mkwii.com/item/ (credits to XeR).

If desired, a player can modify this file to permanently manipulate/change the odds of getting certain items in an Online VS race. For this guide, we will simply modify the ItemSlot.bin file to where we can never pickup TC's or Bloopers from an item box.




Chapter 2: ISO/WBFS Extraction

For this guide we will be working with the an NTSC-U/RMCE01 wbfs file. Keep in mind that the ItemSlot.bin file is region free. Therefore, once you have made your desired modifications to an ItemSlot.bin file, you can use that file in any ISO/WBFS. Let's say our NTSC-U wbfs file is located in /home/user/games and its filename is USA.wbfs. First open up a terminal, then cd (change directory) to the location of USB.wbfs.

cd /home/user/games

Now extract USA.wbfs. We must specify a brand new directory that has not been made yet for the command on WIT Tools for extraction. For example... run the following command...

wit extract USA.wbfs /home/user/newfolder

NOTE: You must NOT make the newfolder directory beforehand or else WIT tools will display an error. Let the Tools create the directory.




Chapter 3: Common.szs Extraction

newfolder directory is now created and it contains our extract wbfs contents. Next we need to extract the Common.szs file. 

cd /home/user/newfolder/DATA/files/Race

wszst extract Common.szs

NOTE: if your wbfs is scrubbed, there will NOT be a DATA folder.




Chapter 4: ItemSlot.bin Edits

A "Common.d" directory will now be created, the ItemSlot.bin file is located in that directory. Open up your Hex Editor, then open the ItemSlot.bin file. For reference, here is a list of all the ItemSlot.bin addresses for every item's probability for Online VS.

Green Shell Probabilities
1st 0x39B - 41
2nd 0x39C - 23
3rd 0x39D - 1E
4th 0x39E - 0F
5th 0x39F - 0A
6th 0x3A0 - 00
7th 0x3A1 - 00
8th 0x3A2 - 00
9th 0x3A3 - 00
10th 0x3A4 - 00
11th 0x3A5 - 00
12th 0x3A6 - 00

Red Shell Probabilities
1st 0x3A7 - 00
2nd 0x3A8 - 32
3rd 0x3A9 - 32
4th 0x3AA - 28
5th 0x3AB - 1E
6th 0x3AC - 14
7th 0x3AD - 0A
8th 0x3AE - 05
9th 0x3AF - 00
10th 0x3B0 - 00
11th 0x3B1 - 00
12th 0x3B2 - 00

Banana Probabilities
1st 0x3B3 - 4B
2nd 0x3B4 - 28
3rd 0x3B5 - 0F
4th 0x3B6 - 05
5th 0x3B7 - 00
6th 0x3B8 - 00
7th 0x3B9 - 00
8th 0x3BA - 00
9th 0x3BB - 00
10th 0x3BC - 00
11th 0x3BD - 00
12th 0x3BE - 00

Fib Probabilities
1st 0x3BF - 28
2nd 0x3C0 - 0F
3rd 0x3C1 - 0A
4th 0x3C2 - 05
5th 0x3C3 - 00
6th 0x3C4 - 00
7th 0x3C5 - 00
8th 0x3C6 - 00
9th 0x3C7 - 00
10th 0x3C8 - 00
11th 0x3C9 - 00
12th 0x3CA - 00

Shroom Probabilities
1st 0x3CB - 00
2nd 0x3CC - 19
3rd 0x3CD - 23
4th 0x3CE - 2D
5th 0x3CF - 1E
6th 0x3D0 - 19
7th 0x3D1 - 14
8th 0x3D2 - 00
9th 0x3D3 - 00
10th 0x3D4 - 00
11th 0x3D5 - 00
12th 0x3D6 - 00

Triple Mushroom Probabilities
1st 0x3D7 - 00
2nd 0x3D8 - 00
3rd 0x3D9 - 00
4th 0x3DA - 0A
5th 0x3DD - 14
6th 0x3DC - 1E
7th 0x3DD - 32
8th 0x3DE - 41
9th 0x3DF - 4B
10th 0x3E0 - 3C
11th 0x3E1 - 19
12th 0x3E2 - 0A

Bomb Probabilities
1st 0x3E3 - 00
2nd 0x3E4 - 00
3rd 0x3E5 - 05
4th 0x3E6 - 0A
5th 0x3E7 - 0F
6th 0x3E8 - 0F
7th 0x3E9 - 0A
8th 0x3EA - 00
9th 0x3EB - 00
10th 0x3EC - 00
11th 0x3ED - 00
12th 0x3EE - 00

Blue Shell Probabilities
1st 0x3EF - 00
2nd 0x3F0 - 00
3rd 0x3F1 - 00
4th 0x3F2 - 05
5th 0x3F3 - 0A
6th 0x3F4 - 0F
7th 0x3F5 - 0F
8th 0x3F6 - 0A
9th 0x3F7 - 05
10th 0x3F8 - 00
11th 0x3F9 - 00
12th 0x3FA - 00

Shock Probabilities
1st 0x3FB - 00
2nd 0x3FC - 00
3rd 0x3FD - 00
4th 0x3FE - 00
5th 0x3FF - 00
6th 0x400 - 00
7th 0x401 - 00
8th 0x402 - 00
9th 0x403 - 00
10th 0x404 - 00
11th 0x405 - 0F
12th 0x406 - 28

Star Probabilities
1st 0x407 - 00
2nd 0x408 - 00
3rd 0x409 - 00
4th 0x40A - 00
5th 0x40B - 00
6th 0x40C - 00
7th 0x40D - 00
8th 0x40E - 19
9th 0x40F - 28
10th 0x410 - 37
11th 0x411 - 37
12th 0x412 - 23

Golden Probabilities
1st 0x413 - 00
2nd 0x414 - 00
3rd 0x415 - 00
4th 0x416 - 00
5th 0x417 - 00
6th 0x418 - 05
7th 0x419 - 14
8th 0x41A - 2D
9th 0x41B - 37
10th 0x41C - 46
11th 0x41D - 3C
12th 0x41E - 2D

Mega Probabilities
1st 0x41F - 00
2nd 0x420 - 00
3rd 0x421 - 00
4th 0x422 - 05
5th 0x423 - 0F
6th 0x424 - 14
7th 0x425 - 0F
8th 0x426 - 0A
9th 0x427 - 00
10th 0x428 - 00
11th 0x429 - 00
12th 0x42A - 00

Blooper Probabilities
1st 0x42B - 00
2nd 0x42C - 00
3rd 0x42D - 00
4th 0x42E - 00
5th 0x42F - 0A
6th 0x430 - 0F
7th 0x431 - 0F
8th 0x432 - 0A
9th 0x433 - 0A
10th 0x434 - 00
11th 0x435 - 00
12th 0x436 - 00

POW Probabilities
1st 0x437 - 00
2nd 0x438 - 00
3rd 0x439 - 00
4th 0x43A - 00
5th 0x43B - 0A
6th 0x43C - 0A
7th 0x43D - 0F
8th 0x43E - 0A
9th 0x43F - 0A
10th 0x440 - 00
11th 0x441 - 00
12th 0x442 - 00

TC Probabilities
1st 0x443 - 00
2nd 0x444 - 00
3rd 0x445 - 05
4th 0x446 - 0F
5th 0x447 - 0F
6th 0x448 - 0F
7th 0x449 - 0A
8th 0x44A - 0A
9th 0x44B - 00
10th 0x44C - 00
11th 0x44D - 00
12th 0x44E - 00

Bullet Bill Probabilities
1st 0x44F - 00
2nd 0x450 - 00
3rd 0x451 - 00
4th 0x452 - 00
5th 0x453 - 00
6th 0x454 - 00
7th 0x455 - 00
8th 0x456 - 00
9th 0x457 - 05
10th 0x458 - 0F
11th 0x459 - 2D
12th 0x45A - 46

Triple Green Probabilities
1st 0x45B - 00
2nd 0x45C - 0A
3rd 0x45D - 14
4th 0x45E - 14
5th 0x45F - 0F
6th 0x460 - 0A
7th 0x461 - 05
8th 0x462 - 00
9th 0x463 - 00
10th 0x464 - 00
11th 0x465 - 00
12th 0x466 - 00

Triple Red Probabilities
1st 0x467 - 00
2nd 0x468 - 00
3rd 0x469 - 0A
4th 0x46A - 14
5th 0x46B - 14
6th 0x46C - 14
7th 0x46D - 0F
8th 0x46E - 0A
9th 0x46F - 00
10th 0x470 - 00
11th 0x471 - 00
12th 0x472 - 00

Triple Banana Probabilities
1st 0x473 - 14
2nd 0x474 - 19
3rd 0x475 - 14
4th 0x476 - 05
5th 0x477 - 00
6th 0x478 - 00
7th 0x479 - 00
8th 0x47A - 00
9th 0x47B - 00
10th 0x47C - 00
11th 0x47D - 00
12th 0x47E - 00 

We want to completely zero out the probabilities of ever receiving the TC or Blooper. Therefore, for TC & Blooper probabilities, we must zero out all the values for all positions.

Let's start with the Blooper Probabilities. Using the reference above, we see that addresses 0x42F through 0x433 have values greater than zero. Zero out every byte for that address range. 

Next, we move onto the TC Probabilities. Using the reference above, we see that addresses 0x445 through 0x44A have values greater than zero. Zero out every byte for that address range. Double check your edits. Save the changes. If you are using HxD, a backup file (with the .bak extension) of the original will automatically be created in the Common.d folder next to your new modified ItemSlot.bin file. Delete the ItemSlot.bin.bak file or move it to a designated folder or safekeeping.




Chapter 5: Clean Up, Rebuild

That's it for the ItemSlot.bin edits. Now we need to rebuild the Common.szs.

Delete the current Common.szs file that is in the /Race directory. We will be creating a new one, therefore we no longer need the original. Let's create the new Common.szs file now...

cd /home/user/newfolder/DATA/files/Race

wszst create ./Common.d

A new Common.szs file is now created. Delete the "Common.d" directory, we no longer need it. Time to rebuild the wbfs file!

cd /home/user

wit copy ./newfolder /home/user/games/newItemSlotEditedUSA.wbfs

newItemSlotEditedUSA.wbfs is now created! WBFS file is ready to add to a USB drive to play with on a USB Loader app. Congratz! Test it out. You will notice that you will NEVER pick up a TC or Blooper from an itembox for Online VS.
Reply
#2
There is a tool for that, no hex editing needed.
Reply
#3
Yes I know that, I just personally like using Hex Editors. I keep forgetting to post about the program in Resources... lol
Reply
#4
I've been wondering, is there a way to just modify the 1v1 item probability values? Or are the 1v1 item odds based off of the 12 player odds and you have to modify it that way?

Would be useful to know, since I do 1v1s often with my friends and it would be nice to have items that actually make sense.
Reply
#5
(05-18-2024, 05:20 PM)Fifty Wrote: I've been wondering, is there a way to just modify the 1v1 item probability values? Or are the 1v1 item odds based off of the 12 player odds and you have to modify it that way?

Would be useful to know, since I do 1v1s often with my friends and it would be nice to have items that actually make sense.


Anything below a 12 player room is calculated using values of the 12 player table. Idk the exact formula.

Yes there is a way, via a code. I frankensteined this up really quick. No idea if it works

NTSC-U
C27AC3C0 00000002
3D808000 992C164F
2C09000C 00000000
C27ACBC4 0000000F
3D808000 896C164F
2C0B0002 80850004
40A20060 7D8802A6
48000051 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
7C8802A6 7D8803A6
60000000 00000000

PAL
C27BAE20 00000002
3D808000 992C164F
2C09000C 00000000
C27BB624 0000000F
3D808000 896C164F
2C0B0002 80850004
40A20060 7D8802A6
48000051 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
7C8802A6 7D8803A6
60000000 00000000

Red font is the Item Table for 1st Place.
Blue font is the Item Table for 2nd Place.

Each halfword is an item probability value. If you don't know what a Halfword is, it's 4 hex digits (i.e. 0000)

So the first red halfword is for 1st Place Green shell. Very next halfword is 1st Place Red shell. etc etc til you hit the final red halfword which is for 1st Place Triple Nana. After that you are now in the blue halfwords. So 1st blue halfword is 2nd Place Green. Next is 2nd Place Red. etc etc til you finally hit the halfword for 2nd Place Triple Nana.

The probability values you insert are not of the standard 0-100% decimal type.

How to change Decimal Percent Value to Hex Value for Code.
- Multiply Percent by 2. Change to Hex. Prepend Zeroes to make it Halfword in width

Example 37.5%
37.5 x 2 = 65
65 converted to Hex is 41
0041 would be the Halfword Value to use

Code:
lis r12, 0x8000 #Load 0x8000 into upper 16 bits of r12, lower 16 bits are cleared)
stb r9, 0x164F (r12) #Store byte of r9 (in-race room size) to address 0x8000164F, offset used to complete 2nd half of address
cmpwi r9, 0xC #Default instruction

Code:
#Conditional Item Probability Table Mod
#r4 = Pointer to Table
#Check if In-Race Room size is 2 and only 2
lis r12, 0x8000
lbz r11, 0x164F (r12)
cmpwi r11, 2
lwz r4, 0x0004 (r5) #Original Instruction
bne+ the_end
#It is, Backup LR
mflr 12
#Make the Table
bl item_table
#Create 1v1 Probability Table
.llong 0x0000000000000000 #1st Place Green thru Fib
.llong 0x0000000000000000 #1st Place Shroom thru Blue
.llong 0x0000000000000000 #1st Place Shock thru Mega
.llong 0x0000000000000000 #1st Place Blooper thru Bill
.long 0x00000000 #1st Place Trip Greens thru Trip Reds
.short 0x0000 #1st Place Trip nana
.llong 0x0000000000000000 #2nd Place Green thru Fib
.llong 0x0000000000000000 #2nd Place Shroom thru Blue
.llong 0x0000000000000000 #2nd Place Shock thru Mega
.llong 0x0000000000000000 #2nd Place Blooper thru Bill
.long 0x00000000 #2nd Place Trip Greens thru Trip Reds
.short 0x0000 #2nd Place Trip nana
item_table:
#Update r4 (Table ptr)
mflr r4
#Restore LR
mtlr r12
#End of Code
the_end:
Reply
#6
(05-20-2024, 09:40 PM)Vega Wrote: Anything below a 12 player room is calculated using values of the 12 player table. Idk the exact formula.

Yeah, that was my guess (though your original post already stated that). I had doubts that they made a specific table for each amount of players that could be in a room.

(05-20-2024, 09:40 PM)Vega Wrote: Yes there is a way, via a code. I frankensteined this up really quick. No idea if it works

Oh wow, thanks. Didn't expect that. Will definitely test this out soon.
Reply
#7
Edited the code. I had a silly mistake in the reds vs blues.
Reply
#8
Just tested it (with 100% single shrooms for 1st and 100% triple shrooms for 2nd) and it actually works, not entirely sure about special item boxes, and it doesn't include the Mushroom Bug that doesn't matter ofc because there's a code for that. Thank you so much for this code. Very useful.

Will you post this code as a thread somewhere else or too simple/based off another code?
Reply
#9
Not going to bother posting it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)