News: 11 March 2016 - Forum Rules

Author Topic: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)  (Read 1503 times)

raw86K

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Hello!

These last weeks I've been messing around with Power Pro Kun Pocket 1, and I've found where the first dialogue that is displayed in the game is shown, and its pointer. I wanted to find the text routine, to try to understand better how it displays the text on screen, and to try to accommodate a fourth line of text on a textbox or a future VWF hack. (As an additional note, I figured some of the "events" that the text routine is able to read, like new lines of dialogue, changing text speed, displaying player name, using bold characters, among other stuff).


Examples of the textboxes.

The offset of the first dialogue (leftmost screenshot) is 0x54000, and its pointer is located in the same bank (15), at offset 0x541F5 (pointer is "00 40"). Text seems to be splitted between different banks, and at least for the first "cutescene", all the pointers are stored one after another (offsets from 0x541F5 to 0x541FF).

From this point, I haven't been able to find where the "code" that manages the text lies in the ROM. I've been trying to find said routine for more almost two weeks,  with a very basic use of BGB's debugger (as I am not proficient with it).

Text is represented in 1 byte per character (I was able to create a table for it by modifying the values of the first dialogue) and some of the kanji are represented with 2 bytes ("FD XX", "FD 1D" being "今" as an example). There also are functions or "events" that take up to 2 or 3 bytes, that are used for managing the flow of the dialogue box, like:

"FE 0A": Text speed 1 (fastest).
"FE 0B": Text speed 2 (almost fastest).
"FE 00": Line break.
"FE 32": Wait 1 second to continue displaying text.
"FF FF": Next "cutescene" (change of background + continue from next pointer).


WindHex + table I created for the game.

I have been able to see that every time an "FF FF" instruction is read by the text routine ("FF FF" being like a "load next background from the index, then read the next pointer), Banks are changed back and forth as can be seen in the explanation below:



Any clues or possible ideas on how can I use the debugger to be able to pinpoint where the text routine is/is being loaded from? Or maybe the procedure I'm trying to follow is not the best one? I think that the text logic is stored at bank 56, as every time it needs to load a new resource, goes to bank 56 and changes to another bank (or as can be seen in the croquis above, when the user says "yes" to the creation of the character with these details, it goes from bank 6 to bank 56 and changes to 15 (where the first text for that cutescene is), and the same happens when loading the next cutescene).

Thanks in advance,

raw86K

FAST6191

  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
Re: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)
« Reply #1 on: August 01, 2021, 12:52:27 pm »
That amount of markup, scripting and variability in a GBC text engine? Wow.

GBC VFW is also an interesting proposition (the BG tile arrangements are not so conducive to it as later devices), and fourth line might be possible but I would immediately worry about memory issues in something like that (though I suppose that is a concern even if editing "normally").

Things I would feed to the debugger. What about the pointers themselves? Anything that reads the pointer then will be shortly parsing all the text (or possibly in this case doing some maths on it to find the final destination for the read).

343

  • Jr. Member
  • **
  • Posts: 97
  • Gameboy Color Rules!
    • View Profile
Re: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)
« Reply #2 on: August 01, 2021, 05:49:52 pm »
I can't comment about the romhacking part.
But your .tbl have missing many of the dakuten handakuten glyphs.
On the bank 15 image, have 2 kanji together
F1=高
F2=校
Try to find the font with any graphic program and correct the. tbl before dump the text script.

The font is at $165CB
« Last Edit: August 02, 2021, 02:42:58 am by 343 »

raw86K

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)
« Reply #3 on: August 02, 2021, 11:38:11 am »
@FAST6191, yes, I was surprised at how well thought and flexible the text engine is. As soon as I have some time, I will check what is reading the pointers (I did not thought before of Bank 0 having the text engine logic, and it is possible that is there, from what little I could saw yesterday, as some routines that are on said bank are the ones reading the text).

@343, I have the dakuten/handakuten mapped in my table! Its WindHex not showing the characters big enough on that window to be noticeable enough. For hiragana, they go from "38" to "50", and for katakana, from "88" to "A1". As for the kanji at "F1", thanks for the info! I wasn't able to identify that one properly (still missing 10 or so).

Just out of curiosity, what software did you use to export the font to png? (I haven't checked if yychr has that option).

343

  • Jr. Member
  • **
  • Posts: 97
  • Gameboy Color Rules!
    • View Profile
Re: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)
« Reply #4 on: August 05, 2021, 12:25:39 pm »
I used tilemolester.
I check it again, and could not found the handakuten/dakuten glyphs on the font.

raw86K

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)
« Reply #5 on: August 06, 2021, 02:52:34 am »
I used tilemolester.
I check it again, and could not found the handakuten/dakuten glyphs on the font.

The text engine fuses the needed kana and handakuten/dakuten glyph together. I'm planning to use that to my advantage so I can generate "àáèéìíòóùú..." and so on.
Thanks for the software's name!

FAST6191

  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
Re: Trying to find text routine on GBC game (Power Pro Kun Pocket 1)
« Reply #6 on: August 06, 2021, 08:46:16 am »
This text/game engine gets more and more impressive. I don't know that I have examples for dynamic character generation (or indeed general graphics editing in RAM) for newer systems. Granted most newer systems have memory and ROM space to spare and in some ways adding an accent to white space is hardly a radical notion when all is said and done... for something that for many would be a throwaway GBC title though it is quite impressive.