PDA

View Full Version : [Tutorial] [Tut]Create complet new Tileset for Pokemon GBA games


LU-HO
October 5th, 2008, 08:14 AM
Hello all

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

What do you need:
- Hexeditor
- AdvanceMap
- 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 = (<TilesetHeader-Offset> - <TilesetHeader-Offset Tileset 0>) / 24.

To calculate the Offset of the Tileset you have to fit the same conditions:
<TilesetHeader-Offset> = <TilesetHeader-Offset Tileset 0> + (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
1. Open AdvanceMap.
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)
http://img137.imageshack.us/img137/1268/findfreespacedz2.th.png (http://img137.imageshack.us/my.php?image=findfreespacedz2.png)http://img137.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
4. insert 660 for Needed Bytes and click "OK" to start the search.
http://img410.imageshack.us/img410/2471/findfreespacewindowaa1.th.png (http://img410.imageshack.us/my.php?image=findfreespacewindowaa1.png)http://img410.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
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 = (<TilesetHeader-Offset> - <TilesetHeader-Offset Tileset 0>) / 24.
<TilesetHeader-Offset> = <TilesetHeader-Offset Tileset 0> + (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)
Tileset-Header Offset: $718C58

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
http://img525.imageshack.us/img525/718/bereichausgewaehlttq8.th.png (http://img525.imageshack.us/my.php?image=bereichausgewaehlttq8.png)http://img525.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
5.4. Edit->past
http://img142.imageshack.us/img142/219/bereicheingefuegtrq5.th.png (http://img142.imageshack.us/my.php?image=bereicheingefuegtrq5.png)http://img142.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

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.
http://img142.imageshack.us/img142/1370/blockdateneingefuegtmx8.th.png (http://img142.imageshack.us/my.php?image=blockdateneingefuegtmx8.png)http://img142.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

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.
http://img142.imageshack.us/img142/1742/aufgabendateneingefuegtrt7.th.png (http://img142.imageshack.us/my.php?image=aufgabendateneingefuegtrt7.png)http://img142.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

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)
http://img394.imageshack.us/img394/8311/headereingefuegtjn4.th.png (http://img394.imageshack.us/my.php?image=headereingefuegtjn4.png)http://img394.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

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

8. Step: use new Tileset on an existing map in AdvanceMap
1. open AdvanceMap and your ROM
2. open the Map
3. change to Headerview (the Normal, not professional View)
4. insert our TilesetNumber -> 186396
5. press "Change Tileset"-Button.
http://img396.imageshack.us/img396/5004/changetilesetnummeraq1.th.png (http://img396.imageshack.us/my.php?image=changetilesetnummeraq1.png)http://img396.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
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.
http://img518.imageshack.us/img518/9382/blockeditorrahmenes7.th.png (http://img518.imageshack.us/my.php?image=blockeditorrahmenes7.png)http://img518.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
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

ZodiacDaGreat
October 5th, 2008, 10:38 AM
Ah, cool.... I hope you implement this in Advance Map cause I'll be needing this :)

LU-HO
October 5th, 2008, 11:21 AM
Ah, cool.... I hope you implement this in Advance Map cause I'll be needing this :)

It will take much time until AdvanceMap will be released, so i released this tutorial so you don't have to wait until i release it, and you can insert new Tilesets now.

Darthatron
October 5th, 2008, 07:39 PM
Very nice. And pretty easy to understand. =) I can't wait until you implement it into Advance Map.

Thrace
October 6th, 2008, 02:33 AM
This is nice, I'm not sure how useful this is though. Surely there are enough tilesets already. I'd really like to see a tutorial on how to add animations to tiles.

cooley
October 6th, 2008, 02:53 PM
This is definitely useful to some "graphical" Hackers, Maybe I should make a "Calculator" Tool for it, but it doesn't seem to really spark my interests. I just don't know...

Derlo
October 13th, 2008, 02:18 PM
Hello!
This is really a great tutorial!!
Well, I followed all correctly of the steps (I Think so)...
Everything gave right in AMAP.... but when I will play Rom
in the emulator the palettes don't work!
Here below the image:
http://img239.imageshack.us/img239/7483/erroaq9.png (http://imageshack.us)
What should I make for adjusting that?

Lady Berlitz
October 13th, 2008, 03:05 PM
Wow, a tutorial by LU-HO? This is unexpected.
Also, this is quite original, as most tutorials have the same idea; but this is totally different.

I'm a little lazy when it comes to following step-by-step things, but I'll try this at one point.

Thanks for writing this! It seems like it can add a lot better hacks to PC over time.

LU-HO
October 14th, 2008, 02:31 PM
Hello!
This is really a great tutorial!!
Well, I followed all correctly of the steps (I Think so)...
Everything gave right in AMAP.... but when I will play Rom
in the emulator the palettes don't work!
Here below the image:
http://img239.imageshack.us/img239/7483/erroaq9.png (http://imageshack.us)
What should I make for adjusting that?

Can you please post an Image of the palettes from VisualBoyAdvance.
and some pictures with the palettes from AdvanceMap, so i can see where exactly is the difference.

Megiddo-san
October 14th, 2008, 03:49 PM
I have the same problem.
http://i255.photobucket.com/albums/hh139/oddigem/amappal.png?t=1224028084
http://i255.photobucket.com/albums/hh139/oddigem/vbapal.png?t=1224028148

Derlo
October 14th, 2008, 05:38 PM
The image of Meggido is the same that mine!
I also used PAL7.
And in Palet View of VBA all the colors are white.

LU-HO
October 15th, 2008, 11:42 AM
pleas try to replace all 512 Byte of the palette with 00-Bytes instant of let them FF.
and report what happen if you change the colors afterwards.
the problem might be that FFFF is not a valid Color code 7FFF is the highest valid color. so if all are 0000 this would fix this.

Megiddo-san
October 15th, 2008, 02:20 PM
When I changed them all to 00 then redid the edit, the tile turned out all black.

Derlo
October 16th, 2008, 03:51 AM
I also tried that.
And the same thing of Meggido happened.
Now everything that was WHITE, was BLACK!

The problem for the the one that I saw is the following:
AMAP recognizes the offset of the palettes, but VBA no.
If I use the normal palettes of the rom, the tiles are visible,
but when I use the new palette that problem happens.

LU-HO
October 19th, 2008, 09:31 AM
Hello all

I found the error for megiddo and Derlo.
you have to use 01 for SubColorChoose.
so the header for my example is:
[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)

I fixed this in the tutorial text.

sorry i forget this Part ^^"

Greetz LU-HO

Derlo
October 19th, 2008, 05:53 PM
Thank you LUHO!!
Now it is perfectly working!
You are the best!

Neti
November 2nd, 2008, 09:08 AM
Really useful, but i think i would die when trying it^^
i would really appreciate someone making a tool for this

LU-HO
November 2nd, 2008, 09:12 AM
Really useful, but i think i would die when trying it^^
i would really appreciate someone making a tool for this

Hacking with tools is no spezial skill.
If you want be a RomHacker you have to know how you use the Hexeditor.
And this Tutorial is a Simple description how you could add a new Tileset with a HexEditor. No spezial/difficult thing for a real RomHacker.

Zeikku™
November 2nd, 2008, 09:20 AM
Hacking with tools is no spezial skill.
If you want be a RomHacker you have to know how you use the Hexeditor.
And this Tutorial is a Simple description how you could add a new Tileset with a HexEditor. No spezial/difficult thing for a real RomHacker.

I actually agree that this doesn't seem too hard, thanks for the tut anyways,
I need to try this when I'm free :)
I agree that real rom hackers should be able to hex edit,
that is completely true. Not everything is tool based yet xD

torferno lvl-X
November 2nd, 2008, 10:33 AM
I'm gonna try this immediately.

dragonarche
November 11th, 2008, 03:12 AM
good tut
very clear instructions thanks
now i can add whole new tiles












~Shadow Magikarp

ZodiacDaGreat
December 8th, 2008, 12:16 PM
Hmm.. There's something I needed to ask.
A Palette have 16*16 Colors, each have 2 Bytes.
16*16*2 = 512
Um, I don't think its 16. 12 for secondary tilesets and 6 for the main tileset, that's for RSE I suppose.

Edit: Ah, I see now LU-HO, Amap shifts some bytes down... Anyway, I'm fine now.
@Others: People who want a tool for this, expect one soon. "AXVE" & "BPRE" are already supported :)

Edit2: Tool is out check the toolbox :)

Liquid Shadow
December 19th, 2008, 09:00 PM
Would there be a way to change the dimensions of the tileset you can insert into RUBY using the hex data given? This would be really helpful as it will allow more leniency in how big your tileset should be.

ZodiacDaGreat
December 19th, 2008, 11:07 PM
lol, that's easy. Although at present theres no such tool that can resize your tileset for you but you could easily dump tilesets of any sizes from unLZ and edit them with tiles you favor.

LU-HO
December 20th, 2008, 06:39 AM
Would there be a way to change the dimensions of the tileset you can insert into RUBY using the hex data given? This would be really helpful as it will allow more leniency in how big your tileset should be.

Hi

No it is not possible to insert a bigger (first part) Tileset. (Image or block count)

If it would be possible, it would be very hard ASM (assembler) work.
and no body knows how it could work, or where he have to change the ASM.

Greetz LU-HO

emokitty
April 28th, 2009, 10:41 AM
Hey guys Im really new to Rom Hacking and I dont yet know how to hex edit. Does anyone have any good Hexediting tutorials?

mewthree w/armor
April 29th, 2009, 04:13 AM
One month rule. Closed. *Closed*