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

Author Topic: Cartographer for Tales of Destiny PS2  (Read 1638 times)

m3tr01d

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Cartographer for Tales of Destiny PS2
« on: February 15, 2021, 05:31:58 pm »
Hi everyone,

first, I just want to say I'm still really noob to this kind of stuff. I want to extract the content of a specific section in Tales of Destiny DC Ps2 file called SLPS_258.42. I already have the .tbl file for mapping the different HEX bytes to Japanese.

I want to translate Title from the game. The text starts at offset 1BBC00. Right under it is the name of the title (see https://drive.google.com/file/d/1PcAkjQHI7WdgE5kLZfVgHLEMJEDS_z9s/view?usp=sharing)

I know that if I take 1BBC00 + FF000 then reverse the bytes, I'll be able to find it in the Pointer table (see https://drive.google.com/file/d/13mNx61rn19bWzPzk2TZY96NNsbSFMCTt/view?usp=sharing )

If I go at the top of the Pointer table, I'll be able to know the start of all this block of text (see https://drive.google.com/file/d/1J8Vbqm-Uej9G3CH_kT13uNTPaSgtMgi_/view?usp=sharing

I then try to make the file for Cartographer. I based my file on the FF1 example.
Code: [Select]
#GAME NAME: Tales of destiny - DC (PS2)

#BLOCK NAME: Title_Block
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $0x1946A0
#POINTER TABLE STOP: $0x194B5F
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $FF000 //add $FF000 to each pointer to get
#TABLE: TOD_UTF.tbl //the string address
#COMMENTS: Yes
#END BLOCK

In my .tbl file, I have specified at the end 00 to split the lines.
/00=[END]\n\n

I don't really know what I need to do to make it work. For some reason It doesn't seem to be able to generate my file.
This is what I get when I run it (see https://drive.google.com/file/d/1Z4gigACF9yl6F4WJAhDmRif6E4y2PPa4/view?usp=sharing ).

There's probably something I am missing there. I really appreciate all the help you can give me.

Thank you!

Choppasmith

  • Full Member
  • ***
  • Posts: 203
    • View Profile
Re: Cartographer for Tales of Destiny PS2
« Reply #1 on: February 16, 2021, 11:03:16 pm »
Hi everyone,

first, I just want to say I'm still really noob to this kind of stuff. I want to extract the content of a specific section in Tales of Destiny DC Ps2 file called SLPS_258.42. I already have the .tbl file for mapping the different HEX bytes to Japanese.

I want to translate Title from the game. The text starts at offset 1BBC00. Right under it is the name of the title (see https://drive.google.com/file/d/1PcAkjQHI7WdgE5kLZfVgHLEMJEDS_z9s/view?usp=sharing)

I know that if I take 1BBC00 + FF000 then reverse the bytes, I'll be able to find it in the Pointer table (see https://drive.google.com/file/d/13mNx61rn19bWzPzk2TZY96NNsbSFMCTt/view?usp=sharing )

If I go at the top of the Pointer table, I'll be able to know the start of all this block of text (see https://drive.google.com/file/d/1J8Vbqm-Uej9G3CH_kT13uNTPaSgtMgi_/view?usp=sharing

I then try to make the file for Cartographer. I based my file on the FF1 example.
Code: [Select]
#GAME NAME: Tales of destiny - DC (PS2)

#BLOCK NAME: Title_Block
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $0x1946A0
#POINTER TABLE STOP: $0x194B5F
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $FF000 //add $FF000 to each pointer to get
#TABLE: TOD_UTF.tbl //the string address
#COMMENTS: Yes
#END BLOCK

In my .tbl file, I have specified at the end 00 to split the lines.
/00=[END]\n\n

I don't really know what I need to do to make it work. For some reason It doesn't seem to be able to generate my file.
This is what I get when I run it (see https://drive.google.com/file/d/1Z4gigACF9yl6F4WJAhDmRif6E4y2PPa4/view?usp=sharing ).

There's probably something I am missing there. I really appreciate all the help you can give me.

Thank you!

Are you SURE the pointers are 4 bytes? I recently tried ripping text from a PSP game, I thought it was 4 bytes for Pointer data but it turned out the 00 was in fact 1 byte for “space” and the pointers were 3 bytes and then it worked fine.

m3tr01d

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Cartographer for Tales of Destiny PS2
« Reply #2 on: February 17, 2021, 09:32:15 am »
First, Thank you for answering me!

So, I talked with a team that are currently translating Growlancer 6 and they helped me a lot with this issue. We found that we need to
actually modify the Cartographer script to use
#BASE POINTER:         $-FF000   
When I do that, I'm able to have a text file that looks clean.

Sample
Code: [Select]
//GAME NAME: Tales of destiny - DC (PS2)

// Define required TABLE variables and load the corresponding tables
#VAR(Table_0, TABLE)
#ADDTBL("C:\Users\Steven\Downloads\abcde_v0_0_9\tales_of_destiny_UTF8.tbl", Table_0)

//BLOCK #000 NAME: Title_Block
#ACTIVETBL(Table_0) // Activate this block's starting TABLE

#JMP($1BB930, $1BF0E4) // Jump to insertion point
#HDR($-FF000) // Difference between ROM and RAM addresses for pointer value calculations

//POINTER #0 @ $1946A8 - STRING #0 @ $1BB968
#W32($1946A8)
//ブラストゲージ+25[END]
ブラストゲージ+25[END]
// current address: $1BB97D

//POINTER #1 @ $1946AC - STRING #1 @ $1BB950
#W32($1946AC)
//ブラストゲージ+50[END]
ブラストゲージ+50[END]
// current address: $1BB965

//POINTER #2 @ $1946B0 - STRING #2 @ $1BB940
#W32($1946B0)
//最小CC+1[END]
最小CC+1[END]
// current address: $1BB94D

I tried to just reinsert the text(as is) using Atlas but for some reason, the text is messed up.
I'm pretty sure Atlas doesn't like my header #HDR($-FF000)

I'm doing some testing to try to be able to reinsert without having issues ...

So for your question, I think they are 4 bytes pointers because the text seems to be correctly delimited in my text file.
Thank you!

Kajitani-Eizan

  • Hero Member
  • *****
  • Posts: 553
  • You couldn't kill me if I tried to let you
    • View Profile
    • KAJITANI-EIZAN's Patch Site: Reimagination
Re: Cartographer for Tales of Destiny PS2
« Reply #3 on: February 18, 2021, 04:51:26 pm »
The text starts at offset 1BBC00.

#JMP($1BB930, $1BF0E4) // Jump to insertion point

Why are you jumping to a different offset than where the text starts? Are you sure that the range you are specifying there contains nothing else but the text you are trying to insert/overwrite?

#HDR($-FF000) // Difference between ROM and RAM addresses for pointer value calculations

Don't do this, this command is intended for ROMs that have a copier header that the actual system doesn't use or recognize. Use #CREATEPTR/#WRITE instead, see Atlas documentation

m3tr01d

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Cartographer for Tales of Destiny PS2
« Reply #4 on: February 19, 2021, 01:01:55 pm »
Wow, I wouldn't have expect Kajitani-Eizan to answer one of my noob post. You are like a legend in the Tales of community lol.

Ok, yesterday I changed a little bit my script and I think I did mostly what you are talking about.

I started over with a more simpler example with Names of character. I was able to generate the script and then
with some find/replace, I got this script :
Code: [Select]
//GAME NAME: Tales of destiny - DC (PS2)

// Define required TABLE variables and load the corresponding tables
#VAR(Table_0, TABLE)
#ADDTBL("C:\Users\Steven\Downloads\abcde_v0_0_9\tales_of_destiny_UTF8.tbl", Table_0)

//BLOCK #000 NAME: Names_Block
#ACTIVETBL(Table_0) // Activate this block's starting TABLE
#VAR(ptr, CUSTOMPOINTER)
#CREATEPTR(ptr, "LINEAR", $-FF000, 32)

#JMP($199900) // Jump to insertion point
//#HDR($-FF000) // Difference between ROM and RAM addresses for pointer value calculations

//POINTER #0 @ $D7C80 - STRING #0 @ $1999F8
#WRITE(ptr,$D7C80)
//スタン[END]
Stahn[END]
// current address: $1999FF

//POINTER #1 @ $D7C84 - STRING #1 @ $1999E8
#WRITE(ptr,$D7C84)
//エルロン[END]
Aileron[END]
// current address: $1999F1

I added CreatedPtr and use now #WRITE. I was able to make a small modification and reload using Atlas without breaking the game.
I then see what I could do with Artes and that's where it gets more complicated. I know you already know all this stuff lol.
I have these weird pointers in green (see https://drive.google.com/file/d/1aHFtnTFynt_bzFUkkC-9KCbq_3Xb9o94/view?usp=sharing)

Do you have a way to deal with them? My only solution seems to just build multiple blocks in my Cartographer script like this :
Code: [Select]
#GAME NAME: Tales of destiny - DC (PS2)

#BLOCK NAME: Names_1
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $182FE8
#POINTER TABLE STOP: $182FF3
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $-FF000 //add $FF000 to each pointer to get
#TABLE: tales_of_destiny_UTF8.tbl //the string address
#COMMENTS: Both
#END BLOCK

#BLOCK NAME: Names_2
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $183008
#POINTER TABLE STOP: $183013
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $-FF000 //add $FF000 to each pointer to get
#TABLE: tales_of_destiny_UTF8.tbl //the string address
#COMMENTS: Both
#END BLOCK


Let me know if this makes sense?

Thank you!


Kajitani-Eizan

  • Hero Member
  • *****
  • Posts: 553
  • You couldn't kill me if I tried to let you
    • View Profile
    • KAJITANI-EIZAN's Patch Site: Reimagination
Re: Cartographer for Tales of Destiny PS2
« Reply #5 on: February 22, 2021, 01:22:38 pm »
I then see what I could do with Artes and that's where it gets more complicated. I know you already know all this stuff lol.
I have these weird pointers in green (see https://drive.google.com/file/d/1aHFtnTFynt_bzFUkkC-9KCbq_3Xb9o94/view?usp=sharing)

Do you have a way to deal with them? My only solution seems to just build multiple blocks in my Cartographer script like this :

Those aren't pointers, probably other data. Looks like a array of structs of size 0x20 which each contain three string pointers (probably arte name, arte furigana, arte description). I'm not totally sure if abcde/Cartographer/Atlas handle this elegantly as you might like. You can use #PTRTBL to automatically handle it, but I believe it will separate those strings from each other. E.g.:

What you probably want:

Quote
Demon Fang
Majinken
Be Link and shoot magic beams from your sword.

Tiger Blade
Kogahazan
It's just two slashes, but yelling the name out loud makes it four times as powerful.

What using PTRTBL like that will give you:

Quote
Demon Fang
Tiger Blade

Majinken
Kogahazan

Be Link and shoot magic beams from your sword.
It's just two slashes, but yelling the name out loud makes it four times as powerful.

Maybe someone else with more experience with those tools can suggest a solution, else you may need to write something custom in Python etc.

Hope this helps!

StorMyu

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Cartographer for Tales of Destiny PS2
« Reply #6 on: February 22, 2021, 04:18:08 pm »
I don't know how cartographer actually grabs data but if it's looking through pointers only then yeah you can't parse this unless you make multiple blocks, the pointers are part of a structure that has the data of each artes attached (can't say exactly what but let's imagine it's like this:
struct arte {
 char* arteName;
 char* definitionText;
 int ccCost;
 int damage;
 etc etc
}
 

m3tr01d

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Cartographer for Tales of Destiny PS2
« Reply #7 on: February 23, 2021, 08:19:59 am »
Alright,

I was able to extract 3 block of text by Artes. I think this should do for what we are trying to do :)

Code: [Select]
//POINTER #0 @ $183008 - STRING #0 @ $1A0F28
#WRITE(ptr,$183008)
//[Sign_4]魔神剣[END]
[Sign_4]魔神剣[END]
// current address: $1A0F34

//POINTER #1 @ $18300C - STRING #1 @ $1A0F18
#WRITE(ptr,$18300C)
//マジンケン[END]
マジンケン[END]
// current address: $1A0F23

//POINTER #2 @ $183010 - STRING #2 @ $1A0ED0
#WRITE(ptr,$183010)
//剣圧による斬撃の飛び道具を繰り出す剣技。[LINE]
//様々な行動との連携が可能。[END]
剣圧による斬撃の飛び道具を繰り出す剣技。[LINE]
様々な行動との連携が可能。[END]
// current address: $1A0F14


Thank you for the help guys!