PDA

View Full Version : RS Major Tileset Hack


ZodiacDaGreat
December 15th, 2009, 12:46 AM
Ruby Version
@ RS Major Tileset Hack
@ By ZodiacDaGreat
@ ------------------------------------------------------------------

@ Hack 1 - Making the game use a enlarged tileset
@ ------------------------------------------------------------------
To enlarge the major tileset like in Fire Red, we must edit this routine.

08056d38 b500 push {lr}
08056d3a 4903 ldr r1, [$08056d48] (=$06004000)
08056d3c 6940 ldr r0, [r0, #0x14]
08056d3e f7ff bl $08056c98
08056d42 bc01 pop {r0}
08056d44 4700 bx r0
08056d46 0000 lsl r0, r0, #0x00

0x06004000 is the location where Tileset 2 data begins in the VRAM

for Ruby, on Fire Red it starts at 0x06005000. So, to change it -

just edit it to 0x06005000.

This pointer is at 0x56d48 in reversed format. So, to make Ruby use a

Fire Red sized major tileset just insert:
0050 0006 at 0x56d48

@ Hack 2 - Making the game use more tileset blocks
@ -------------------------------------------------------------------
~ Coming Soon~

@ Step 3 - Changing Advance Map's ini setting
@ -------------------------------------------------------------------
Finally we need Advance Map to display the correct tileset size, so

we need to hack it's ini. Find 'AdvanceMap.ini' in the ini folder and

find this:

[Version:AXV]
mainfile=ini/Main.ini
mapsfile=ini/Maps.ini
TilesetIni=ini/Tilesets.ini
Tilesethoehe=32 @ This value must be 40
Teil1Bloecke=$200
SpritePalettenAnz=27
AnzMapNamen=87
AnzTilesets=57
SuchByte=$FF
SuchBeginn=$6B0000
AnzItems=348

Emerald Version
@ Emerald Major Tileset Hack
@ By ZodiacDaGreat
@ ------------------------------------------------------------------

@ Hack 1 - Making the game use a enlarged tileset
@ ------------------------------------------------------------------
To enlarge the major tileset like in Fire Red, we must edit this routine. It looks way too different from Ruby's uh? Well, this is because later games were

more protected. Below I've commented the parts to hack to make it load the major tileset like Fire Red.

08088d78 b500 push {lr}
08088d7a 6940 ldr r0, [r0, #0x14]
08088d7c 2280 mov r2, #0x80 @ mov r2, #0xA
08088d7e 0092 lsl r2, r2, #0x02 @ lsl r2, r2, #0x6
08088d80 1c11 add r1, r2, #0x0
08088d82 f7ff bl $08088c78
08088d86 bc01 pop {r0}
08088d88 4700 bx r0
08088d8a 0000 lsl r0, r0, #0x00

Why change it to what I've commented?
Because on Emerald the 0x06004000 (Where the major tileset is loaded in the VRAM) is calculated. How?

The above routine left shifts the r2 value by 2. So, 80 left shifted by 2 is 0x200; the value is again left shifted by 0x5 in another routine making it

0x4000. That 0x4000 is added to 0x06000000 (VRAM base address) in another routine just before it is taken as the value to load the tileset. So, to change

that we simply need to re-calculate the value added to the base address of the VRAM. That's all you have to change.

My changes were 0xA left shifted by 0x6, which gives 0x280 and 0x280 left shifted by 0x5 is 0x5000. So, to hack it insert 0A 22 92 01 at 0x88d7c.

@ Hack 2 - Making the game use more tileset blocks
@ -------------------------------------------------------------------
~ Coming Soon~

@ Step 3 - Changing Advance Map's ini setting
@ -------------------------------------------------------------------
Finally we need Advance Map to display the correct tileset size, so

we need to hack it's ini. Find 'AdvanceMap.ini' in the ini folder and

find this:

[Version:BPE]
mainfile=ini/Main.ini
mapsfile=ini/Maps.ini
TilesetIni=ini/EmTilesets.ini
Tilesethoehe=32 @ This value must be 40
Teil1Bloecke=$200
SpritePalettenAnz=27
AnzMapNamen=213
AnzTilesets=74
SuchByte=$00
SuchBeginn=$6B0000
AnzItems=376

Fire Red Version
@ FRLG Major Tileset Hack
@ By ZodiacDaGreat
@ ------------------------------------------------------------------
This is exactly like Emerald's hack, but in different format. The

routine we're interested in is this:

08059a7c b500 push {lr}
08059a7e 6940 ldr r0, [r0, #0x14]
08059a80 21c0 mov r1, #0xc0
08059a82 0049 lsl r1, r1, #0x01
08059a84 22a0 mov r2, #0xa0 @ Value 1
08059a86 0092 lsl r2, r2, #0x02 @ Value 2
08059a88 f7ff bl $08059888
08059a8c bc01 pop {r0}
08059a8e 4700 bx r0

0xA0 left shifted by 0x2 = 0x280. 0x280 left shifted by 0x5 is

0x5000. 0x5000 is added to the base VRAM address to give you the

location from where tileset is to be loaded. I don't recommend

changing Fire Red's though :P Cause there's already enough space.

Unfixed Issues
- When you enter Mauville or some other city with loads of animations in Tileset 2 the map becomes screwed up. To fix this you need to edit your animations, Juan's tutorial mentions how to do that, you just need to change the VRAM address for the animation as well of Tileset 2.
Edit: Did more research and found out that cities which was screwed up was due to the large second tileset. So, once you apply this hack - your Tileset 2 cannot be large like Slateports' or Mauvilles' as in Fire Red no tileset 2 is that large.

The reason why, is because when it because large it overwrites the empty data used for the screen and the Town/City/Route label hence causing a weird display. If you don't understand what I'm saying just go study Fire Red in the Tile Viewer for char bases 0x06000000, 0x06004000, 0x06008000. You'll see that no tileset reaches 0x06008000 but when you apply this hack on Ruby and you check char base 0x06008000 - there's tileset data there.

- Tileset 2 tiles are all in a mess, this is because when we changed the location for where Tileset 2 begins in the VRAM to it's new place, the block data still used the original unchanged location. I'll fixed this soon.
Edit: That's wrong XD, everything is fine but you need to redo your tiles in Advance Map's Block Editor

Finally, the animation routines for your previous tileset 2 must be edited to reflect the changes in this hack ^^

This is what I did just now, from what you can see it's from my private home made documentation of all the stuff I hack, I decided to release this to the public... Have fun as always give credit and don't claim this as your tutorial ;)

diegoisawesome
December 15th, 2009, 04:24 PM
Do you think you could maybe adapt it for use in Fire Red? I'm hacking Fire Red, and this would be extremely useful.

[offtopic]1st post! W00T!

ZodiacDaGreat
December 15th, 2009, 04:42 PM
Do you think you could maybe adapt it for use in Fire Red? I'm hacking Fire Red, and this would be extremely useful.

[offtopic]1st post! W00T!
Yeah, adapting it for Fire Red isn't hard, but why? Increasing more space on the major tileset in Fire Red will mean lesser space for the secondary tileset is it? Anyway, I'll post the Fire Red adaption later, you just need to change the VRAM offset as well ;)

Sleepwalker
December 15th, 2009, 04:44 PM
Can you do the same thing to Emerald following those steps?

Liquid Shadow
December 15th, 2009, 05:28 PM
....WOW... You don't understand how much this has helped me and how many restrictions it removed.

I'm simply amazed, once again.

~Teh Panda~
December 15th, 2009, 05:30 PM
EDIT: Alright so now it all looks good in amap, but now when I load up the rom everything is screwed up

ZodiacDaGreat
December 15th, 2009, 08:34 PM
EDIT: Alright so now it all looks good in amap, but now when I load up the rom everything is screwed up
Yeah XD I re-checked and found the same, so I edited the thread. Read the Unsolved Issues - you must've faced those eh?

~Teh Panda~
December 15th, 2009, 08:54 PM
Yeah XD I re-checked and found the same, so I edited the thread. Read the Unsolved Issues - you must've faced those eh?

Actually I did not xD, I witnessed the errors then had to go do homework, will talk to you more about it on MSN I presume.

Pokepal17
December 16th, 2009, 04:58 AM
Wow, this is awesome. :D

However vould you add some screenies for the people who don't like reading need visual aid, please?

And it's a shame that when one tileset gets bigger, the other one must get shorter. Hope yuo find a fix for this :)

ZodiacDaGreat
December 16th, 2009, 10:40 AM
Okay, I'll add it when I have sometime but the thing with ASM is with visual aids it becomes too long - me I keep them all in .txts in one folder :P Anyway, this hack is copying Fire Red's tileset system so tileset 2 isn't geting shorter. It's just some maps in R/S which previously had big tilesets must be reduced or you'll enter a glitchy map - I'm sure you liked Fire Red's tileset system ;)

Pokepal17
December 16th, 2009, 12:42 PM
Okay, I'll add it when I have sometime but the thing with ASM is with visual aids it becomes too long - me I keep them all in .txts in one folder :P Anyway, this hack is copying Fire Red's tileset system so tileset 2 isn't geting shorter. It's just some maps in R/S which previously had big tilesets must be reduced or you'll enter a glitchy map - I'm sure you liked Fire Red's tileset system ;)


Yes I did, very much. :)

However, I find it useful for R/S/E but I don't see why a lot of people would want to do the inverse with Fire Red since if you're careful and don't insert multiple tiles, there should be no problem. :P

interdpth
December 30th, 2009, 08:46 PM
Thanks for all the help, Zodiac

ZodiacDaGreat
December 30th, 2009, 08:51 PM
Yeah, the thing's updated with how to do it on Emerald, I'll research the Fire Red way now.

Edit: Added the Fire Red version one ^^ But not with the patching bytes, to patch or hack the routine you need an assembler.

altariaking
April 25th, 2010, 04:32 AM
ok, i did everything you said for emeeald.
when i open it in advance map, it's fine.
when i open it in vba, not fine.
a lot of tiles like grass are all glitchy.

diegoisawesome
May 6th, 2010, 04:10 PM
What we need now is that Step 2.
EDIT: Applying the patch for Emerald, strangely enough, didn't work.
EDIT2: Not only did it not work as expected, here's exactly what it did:
1. At first, when walking out a door, it loaded Tileset 2 into 0x06004000. I thought, this is strange...
2. Then, when walking to another map, the entire screen crapped up. Looking at the tile viewer, I saw that it had ended up loading Tileset 2 into 0x06005000, but keeping the version in 0x06004000 as well, and loading everything that the 0x06004000 version had overwritten, but after the 0x06005000 version!
My guess is that you found only one of the routines.
EDIT3: I was right! There are three more routines that you need to patch: 0x88DB6, 0x88D68, and 0x88D54, although only the first and fourth bytes, otherwise the other calculations would go awry. But you already know that, I'm talking to the people who look through this thread for a fix.
The end result is still screwed up when walking from one map to the next, but it's working for the most part.

ZodiacDaGreat
May 9th, 2010, 09:14 PM
What we need now is that Step 2.
EDIT: Applying the patch for Emerald, strangely enough, didn't work.
EDIT2: Not only did it not work as expected, here's exactly what it did:
1. At first, when walking out a door, it loaded Tileset 2 into 0x06004000. I thought, this is strange...
2. Then, when walking to another map, the entire screen crapped up. Looking at the tile viewer, I saw that it had ended up loading Tileset 2 into 0x06005000, but keeping the version in 0x06004000 as well, and loading everything that the 0x06004000 version had overwritten, but after the 0x06005000 version!
My guess is that you found only one of the routines.
EDIT3: I was right! There are three more routines that you need to patch: 0x88DB6, 0x88D68, and 0x88D54, although only the first and fourth bytes, otherwise the other calculations would go awry. But you already know that, I'm talking to the people who look through this thread for a fix.
The end result is still screwed up when walking from one map to the next, but it's working for the most part.
Okay, part of your discovery is right, the screen gets messed up when your tileset 2 is bigger than it is on Fire Red. Cause on Fire Red tileset 2 is small, while R/S/E tileset 2's are bigger.

Edit: Yeah, I remember now why I didn't proceed further to edit the other 3 parts. Because, as you said coming out indoors the tileset 2 gets loaded into 0x06004000. Well, this didn't matter since the map refreshes when you goto another map (outdoors). And there wasn't any bugs, AFAIK. Anyway, if you're interested in patching the full thing feel free :)

diegoisawesome
May 10th, 2010, 01:45 PM
Can I get your MSN? It would be much faster if we could talk on there.

diegoisawesome
July 26th, 2010, 08:08 AM
Sorry for double posting, but I finally fixed the routine for Emerald! (almost perfect)
0x88DB6, 0x88D68, and 0x88D54 need to be overwritten with 0A XX XX 01, where XX stands for bytes that you DO NOT change.

Then, paste 00 B5 40 69 C0 21 49 00 A0 22 92 00 FF F7 78 FF 01 BC 00 47 in 0x88D78, and test it out. Ta-da!

I found the solution when I copied over some bytes from FR, and kept messing with them until everything was coming out correctly. This included fixing the bl $08088c78 which was shifted over two bytes (and therefore I wrote my own bl).

knizz
January 2nd, 2011, 03:09 AM
Here is another function that needs to be edited when changing the tileset sizes on Firered: 08059080

Quickster
May 24th, 2011, 02:22 PM
Im pretty sure that theres no thread revival limit in this sub section, but if there is, I apologize mods. I want to do the routine for emeralds tileset, and possibly fire red, but I do not know the first place to start. I tried to learn basic ASM from the multiple tutorials here, but I still cant understand this. Can someone tell me where to begin and the basics of doing this?

Deokishisu
September 18th, 2012, 04:03 PM
Sorry for double posting, but I finally fixed the routine for Emerald! (almost perfect)
0x88DB6, 0x88D68, and 0x88D54 need to be overwritten with 0A XX XX 01, where XX stands for bytes that you DO NOT change.

Then, paste 00 B5 40 69 C0 21 49 00 A0 22 92 00 FF F7 78 FF 01 BC 00 47 in 0x88D78, and test it out. Ta-da!

I found the solution when I copied over some bytes from FR, and kept messing with them until everything was coming out correctly. This included fixing the bl $08088c78 which was shifted over two bytes (and therefore I wrote my own bl).

Thank goodness there isn't a thread revival limit here!

I did what diegoisawesome said to do here, but my tileset 0 in Emerald still only holds 1FF blocks instead of Firered's 27F. Please tell me I grossly misunderstood what I was doing and that I'm missing a simple step somewhere. AdvanceMap's .ini has already been edited to what the original post suggested.

diegoisawesome
September 18th, 2012, 04:31 PM
Thank goodness there isn't a thread revival limit here!

I did what diegoisawesome said to do here, but my tileset 0 in Emerald still only holds 1FF blocks instead of Firered's 27F. Please tell me I grossly misunderstood what I was doing and that I'm missing a simple step somewhere. AdvanceMap's .ini has already been edited to what the original post suggested.
By blocks, do you mean blocks made out of tiles? If so, this isn't what you need. This hack changes the amount of TILES, not the number of BLOCKS.

Deokishisu
September 18th, 2012, 05:11 PM
By blocks, do you mean blocks made out of tiles? If so, this isn't what you need. This hack changes the amount of TILES, not the number of BLOCKS.

OH! Okay, so this is really only half of what it takes to make Emerald's tilesets work exactly as Firered's does.

I suppose I'll start searching around for how to change the block amount as well. (Can you tell I haven't done any hacking in a while?)