The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Emulation & 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!
New threads in this forum are to be approved by a moderator before they are displayed. The thread revival limit does not apply here.


Reply
 
Thread Tools
  #1    
Old December 18th, 2010, 04:15 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
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
Reply With Quote
  #2    
Old December 19th, 2010, 05:50 AM
knizz's Avatar
knizz
 
Join Date: Aug 2007
Different sprites have different colors when producing textboxes?! In which game?
__________________
Firered IDA 6.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)
Reply With Quote
  #3    
Old December 19th, 2010, 05:55 AM
Spherical Ice's Avatar
Spherical Ice
 
Join Date: Nov 2007
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.
__________________
Reply With Quote
  #4    
Old December 19th, 2010, 08:54 AM
knizz's Avatar
knizz
 
Join Date: Aug 2007
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.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)

Last edited by knizz; December 19th, 2010 at 09:24 AM.
Reply With Quote
  #5    
Old December 19th, 2010, 09:49 AM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
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
Reply With Quote
  #6    
Old December 19th, 2010, 04:03 PM
Jambo51's Avatar
Jambo51
Glory To Arstotzka
 
Join Date: Jun 2009
Gender: Male
Nature: Quiet
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.
__________________
Placeholder Temporary Signature

Last edited by Jambo51; December 19th, 2010 at 05:11 PM. Reason: Routine developed :D
Reply With Quote
  #7    
Old December 19th, 2010, 10:52 PM
knizz's Avatar
knizz
 
Join Date: Aug 2007
I'm impressed! In my opinion the table is the better way but now everyone can choose.
__________________
Firered IDA 6.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)
Reply With Quote
  #8    
Old December 20th, 2010, 04:26 AM
Jambo51's Avatar
Jambo51
Glory To Arstotzka
 
Join Date: Jun 2009
Gender: Male
Nature: Quiet
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
__________________
Placeholder Temporary Signature
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 11:57 AM.


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.