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

Author Topic: Cartographer vs variable-length "script" codes?  (Read 2036 times)

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Cartographer vs variable-length "script" codes?
« on: January 27, 2014, 03:03:04 pm »
Hello there!

I am looking for advice on the best way to handle a custom hex section of variable length when dumping script. More precisely, I have a Cartographer-Atlas set of commands & tables that works wonders for normal text (thanks to RedComet and Klarth for these great programs!), but I don't know how to handle the following.
The game has a script engine. In the script, I can clearly see the parts that introduce speech from the characters (with character ID), line break, prompt to wait for key press, and end of speech. Oh, and I have a proper (very long) table for the text itself, of course.
On top of these, there are longer series of bytes which I am still working at understanding.

But let us focus on the tag that introduces character's speech. It goes:
00 00 0z 00 xx 00 where xx=character ID on 1 byte, and z=0 for start of speech, 2 for reply.
Now with Cartographer I think can indicate this as:
Code: [Select]
$00000000=<new char>,2
$00000200=<reply char>,2
07=<br>
08=<p>
7F=</char>
which will result in 2 bytes being dumped every time this is seen. I assume I would then create a "post processor" that I run on the script resulting from Cartographer to customize the meaning of the character ID.
QUESTION 1: Is this the right way to go?
QUESTION 2: Is the source code from Cartographer available to try and extend / customize it to support that? If not, is there any source code you would recommend I use as a basis instead of reinventing the wheel?

Also to add to the question, there are "quite a few" bytes that are added in between script sessions, just before the 00000000 tags (and after the preceding 7F). Here are a couple of examples that show the flexibility needed:
Spoiler:
Ex 1:
Code: [Select]
1a 00 05 00 03 00 01 00 0b 00 01 00 04 00 01 00
1d 00 00 00 (start speech)

Ex 2:
Code: [Select]
1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
5e 00 00 00 f0 d8 00 00 1d 00 05 00 (start speech)

Ex 3:
Code: [Select]
   00 6a c5 1c 00 00 00 00 00 00 00 00 00 00 00
17 00 10 00 00 00 1d 00 05 00 6a 00 00 00 01 00
(start speech)

Ex 4:
Code: [Select]
                 (7F)00 5c 00 73 00 f0 d8 01 00
34 00 73 00 ff ff 6a c5 f0 d8 00 00 20 00 73 00
6a c5 1f 00 04 00 5f 00 73 00 f0 d8 6d 00 00 00
(start speech)

Ex 5:
Code: [Select]
7F 00 6a c5 1c 00 00 00 00 00 00 00 00 00 00 00
17 00 10 00 00 00 1d 00 05 00 6a 00 00 00 01 00
(start speech)

Ex 6:
Code: [Select]
6ac5 f0d8 0100 (start speech)
Ex 7:
Code: [Select]
6a c5 01 00 00 00 01 00 01 00 1c 00 00 00
03 00 00 00 5b 00 00 00 07 00 0f 27 01 00 01 00
5a 00 02 00 03 00 (start speech)

I am not asking for an interpretation of these bytes - I want to work at it. But to help me with that, I would like to "raw dump" them in order to compare their different occurrences.
QUESTION 3: I don't believe Cartographer would support a variable-length dump, would it?
QUESTION 4: Apart from writing my own dumper (which would require table support since this is a Japanese game), is there an easier way forward?

I am OK with programming. just asking for advice on the "shorter" path forward.
Thanks in advance for any insights you may share.
By the way, the game is Super Robot Taisen Advance for the GBA. (No promises, this is more of a "how far can I go" self-challenge for now, but I would really like to at least get this to a stage where I can share the dumper-inserter. If not more. Well thus the "how far". ;)

Have a nice day!  8)

PS: Sorry for the long post.

EDIT: Going the "custom dumper-inserter" way.
Topic can be closed.
« Last Edit: February 04, 2014, 02:59:13 pm by BlackDog61 »