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!

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old December 18th, 2010 (4:15 PM).
Diegoisawesome's Avatar
Diegoisawesome Diegoisawesome is offline
Oh god the bees
  • Silver Tier
 
Join Date: Dec 2007
Location: :noitacoL
Age: 20
Gender: Male
Nature: Naive
Posts: 1,039
Exactly what the title says.
There's nothing in the overworld data itself to specify text color, and I was wondering if anybody knows a table or something that tells the sprite which color font to use.
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Diego's Miscellaneous Patches
GBA Intro Manager
The Secret Sauce: Triple-Layer Tiles
Reply With Quote

Relevant Advertising!

  #2    
Old December 19th, 2010 (5:50 AM).
knizz's Avatar
knizz knizz is offline
     
    Join Date: Aug 2007
    Posts: 192
    Different sprites have different colors when producing textboxes?! In which game?
    __________________
    Firered IDA 6.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
    VBA-M with lua scripting support
    Reply With Quote
      #3    
    Old December 19th, 2010 (5:55 AM).
    Spherical Ice's Avatar
    Spherical Ice Spherical Ice is offline
    • Crystal Tier
     
    Join Date: Nov 2007
    Location: Bristol, UK
    Age: 19
    Posts: 5,226
    In FireRed, if you apply a simple text script to, say, a Youngster overworld, the text will be blue, and if you apply a simple text script to a Lass overworld, the text will be red by default.
    __________________

    A Pokemon that is discriminated!
    Support squirtle and make it everyone's favourite.
    Reply With Quote
      #4    
    Old December 19th, 2010 (8:54 AM). Edited December 19th, 2010 by knizz.
    knizz's Avatar
    knizz knizz is offline
       
      Join Date: Aug 2007
      Posts: 192
      The table you're looking for is at 08464300. It has 4-bit entries. (Firered)

      EDIT: How I found this out:
      As you probably know the C7-Script-Commands overwrites the color to use for the next textbox. This commands writes its argument to 020370DA. Now I put a writing breakpoint on 020370DA. 0xFF is written to this position in every frame by 080CBDF0 so I turn the writing breakpoint off and replace it with a reading breakpoint. This one triggers at 080CBE04. The code shows: If 080CBDF0 isn't 0xFF it is used as the color. Otherwise a function (0813CD24) is called to read the color out of the table mentioned above.
      __________________
      Firered IDA 6.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
      VBA-M with lua scripting support
      Reply With Quote
        #5    
      Old December 19th, 2010 (9:49 AM).
      Diegoisawesome's Avatar
      Diegoisawesome Diegoisawesome is offline
      Oh god the bees
      • Silver Tier
       
      Join Date: Dec 2007
      Location: :noitacoL
      Age: 20
      Gender: Male
      Nature: Naive
      Posts: 1,039
      Quote:
      Originally Posted by knizz View Post
      The table you're looking for is at 08464300. It has 4-bit entries. (Firered)

      EDIT: How I found this out:
      As you probably know the C7-Script-Commands overwrites the color to use for the next textbox. This commands writes its argument to 020370DA. Now I put a writing breakpoint on 020370DA. 0xFF is written to this position in every frame by 080CBDF0 so I turn the writing breakpoint off and replace it with a reading breakpoint. This one triggers at 080CBE04. The code shows: If 080CBDF0 isn't 0xFF it is used as the color. Otherwise a function (0813CD24) is called to read the color out of the table mentioned above.
      Awesome! Exactly what I wanted/needed.
      I thought about doing that, but decided it wasn't as MUCH of a priority as other things.
      Also, I'm guessing that each 4 bits are flipped? (Ex. Sprite 1= Male; Sprite 2 = Female, = 10)
      __________________


      My other resources:
      My Website
      diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
      diegoisawesome's Miscellaneous Finds
      The Ruins of Alph Puzzles
      Diego's Miscellaneous Patches
      GBA Intro Manager
      The Secret Sauce: Triple-Layer Tiles
      Reply With Quote
        #6    
      Old December 19th, 2010 (4:03 PM). Edited December 19th, 2010 by Jambo51.
      Jambo51's Avatar
      Jambo51 Jambo51 is offline
      Glory To Arstotzka
         
        Join Date: Jun 2009
        Gender: Male
        Nature: Quiet
        Posts: 732
        Thanks to knizz's post, I'm gonna try to get rid of this table altogether! What i'm gonna attempt is to place this "sex" byte within the actual sprite data and then rewrite the routine to make it read from the sprite data instead, thus removing the need for a table of values, and making the routine compatible with JPAN's hack or a simple extended table.

        EDIT: Here we go! This routine makes the first "alignment" byte in the Overworld data into the male/female byte, getting rid of the need for this space using table altogether.

        Code:
        .text
        .align 2
        .thumb
        .thumb_func
        .global OWsexbytechange
        main:
         push {lr}
         ldr r2, table
         mov r1, #0x4
         mul r0, r1
         add r0, r0, r2
         ldr r0, [r0, #0x0]
         ldrb r0, [r0, #0xE]
         cmp r0, #0x2
         bge black
        back: pop {r1}
         bx r1
        black: mov r0, #0x3
         b back
        .align
        table: .word 0x0839FDB0
        So, for the swimmer male sprite:
        Code:
        FFFF0611FF110001100020001501000010373A089C373A0868333A08780D3A08FC1C2308
        The byte in bold becomes the male/female byte. 00 - Male, 01 - Female and anything above this is set to neutral (Black).
        The main reason I developed this routine was to add support for extended Overworld tables and JPAN's Overworld hack. With the routine as is, it won't work with JPAN's hack, but it'll immediately support any extended table or normal table. It goes without saying that you'll need to modify the bytes to match the given sprite (EG, for Misty, change the relevant byte to 0x01 instead of 0x00), but it won't crash if you don't, just print blue text instead of red.

        This code is smaller than the code it replaces, so you can safely overwrite the original routine at 0x0813CD24 without any issues.

        I will look to release a patch with all the bytes corrected in the future, and then develop a version which supports JPAN's hack (shouldn't be overly difficult tbh) so that we can have "proper" male and female sprites.

        Hopefully, when a newer version of Overworld Editor is released, it will support this option as it will make it much easier to designate which sprites you wish to be male and female.
        __________________
        Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
        Reply With Quote
          #7    
        Old December 19th, 2010 (10:52 PM).
        knizz's Avatar
        knizz knizz is offline
           
          Join Date: Aug 2007
          Posts: 192
          I'm impressed! In my opinion the table is the better way but now everyone can choose.
          __________________
          Firered IDA 6.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
          VBA-M with lua scripting support
          Reply With Quote
            #8    
          Old December 20th, 2010 (4:26 AM).
          Jambo51's Avatar
          Jambo51 Jambo51 is offline
          Glory To Arstotzka
             
            Join Date: Jun 2009
            Gender: Male
            Nature: Quiet
            Posts: 732
            Quote:
            Originally Posted by knizz View Post
            I'm impressed! In my opinion the table is the better way but now everyone can choose.
            As I said, it's more built to add compatibility with JPAN's Overworld Hack, as that still uses exactly the same table, but doesn't take into account that it's an entirely different Overworld table. The table is, with this hack, made entirely unrequired, giving us free space to use. However, arguably, the table would be easier to edit from a hex editing point of view.

            Thanks for the opinion. I always appreciate comments and such, it's how I improve as a hacker. :D
            __________________
            Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
            Reply With Quote
              #9    
            Old June 23rd, 2014 (2:37 PM). Edited May 2nd, 2017 by esperance.
            esperance's Avatar
            esperance esperance is offline
            • Platinum Tier
             
            Join Date: Mar 2010
            Location: Ohio
            Age: 20
            Gender: Male
            Nature: Relaxed
            Posts: 3,830
            Disabling on FireRed and LeafGreen

            I hate to revive this after so long, but I figured out a pretty easy way to disable this.
            Basically, I just replace an instruction in the table reader (0813CD24) found by knizz which makes it jump to the fail-safe it has and forces it to choose grey.

            To remove it on FireRed, at 0x13CD24 replace 00 B5 00 04 with 00 B5 0F E0.
            To remove it on LeafGreen, do the same only at 0x13CCFC.

            Also, to change the color that it will always use, mess around with the byte at 0813CD48 (0813CD0E on LeafGreen). The 03 there is the default grey. Changing it to 00 will make it blue and 01 makes it red. All other values make it grey. Of course, this is because it works like the "textcolor" script command.
            __________________
            What are you so afraid of?
            Reply With Quote
            Reply

            Quick Reply

            Join the conversation!

            Create an account to post a reply in this thread, participate in other discussions, and more!

            Create a PokéCommunity Account

            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 12:48 AM.