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

Author Topic: SNES - Using Cartographer where pointers are embedded into the script  (Read 933 times)

RType88

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi all,

First post here - been trawling through the forums for a while and learnt a lot, so thank you for all the help you've already given me! I'm stumped by this one and I'm hoping someone can help.

As a first foray into translating SNES roms I've been looking at Itadaki Street 2. I've found some text but I'm having issues extracting it correctly with Cartographer. I downloaded Final Fantasy 1 to understand Cartographer's setup, but the roms are set up very differently and I'm really struggling with configuring Cartographer correctly.

In Final Fantasy 1, the pointers all sit together before the script begins. However, in Itadaki Street 2, the pointers sit between each chunk of dialogue.

For example, if I understand correctly, here the pointer is contained in a block begins at 0x72B9B which runs to the 00 dividing it from the actual text at 0x72BA3. I've messed around with the data between here and it seems they control the width and height of the text box, the X & Y position of the text box etc. The actual pointer data is the two bytes at 0x72BA1 (or is it the three bytes starting 0x72BA0? Incrementing 0x72BA0 seems to change where the game pulls the text from, but not with any consistency that I can understand. Does the value at 07x2BA0, 10 in this case, indicate the bank the pointer is directing to?  If someone can help me with that, that would be great too!)

Fine, all great. Here's the problem I'm having. Immediately after the pointer is a 00 and the text begins and runs to a FF at 0x72C24. Then, a block like the first one appears again from 0x72C24 to a 00 at 0x72C2C, with the pointer information at 0x72C2A (or C29, again depending on what the deal is with that 10.)

Knowing that the pointers sit in blocks of window display data between the blocks of texts, and that the blocks of texts can be different sizes, how can I configure Cartographer to extract this script in a suitable way that it can be reinserted?

I hope this all makes sense - again I'm VERY new to this so apologies if this was a little long winded. Any advice would be greatly appreciated!

« Last Edit: August 13, 2019, 07:13:30 am by RType88 »

Mauron

  • Sr. Member
  • ****
  • Posts: 498
    • View Profile
Re: SNES - Using Cartographer where pointers are embedded into the script
« Reply #1 on: August 13, 2019, 06:14:03 pm »
What you need to know is how the game finds the blocks that contain those pointers. If each text block is (header)00(text)FF, and the text can vary in size, there has to be a pointer to the header, which probably is more like the FF1 setup.
Mauron wuz here.

abw

  • Sr. Member
  • ****
  • Posts: 276
    • View Profile
Re: SNES - Using Cartographer where pointers are embedded into the script
« Reply #2 on: August 13, 2019, 11:47:28 pm »
Taking that a step further, if the data is laid out as (header1)00(text1)FF(header2)00(text2)FF...(headerN)00(textN)FF, then the pointers will probably point to the start of the header = the byte after the FF, i.e 0x72B9B, 0x72C24, 0x72CA6, etc. Since you already found the RAM pointer inside the header, we know that ROM 0x72BA4 = RAM $??ABA4, so the pointers will probably have values of $AB9B, $AC24, $ACA6, etc. and probably be stored in little-endian format as 9B AB 24 AC A6 AC etc., and searching the ROM for those bytes gets a hit at 0xED27, so that is most likely where your pointer table lives.

RType88

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SNES - Using Cartographer where pointers are embedded into the script
« Reply #3 on: August 14, 2019, 08:01:37 am »
I'm both relieved and embarrassed it was something so simple. Of COURSE it makes sense for the pointer to be directing to the start of the text's header so it can pull out the window attributes. I've managed to find a bunch of pointers now using this logic!

Thank you Mauron for correcting my initial misunderstanding, and abw for taking the time to demonstrate it in action. Much appreciated!