October 2nd, 2016 (9:28 PM). Edited October 4th, 2016 by Froosty.
 Froosty The_Learner Join Date: Sep 2014 Location: Somewhere in this world. Age: 21 Gender: Male Nature: Brave Posts: 541
Hello guys, I am The_learner.
Spoiler:
I have been playing pokemon games for some time.. and for always I am a big fan of gba games rather than Ds ans 3ds or gb games.
The reason for it might also be that the first game I played was FIRE RED

The feature that is a available in fired but not in other games is "habitat"
.
Thanks to lot of tools and people we can easily add pokemons in fire red, (this is great)
But the game itself wont put the added pokemon in a specific habitat.
It needs to be edited.
So with the thought of helping other hackers out there, I decided to make this small tutorial.
(I am not a professional hacker but with some study i actually found out a method to fo it)

Tools you need:
1. PGE (my suggestion)
2. Hex editor (any)
3. Free space finder
4. Free time and a brain of course :P (a bad joke)

Learning the table:
Spoiler:
Firstly i hope all of you might know about tools like PGE and G3HS.
They have a .ini file in their folder.
Open it and goto BPRE section, and search for habitat!
You will see an pointer there,
HabitatTable=452C4C

Open hex exitor and goto that pointer(452C4C).
You will see the main table responsible for habitat data over there!

The table should be in this format!
ZZ YY XX 08 DD 00 00 00
Spoiler:
Where;
XX YY ZZ is the pointer to the table of specific habitat.
DD CC are most probably the number of pages for a specific habitat, but I suggest not to edit the last 4 bytes of the data, as they can be done easily with PGE.
(The first 4 bytes can also be easily edited with PGE)

There are 9 habitats and each habitat table takes 8 bytes so the table for Habitat is within the 48(hex) value from that pointer:
Spoiler:
D4 27 45 08 1B 00 00 00 AC 28 45 08 1A 00 00 00 7C 29 45 08 10 00 00 00 FC 29 45 08 10 00 00 00 7C 2A 45 08 0A 00 00 00 CC 2A 45 08 11 00 00 00 54 2B 45 08 0B 00 00 00 AC 2B 45 08 0C 00 00 00 0C 2C 45 08 08 00 00 00

We can easily dissemble that data for better knowledge:
Spoiler:

D4 27 45 08 1B 00 00 00 - habitat grassland
AC 28 45 08 1A 00 00 00 - habitat forest
7C 29 45 08 10 00 00 00 - habitat water edge
FC 29 45 08 10 00 00 00 - habitat sea
7C 2A 45 08 0A 00 00 00 - habitat cave
CC 2A 45 08 11 00 00 00 - habitat mountain
54 2B 45 08 0B 00 00 00 - habitat rough terrain
AC 2B 45 08 0C 00 00 00 - habitat urban
0C 2C 45 08 08 00 00 00 - habitat rare

In the above table:
the bolded portion indicates the pointer to the pages, and the underlined hex values represent the number of pages of the corresponding habitats.

For eg: D4 27 45 08 1B 00 00 00 - habitat grassland
It means the grassland habitat has 1B(27) pages and the pointer to the pages is at 0x4527D4

It is the same for all the other data as well.

If you visit the pointer XX YY ZZ from above then again you will find a table responsible for pokemon data on pages!
(If you remember well in a pokedex on habitat searching, in one page 2-3 pokemon are seen then next page is opened with other pokemons)
.
The above table is responsible for that happening.

Again the table will be in same format;
Spoiler:
ZZ YY XX 08 DD 00 00 00
But this time;
XX YY ZZ is pointer to pokemon data!
DD is number of pokemon per page (min1-max4)

Lets visit the cave habitat this time, as it has less number of pages so a shorter task of making you understand :)
Spoiler:

firstly I went to the pointer 0x452A7C which is the table to pages for cave habitat as we talked earlier
now the number of pages in cave habitat is A(10) that means the table should be of A*8 bytes=50 bytes
so I copied the 50 bytes of data from that pointer
Spoiler:
AC 26 45 08 03 00 00 00 B2 26 45 08 04 00 00 00 BA 26 45 08 04 00 00 00 C2 26 45 08 03 00 00 00 C8 26 45 08 03 00 00 00 CE 26 45 08 02 00 00 00 D2 26 45 08 03 00 00 00 D8 26 45 08 02 00 00 00 DC 26 45 08 02 00 00 00 E0 26 45 08 03 00 00 00

again I am shortening the data for better understanding
AC 26 45 08 03 00 00 00 - first page with 3 pokemons
B2 26 45 08 04 00 00 00 - second page with 4 pokemons
BA 26 45 08 04 00 00 00 - third page with 4 pokemons
C2 26 45 08 03 00 00 00 - forth page with 3 pokemons
C8 26 45 08 03 00 00 00 - fifth page with 3 pokemons
CE 26 45 08 02 00 00 00 - sixth page with 2 pokemons
D2 26 45 08 03 00 00 00 - seventh page with 3 pokemons
D8 26 45 08 02 00 00 00 - eighth page with 2 pokemons
DC 26 45 08 02 00 00 00 - ninth page with 2 pokemons
E0 26 45 08 03 00 00 00 - tenth page with 3 pokemons

As you can see in data above, the first four byte again is the pointer, but this time its the pointer to the pokemon data, and the underlined hex value is the indication of number of pokemon in that page.
this value handles the working of the first four byte of the pointer.(this is not so important, but try to get the meaning of it)

For eg:AC 26 45 08 03 00 00 00 - first page with 3 pokemons
I am going to the first page of cave habitat; its pointer is 0x4526AC
the first page has 3 pokemons, each pokemon take 2 bytes so the first page will read the 6 bytes from the pointer above
29 00 2A 00 A9 00
here it is
again,
29 00 - first pokemon in this page ( 00 29 in hex --> 41in dec which is Zubat)
2A 00 - second pokemon in this page (00 2A in hex --> 42 in dec which is Golbat)
A9 00 - third pokemon in this page (00 A9 in hex --> 169 in dec which is Crobat)

The pokemon is based on the index number as seen in PGE or G3HS
eg: if index number of a pokemon is 721 then it is 2D1 in hex,
or better say 02D1; now add a space in middle and then reverse the values it will be D1 02.

Spoiler:
but it is better if you change the pokemon with the help of PGE habitat editor
What i suggest is you place the pointer in the page table then in that pointer simply put "01 00" if you check in habitat editor then it will show bulbasaur, then you can select the pokemon you want from dropdown menu. you need not play with hex by this method.

Every time the DD I stated in the pointers above acts as the limiter to the table,
means if you set DD to 03 in the habitat table,
then it will only load 3 pages even if you have set more in the pointer.
.
So you need to be good at hex editing as well,
and also have a look at this tutorial.

I will be adding pics to this tutorial soon and also try to edit it to be more understandable.
.

Expanding the table
Spoiler:
soon

I would love to get feedbacks and know if this method is working for you :)
Pls reply to this thread if you are not understanding any thing or you are getting any kind of error. I would love to help you out :D
Thanks.
October 26th, 2016 (12:42 PM).
 mbcn10ww Join Date: Oct 2016 Location: Brazil Gender: Male Nature: Lonely Posts: 364
Excuse me, but I want to know what I'm doing wrong:
I've expanded my habitats correctly. (I know this because I'm a "HEXpert", and when I open my rom on PGE or G3HS it works perfectly)

But my PokéDex habitats page is glitched, and when I catch a new PKMN the game crashes when the habitats page would be executed.
__________________
My Works:
[Fire Red] Adding New Trainer Sprites
[Fire Red] My Version of HMs Type Check
[Fire Red] Touched's Mega Evolution System (PATCH)
October 26th, 2016 (3:47 PM).
 pokefreak890 The One that will make everything great Join Date: Nov 2014 Gender: Male Posts: 820
Regarding all this If possible can u show me pictures on how to do this since I'm a visual learner
__________________
3DS FREIND CODE : 2724-3540-0898
October 26th, 2016 (5:19 PM).
 Froosty The_Learner Join Date: Sep 2014 Location: Somewhere in this world. Age: 21 Gender: Male Nature: Brave Posts: 541
Quote:
 Originally Posted by pokefreak890 Regarding all this If possible can u show me pictures on how to do this since I'm a visual learner
Yeah wait pls ... i got your errors so i will go with pictures in this tutorial and possible i will even upload a video in youtube... :) just wait some time more.

Quote:
 Originally Posted by mbcn10ww Excuse me, but I want to know what I'm doing wrong: I've expanded my habitats correctly. (I know this because I'm a "HEXpert", and when I open my rom on PGE or G3HS it works perfectly) But my PokéDex habitats page is glitched, and when I catch a new PKMN the game crashes when the habitats page would be executed.
It should not have happened if you followed this process as nothing happened with me, but wait i will once redo the tutorial with pictures... hope that will be easier :)
October 26th, 2016 (5:42 PM).
 mbcn10ww Join Date: Oct 2016 Location: Brazil Gender: Male Nature: Lonely Posts: 364
Quote:
 Originally Posted by The_learner Yeah wait pls ... i got your errors so i will go with pictures in this tutorial and possible i will even upload a video in youtube... :) just wait some time more. It should not have happened if you followed this process as nothing happened with me, but wait i will once redo the tutorial with pictures... hope that will be easier :)
I've found the problem, the habitats in my rom base wasn't repointed correctly, only 0x08106888 was with the 4C 2C 45 08, I've fixed it putting my new table offset on all 4C 2C 45 08 pointers.
Thank you for the tutorial. ^^
October 26th, 2016 (5:58 PM).
 Froosty The_Learner Join Date: Sep 2014 Location: Somewhere in this world. Age: 21 Gender: Male Nature: Brave Posts: 541
Quote:
 Originally Posted by mbcn10ww I've found the problem, the habitats in my rom base wasn't repointed correctly, only 0x08106888 was with the 4C 2C 45 08, I've fixed it putting my new table offset on all 4C 2C 45 08 pointers. Thank you for the tutorial. ^^
So did you fix the problem...??
October 26th, 2016 (6:14 PM).
 mbcn10ww Join Date: Oct 2016 Location: Brazil Gender: Male Nature: Lonely Posts: 364
Quote:
 Originally Posted by The_learner So did you fix the problem...??
Yep, it's working fine now, with all 721 PKMN. ^^

Now I want to create separate Dexes, something like region separate Dexes and a Mega Dex.
October 26th, 2016 (10:21 PM).
 Froosty The_Learner Join Date: Sep 2014 Location: Somewhere in this world. Age: 21 Gender: Male Nature: Brave Posts: 541
Quote:
 Originally Posted by mbcn10ww Yep, it's working fine now, with all 721 PKMN. ^^ Now I want to create separate Dexes, something like region separate Dexes and a Mega Dex.
I am glad my tutorial got helpful.... but i dont know about the seperate dex thing... :(
October 27th, 2016 (4:22 AM).
 mbcn10ww Join Date: Oct 2016 Location: Brazil Gender: Male Nature: Lonely Posts: 364
Quote:
Don't worry, no one knows how to do it, I will try it myself.
October 27th, 2016 (4:24 AM).
 Froosty The_Learner Join Date: Sep 2014 Location: Somewhere in this world. Age: 21 Gender: Male Nature: Brave Posts: 541
Quote:
 Originally Posted by mbcn10ww Don't worry, no one knows how to do it, I will try it myself.
I think it will meed asm thing...
October 27th, 2016 (4:30 AM).
 mbcn10ww Join Date: Oct 2016 Location: Brazil Gender: Male Nature: Lonely Posts: 364
Quote:
 Originally Posted by The_learner I think it will meed asm thing...
I know, but I have to try it.