The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.


Advertise here

Reply
 
Thread Tools
  #1    
Old December 30th, 2011, 03:41 PM
NintendoBoyDX
Togepi
 
Join Date: Jul 2010
Gender: Male

Advertise here
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 by NintendoBoyDX; December 31st, 2011 at 02:14 PM.
Reply With Quote
  #2    
Old January 1st, 2012, 02:14 AM
NintendoBoyDX
Togepi
 
Join Date: Jul 2010
Gender: Male
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
Reply With Quote
  #3    
Old January 1st, 2012, 04:07 AM
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter Tier 2
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 22
Gender: Male
Nature: Modest
Really nice work man. I knew you could pull it off.
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote
  #4    
Old January 1st, 2012, 09:37 AM
Full Metal's Avatar
Full Metal
C(++) Developer.
Community Supporter
 
Join Date: Jan 2008
Location: In my mind.
Age: 19
Gender: Male
Nature: Timid
Send a message via Windows Live Messenger to Full Metal
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...
__________________

★ full metal.

I like to push it,
and push it,
until my luck is over.
Reply With Quote
  #5    
Old January 1st, 2012, 11:36 AM
NintendoBoyDX
Togepi
 
Join Date: Jul 2010
Gender: Male
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

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.
Reply With Quote
  #6    
Old January 1st, 2012, 04:09 PM
Full Metal's Avatar
Full Metal
C(++) Developer.
Community Supporter
 
Join Date: Jan 2008
Location: In my mind.
Age: 19
Gender: Male
Nature: Timid
Send a message via Windows Live Messenger to Full Metal
Ahh, I see. That is actually a pretty good advantage there!
__________________

★ full metal.

I like to push it,
and push it,
until my luck is over.
Reply With Quote
  #7    
Old May 31st, 2012, 01:56 PM
Chaos Rush's Avatar
Chaos Rush
im sexy and i know it
 
Join Date: May 2007
Location: Taylor Swift
Gender: Male
Nature: Adamant
Quote:
Originally Posted by NintendoBoyDX View Post
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?
__________________

The Chaos Emerald ROM Base (it's gonna take awhile)

DS-style 64x64 Pokémon Sprite Resource NOW COMPLETED
Custom Sugimori-style Pokémon Sprite Resource IN PROGRESS


Non-Pokémon hacks I support:
Sonic Classic Heroes
Sonic 3 Complete
Reply With Quote
  #8    
Old June 1st, 2012, 02:50 PM
NintendoBoyDX
Togepi
 
Join Date: Jul 2010
Gender: Male
Quote:
Originally Posted by Chaos Rush View Post
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 by NintendoBoyDX; October 30th, 2012 at 06:16 PM.
Reply With Quote
  #9    
Old June 11th, 2014, 07:16 PM
RaileysXerilyasRX's Avatar
RaileysXerilyasRX
Mega Salamence is a rebel scum
 
Join Date: Feb 2014
Location: Philippines
Gender: Male
Nature: Adamant
Nice! :D But what about for Doors.
__________________
RaileysXerilyasRX
"Light is one peaceful thing. Darkness is one dangerous thing. However, many fears from the darkness. The reality is everyone has his or her own darkness. You cannot have the light without the darkness. The good thing why the darkness is in you: It is because the darkness wants you to control it."
Pokémon DarkEclipse Version
TO BE CONCLUDED! SOMEWHERE 2015.
Reply With Quote
  #10    
Old July 2nd, 2014, 10:32 AM
Tao Dragon's Avatar
Tao Dragon
 
Join Date: Mar 2014
Age: 20
Gender: Male
Nature: Lonely
Spoiler:
Quote:
Originally Posted by NintendoBoyDX View Post
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?


Hey, um, I want to import firered tilesets to emerald rather than r/s tilesets to firered. And also I have no idea where the info given applies. You talk about editting the ini in advance map but all I see are some numbers like 80 and the likes and words written in german. I assume I have to edit the ini in conjunction with hex editor right? If this is the case then I'll have to start using it. I suppose it's possible to do the inverse from fr to r/s. The thing is I don't know if emerald is exactly the same as r/s. And I also need to know where I'm going to apply this information.

What I've been doing is recoloring firered tilesets in ms paint which works but it takes time. Your way seems to be more direct. I also have another problem there is a limit of tiles I can import and the ones at the bottom don't display. Is there a way to increase the number of tiles I can import to tileset 0?
__________________
3DS Friend Code: 4012 - 4565 - 2182
3DS IGN: Raymond
Pokemon X IGN: Calem
Vivillon: Archipelago
Friend Safari Type:
Friend Safari Pokemon: Pumpkaboo, Dusclops, Lampent

Last edited by Tao Dragon; July 2nd, 2014 at 10:55 AM.
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 09:42 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.