• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to make a Pokemon GBA ROM Hacking Tool C#

Momoro

I'm gonna put some dirt in your eye..
  • 269
    Posts
    5
    Years
    Hi, there! I am making this tutorial to update xGal's old one, which was severely out-of-date. In this tutorial, I will show you how to read the Header(e.g. "Pokemon FIRE"), the GameCode(e.g. BPRE), the game version(e.g. 01), and the Hidden Header(e.g. "pokemon red version")

    Okay, let's get started!


    What we will need:

    Visual Studio 2013(preferably)
    A C#-Brain

    Okay, let's go.


    First, make a Windows Forms Application, C#.




    After doing all that, make your windows forms look like this.

    [PokeCommunity.com] How to make a Pokemon GBA ROM Hacking Tool C#



    Okay, after doing that, double-click the button1.

    The Form1.cs should come up, now put this into the click event:

    Code:
    OpenFileDialog ofd = new OpenFileDialog();
    ofd.Filter = "GBA File (*.gba)|*.gba";
    ofd.Title = "Open a file!";
    
    if (ofd.ShowDialog()==DialogResult.OK)
    {
                   string gameCode = string.Empty;//Makes a new string that will be used to the gamecode.
                using (BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName))) //Sets a new integer to the BinaryReader
                {
                    br.BaseStream.Seek(0xAC, SeekOrigin.Begin); //The seek is starting from 0xAC
                    gameCode = Encoding.UTF8.GetString(br.ReadBytes(4)); //Reads 4 bytes from 0xAC and encodes it to text
                    textBox4.Text = gameCode; //You know, BPRE, etc.?
                    string GameCoding = string.Empty;
                    br.BaseStream.Seek(0xA0, SeekOrigin.Begin); //The seek is starting from 0xA0
                    GameCoding = Encoding.UTF8.GetString(br.ReadBytes(12)); //Reads 12 bytes from 0xA0 and encodes it to text
                    textBox3.Text = GameCoding; //This is the "POKEMON FIRE" thing
                        string GameVersion = string.Empty;
                        br.BaseStream.Seek(0xB0, SeekOrigin.Begin); //The seek is starting from 0xB0
                        GameVersion = Encoding.UTF8.GetString(br.ReadBytes(2)); //Reads 2 bytes from 0xB0 and encodes it to text
                        textBox2.Text = GameVersion;//Game Version!!! Yay!
                        string HH = string.Empty;
                        br.BaseStream.Seek(0x108, SeekOrigin.Begin); //The seek is starting from 0x108
                        HH = Encoding.UTF8.GetString(br.ReadBytes(19)); //Reads 19 bytes from 0x108 and encodes it to text
                        textBox1.Text = HH;
                }
                //We don't want to limit this to ONLY BPRE, unlike xGal's tutorial.
                using (BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName))) //We have to do this again, or it will cause an error.
                br.Close(); //Closes the BinaryReader. Without it, opening the file with any other command will result the error "This file is being used by another process".
    }

    Okay, so after getting all that code down, everything loads into place.
    But, what's the point of loading & editing without SAVING?

    Ha! Double click on the button2 and put this code in:

    Code:
    SaveFileDialog sfd = new SaveFileDialog();
    sfd.Filter = "GBA File (*.gba)|*.gba";
    sfd.Title = "Saving is essential!";
    
    if (sfd.ShowDialog()==DialogResult.OK)
    {
           BinaryWriter bw = new BinaryWriter(File.OpenWrite(ofd.FileName));
          
           bw.BaseStream.Seek(0xAC, SeekOrigin.Begin); //The seek is starting from 0xAC
           bw.Write(textBox4.Text);
    
           bw.BaseStream.Seek(0xA0, SeekOrigin.Begin); //The seek is starting from 0xA0
           bw.Write(textBox3.Text);
    
           bw.BaseStream.Seek(0xB0, SeekOrigin.Begin); //The seek is starting from 0xB0
           bw.Write(textBox2.Text);
    
           bw.BaseStream.Seek(0x108, SeekOrigin.Begin); //The seek is starting from 0x108
           bw.Write(textBox1.Text);
    
           bw.Dispose();
           bw.Close();
    }

    That's really all you have to do!
    Edit it as much as you need, but don't destroy the essential parts.

    Thank you for reading, I hope you enjoyed it. Comment and tell me what you liked, or disliked about this guide! Cya, kids! :D
    Credit:

    xGal
    Momoro
    I don't know... Maybe esperance
     
    Last edited:
    Some symbols such as Emojis and Unicode Symbols will turn into �, or just null spaces if you try to save them into the Game-Code, Header, Version and Hidden Header.(Basically, don't try pasting special characters into crucial parts of the game; pasting them into dialogs like Oak's Intro is fine, but will still return �)
     
    Last edited:
    Back
    Top