GummiMOD - Adding Custom Keyblades [KH2 - ALL]

Discussion in 'Code Vault' started by TopazTK [Topaz' Reality], Sep 24, 2019.

  1. TopazTK [Topaz' Reality] Moogle Assistant

    Joined:
    May 23, 2019
    Gender:
    Darkness
    Location:
    Kosovo, Prizren
    2
    6
    Hello everyone, Topaz here. As you may be aware of, there have been some interesting modification capabilities for Kingdom Hearts 2 lately and as such, the amount of people who want to mod this game has been significantly increased, at least in my observations.

    So, to help with this, I decided to make a tutorial series here in KH-Vids in order to spread my knowledge of the game in order to help others on modding this game. So welcome to GummiMOD and today we are going to learn how to add our own fully-custom Keyblades.

    DISCLAIMER: This is the first thread of GummiMOD. GummiMOD is the name of the tutorial series that will be posted on here. I cannot make a video of this series because, well, I tried.

    DISCLAIMER 2: In addition to Disclaimer the First, I will not show you how to use modeling tools such as Soraiko's MDLXBuilder or MDLXViewer, as those require knowledge of rigging software such as Blender or Maya. As such, you are expected to have any custom models that you are going to use ready and they will be mentioned as "CUSTOM_MODEL" in this series. If you do not know how to rig, YouTube is your friend. If you do not know how to use MDLXBuilder/Viewer, some people have made tutorials of it.

    INFORMATION:
    GAME: Kingdom Hearts 2 - ( All Regions, All Versions )
    DIFFICULTY: Upper-Intermediate
    TOOL ASSISTANCE: Minimal

    REQUIRED SOFTWARE:
    REGULAR:
    HxD or alternatives [Required]
    PNGoo [GUI] or PNGQuant [CLI] [Optional] (Both are the same, really. One is a GUI and the other is a Command Line. You only need this if you want your images to look good.)

    KH2 TOOLS:
    KH2FM_Toolkit and .BAT Scripts [GovanifY] or KH2 ISO Patcher [CrazyCatz00] [Required]
    CCZ Tools Archive [CrazyCatz00, Required] (Realistically, you only need 2 tools from this. However, the others are nice to have around.)
    MSGShifter [TopazTK, Required] (I made this so you do not have to suffer.)

    DISCLAIMER 3: This tutorial assumes you know how to use the patcher programs. If that is not the case, click here.

    Alright, now we have the basics out of the way. Now, let's go over the steps on how to make this a reality.

    STEP 1: Getting the files

    Extract your game using the patcher programs provided. After doing so, or if already done so, go to the extraction folder and get these files from the KH2 folder:
    • 03system.bin
    • 00objentry.bin
    • itempic/item-001.imd
    • msg/jp/sys.bar
    • CUSTOM_MODEL.mdlx (One for each Keyblade, paired with CUSTOM_EFFECT)
    • CUSTOM_EFFECT.a.fm (One for each Keyblade, paired with CUSTOM_MODEL)

    QUICC NOTE: CUSTOM_MODEL and CUSTOM_EFFECT has to have the same name, but it can be whatever you wish as long as it follows these rules:
    • Must contain only English Characters A-Z and a-z
    • Cannot contain any spaces
    • Cannot contain any special characters
    • Can contain an underscore "_"
    • Must have a length of shorter than or equal to 32 characters (But let's be honest, 32 is kind of an overkill)

    For simplicity, I will be using the name "W_EXKAI"

    QUICC NOTE 2: Obviously, the 2 files mentioned in Quicc Note the First are custom files, hence are not in the game, hence you have to make them yourself, hence DO NOT LOOK FOR THEM IN THE EXTRACTION FOLDER

    After you get these files, use the BAR Editor in the CCZ Tools Archive to open 03system.bin as shown in the GIF below:
    [​IMG]

    And then you will need to extract the files named went[0x02] and item[0x02]. Here is a GIF showing you how to extract files using the BAR Editor:

    [​IMG]

    After you have done so, move all of them to a folder for convenience. The folder should look like this, not counting the models:
    [​IMG]

    If it does not, go trough this step all over again.

    STEP 2: Setting up the object data

    Now that we have the files we need, we can start editing them to add our own custom, sweet Keyblades. Now, all of these files must be edited in an order and as such, following the order I tell ya is important. Now it may not matter in the end if you are a master programmer but please, EDIT IN THIS ORDER

    And we shall begin. Open 00objentry.bin in HxD (Or whatever you downloaded as an alternative. I said HxD because you do not have to know Hexadecimal math to do stuff on it anymore). And you should see this picture:
    [​IMG]

    QUICC NOTE 3: This tutorial assumes that you have never edited Hexadecimal data before, and as such I shall use this window below (Opened by pressing Ctrl+E in HxD) in order to tell you what you should select as, this will do so automatically. I mean, this is easier to understand than "Go to offset 0x5AF and select 0xAF bytes after the 0xDA section in 0xFA". Just, be sure to select "Length" instead of "End-Offset":
    [​IMG]

    Now, press Ctrl+E and type in 4 in Start-Offset and 4 in Length (From now on, I will say it like X-Y. X is Start Offset, Y is Length), and it will select the entry count for this file. Now, at the right of the HxD window, you should see this small window:
    [​IMG]

    In this very window, click Int32 and increase the highlighted value by the amount of Keyblades you are going to add and press Enter. In this example, we are only going to add one of them so the value goes from 1900 to 1901.

    Now, scroll to the very end of the file, and copy this code block down below:
    Code:
    FF FF 00 00 05 00 00 19
    58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
    58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 0B
    00 00 00 00 00 00 00 00
    
    Now, paste it after clicking the last number in the file. The result should look like this:

    [​IMG]

    In this part, click the first "X" and enter the name of the CUSTOM_MODEL. After which, click the first "58" and hold down 0 until all of the "58"s are "00"s. After that, highlight "FF FF" and click Int16 in the small side window. Type in "2561" and increase it by 1 for the number of the Keyblade you are adding. If it is the first Keyblade, increase it by 1. The end result for one Keyblade should look like this. For the second, the third, the fourth etc. You just, rinse and repeat.

    QUICC NOTE 4: In theory, that value you put in instead of "FF FF" can be anything you wish as long as it is less than around 30K and more than 2561. I used the closest value to minimum to avoid any crashes that can occur. I will edit this post in the near future when I find out what is the maximum allowed value.

    However, note all of the values you put in after highlighting "FF FF" somewhere. You will need them. These values should be referred to as "UCM"s.

    STEP 3: Adding the models as a weapon

    Now comes somewhat of a challenging part in this whole thing. Bare with me as I will try to explain what to do. And, no matter what, do not and I repeat: DO NOT mess this up. Open went [0x02].bin in HxD, click Ctrl+G (NOT Ctrl+E but rather, Ctrl+G) and type in 0x118 and press Enter.

    After which, and this is sorta but not really the complex part, count every 4 byte section (XX-XX-XX-XX) as one entry, starting from zero. Like in the GIF below. We see that I selected 64-00-00-00, then 67-00-00-00 and then 68-00-00-00. In this case, 64-00-00-00 is zero, 67-00-00-00 is one and 68-00-00-00 is two. Do this until you highlight a value of 00-00-00-00:
    [​IMG]

    The first "index" I found with the value of 00-00-00-00 was index 25. So we will take that as an example. Highlight it and click Int32. Now, remember that value you noted in Step 2? Put THAT in there. In my case, it was 2562 since I added one Keyblade and just modified the minimum.

    That was actually easy if you kept track of it right. The thing is, however, the highlighted area is the region for Sora's weapons. DO NOT edit outside of it, DO NOT edit the values which are NOT 00-00-00-00.

    STEP 4: Creating an item picture for your Keyblade

    This step is easy, do not worry about it. First up, either create or find an image of the Keyblade you are going to add which is 128x128 in size. After that, if you want to use PNGoo/PNGQuant to preserve picture quality, follow the steps in the first spoiler, otherwise, ignore the spoiler.
    Now, this spoiler will split unto 2 spoilers, after following one of them, you may proceed:
    Open PNGoo and drag your image unto it. Then, tick the box that says "Overwrite PNGs" and press the "Go" button. Your image will be replaced with the preserved one.

    Open the folder that PNGQuant is in, drag your image to the BAT file which claims it will reduce your image's palette to 256 colors. It will create a new image which will have the name of the original + "-fs8". You want to use this image instead of the original one.

    First, copy item-001.imd for each Keyblade you are going to add.

    Now, open the Image Editor from the CCZ Tools Archive, then open the copied item-001.imd. And then, click on "Replace" and choose the picture file you want in place. The procedure is so basic that you do not need a GIF for this.

    After doing so, rename the picture file to item-xxx.imd, the "xxx" being the 3-digit number you want to use. Must be unique and must be bigger than or equal to 400 and must be different for all the item-xxx.imd files. Note this number, you shall need it.

    STEP 5: Creating the name and the description

    This part is a mind boggle. Trust me, it is. It is such a mind boggle in fact, I have made a tool to assist you with editing the file to complete this step. So it is not as much of a mind boggle.

    QUICC NOTE 5: You need internet for this.

    First, drag sys.bar to my beloved MSGShifter. Upon doing so, you shall see the following message:
    Code:
    > KH2 MSGShifter by TopazTK - Copyright 2019
    > This program was written in haste but all checks of it were done. Unhandeled errors are present.
    
    Please enter the amount of strings to add to the file.
    
    Enter the amount of lines to add unto the string file. 2 for each Keyblade, one of them being the name and the description. After doing so, you should see a message like the one below. In here, I added 2 strings for one Keyblade. Do what the program says:
    Code:
    Here are the IDs of the new lines of string, in order (Do note these):
    21623
    21624
    
    After closing the window, you should see sys.new.bar in the same folder as sys.bar. Delete the old and rename the new to sys.bar.

    Now, go to CrazyCatz00's Text Editor by clicking here, click "Choose Files" and open the sys.bar file. If you are doing this for the first time, or cleared your history, you should see this:
    [​IMG]

    You shall see 2 radio buttons, one named "Hex" and the other named "Text". Click the one that says "Text". After which, a box will appear right besides the "Text" button, click that and choose "KH2 Final Mix X SYS" with X being your language (English for International Roms, Japanese for the Japanese ones). After which, scroll the inner window to it's end, you shall see this:
    [​IMG]

    You see the lines which only have "{eol}" in it? Those are your new lines! You will need to edit them (With {eol} at the end of them) in order to add your Keyblade. After editing them in Name-Desc. order, it should look similar to this:
    [​IMG]

    Now, scroll up and then click the buttons "Save Section" and then "Save File". Now a file named sys.bar will be downloaded with your edited text. You will need to replace your old sys.bar file with this one.

    Now for the final step before creating a patch file:

    STEP 6: Adding the Keyblade Item

    At last, we are here. The final step before our patching and testing phase (Besides making it obtainable, which will be covered at the next GummiMOD article), which is to actually make it unto an item. Now, open item[0x02].bin on HxD. You should see something similar to this:
    [​IMG]

    After opening the file, press Ctrl+E and type in 4-4 and press Enter. Then, click on Int32 on the small side-window and increase the highlighted value by one for each Keyblade you are adding in. After which, press Ctrl+E again and type in 3234-4,press Enter and yet again, click on Int32 and increase this value by one for each added Keyblade.

    Now, copy the value below;
    Code:
    AA AA 02 00 BB BB CC CC
    DD DD DD DD 00 00 00 00
    00 00 EE EE FF FF 00 04
    
    Press Ctrl+G, type in 3230 (For unedited files) and press Enter. You should see the blinking cursor at the position of my cursor, with a red value and a lot of 64s under it. If you do not, scroll until you find it. If you do, paste the code you copied earlier for each added Keyblade. After pasting, it should look similar to the spoiler inside the spoiler:
    [​IMG]

    [​IMG]

    Now first, highlight "AA AA" and click on Int16, then type in something greater than 768 unto it. I do not know what the max value is here, so be cautious. Note that for each Keyblade, you will need a unique value. This is known as the "UWM" and is necessary for you to get your Keyblade trough codes or the game itself.

    QUICC NOTE 6: If you do not know how to deal with Little Endian conversions, not the decimal value and convert it to HEX when using it with codes n' ****

    Then, highlight "BB BB" and click on Int16, then type in the number we have noted from all the way back in Step 2. In my case, it was 25 for my one and only Keyblade.

    For now, leave "CC CC" as it is.

    Highlight "DD DD". NOT "DD DD DD DD" but rather, the first 2 "DD"s, which are "DD DD". Then click on Int16 and type in the name ID. It is one of the numbers in the odd side of the order (1st, 3rd, 5th, etc.) from the values which MSGShifter at Step 5 asked you to note. Then, do the same for the other pair of "DD"s, but this time with one of the numbers on the even side of the order (2nd, 4th, 6th, etc.)

    QUICC NOTE 7: I say "one of" but be sure to select the respective IDs for your Keyblades. For example the name of the 3rd Keyblade you added is the 5th ID on the list. Another example, the description of the 5th Keyblade you added is 10th ID from the list.

    Highlight "EE EE" and click on Int16. Then type in something which is greater than 200. Must be unique for each Keyblade.

    Highlight "FF FF" and click on Int16. Then type in the number you typed in to the "xxx" part of item-xxx.imd.

    Now, copy the value below:
    Code:
    AA AA BB BB CC DD 00 00
    64 64 64 64 64 64 64 00
    
    Then, scroll to the end of the file and click (Or just do Ctrl+G and type in FFFFFFFFFFFF) and paste the code you copied, one paste for each Keyblade. If ya have done correctly, it should look similar to this:
    [​IMG]

    Now, highlight "AA AA" and click Int16, then type in something greater than 166. Must be different for each Keyblade.

    Then, highlight "BB BB" and download this list here. Open the list and find the ability you want to use. Copy the numbers in front of it's name and click Int16 in HxD. Paste it in there (Covert from Hexadecimal to Decimal first).

    Then highlight "CC" and click UInt8. Then, type in how much Attack you want it to have. The max value is 255.

    Finally, highlight "DD" and click UInt8. Then, type in how much Magic you want it to have. The max value is 255.

    Now, do you remember me saying "For now, leave "CC CC" as it is"? Now, copy the value you put into "AA AA" in here and paste it unto the "CC CC" on the thing you made. At this point, you can find it by scrolling up if you did not save the file. This is important, as if this value is not filled in correctly, the game will not display any stats.

    Now save and close everything.

    STEP 7: Finalization

    Now that we have all of our files ready, we can proceed with putting everything back where they belong. First, open 03system.bin with the BAR Editor once more. And then, do as I do in the GIF below to replace the went[0x02] and item[0x02] files with the ones you edited. After which, click "Save" and save 03system.bin:
    [​IMG]

    Then, put all the files in the folder which the patcher program resides in the following structure:
    • 03system.bin
    • 00objentry.bin
    • itempic/item-xxx.imd (ALL OF THEM)
    • msg/jp/sys.bar
    • obj/CUSTOM_MODELS.mdlx (ALL OF THEM)
    • obj/CUSTOM_EFFECT.a.fm (ALL OF THEM)

    And then, following the video given in Disclaimer the Third, create a patch and patch your game.

    And, well, this is it. The Keyblades in question are not yet obtainable, but they are present and it is possible to access them with a cheat code for editing Sora's weapon using the UWM (aka the "AA AA" value you noted from item[0x02]) as the value.

    Thank you all so much for reading the first ever article of GummiMOD. In the next chapter I will show you how to add your own custom treasure chests, complete with actual chests which do not replace anything. Stay tuned!

    - TopazTK
     
    Last edited: Sep 29, 2019
  2. TopazTK [Topaz' Reality] Moogle Assistant

    Joined:
    May 23, 2019
    Gender:
    Darkness
    Location:
    Kosovo, Prizren
    2
    6
    CHANGELOG:

    - Fixed some incorrect terms that caused confusion.
    - Forgot to mention an important detail, added it.
    - More to come.
     
    Last edited: Sep 29, 2019