News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Find the font  (Read 2707 times)

Joserichi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Find the font
« on: May 13, 2012, 09:03:52 am »
I'm trying translate a gbc rom, but I don't find the font. I have used Tile Layer Pro and Tile Molester. What can I do to find the font? (The game is Survival Kids)
« Last Edit: May 15, 2012, 01:02:55 pm by Joserichi »

Spikeman

  • Hero Member
  • *****
  • Posts: 1063
  • *unce unce unce*
    • View Profile
    • None at the moment, check out my Last.fm page instead?
Re: Find the font
« Reply #1 on: May 17, 2012, 02:52:18 am »
The font may be in a different bit depth (did you try 1bpp, 2bpp, etc.?) or it may be compressed. If it's compressed you can find it by using a debugger (I would use BGB) or maybe ROM corruption. However, you'll still have to find a way to decompress and recompress the font, which, unless it's a common compression format with already existing utilities, will involve a lot of work - finding and understanding the decompression code and either coding a compressor or hacking the code so it will load decompressed graphics.
Open Source Hacking Projects: Guru Logic Champ, Telefang 2, (Want more? Check out my GitHub!)

Joserichi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Find the font
« Reply #2 on: May 17, 2012, 12:13:29 pm »
Because nobody answered me, I have searched and tried some things:
I didn't find the font in any format, so I guessed that is compressed. I used bgb and I found the font in the memory: it stored at sra3:b000 and it's copied to the vram when needed. Then I tried to find from where in the rom comes, so I set a breakpoint in 3:b000 (on write). But, when the breakpoint pauses the game, all the font has been loaded. (How? The breakpoint is set before the game loads the font)
Could anyone help me?
« Last Edit: May 17, 2012, 12:22:45 pm by Joserichi »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7067
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Find the font
« Reply #3 on: May 17, 2012, 01:24:19 pm »
I think you found a (cart) RAM copy of the font, if I'm understanding the notation right. I'm guess "sra" is SRAM and 3:b000 is $B000 with SRAM bank 3 swapped in. (I know on GB that $A000-BFFF is cart RAM)
So, try to find when it writes to $B000? (ROM address will be $0000-7FFF)
"My watch says 30 chickens" Google, 2018

Joserichi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Find the font
« Reply #4 on: May 17, 2012, 05:18:46 pm »
Yes, is SRAM bank 3 address B000 (I have used the same notation that bgb)
I am searching in that address because at the start, the game (decompress and) copies the font from somewhere to that address, and later, when the font is needed, it copies from here to the VRAM.

Spikeman

  • Hero Member
  • *****
  • Posts: 1063
  • *unce unce unce*
    • View Profile
    • None at the moment, check out my Last.fm page instead?
Re: Find the font
« Reply #5 on: May 18, 2012, 01:37:05 am »
Tried poking around in the debugger a bit. It looks like the font is indeed compressed, but I haven't managed to sort much out of the decompression routine yet. However, it looks like the font data is stored in ROM around 2b:4000 (0xAC000 in the file). Changing that 0xDE at 2b:4002 seems to mess up the entire font, so that should be a start.

Edit: Notice if you look at 0xAC000 in Tile Molester you can see little pieces of font characters. That's pretty typical of compressed fonts, so it looks like that is indeed the spot to be checking out.

Oh also, ROM0:087A is where the font data is read from the ROM. Hope that's a good starting spot.
« Last Edit: May 18, 2012, 01:42:08 am by Spikeman »
Open Source Hacking Projects: Guru Logic Champ, Telefang 2, (Want more? Check out my GitHub!)