_ __ ___ ____ ______ - -- --- ---- --------------------------------------\ \\\_\\__\\___\\_____\ /\___ ___ /\________/\______ /\______/\___ /\____ _____ \\ \ \_\ _ \\_ _ \_\ _ \ \\ \ \ / / / / / / / / / / / / / / / / / / _ / / ____/ / / / \\___\___/\___/____/ /-DzG\___/____/ \\___/___/___/ ______ ____ ___ __ _ _/ / \\___________/ \_____\\___\\__\\_\\\ \-\_____/--[ Presents ]---------------- ---- --- -- - (__) (__) [ Information ]---------------------------------------------- ---- --- -- - [ Title ................................................. fuGBAr v0.1 ] [ Date ................................................... 2001-09-30 ] [ What ........................... Tool to view/alter GBA rom headers ] [ Platform ............................................ Win32 / Linux ] [ Code ....................................................... DANZiG ] [ Gfx ........................................................... N/A ] [ Muzak ......................................................... N/A ] [ Homepage .................................. http://www.napalm-x.com ] [ Contact ....................................... danzig@napalm-x.com ] _ __ ___ ____ ______ - -- --- ---- --------------------------------------/ ///_//__//___//_____/ (__) (__) (__) (__) [ Notes ]---------------------------------------------------- ---- --- -- - fuGBAr (Fix Up GameBoy Advance Roms) is a program which, as is obvious from the title, allows you to peruse the header of a gba rom as well as tamper with it :) Please note, fuGBAr is intended for the hobby *programmers* of the GBA... Story: In a fit of boredom and the lack of a particular feature in the currently available 'rom fixers' (gbafix/gbarm) I decided to code my own and release it in the event others may find it useful. fuGBAr, in its normal PC or Linux incarnations is a commandline tool, intended to be used standalone or in makefiles. Included in the archive is a some info showing how to integrate fuGBAr into your project/makefile. I have also included a win32 GUI version as well - should the occasion arise to use it. Perhaps the mildly curious rom hacker might toy with it. Note: The linux version will possibly need to have its file permission set to be able to execute... fuGBAr is free for commercial or non-commercial use. You may copy and distribute fuGBAr in unmodified form provided that the entire package, including - but not restricted to - copyright, trademark notices, disclaimers, .nfo and .diz files, as released by Napalm, is distributed. You may not charge a fee for fuGBAr. Please read the following documentation as well as our (entertaining?) disclaimer included in this archive. _ __ ___ ____ ______ - -- --- ---- --------------------------------------/ ///_//__//___//_____/ (__) (__) (__) (__) [ History ]-------------------------------------------------- ---- --- -- - v0.1 - 2001-09-30 - Nothing exciting to report. _ __ ___ ____ ______ - -- --- ---- --------------------------------------/ ///_//__//___//_____/ (__) (__) (__) (__) [ Usage ]---------------------------------------------------- ---- --- -- - Usage: fugbar (note: the ordering is not strict) Options are preceded by a '-' or '/', followed by a space and then any additional parameter. Depending on the option, parameters can be entered as ascii, hex, or decimal, unless noted otherwise. Ascii parameters that include spaces MUST be encapsulated in double-quotes. Ex: fugbar -v test.gba -t "MY NEW GAME!" Hex parameters must be preceded by the traditional '0x' Ex: fugbar -v test.gba -f 0x66 The following describes the options: -h (Help) Will display the help screen with short descriptions. Ex: fugbar -h -i (Info) This option will display the current header of the given GBA rom. This includes the rom's Title, Game Code, Maker Code, Main Unit Code, Device Type, Mask Rom version number, and Complement check. Also will tell you if the Complement is valid or invalid. Ex: fugbar kickass.gba /I Ex: fugbar -i wetpanties.gba -e (Extract Logo) Within the header of a gba rom lies an area reserved for a small 156 byte Nintendo Logo. fuGBAr does NOT include this logo to correct rom headers, as it is illegal to store the logo within fuGBAr. It is copyrighted, and belongs to Nintendo. It can be argued that it's ok to include this copyrighted logo in your GBA works, since its required for the rom to actually work, but this tool is not a gba rom and we'd rather not deal with any legal harrassment. The -e option will let you extract the logo from one of your own gba files. You need only perform this ONCE. fuGBAr will save a file in the current directory called 'gbalogo.bin'. From then on, whenever you repair or modify headers, fuGBAr will load this file and apply it properly. I could have 'generated' the logo, but there still are legal ramifications so personally I think it is best to let the user extract the logo from his/her own roms, legally. Once you extract a logo, you should move it to the directory where fuGBAr resides. Again, if you are not sure what the fuss about this logo is, a proper header with the logo is necessary for the gba rom to run on the actual GameBoy Advance hardware. Ex: fugbar -e whipitgood.gba -s (Strip Logo) "Hey! We've gone to the trouble of making sure we can get the Nintendo logo in my roms, why would I want to remove them from the header?!" Good question. As noted above there was a legal precedent in the early days on other consoles which dictated that it would be ok to include a logo such as this in the rom, since without it, the hardware would not run it (anti-competitive practices?). I'm not a lawyer, and I don't know if this is still a 'grey' area. So I include this option in the event you are a hobby programmer and it would not be legal for you to distribute your gba productions with the logo in your country or nation. Your audience can easily grab and use this tool or the others available like this one to fix the header of your demos/games. Ex: fugbar -v -s spreadthis.gba -v (Validate) This option will appropriately set parts of the header that are not editable (no need to bore you with those details). It will also insert the Nintendo Logo if you previously extracted it (-e option), and most important of all, it will calculate and insert a proper Complement Check value. Ex: fugbar -v sexynuns.gba -l (Light Validate) Ironically, the very first rom I tried to fix with my own tool was a raster demo by Exoticorn (raster.bin), which btw is a clever piece of work for 256 bytes including the header. The problem arose when I tried to validate the rom, the demo wouldn't work. So one might guess that the demo actually occupies parts of the header, and the validate option probably tramples over these parts (some parts not normally editable, but there are guidelines for their defaults). So to deal with this and other productions that may come in the future that might use these precious few bytes, I've added this option, which merely adds the logo and fixes the complement check byte if it is invalid, otherwise it leaves it alone. Hopefully it works ok... Ex: fugbar -l -o fixed.gba raster.bin -p [hex] (Pad) This option by itself (NO parameter) will pad a rom to the next power of two (and if it is already a power of two in size, this option is ignored). Alternatively, you can provide a value (filesize) of your choosing to pad up to. Though I specify that the argument must be entered in hex format, it can also be in decimal. By default, file is padded with 0xff. Ex: fugbar -p toefungus.gba (pad to next power of two) fugbar bodyodor.gba -p 0xc000 (hex, pad to 49152 bytes) fugbar nosepick.gba /P 0xc000 (hex, pad to 49152 bytes) fugbar -p 49152 britishteeth.gba (same but decimal, duh!) -f [hex] (Fill) Here is one of my motivations for writing my own util. This option will let you choose the value with which to pad the file with. This option will not accept a decimal argument, and if provided with such, it will be treated as ascii. But hey! What a neat (albeit useless) feature! I've seen some games in the past including some gbc games that padded their dead space with ascii text, and I thought it would be nice to allow it here. So, the fill option accepts a hex parameter (up to 32 bits, yes useless too, but who cares), and if it doesn't recognize it as hex, it assumes it is ascii. This too can be enclosed in double quotes if you wish to have spaces in the text. Please note: Do not begin your ascii text with a '-' or '/' or else the parser assumes that it has found the next command line option/switch! Ascii text may be 16 chars max. Be sure to use the -p parameter, if you actually want it to do something :) Ex: fugbar -p -f 0x11 mooshoopork.gba (pads with 0x11) fugbar /F 0x2222 /P poopooplatter.gba (obvious, no?) fugbar -p -f 0x12344321 eggroll.gba (you KNOW this, man!) fugbar -p -f CHAOS dimsum.gba (pads with text 'CHAOS') fugbar crusader.gba /p /f "Dork Was Here ! " -t (Title) This option will let you change the Title of the gba rom. Remember, if you would like to include spaces in your title, encapsulate it double-quotes. Use this option with the -v option (validate) to force your new Title into the header. The Title may be up to 12 chars. Ex: fugbar igotdaruns.gba -v -t MONTEZUMA fugbar -v -t "Dr Who 2001!" tardis.gba -g (Game Code) This option will let you change the Game Code of the gba rom. Use this option with the -v option (validate) to force your new Game Code into the header. The Game Code may be up to 4 chars. Note: Thanks to Credo's information, you can choose to adhere to more official guidelines by observing that: 1st char is generally 'A', presumably for 'AGB'. 2nd and 3rd chars are reserved for abbreviations of the Title. 4th char is the territory: 'J' == Japan/Asia 'E' == USA 'P' == Europe, Australia, Africa Ex: fugbar -v -t "BATMAN 2001" -g ABME dunanunanunanuna.gba fugbar -v -t "NUKE YORK" -g "MOK!" Rock-n-Rule.gba -m (Maker Code) This option will let you change the Maker Code of the gba rom. Use this option with the -v option (validate) to force your new Maker Code into the header. The Maker Code may be up to 2 chars. Officially, this two letter code represents the developer ID, distributed by Nintendo. Ex: fugbar -v -t "WHO ME ?" -m ME beetlejuice.gba fugbar -v -t "HANK - RIP" -m AD angrydwarf.gba -u (Main Unit Code) This option will let you change the Main Unit of the gba rom. Use this option with the -v option (validate) to force your new Main Unit Code into the header. Officially, this number code is typically 0x00. No need to bother with it unless you have an unhealthy compulsion to change this byte :) Note: parameter can be decimal too. Ex: fugbar -v -u 0x32 rockthecasbar.gba fugbar -v -u 0x01 alphabits.gba fugbar -v -u 255 nevermore.gba -d (Device Type) This option will let you change the Device Type of the gba rom. Use this option with the -v option (validate) to force your new Device Type into the header. Officially, this number code is typically 0x00. Note: parameter can be decimal too. Ex: fugbar -v -d 0xff bangzoom.gba fugbar -v -d 32 tothemoon.gba -r (Mask Rom Number) This option will let you change the Mask Rom Number of the gba rom. Use this option with the -v option (validate) to force your new Mask Rom Number into the header. Officially, this number code is typically 0x00. Hobbyists can put version numbers here. Note: parameter can be decimal too. Ex: fugbar -v -r 0x01 newbie.gba fugbar -v -r 0x02 pong_v02.gba -o (Output) With this you can specify a different file to write to, or rather, to create a new file with all your header and/or padding changes. Useful only if perhaps you want to conveniently preserve the original file. Ex: fugbar -t "FUNKY MUSIC" -o final.gba -v whiteboy.gba _ __ ___ ____ ______ - -- --- ---- --------------------------------------/ ///_//__//___//_____/ (__) (__) (__) (__) [ Greets ]--------------------------------------------------- ---- --- -- - You ! _ __ ___ ____ ______ - -- --- ---- --------------------------------------/ ///_//__//___//_____/