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!

Reply
 
Thread Tools
  #1    
Old December 30th, 2011 (3:41 PM). Edited December 31st, 2011 by NintendoBoyDX.
NintendoBoyDX NintendoBoyDX is offline
     
    Join Date: Jul 2010
    Gender: Male
    Posts: 94
    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?
    Reply With Quote

    Relevant Advertising!

      #2    
    Old January 1st, 2012 (2:14 AM).
    NintendoBoyDX NintendoBoyDX is offline
       
      Join Date: Jul 2010
      Gender: Male
      Posts: 94
      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 (4:07 AM).
      Darthatron's Avatar
      Darthatron Darthatron is offline
      巨大なトロール。
      • Silver Tier
       
      Join Date: Jan 2006
      Location: Melbourne, Australia
      Age: 25
      Gender: Male
      Nature: Modest
      Posts: 1,152
      Really nice work man. I knew you could pull it off.
      __________________
      あなた は しきしゃ です
      わたし は ばか です
      Reply With Quote
        #4    
      Old January 1st, 2012 (9:37 AM).
      Full Metal's Avatar
      Full Metal Full Metal is offline
      C(++) Developer.
      • Silver Tier
       
      Join Date: Jan 2008
      Location: In my mind.
      Age: 21
      Gender: Male
      Nature: Timid
      Posts: 806
      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 NintendoBoyDX is offline
         
        Join Date: Jul 2010
        Gender: Male
        Posts: 94
        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 (4:09 PM).
        Full Metal's Avatar
        Full Metal Full Metal is offline
        C(++) Developer.
        • Silver Tier
         
        Join Date: Jan 2008
        Location: In my mind.
        Age: 21
        Gender: Male
        Nature: Timid
        Posts: 806
        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 (1:56 PM).
        Chaos Rush's Avatar
        Chaos Rush Chaos Rush is offline
           
          Join Date: May 2007
          Gender: Male
          Posts: 1,297
          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?
          __________________
          Reply With Quote
            #8    
          Old June 1st, 2012 (2:50 PM). Edited October 30th, 2012 by NintendoBoyDX.
          NintendoBoyDX NintendoBoyDX is offline
             
            Join Date: Jul 2010
            Gender: Male
            Posts: 94
            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
            Reply With Quote
              #9    
            Old June 11th, 2014 (7:16 PM).
            You Watanabe's Avatar
            You Watanabe You Watanabe is offline
            Now Leaving...
               
              Join Date: Feb 2014
              Location: Shiganshina District, Wall Maria
              Gender: Female
              Nature: Adamant
              Posts: 430
              Nice! :D But what about for Doors.
              __________________

              Userpage


              Pokémon Dark Jade Version (Coming Soon!)


              The Omsoc Empire (Coming Soon!)
              Reply With Quote
                #10    
              Old September 20th, 2014 (6:46 AM).
              anonyboy's Avatar
              anonyboy anonyboy is offline
              Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-Creator
                 
                Join Date: Sep 2013
                Location: Israel
                Gender: Male
                Nature: Adamant
                Posts: 277
                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?
                Reply With Quote
                  #11    
                Old September 20th, 2014 (8:43 AM).
                Shiny Quagsire's Avatar
                Shiny Quagsire Shiny Quagsire is offline
                I'm Still Alive, Elsewhere
                   
                  Join Date: May 2009
                  Location: Hoenn Safari Zone
                  Age: 19
                  Gender: Male
                  Nature: Jolly
                  Posts: 700
                  Quote:
                  Originally Posted by anonyboy View Post
                  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.
                  __________________



                  Reply With Quote
                    #12    
                  Old September 20th, 2014 (8:44 AM).
                  Kenny1's Avatar
                  Kenny1 Kenny1 is offline
                  On a break from Rom hacking, to improve other skills.
                     
                    Join Date: Nov 2013
                    Gender: Male
                    Posts: 86
                    Quote:
                    Originally Posted by anonyboy View Post
                    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.
                    __________________
                    I'm no longer active here, I check back every now and then to see what happens, but that's it. I no longer hack either.
                    Reply With Quote
                      #13    
                    Old September 20th, 2014 (9:12 AM).
                    anonyboy's Avatar
                    anonyboy anonyboy is offline
                    Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-Creator
                       
                      Join Date: Sep 2013
                      Location: Israel
                      Gender: Male
                      Nature: Adamant
                      Posts: 277
                      Quote:
                      Originally Posted by Shiny Quagsire View Post
                      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??
                      Reply With Quote
                        #14    
                      Old September 20th, 2014 (9:43 PM).
                      Shiny Quagsire's Avatar
                      Shiny Quagsire Shiny Quagsire is offline
                      I'm Still Alive, Elsewhere
                         
                        Join Date: May 2009
                        Location: Hoenn Safari Zone
                        Age: 19
                        Gender: Male
                        Nature: Jolly
                        Posts: 700
                        Quote:
                        Originally Posted by anonyboy View Post
                        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.
                        __________________



                        Reply With Quote
                          #15    
                        Old October 8th, 2014 (8:27 AM).
                        anonyboy's Avatar
                        anonyboy anonyboy is offline
                        Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-Creator
                           
                          Join Date: Sep 2013
                          Location: Israel
                          Gender: Male
                          Nature: Adamant
                          Posts: 277
                          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.
                          Reply With Quote
                            #16    
                          Old May 20th, 2017 (5:04 PM).
                          Super Versekr Dark Super Versekr Dark is offline
                             
                            Join Date: Jan 2017
                            Gender: Male
                            Posts: 3
                            Give me Black Screen, does anyone know why?
                            Reply With Quote
                            Reply
                            Quick Reply

                            Sponsored Links
                            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

                            Forum Jump


                            All times are GMT -8. The time now is 9:07 PM.