- 3
- Posts
- 5
- Years
- Seen Nov 17, 2019
I'm new to ASM and ROM hacking, and because of that, I haven't quite figured out the best ways to find the information I need from the ROM. I'm using Firered as my test game since it's very heavily documented.
I'm currently trying to write a c++ program that reads the ROM's bytes (like PGE or YAPE) and grabs the pokemon's information. Right now I'm trying to read out all of the pokemon names from 0x245EE0 to 0x2469b4. It works like it should, even running each name through the encoder/decoder that I wrote to give me ASCII.
Here's the code I have for this part:
I know that this code works but I'm kinda frustrated that I can't find any reference to where the game keeps the number of pokemon. I could set up a check to make sure that the 11 bytes never read "AC FF 00 00 00 00 00 00 00 00 00" (which is the case with the entry after CELEBI). I just think that there must be a better way. I've tried to find any information through the multitudes of forum posts, but I'm just lost now.
Any help would be appreciated.
I'm currently trying to write a c++ program that reads the ROM's bytes (like PGE or YAPE) and grabs the pokemon's information. Right now I'm trying to read out all of the pokemon names from 0x245EE0 to 0x2469b4. It works like it should, even running each name through the encoder/decoder that I wrote to give me ASCII.
Here's the code I have for this part:
Spoiler:
void print_out_pokemon_names() {
int pokemon_name_offset = 0x245EE0;
int names_to_read = (0x2469b4 - pokemon_name_offset) / 11;
fstream fstr("C:\\RomUtilsRes\\Fire Red.gba", ios::in | ios::out | ios::binary);
fstr.seekg(pokemon_name_offset);
for (int i = 0; i < names_to_read; i++) {
char name[12];
string str_name;
fstr.read(name, 11);
for (int j = 0; j < 11; j++) {
string encoded = PokeEncode::Encode(name[j]); // This is the encoding/decoding class I put together.
str_name += encoded;
}
cout << "\nEncoded Name: " << str_name << endl;
}
fstr.close();
}
int pokemon_name_offset = 0x245EE0;
int names_to_read = (0x2469b4 - pokemon_name_offset) / 11;
fstream fstr("C:\\RomUtilsRes\\Fire Red.gba", ios::in | ios::out | ios::binary);
fstr.seekg(pokemon_name_offset);
for (int i = 0; i < names_to_read; i++) {
char name[12];
string str_name;
fstr.read(name, 11);
for (int j = 0; j < 11; j++) {
string encoded = PokeEncode::Encode(name[j]); // This is the encoding/decoding class I put together.
str_name += encoded;
}
cout << "\nEncoded Name: " << str_name << endl;
}
fstr.close();
}
I know that this code works but I'm kinda frustrated that I can't find any reference to where the game keeps the number of pokemon. I could set up a check to make sure that the 11 bytes never read "AC FF 00 00 00 00 00 00 00 00 00" (which is the case with the entry after CELEBI). I just think that there must be a better way. I've tried to find any information through the multitudes of forum posts, but I'm just lost now.
Any help would be appreciated.