Thread: [Tutorial] [Tut]Create complet new Tileset for Pokemon GBA games View Single Post
#1
October 5th, 2008 (8:14 AM). Edited October 19th, 2008 by LU-HO.
 LU-HO Author of AdvanceMap Join Date: Mar 2005 Location: Switzerland Posts: 243
Hello all

Because many people have requested it many times, i now write a tutorial for this.

What do you need:
- Hexeditor
- Attachement (empty Tileset image [compressed])
- a bit of your brain

Introduction:
In this Tutorial, you will insert a empty Tileset. After inserting it, you have to add/insert the correct data with AdvanceMap.
As common, first create a Backup of your Hack, before starting this tutorial.

needed basic knowledge:
The Tileset Header has these parts:
[compressed, 1 Byte(00 not compressed or 01 compressed)][SubColorChoose, 1 Byte(00 for part 1 Tileset, 01 for part2 Tileset)][0000]
[Pointer to Tileset image, 4 Bytes]
[Pointer to Palettes, 4 Bytes]
[Pointer to BlockData, 4 Bytes]
[Pointer to BehaviorData(RSE) respectively Animations(FRLG), 4 Bytes]
[Pointer to Animations(RSE) respectively BehaviorData(FRLG), 4 Bytes]

To use the new Tileset in AdvanceMap, you have to attend to the AdvanceMap TilesetNumber calculation.
It work as follow:
TilesetNumber = ( - ) / 24.

To calculate the Offset of the Tileset you have to fit the same conditions:
= + (TilesetNumber * 24)
WARNING: on Emerald you have to add + 8 to the result!

Tileset-Header Offset, Tileset 0:
The Offset to calculate the Tileset Numbers for each Version/Language
Rubin:
AXVD=Hex: \$2924DC / Dez: 2696412
AXVE=Hex: \$286CF4 / Dez: 2649332
AXVJ=Hex: \$25F15C / Dez: 2486620
AXVF=Hex: \$28D958 / Dez: 2677080
AXVS=Hex: \$28A28C / Dez: 2663052
AXVI=Hex: \$2871E4 / Dez: 2650596

Saphier:
AXPD=Hex: \$292470 / Dez: 2696304
AXPE=Hex: \$286C84 / Dez: 2649220
AXPJ=Hex: \$25F0EC / Dez: 2486508
AXPF=Hex: \$28D8E8 / Dez: 2676968
AXPS=Hex: \$28A21C / Dez: 2662940
AXPI=Hex: \$287174 / Dez: 2650484

Emerald:
BPED=Hex: \$3F1434 / Dez: 4133940
BPEE=Hex: \$3DF704 / Dez: 4060932
BPEJ=Hex: \$3B7B24 / Dez: 3898148
BPEF=Hex: \$3E45F0 / Dez: 4081136
BPES=Hex: \$3E2D60 / Dez: 4074848
BPEI=Hex: \$3DC448 / Dez: 4047944

Leaf Green:
BPGD=Hex: \$2D4998 / Dez: 2967960
BPGE=Hex: \$2D4A74 / Dez: 2968180
BPGJ=Hex: \$298B24 / Dez: 2722596
BPGF=Hex: \$2CEEC4 / Dez: 2944708
BPGS=Hex: \$2D023C / Dez: 2949692
BPGI=Hex: \$2CDB54 / Dez: 2939732

Fire Red:
BPRD=Hex: \$2D49B8 / Dez: 2967992
BPRE=Hex: \$2D4A94 / Dez: 2968212
BPRJ=Hex: \$298B44 / Dez: 2722628
BPRF=Hex: \$2CEEE4 / Dez: 2944740
BPRS=Hex: \$2D025C / Dez: 2949724
BPRI=Hex: \$2CDB74 / Dez: 2939764

1. Step: search Offset
2. Open your ROM, where you want to insert the new Tileset.
3. Use the "Find free space"-Function to find a free space for your Tileset. (660 Bytes)

4. insert 660 for Needed Bytes and click "OK" to start the search.

For Example i get the Offset: \$718C40 (I use FireRed German)

2. Step: Calculate the effective offset (AM-Logic)
As Described above, we have to calculate the correct offset, otherwise AdvanceMap cannot handle the Tileset.
Wie have to calculate the "Formula" forth ans back:
TilesetNummer = ( - ) / 24.
= + (TilesetNummer * 24)

I use FireRes German, it have the Code BPRD, so i have to use \$2D49B8 as Offset from Tilesets 0.
\$718C40 - \$2D49B8 = \$444288 / \$18 = \$2D81B -> 186395
or in Decimal:
7441472 - 2967992 = 4473480 / 24 = 186395
(PS: I never say it would be an nice TilesetNumber. )

Hm... now the implausibly case occur, that it result a integer.
In the normal case you have a decimal place...
Therefore wie will now cutoff the decimal place and add 1 to the number.
186395+1 => Tileset Number: 186396

And now wie calculate our Offset:
186396 * 24 = 4473504 + 2967992 = 7441496 -> \$718C58
(If it would be an Emerald-ROM we have to add +8)

3. Step: Insert Tileset-Image Data
1. Open your Hexeditor
2. Open your ROM and goto the calculated TilesetHeader Offset.
3. we skip 24 Bytes for TilesetHeader. -> \$718C70 (we notice this Offset)
4. Open the empty Tileset in Attachemend in your Hexeditor.
5. And insert the content to the actual place in your ROM.
5.1. Select filecontent (\$50 / 80 Bytes)
5.2. Edit-> copy
5.3. select the same amount of bytes at teh currend position of your ROM (\$50 / 80 Bytes) \$718C70 to \$718CC0

5.4. Edit->past

4. Step: insert Palette Data
We notice the actual Offset, after inserting TilesetImage. -> \$718CC0
A Palette have 16*16 Colors, each have 2 Bytes.
16*16*2 = 512
We "insert" a empty Palette, so we just skip 512 FF-Bytes. -> \$718EC0

5. Step: insert Block-Data
We notice the actual Offset, after inserting Palettes. -> \$718EC0
Now we insert the Block-Data for 4 empty Blocks.
1 Block have 16 Bytes. (2 Byte for each Tile on it.)
16*4=64
We insert 64 00-Bytes.

6. Step: Insert Behavior-Data
We notice the actual Offset, after inserting Block-Data.-> \$718F00
With Behavior-Data i mean the Behavior-Byte and Background-Byte form Block editor.
We insert Behavior-Data for the 4 Blocks wie inserted before.
On RSE this are 2 Bytes each Block.
On FR/LG this are 4 Bytes each Block.
4*4=16
We insert 16 00-Bytes.

7. Step: insert TilesetHeader
Now we insert the TilesetHeader itself, goto the calculated Offset (\$718C58).
The parts of the TilesetHeader was:
[compressed, 1 Byte(00 not compressed or 01 compressed)][SubColorChoose, 1 Byte(00 for part 1 Tileset, 01 for part2 Tileset)][0000]
[Pointer to Tileset image, 4 Bytes]
[Pointer to Palettes, 4 Bytes]
[Pointer to BlockData, 4 Bytes]
[Pointer to BehaviorData(RSE) respectively Animations(FRLG), 4 Bytes]
[Pointer to Animations(RSE) respectively BehaviorData(FRLG), 4 Bytes]

For our Example this would be: (we need the noticed Offsets)
[01(because it was a compressed Tileset image, we inserted.)][01(because part 2)][0000]
[708C7108] (Offset was: \$718C70)
[C08C7108] (Offset was: \$718CC0)
[C08E7108] (Offset was: \$718EC0)
[00000000] (We have no Animations.)
[008F7108] (Offset was: \$718F00)

Now we have to save the Changes, and close the Hexeditor.

8. Step: use new Tileset on an existing map in AdvanceMap
2. open the Map
3. change to Headerview (the Normal, not professional View)
4. insert our TilesetNumber -> 186396
5. press "Change Tileset"-Button.

6. now change the Map forth and Back, so AdvanceMap load the Tileset correctly.

9. Step: change Tilesetdata
So, now you can change the Tileset Data(Image, Palettes, Block-Data, Behavior-Data) with the Blockeditor.

On the Image you see the 4 new Blocks und the new Tileset image within the red border.

PS: Do not forget the first Tile on each Tileset have to be plain in the first color of the Tileset.

create part 1 Tilesets
Warning on each who want to create part 1 Tilesets!
If you want to create a Tileset for part 1, you have to do this changes on the Tutorial:
All versions:
use 00 for SubColorChoose not 01.

RSE:
You have to insert Block- and Behavior-Data for 512 Blocks, not only 4 Bocks.
that is: 512*16=8192 00-Bytes als Block-Data. 512*2 = 1024 00-Bytes als Behavior-Data.

FR/LG:
You have to insert Block- and Behavior-Data for 640 Blocks, not only 4 Bocks.
that is: 640*16=10240 00-Bytes as Block-Data. 640*4 = 2560 00-Bytes as Behavior-Data.

PS: or you skip the same amount FF-Bytes, i will not you typing your fingers sore. But, Warning!!!.
You have to search a bigger free space at the beginning.
AND WARNING!!! if you skip this Bytes, you will get a really great free space, and AdvanceMap will find this free space on next automaticaly Offset search for inserting some thing. Perhaps on inserting a new Map. And if you change the BlockData afterwards, it would override the Map with your Blockdata, and your map is destroyed!!!

final remark:
This Tutorial is Copyright by LU-HO Poké.
It is not allowed to publish this Tutorial/Images/Attachement on other boards/web pages, expect my explicit permission.
Linking it is allowed.

Greetings LU-HO
Attached Files
 EmptyTileset.zip‎ (187 Bytes, 822 views) (Save to Dropbox)
__________________
Hello out there, you perhaps notice already, I'm no longer active in RomHacking.

It's finally here, AdvanceMap 1.95 (Open Beta).
get it: [Release] AdvanceMap 1.95 Open Beta
Questions about AdvanceMap, found bugs, problems on using it? => contact me.

All versiones of Advance Map are available on ampage.no-ip.info.
The newest version of AdvanceMap is AM 1.95 get it.

Greetz goes to:
Mastermind_X, Tutti, Scizz, Darkmaster01, Tauwasser, F-Zero, Jiggly, Filb, Lugia2000, Mulle, Philb, Jay, TraX, Spacy, Mikaron, Coolman, CrazyNebulak, Arty und Serwe.