• 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.

Development: Porting RS Tile System to Firered

94
Posts
13
Years
  • Seen Nov 2, 2016
Hey everyone, as you may know there are differences between FRLG and RS with the major/minor tilesets. If not here is some info.

tile - a 8x8 pixel piece used to form blocks, there are 1024 tiles in 2 combined (major+minor) tilesets
block - has 2 layers, a top and bottom, each 16x16 pixels, each layer is made of 4 tiles, there are 1024 tiles in a major/minor tileset as well

RS:
Major tileset: DIB image size is 128x256 pixels
Minor tileset: DIB image size is 128x256 pixels
Major tileset: block amount is 512
Minor tileset: block amount is anywhere from 1-512
Major tileset: 512 tiles
Minor tileset: 512 tiles

As you can see the minor and majors are the same size in RS. But in FRLG, because gamefreak wanted to imitate RBY, they switched it up a bit.

FRLG:
Major tileset: DIB image size is 128x320 pixels
Minor tileset: DIB image size is 128x192 pixels
Major tileset: block amount is 640
Minor tileset: block amount is anywhere from 1-384
Major tileset: 640 tiles
Minor tileset: 640 tiles

Because I want to use RS's system on Fr I started a "port", but run into some problems. Here's what to do:

To insert the tilesets correctly make 2 small changes to advancemap.ini. Where it says Tilesethoehe*(tileset height), change it from 40 to 32.
And at Teil1Bloecke (amount of blocks in tileset 1) change it from $280 to $200(in decimal that is from 640 to 512). This way the tilesets now insert correctly, and you can have the correct block amounts, 512 and 512.

*Tilesethoehe is the major tileset's amount of vertical tiles. Since one tile is 8 pixels tall you could fit 32 in one column that is 256 pixels in length, and 40 in one that is 320 pixels in length. The width is not changeable it is always 128 pixels, aka 16 tiles. So obviously, there in a frlg major set there are 40*16 = 640 tiles, minor 24*16 = 384, for a total of 1024. And for rs both major and minor have 32*16 = 512 tiles. DO NOT let this fool you - there are 1024 tiles in 2 sets, and 1024 blocks made out of those tiles in 2 sets as well.

Now the remaining problems are with the code. They don't load correctly into VRAM. The thread below by ZDG shows how to do it in FR. Where it creates the 0x280 that later becomes 0x5000 and is added to vram to create the location for tileset 2, I changed it to 0x200 so that it becomes 0x4000 (the offset added to vram start address 0x06000000).
http://www.pokecommunity.com/showthread.php?t=203040
The other routines each of 0x280(640) and 0x180(384) and so I assume them to be the block amounts. I changed them all to 0x200(512). I even took a look at the changes in prime's DNS which alters the tile loading functions, and i've seemingly found them all (there are many spots around the area that use 0x280/27F and 0x180/17F.

My problem now is that the blocks are scrambled. The tilesets inserted correctly and load properly in vram, the blocks are formed correctly, but the problem is the block numbers are all messed up. For example, where I choose block 0x4, block 0x80 would show up. As far as I can tell it is always the same pattern of random blocks that show up - this happens on only the minor tileset, the major is fine.

I tried editing all these places which are part of the map routines:
08059090 area, 08059a50 area, 0805a970 area, 08070040 area, and 08070490 area. All I did was change the creation of the values 0x27F/17F/280/180 to 0x1FF/200, but still am getting that problem with the blocks. Obviously, I'm missing something or going about this the wrong way. Any ideas?
 
Last edited:
94
Posts
13
Years
  • Seen Nov 2, 2016
Just sorted it out, changes needed are as follows:
change 080590D4 to 0xFFFFF800
change 0805A9B0 to 0xFFFFFE00
change 080590A4, 0809B808, and 0805A97C to 0x1FF
change 08059A56, 08059A70, 08059A84, 08059ABA, 0807015C, 08059A6C, 08059A80, and 08059AC8 to 0x200.
Change your amap settings for firered to 40 for tilesetheight and $200 for the block amount for tileset 1. You should be able to insert correctly and the game should load both tilesets correctly.

Needs more testing though...might be missing some stuff. Oh, and thanks Darthatron for pointing out that 0xFFFFE00 is also -0x280. :p
 

Full Metal

C(++) Developer.
810
Posts
16
Years
This is a very original idea, in my opinion.
But...I don't understand why you would want to do it.
FR offers more room for more blocks and tiles, does it not? :\
I would have swapped things the other way around.
Maybe there's just something I'm not seeing here...
 
94
Posts
13
Years
  • Seen Nov 2, 2016
I did it simply because the tilesets I had make more sense this way. And actually, you get many more tiles out of it. You have 2 majors in both, but many more minors in each. The majors may be a bit smaller in ruby but the minors are much bigger.
i.e. if you have 64 sets...
Fr: 2 ma: 640 * 2 = 1280
62 mi: 384 * 62 =23038
total = 25088
RS: 2 maj: 512 * 2 = 1024
62 min: 512 * 62 = 31744
total = 32768
That goes for blocks and tiles. So much more space, and thats only setting the major to the same size :P

The other thing is now its completely customizable. You could for example use next to no space for the major sets and that gives you a lot more space in the minors. Just edit the amap.ini and the code values to what you nee.
 
1,323
Posts
16
Years
  • Seen Dec 9, 2023
change 08059A56, 08059A70, 08059A84, 08059ABA, 0807015C, 08059A6C, 08059A80, and 08059AC8 to 0x200.
Are you sure those offsets are correct? None of those offsets are originally 0x180 or 0x280 (reading your logic in the first post), and when I tried the whole process (yes, I edited the AMap ini, and yes, I imported tile and palette data for both tilesets from Pokemon Ruby), but all I ended up with is a black screen.

Are you working with a different-language ROM?
 
94
Posts
13
Years
  • Seen Nov 2, 2016
Are you sure those offsets are correct? None of those offsets are originally 0x180 or 0x280 (reading your logic in the first post), and when I tried the whole process (yes, I edited the AMap ini, and yes, I imported tile and palette data for both tilesets from Pokemon Ruby), but all I ended up with is a black screen.

Are you working with a different-language ROM?

Sorry man, should have specified this. Assuming you want the RS tileset system exactly... well, let's take a look at this (fr US):

1. change 080590D4 to 0xFFFFF800
2. change 0805A9B0 to 0xFFFFFE00
3. change 080590A4, 0809B808, and 0805A97C to 0x1FF
4. change 08059A56, 08059A70, 08059A84, 08059ABA, 0807015C, 08059A6C, 08059A80, and 08059AC8 to 0x200.

1. 080590D4 is word that is loaded. Originally, this is 0xFFFFF600. Take 0x280 and shift it left twice and subtract that from 0x100000000, is the easiest way to figure it out. It works in reverse. We want 0x200 left shifted twice, so simply change it to 0xFFFFF800.

2. 0805A9B0 is also a loaded word. Originally it is 0xFFFFFD80, which is 0x100000000 minus 0x280. We need 0x200, so change it to 0xFFFFFE00.

3. 080590A4, 0809B808, and 0805A97C are all loaded halfwords, and are all 0x27F by default. (0x280 - 1). We're again aiming for 0x200, so change these 3 to 0x1FF.

4. These last 8 locations are sections of code. (By default all of these are 0x280 or 0x180, And we need want 0x200 to use the RS tileset system). They use a trick that save memory, and is much faster than loading to create the values. It uses a mov command to generate a certain value, then just bitshifts it left. So again, these are asm code areas, not data. Easiest way to do this is to copy 0x80 into the register then shift it left twice. I can provide a patch if you like.

In other words for 4 just do this:
In hex:
Change 08059A58 to 80
Change 08059A6C to 80 and 08059A6E to 89
Change 08059A70 to 80
Change 08059A80 to 80 and 08059A82 to 89
Change 08059A84 to 80
Change 08059ABA to 80
Change 08059AC8 to 80 and 08059ACA to 89
Change 0807015C to 80

Should take care of it
 
Last edited:

anonyboy

Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-C
286
Posts
10
Years
Hi, I tried to apply the hack on my FR rom with the VBA Memory viewer but the changes hadn't saved at all. what should I do?
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
Hi, I tried to apply the hack on my FR rom with the VBA Memory viewer but the changes hadn't saved at all. what should I do?

The VBA memory viewer only modifies it for that instance of running VBA (ie it never, ever saves changes). If you want to keep your changes you need to use a hex editor like HxD or Hex Workshop.
 

Kenny1

On a break from Rom hacking, to improve other skil
86
Posts
10
Years
  • Age 23
  • Seen Nov 6, 2017
Hi, I tried to apply the hack on my FR rom with the VBA Memory viewer but the changes hadn't saved at all. what should I do?
Try edit them in a Hex editor, I don't think VBA Memory Viewer edits the rom.
ShinyQuagsire beat me to it.
 

anonyboy

Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-C
286
Posts
10
Years
The VBA memory viewer only modifies it for that instance of running VBA (ie it never, ever saves changes). If you want to keep your changes you need to use a hex editor like HxD or Hex Workshop.

But how do I find RAM Offsets in HxD??
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
But how do I find RAM Offsets in HxD??

From the second post:

080590D4 is the global memory offset. This is what the GBA uses to look in the ROM, which starts at 08000000. So to find it in a hex editor, we'd subtract 08000000 and get 050D4, which is what we can use in our hex editor.
 

anonyboy

Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-C
286
Posts
10
Years
for some reason, after i insert Prime-Dialga's DNS with the RSE tile system in, it seems to change the values in 08059A58,08059A6C,08059A6E. hence making some of the blocks unfunctional. after i revert those values, when i start a game the screen goes black.
 
33
Posts
10
Years
  • Age 28
  • Seen Apr 27, 2020
Anyone know how to use the same palette system as rse in frlg? in rse palettes 0-6 are for tileset 1 but in frlg only palettes 0-5 are
 
1
Posts
5
Years
  • Age 33
  • Seen Apr 21, 2019
Sorry man, should have specified this. Assuming you want the RS tileset system exactly... well, let's take a look at this (fr US):

1. change 080590D4 to 0xFFFFF800
2. change 0805A9B0 to 0xFFFFFE00
3. change 080590A4, 0809B808, and 0805A97C to 0x1FF
4. change 08059A56, 08059A70, 08059A84, 08059ABA, 0807015C, 08059A6C, 08059A80, and 08059AC8 to 0x200.

1. 080590D4 is word that is loaded. Originally, this is 0xFFFFF600. Take 0x280 and shift it left twice and subtract that from 0x100000000, is the easiest way to figure it out. It works in reverse. We want 0x200 left shifted twice, so simply change it to 0xFFFFF800.

2. 0805A9B0 is also a loaded word. Originally it is 0xFFFFFD80, which is 0x100000000 minus 0x280. We need 0x200, so change it to 0xFFFFFE00.

3. 080590A4, 0809B808, and 0805A97C are all loaded halfwords, and are all 0x27F by default. (0x280 - 1). We're again aiming for 0x200, so change these 3 to 0x1FF.

4. These last 8 locations are sections of code. (By default all of these are 0x280 or 0x180, And we need want 0x200 to use the RS tileset system). They use a trick that save memory, and is much faster than loading to create the values. It uses a mov command to generate a certain value, then just bitshifts it left. So again, these are asm code areas, not data. Easiest way to do this is to copy 0x80 into the register then shift it left twice. I can provide a patch if you like.

In other words for 4 just do this:
In hex:
Change 08059A58 to 80
Change 08059A6C to 80 and 08059A6E to 89
Change 08059A70 to 80
Change 08059A80 to 80 and 08059A82 to 89
Change 08059A84 to 80
Change 08059ABA to 80
Change 08059AC8 to 80 and 08059ACA to 89
Change 0807015C to 80

Should take care of it

For the 4th point, when I'm trying to modify the relevant offsets, I noticed that none of the offsets were originally 0x280 or 0x180. Also, it was mentioned in the 4th point to change the 8 offsets (08059A56, 08059A70, 08059A84, 08059ABA, 0807015C, 08059A6C, 08059A80, and 08059AC8) to 0x200. However, at the end of the post it mentions to change several other offsets to 80 (or 89 instead for some others). Would just like to clarify - should I modify the offset values to 0x200 for the 8 offsets OR change the 11 offsets to 0x80 (or 0x89 as necessary)?

Would appreciate any help here, as I'm new to hex editing and ROM hacking in general.
 
Back
Top