Thread: Research: RS Major Tileset Hack
View Single Post
  #1    
Old December 15th, 2009 (12:46 AM). Edited December 30th, 2009 by ZodiacDaGreat.
ZodiacDaGreat's Avatar
ZodiacDaGreat ZodiacDaGreat is offline
Working on a Mobile System
     
    Join Date: Feb 2007
    Location: South Pacific
    Age: 25
    Gender: Male
    Nature: Relaxed
    Posts: 429
    Ruby Version
    Spoiler:
    @ 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
    Spoiler:
    @ 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
    Spoiler:
    @ 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 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
    __________________
    Reply With Quote