News:

11 March 2016 - Forum Rules

Main Menu

Cartographer can't dump NDS overlay files

Started by a_friendly_irin, November 21, 2023, 08:45:20 PM

Previous topic - Next topic

a_friendly_irin

SOLVED: Some of the pointers I was attempting to read pointed to a location that was out-of-bounds of the file.

I'm attempting to use Cartographer to extract text from an NDS overlay file. It doesn't give me any errors, but the program appears to terminate before doing anything. I get the "Dumping BLOCK [X]" message, then nothing. The resulting dump file is empty. Targeting other files such as the arm9 works fine.

Quote#GAME NAME: Shin Megami Tensei: Devil Survivor

#BLOCK NAME:   Text
#TYPE:         NORMAL
#METHOD:      POINTER_RELATIVE
#POINTER ENDIAN:   LITTLE
#POINTER TABLE START:   $14B70
#POINTER TABLE STOP:   $14BFC
#POINTER SIZE:      $04
#POINTER SPACE:      $00
#ATLAS PTRS:      No
#BASE POINTER:      $-219D7E0         //add to each pointer to get
#TABLE:         tables/shiftjis.tbl      //the string address
#COMMENTS:      No
#END BLOCK

I'm confident the pointer table and base pointer values are correct, but you can double-check if you have a Devil Survivor nds file.

ETA: Actually, targeting the arm9 is also producing weird results. This test script that targets the first pointer table in the file:

Quote#BLOCK NAME:   1
#TYPE:         NORMAL
#METHOD:      POINTER_RELATIVE
#POINTER ENDIAN:   LITTLE
#POINTER TABLE START:   $E04
#POINTER TABLE STOP:   $E10
#POINTER SIZE:      $04
#POINTER SPACE:      $00
#ATLAS PTRS:      No
#BASE POINTER:      $-2000000      //add to each pointer to get
#TABLE:         tables/shiftjis.tbl      //the string address
#COMMENTS:      No
#END BLOCK

...produces the same error. It does so even if I place it before a script that I know dumps correctly on its own; it just terminates the program with no diagnostic message.

It also appears to break the program even when it comes after a script I've tested to work. This program:
Quote#BLOCK NAME:   7.Races
#TYPE:         NORMAL
#METHOD:      POINTER_RELATIVE
#POINTER ENDIAN:   LITTLE
#POINTER TABLE START:   $15553C
#POINTER TABLE STOP:   $1555C4
#POINTER SIZE:      $04
#POINTER SPACE:      $00
#ATLAS PTRS:      No
#BASE POINTER:      $-2000000      //add to each pointer to get
#TABLE:         tables/shiftjis.tbl      //the string address
#COMMENTS:      No
#END BLOCK
works. However, when I place the previous code after it, it fails to dump anything before moving onto the second dump instruction, which fails to dump and terminates the program. (The races textdump does work in multiple dumps mode, but the next dump still fails.)

What is going on here???

Nezz

Just a hunch, but is that the SJIS table from here? It gave me trouble because it has Unix-style line feeds. Of course then it wouldn't work on the other file either.

Perhaps copy over the commands that do work one by one, see where it breaks?

a_friendly_irin

Quote from: Nezz on November 23, 2023, 02:32:59 AMJust a hunch, but is that the SJIS table from here? It gave me trouble because it has Unix-style line feeds. Of course then it wouldn't work on the other file either.
No, I made it myself. Like I said, it works on other files.

QuotePerhaps copy over the commands that do work one by one, see where it breaks?
I'm not clear how you would do that with Cartographer? There aren't very many extraneous commands. The only one that isn't necessary for the command to compute at all is the base pointer value, but if I remove that it definitely won't work because then the pointers will be pointing to an address that's way beyond the size of the file.

Nezz

It still *could* be the table file, if one script uses a malformed entry and the other doesn't. Have you tried an empty table?

a_friendly_irin

#4
Quote from: Nezz on November 23, 2023, 02:49:52 PMIt still *could* be the table file, if one script uses a malformed entry and the other doesn't. Have you tried an empty table?
Just did, got the same result. Once again, the race dump script works fine. I was thinking my table may have missed some punctuation characters, but the race script dumps the unassigned values as hex values like it's supposed to. The other scripts just terminate.

ETA: Raw dumping the strings works fine, so there's something about the pointers specifically that's breaking Cartographer.

Normmatt

When I last used cartographer I had issues with negative values in the Base pointer, try something like:

#BASE POINTER:      $FDE62820        //instead of $-219D7E0