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

Author Topic: Where the heck is the error??? Cartographer/Atlas problem.  (Read 4978 times)

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Where the heck is the error??? Cartographer/Atlas problem.
« on: July 08, 2011, 09:55:41 pm »



the value x034C @ x0C is the first pointer in little endian.
the value x034E @x14 is the second pointer in little endian.
So this should give a dump of 2 bytes for the first pointer but Cartographer give me many more bytes than that and this for all pointers in the table.
The descriptions in the dump show the right values of pointers / text adresses.
This is a copy of the command file to be checked:

#GAME NAME:      AAI2 (NDS/Jp)

#BLOCK NAME:      Text Block 460 (POINTER)
#TYPE:         NORMAL
#METHOD:      POINTER
#POINTER ENDIAN:   LITTLE
#POINTER TABLE START:   $000C
#POINTER TABLE STOP:   $0344
#POINTER SIZE:      $02
#POINTER SPACE:      $06
#ATLAS PTRS:      Yes
#TABLE:         AAI2jpn.tbl
#COMMENTS:      Yes
#END BLOCK


« Last Edit: July 09, 2011, 06:00:54 am by Auryn »

Vehek

  • Full Member
  • ***
  • Posts: 177
    • View Profile
Re: Where the heck is the error??? Cartographer problem.
« Reply #1 on: July 08, 2011, 10:13:44 pm »
Does your table have a proper end token? Are those "many more bytes" duplicates of later strings?

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Where the heck is the error??? Cartographer problem.
« Reply #2 on: July 09, 2011, 12:20:53 am »
There is no end token in the text.
And the "many more bytes" are about 800+ bytes  from the pointer on or less if the end of file is reached.

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Where the heck is the error??? Cartographer problem.
« Reply #3 on: July 09, 2011, 01:56:38 am »
How does the game know how long each string is if there are no end tokens?

The "error" is that Cartographer doesn't automatically stop dumping once it reaches the next pointer address. If there are no end tokens and thus no way of telling where a string ends apart from checking the next pointer address, then you'll have to dump the raw script and insert pointer writes manually.
In the event of a firestorm, the salad bar will remain open.

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Where the heck is the error??? Cartographer problem.
« Reply #4 on: July 09, 2011, 03:13:21 am »
The next 2 byted after the pointer tell the game the length with a calculation.

So no easy way to make it stop at the next pointer and from what I know, there are no cartographer source codes to change it  nor another program to dump the text :'( :'(

3.18 MB in 463 files to be pointed by hand  :banghead:

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Where the heck is the error??? Cartographer problem.
« Reply #5 on: July 09, 2011, 03:49:26 am »
Not necessarily. An ad hoc script dumper is easy to put together. You know you can get Visual Basic 2010 Express for free, right?
In the event of a firestorm, the salad bar will remain open.

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Where the heck is the error??? Cartographer / atlas problem.
« Reply #6 on: July 09, 2011, 05:29:41 am »
My programming skills are equal to 0 in window...the only things i program are scripts in secondlife but even those not at high level. Thanks anyway for the help.

Now i get to use for the first time Atlas and I am a bit perplex about some values there.
First my hand corrected cartographer dump look like this (cut for save space):
//GAME NAME:      AAI2 (NDS/Jp)

//BLOCK #000 NAME:      Text Block 460 (POINTER)

//POINTER #0 @ $C - STRING #0 @ $34C

#W16($C)
//<$AA><$55>

//POINTER #1 @ $14 - STRING #1 @ $34E

#W16($14)
//全てのデータを<Blue>消去<White>して[LINE]
<FAB5><$AD><$55><Blue>初期状態<White>に戻しますか<ACB4><$AA><$55>

//POINTER #2 @ $1C - STRING #2 @ $38A

#W16($1C)
//<FAB5><$AD><$55>本当に全てのデータを[LINE]
<Blue>消去<White>してよろしいですか<ACB4><$AA><$55>

I was thinking to use this script to reinsert the text:
// Pointers to individual strings not shown
#VAR(dialogue, TABLE) 
#ADDTBL(“game.tbl”, dialogue) (game.tbl is the table file to use to reinsert the text...correct??)
#ACTIVETBL(dialogue)
#ENDIANSWAP(“FALSE”)  (offsets are little endian)
#EMBTYPE(“LINEAR”, 16, $C) ($C is the offset of the first pointer in the rom / in the file??)
#JMP($034C, $097C) (what if I don't care about the dimentions and my text can be so long as it want?? What value i write there??

Last but not least, how to continue the script?? The pdf is a bit confusing and please dont' tell me that i have to write that embset(x), embwrite (x) for all 103 pointers in this file  :-\

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #7 on: July 09, 2011, 03:31:54 pm »
See, that's the beauty of using Cartographer. See that "#W16" business before each text block? It's already formatted to insert the pointers properly.
In the event of a firestorm, the salad bar will remain open.

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #8 on: July 11, 2011, 10:03:32 pm »
Yeah...thanks I knew that but there are still 4 unanswered questions in my post  :banghead:

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #9 on: July 11, 2011, 10:53:24 pm »
Right.

1. If you have a "game.tbl," and it's the table for the game's script, then yes, use that. If you don't have a table, you'll need to make one. Fortunately, since the script is likely stored in Shift-JIS format, you can use the one we have right here.

2. Offset is how much each embedded pointer will be offset. For example, say you're doing a GBA game that needs 32-bit pointers. That'd be "#EMBTYPE("LINEAR", 32, $8000000)." Also, if you're using a proper pointer table, you don't need embedded pointers.

3. #JMP doesn't have to specify a range; specifying the first address will do fine. (The readme mentions this, BTW.)

4. If you're using Cartographer right, this little chunk attached to the start of the script is all you need.
In the event of a firestorm, the salad bar will remain open.

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #10 on: July 12, 2011, 12:41:35 pm »
Thanks, I will give it a try then.

Klarth

  • Sr. Member
  • ****
  • Posts: 484
    • View Profile
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #11 on: July 16, 2011, 02:27:42 pm »
There aren't many games that use pointers for string length detection.  I'd suggest using a custom dumper (if you need help, PM me with specifics, since this would probably take less than 10 minutes) and then reinserting with Atlas using a script like:

Code: [Select]
#VAR(dlg, TABLE)
#VAR(ptr, CUSTOMPOINTER)
#VAR(ptrtbl, POINTERTABLE)
#ADDTBL("game.tbl", dlg)
#ACTIVETBL(dlg)
#CREATEPTR(ptr, "LINEAR", $-80000000, 32)
#PTRTBL(ptrtbl, $C, 6, ptr)
#AUTOWRITE(ptrtbl, "<END>")
#JMP($034C)
// Start text here

全てのデータを<Blue>消去<White>して[LINE]
<FAB5><$AD><$55><Blue>初期状態<White>に戻しますか<ACB4><$AA><$55><END>

<FAB5><$AD><$55>本当に全てのデータを[LINE]
<Blue>消去<White>してよろしいですか<ACB4><$AA><$55><END>
I put <END> on each string myself so that you can use pointer tables instead of having WXX Atlas commands through your whole script.  Define it as /<END> in your table.  I'm not sure if Cartographer does start/stop dumps, but you can use romjuice for that and apply the code above (with adjustments for script/pointer start offsets...and the <END>s)...or spend a few minutes doing a custom dumper to automate since you have 463 script files and probably tons of strings.

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5763
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #12 on: July 16, 2011, 03:32:55 pm »
Wouldn't that fail to insert properly? The pointer tables need to have one more pointer than it has strings to get the length for the last string.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Klarth

  • Sr. Member
  • ****
  • Posts: 484
    • View Profile
Re: Where the heck is the error??? Cartographer/Atlas problem.
« Reply #13 on: July 16, 2011, 03:52:24 pm »
Wouldn't that fail to insert properly? The pointer tables need to have one more pointer than it has strings to get the length for the last string.
Good point, I didn't cover that.  The last string should look like:
Code: [Select]
String<END>
<END>

That way autowrite will write an additional pointer just after the last string.