StarsMmd Posted May 10, 2015 Posted May 10, 2015 (edited) EDIT: Note this tutorial is outdated and a lot more progress has been made since I first wrote this many years ago. The easiest way to get into modding these games is to use my Hack tools (currently mac only but the windows version is in beta testing in the discord server). We have a discord server for everything Pokemon Colosseum, XD and Battle Revolution hacking here: https://discord.gg/xCPjjnv --------------------- I can finally start posting all the data I have so far on hacking Pokemon Colosseum and Pokemon XD. There is a lot of it so it will take a while. Here is the first part. This is very important as it is a prerequisite for almost anything you want to hack in these games. Before I get into the details of the hacking I have some hints and tips that you should read. ===================== Prerequisites ===================== Some useful files for looking up data: Abilities Common Values Item List Pokemon IDs Pokemon Moves Especially useful is the list of pokemon ids since they aren't always the same as their pokedex order. Those used to hacking gen III may already be aware of this since it is unique to the gen III games. The source code for my editing tools: https://github.com/PekanMmd/Pokemon-Colosseum-Hacking-Resources Some files you'll need: fsys extract and decompress script.txt pokemon lzss recompress script.txt - I. Things you'll need - Download Gamecube rebuilder (or similar program). Download QuickBMS. Any hexadecimal converter (or you can do it all in your head if you prefer). Any free online converter is enough. You may also want a binary converter for XD. [Edit by @evandixon: When set to Programmer mode, the built-in calculator in Windows will work.] A hex editor. (No tools as of the time of writing except my iOS apps which won't be released for the reasons explained in part III) Check out my git hub repository and download the quickBMS scripts. If you want to edit the banner for the ISO download a program called GCBanner. I won't be explaining it here but there are tutorials somewhere online. An emulator will be very useful for testing. Dolphin is really good these days. It plays Colosseum perfectly with the right settings but does have a few glitches with XD. It is convenient having the emulator on the computer you're hacking on because once you build the ISO you can test right then and there. However, computers can rarely produce good emulation speeds. I recently started using Nintendon't on my Wii U and it is brilliant. If you have a Wii or Wii U I recommend finding a tutorial online on installing Nintendon't as the consoles have built in GameCube emulation made by Nintendo themselves and so runs the games perfectly at full speed. - II. Useful knowledge - Learn basic hexadecimal to decimal conversion. As long as you understand what it is a hex converter will do the rest. I will not be covering this myself as there are many tutorials already. A very tiny bit of binary also comes up in XD. If you understand hex you probably get binary too and there are many converters online. Experience hacking other gen III games is very valuable. Hacking other gen games will also be of slight use but gen III does have it's quirks. My git hub repo also has some useful files for looking things up like the ids of each Pokemon so download those files also. ( I haven't put it up yet but will do soon) Less importantly, since the game was originally coded by the Japanese, a lot of the file names are transliterations of the Japanese names. For example, all the Pokemon and NPC models are named by their Japanese names. I happen to speak Japanese and I've found it really useful because it allows me to more easily figure out what is inside a file. Sometimes the name makes it very obvious. Like in field_common.fsys there is a file called "bikkuri". I know this means surprise in Japanese so I was able to make the assumption that this file contains data for when an NPC trainer spots you and the little surprise animation pops up above their head. There are no Japanese characters anywhere so just understanding a bit of the language phonetically helps. Some phrases that might come in handy: Japanese English snatch ball snag ball snatch dan team snagem dark pokemon shadow pokemon gonza gonzap mirabo / mirrorbo miror B. esaba pokespot (literally feeding place) waza move/attack usohachi bonsly gonbe munchlax lugia lugia ( convenient ) runpappa ludicolo relive purify labo lab nakigoe cry (as in a pokemon's 'roar') 10manvolt thunderbolt (literally 100,000 volts) - III. N.B. - The GameCube files are in "big endian". Those used to hacking on other platforms will be used to reversing bytes but there is no need for that at any time on the GameCube. The downside is that this makes opening files on "little endian" computers (as far as I know that's about every computer in common use) a bit trickier. Programs may need to byte-swap when reading and writing values longer than 1 byte in length. The amount of time spent compressing and recompressing files (not to mention the difficulty of emulating GameCube games) means testing can be a long and tedious process so not everything has been tested fully. Also I'll be teaching you 'safe' techniques. I haven't reached the level of repointing to expand the size of data regions. Hopefully when more automated tools are available more possibilities will open up. The preparation section isn't very exciting but is necessary so pay attention. You may find yourself repeating these steps many times before programs are available. In order to minimize repeating tedious steps, try to edit the files as much as possible all in one go before recompressing. Don't forget to be conscious of increasing the file size as I'll mention in the preparation section. All of my tools are iPad apps which I can't release because I doubt it'll be allowed. Even if Apple were to somehow accept them for the App store, Pokemon Company/Genius Sonority would probably complain. The programming was all done in a rush and the UI is pretty poor but I will be releasing the source code for everything so hopefully someone else will make some better tools. Do check out my YouTube videos. They're a bit long but I do go into more depth about many of the concepts and techniques introduced in these tutorials. I especially recommend the fsys and compression video because that is a bit tricky to describe. Since there are few automated processes and it is very easy to make mistakes, make sure you keep backups of your files. Changing just one byte incorrectly can ruin your files. The two most interesting files are the Start.dol and common_rel.fdat (in common.fsys). These two files contain a lot of the important data. They are loaded into the game's ram when the game is loaded which means that anything that can be done in those files can, in theory, also be achieved through Action Replay codes or if you prefer you could do a ram dump, edit the ram directly and then load the edited ram. This includes editing pokemon stats, move data, TMs list, a little bit of text, starter pokemon and gift pokemon and trainer teams(colo only). XD has the physical/special split! It's only used for shadow moves though. I would really like to find a way to incorporate it into all the moves. I'm really hoping someone can crack this. I'm hacking the US versions of the two games. There may be differences if you're using a different region. ================================== Part 1: Extraction,Decompression and Recompression ================================== - I. File extraction - This is how we get individual game files out of the ISO. Run Gamecube Rebuilder. Select: Image >> open. navigate to your gamecube ISO/GCM and open it. In the file browser to the right, right click on 'root' and then click 'extract'. Choose a location to save the folder in on your computer. This will save all the game files in a folder called 'root' wherever you choose to save it. This can take a while but is useful if you want easy access to all the files. Alternatively, if you only want an individual file then you can right click on the specific file you want and extract it in the same way. Edit any of the files, making sure to either keep them in the same folder or put them back later with the same file name. - II. File reimporting and ISO rebuilding - This is how we put the files back into the ISO after we've edited them. Try to make sure the file size is the same as the size of the original file you are replacing. If it is too large then you may mess up our ISO. - importing an individual file- open the ISO image as in part i. find the file you have edited, right click it, click 'import' and load the edited file. - rebuilding whole ISO- If GameCube Rebuilder is still open with an image loaded, select: image >> close. Run GameCube Rebuilder. Select: root >> open, navigate to the 'root' folder you made in part I. Select: root >> save, choose where you want to save your new ISO/GCM and name it. Select root >> rebuild. A new ISO/GCM will be saved as you specified in step 3. - III. fsys extraction and decompression - Most of the game files are compressed and archived in .fsys files (kind of like a .zip or .rar file). This is how we get them out and decompress them in order to be able to edit them. Some files haven't been archived and don't require decompression but most of the useful and interesting ones do. Run quickBMS. Select the "fsys extract and decompression script" (see attatched files or source code on github) and click 'open'. Select your .fsys file and click 'open'. You can select multiple files at the same time and the program will extract from them one at a time. Choose a folder to save the files in and then click 'save' (warning this will most likely extract multiple files so you may want to create a folder for them). You can stay in the same folder if you wish. This script automatically decompresses and adds a '.fdat' file extension to each file extracted. Open the .fdat files in a hex editor or if opening them in a program then you can read the bytes as binary data. If the fsys archive contains multiple files with the same name (which is quite common actually), then simply type 'r' into the command line and then press the return/enter key on your keyboard quickBMS will automatically rename the files with sequential numbers. - IV. File recompression - Of course, once the files have finished being edited they must be recompressed so we can put them back in. Open the file you want to recompress in your hex editor and record the exact number of bytes in the file. Any decent hex editor should show this value somewhere; if not automatically then highlight all the bytes (ctrl + a on windows) and then it should show you how many bytes are highlighted. Make sure you convert this number to decimal if it is in hexadecimal. Open the "pokemon lzss recompress script" (see attatched files or source code on github) in any text editor. A simple one like notepad is best. At the end of the file you will see 2 identical numbers. Replace them with the file size you recorded in step 1 (again remember to convert it to decimal). You should now have two new identical numbers which represent the file size. Save the modified script. (If you are editing the same file a lot without changing the file size it may be convenient to save a separate script for the specific file with a different name so you can reuse that script and skip the first 2 steps.) Run quickBMS and follow the steps in section III above, however, this time run it with the script from step 2 and then the file you are trying to compress. This script will save the file without a .LZSS extension. - V. fsys reimporting - Once the files have been recompressed they now need to be put back precisely where they were found in the archive so that they game can load our new edited data. Make sure your compressed file size is smaller than the original compressed file size. In each section where I edit .fdat files I will share tips on how to effectively do this. In general, if you can make long rows of 00 bytes, for example by deleting text or removing items, EVs, or a whole Pokémon from a trainer, your compressed size will decrease. If you edit data and you aren't creating long rows of 00bytes then you are most likely going to increase the compressed file size. Such is life. If you want to learn more then research how the LZSS compression algorithm works and about 'entropy' in terms of data compression, which is similar to the concept of entropy in physics. In very basic terms, we are trying to decrease the randomness of the data so it compresses better. Open the .LZSS file you want to reimport in your hex editor. Note the exact number of bytes in the file. If you had changed the uncompressed file size then also note that beforere compressing the .fdat file. Open the .fsys file you originally extracted the .LZSS file from (as a .fdat file) in your hex editor. Note the exact number of bytes in the file (in hexadecimal this time). I recommend checking out my youtube video on fsys and decompression as this step gets complicated. Bear with me, this step is hard to explain by typing. However, it is usually very easy to do. The .fsys file is an archive comprising multiple files (or sometimes one file) within it. the files in the .fsys are all separated by some rows of 00 bytes and each one starts with the magic bytes "LZSS" which you can see in the ASCII version of the data in your hex editor. Your task in this step is to figure out which file in the archive is the one you have edited and are trying to replace. Not far from the start of the .fsys file you have the file names of the files in the archive. Use this to figure out the position of your file in the archive. If the file was sequentially named by quickBMS because of name conflicts then the lower numbered ones were the first ones in the archive. You can also figure out which file you want by looking at the header for each file which starts with the "LZSS" and then has the compressed and uncompressed file sizes. Match these with the sizes you expect for your file. Also the data should start with the same bytes as your file since you probably didn't change much at the very beginning of the file so it decompresses the same way. The files I edit a lot "common_rel.fdat" which is the first file in common.fsys, and the text data files for the maps which is the third file in any of the .fsys files for a map. This is true for both games and makes this step easy to figure out. If you somehow got through all the text and managed to make sense of it then it will soon become obvious how to figure all this out. There is a very easily recognised pattern to the .fsys files. If you scroll down just past the file names then you will find data separated by rows of 0x11 bytes (i.e. 11 11 11 11 11 11 11 11 11 11 11 11) in colosseum or just 0x00 (0x0000000000000000000) in XD. The blocks of data which precede each of these rows describes and individual file in the archive and this data is in the same order as the file names and the same order that the files in the archive are saved in. This block of data contains the offset within the .fsys file that the .LZSS file starts as well as both the compressed and uncompressed file sizes. If we have changed any of these values (usually the compressed file size) then we must update this information here or the game will crash even before we reach the title screen. Before you change the decompressed file size value you must add 16 bytes (0x10) to your value because there is also a 16 byte header which isn't part of the LZSS file we created but is in the .fsys file. Scroll to the start of the file in question. The "LZSS" bytes at the start will let you know you're at the start of the file. The 16 bytes starting with "LZSS" are the file header. Again this has the compressed and decompressed file sizes for that file so if you have changed these then update these values once again (remembering to add 16 bytes to your decompressed file size). Always remember you need to update the decompressed file size in two places. Copy all the bytes from your .LZSS file (ctrl + a to highlight all then ctrl + c to copy). Starting from the byte after the header in the .fsys file, highlight as many bytes as the number of bytes you copied from the .LZSS file. Assuming your .LZSS is smaller there will still be some bytes left over from the previous file. Replace these extra bytes with 00 until the end of the previous file. If your file is too large then you willoverlap with the next file, hence the emphasis on keeping your file as small as possible. We can move the next file if necessary as long as we update the pointers in its block of data before the 111111 row corresponding to the next file. I've never actually tested this myself but it seems obvious enough. There are a few bytes between each of the files for tidiness but we can overwrite these if we want to since this won't increase the size of the .fsys file. Again, I haven't tested this but if you wanted to increase the total size of the .fsys file and repointed everything properly then you would probably need to update the ISOs .toc file with the new file size of the .fsys. I haven't done this before though so good luck if you attempt it. The details of the .toc file have probably been documented somewhere before as it is pretty much the same in every gamecube ISO. That's it ! You've successfully extracted, decompressed, recompressed and reimported a game file from a .fsys file. This process is a lot easier to do than describe and not knowing how to do this was the only reason Pokémon Colosseum and XD hadn't been hacked before. Now we can research and edit the game files with ease. Part 2 - View full tutorial Edited August 25, 2016 by StarsMmd
StarsMmd Posted June 2, 2015 Author Posted June 2, 2015 Just a quick update. I found the recompression script I've been using on a forum somewhere like a year ago and it's been really tedious to use. I just did some research on quickBMS scripts and I've amended the script to be a little easier to use. This new script automatically calculates the file size so you don't need to update the script every time you want to compress a different file. This also means that multiple files can be compressed on one run of quickBMS. The new script: Endian Big ComType LZSS_Compress "12 4 2 2 0" Get Name Filename Get FileLength ASize Get Ext Extension String Name -= Ext String Name += ".lzss" CLog Name FileLength FileLength
teddywestgeass Posted August 27, 2015 Posted August 27, 2015 So this comment isn't a contribution, but hopefully I will be able to in the future. I just wanted to give you a massive THANK YOU, StarsMmd. I have wanted to do this for so long and now I have the materials to do so. I've looked for gamecube hacking materials in the past but digging through forums has not exactly been my forte. Luckily I stumbled upon yours while researching how to hack Gen V games. I'm going to be dedicating a lot of time into learning Hex & Binary, as well as the nature of these games' data. If I am somehow able to contribute information or findings I absolutely will, but compared to the terminology I'm seeing right now I may be lost in the dust. Seriously I'm excited =)
StarsMmd Posted August 28, 2015 Author Posted August 28, 2015 So this comment isn't a contribution, but hopefully I will be able to in the future. I just wanted to give you a massive THANK YOU, StarsMmd. I have wanted to do this for so long and now I have the materials to do so. I've looked for gamecube hacking materials in the past but digging through forums has not exactly been my forte. Luckily I stumbled upon yours while researching how to hack Gen V games. I'm going to be dedicating a lot of time into learning Hex & Binary, as well as the nature of these games' data. If I am somehow able to contribute information or findings I absolutely will, but compared to the terminology I'm seeing right now I may be lost in the dust.Seriously I'm excited =) That makes me very happy to hear. Once you understand how hex works then everything else will be really easy. Trust me, gamecube hacking is many times easier than hacking gen V. If you have any questions feel free to pm me. I check the forums everyday. Good luck !
JuiceTin13 Posted August 24, 2016 Posted August 24, 2016 Finally getting started bro, also please make a tutorial for GCBanner 'cuz I'm not getting any also can you link me to your repository for quickBMS scripts ?
JuiceTin13 Posted August 24, 2016 Posted August 24, 2016 just doing everything step by step, hope you give a more detailed information because there is no one else
StarsMmd Posted August 25, 2016 Author Posted August 25, 2016 Finally getting started bro, also please make a tutorial for GCBanner 'cuz I'm not getting any also can you link me to your repository for quickBMS scripts ? I haven't used gcbanner in a while and I'm not sure if I still have a link to the tutorial I used . I'll see if I can figure it out though. Please do remind me if I forget though. The quickBMS scripts are in the first post, I'll move them to the top so they're more obvious
JuiceTin13 Posted August 25, 2016 Posted August 25, 2016 Hi there please check out my latest hack - https://projectpokemon.org/forums/showthread.php?49701-Pokemon-Mystery-Dungeon-Sky-Rockers-!&p=219655#post219655
StarsMmd Posted August 25, 2016 Author Posted August 25, 2016 Hi there please check out my latest hack - https://projectpokemon.org/forums/showthread.php?49701-Pokemon-Mystery-Dungeon-Sky-Rockers-!&p=219655#post219655 Is that actually the first hack for explorers of sky? I thought the mystery dungeon hacking scene was pretty far along. That's really impressive. I actually haven't played mystery dungeon since mystery dungeon red though and I'll definitely be going back to that series eventually. I'd love to play this once I've finished the originals though oh, you can try putting it in your signature to help promote it because I think a lot of people would be interested in it.
JuiceTin13 Posted August 25, 2016 Posted August 25, 2016 +mentioned you in it, how to put it in signature ?
StarsMmd Posted August 25, 2016 Author Posted August 25, 2016 +mentioned you in it, how to put it in signature ? It's in the settings somewhere. There's an option to edit your signature.
JuiceTin13 Posted August 25, 2016 Posted August 25, 2016 It's in the settings somewhere. There's an option to edit your signature. ok, but how do I make a clickable signature, like its an image but when i click it, it takes me to the thread page ?
StarsMmd Posted August 25, 2016 Author Posted August 25, 2016 ok, but how do I make a clickable signature, like its an image but when i click it, it takes me to the thread page ? I have no idea actually. I'm a n00b at this stuff myself. Maybe google knows?
JuiceTin13 Posted August 25, 2016 Posted August 25, 2016 I have no idea actually. I'm a n00b at this stuff myself. Maybe google knows? can you give me your skype id so we can talk ?
StarsMmd Posted August 25, 2016 Author Posted August 25, 2016 can you give me your skype id so we can talk ? Sorry, I'm not really allowed to do that.
JuiceTin13 Posted August 25, 2016 Posted August 25, 2016 Sorry, I'm not really allowed to do that. why ? atleast send me your id on twitter ?
StarsMmd Posted August 25, 2016 Author Posted August 25, 2016 why ? atleast send me your id on twitter ? @StarsMmd
JuiceTin13 Posted August 28, 2016 Posted August 28, 2016 Hello, are you looking forward to make youtube videos on your hack ? if so then at least give me and my project a shoutout
StarsMmd Posted August 30, 2016 Author Posted August 30, 2016 Hello, are you looking forward to make youtube videos on your hack ? if so then at least give me and my project a shoutout Yeah I have plans to do so very soon and I'll be sure to give you a shout out!
fernyferny Posted January 7, 2023 Posted January 7, 2023 (edited) I just made an account to say THANK YOU! This is awesome, I played the game and I'm a huge fan. I have it on my phone. I played it at 2x speed and it was perfect! I noticed the comment at the very top where you say you made a lot of new discoveries and I'm curious. I've never been an apple person but I think I might have to buy a Mac to give this a shot! haha One of my all time Pokémon in the game was the Azumarill, SO STRONG! I love how you incorporated the Fairy type, initially I was confused when I saw the Alolan forms but I realized it was mostly in the stats. >.< I assume it's very tedious to add the graphics in there. Again thank you for this game, I can tell it took a lot of time and dedication to make. I know I'm a little late to the party but just wanted to make an account give my gratitude. If there is a newer thread I would really appreciate it if you could redirect me to it. <(^.^)> Edited January 7, 2023 by fernyferny
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now