This project is an attempt at an open-source translation for Tales of Destiny 2, both for PS2 and PSP.
To be clear, this is not for Tales of Eternia (PSP) or Tales of Destiny II (PS1).
After starting and handing off an open-source project for Tales of Destiny Director's Cut (PS2), the aim of this project is have tools and resources available to complete a patch for Tales of Destiny 2 (PS2), a "sequel" to the first game.
This repository aims to collect all known information about this game in order to create a patch.
Join on Discord: https://discord.gg/HZ2NFjpedn
Spreadsheet with Info: https://docs.google.com/spreadsheets/d/1UVaEjK0o-V1-3atPHfRRw2q9QQcCzPCpr4GXJ2MLvvg
- Translators! Start by checking ps2/scenarios and add
#
before the Japanese line and type English translation underneath.
- The pointer table is in the
SLPS_251.72
file starting at0xDD320
- Each entry of the table consists of (A) a 26-bit offset -> the file offset inside
SLPS_251.72
Offset | Description | Notes |
---|---|---|
00000000 | ELF Start | Beginning of file |
000CA328 | Font (.tm2) | Extract and use comptoe.exe |
000C9D41 | Font Map | Map lowercase to font |
- Edit
.tm2
from0x0CA328
and replace some Hiragana - Go to
0x0C9D41
in the SLPS_251.72 file - It should have a
0x17
- That's the glyph index for lowercase "a"
- Replace that with
0x31
which is "ぁ" - And just follow the sequence up until
0x4B
- Formula to find offset for low bytes:
0xC9D00
-0x20
+0xASCII
- Example: For lowercase letter
a
:0xC9D00
-0x20
+0x61
=0x0C9D41
. So at this offset, mapa
to0x31
th letter in the font (originallyぁ
, new font isa
).
- FILE.FPB has information to unpack the files inside
EBOOT.BIN
- Decrypted
EBOOT.BIN
is also known asULJS00097.BIN
- Each entry of the table consist of (A) a 21-bit offset -> the file offset inside
FILE.FBP
and (B) 11-bits for flags -> Compression, file type, etc... - In order to extract the big file, one would calculate each file size based on the next file's offset.
- That is enough to extract the whole FBP. Reversing the process, it would be easy to repack it.
- The pointer table starts at the
0x44
, which references the very first file in the package (the font). - 21-bits are enough to reference any file in the package. That's because they represent not a byte offset, but a sector in the disc.
- The ISO9660 standard uses
0x0800
bytes sectors. The way to work with them actually depends of the way you think it though: - If you shift 11-bits from data, you'll get the file sector, so you can get the byte offset multiplying that value by
0x0800
. - Since these 21-bits take the most significant part of the data, you can apply a
0xFFFFF800
mask to it, to directly get the byte offset to the file
unsigned int fileSize = (nextSector - currentSector) * 0x0800 - remainder;
For example, to extract the font we would look at the following data:
-
First file -> Sector 0, remainer 0x044C
-
Second file -> Sector 92
-
Offset = 0 * 0x0800 = 0
-
Size = (92 - 0) * 0x0800 - 0x044C = 48BB4
And that should cover extracting the FBP.
Offset | Description | Notes |
---|---|---|
00000000 | ELF Start | Beginning of file |
- https://gamefaqs.gamespot.com/ps2/561922-tales-of-destiny-2/faqs/58741
- https://gbatemp.net/threads/romhacking-in-tales-of-destiny-2.373960/
- https://gbatemp.net/threads/romhacking-in-tales-of-destiny-2.373960/page-3
- https://pastebin.com/fCVPLUP4
- https://www.mediafire.com/file/e44c1ksxl7a17z8/ToD2_String_Extract_v1.7z/file
- https://github.com/talestra/talestra/tree/master/compto
The main difference between PSP and PS2 versions is the compression system. While PS2 uses a mixture of LZSS and RLE, PSP uses zLib. The format of the inner files should be identical.
Before compression, most interesting files are packed using a SCPK header. There is always one initial file (background), then a descriptor table (with one entry per additional file), and then the rest of the files (a set of sprite + amination files, and finishing, a script file).
Background and sprite files use 8-bit indexed RGBA color, reaching a maximum of possible 256 color per palette. Note that the graphic format does support multiple palettes for a same pixel matrix.
The script files use the SCED signature, and contain two main sections:
- The code section, which governs the scripted logic.
- The text section, which contains the strings coded in a custom format.
The ideal way to parse the SCED is to decompile the code section, which contains pointers to the text section.
The important bit about the text is that, once decoded, the string consists in an array of font indices.
The TM2
font inside SLPS_251.72
works the following way:
- there are ten 4-bit palettes at the begining
- the number of palette seems to be at byte 0x05
- each palette is then
0x40
bytes - each palette comes with a
0x10
bytes sub-header, so0x50
per palette - the file header is
0x10
bytes too - after the palette array, there is another
0x10
subheader for the pixel matrix - this one includes the resolution (128 x 512 in this case)
- the matrix size is the rest of the data in the file
- 128 x 512 / 2 (divided by 8 because the matrix is 4 bits)
- on a PSP 4-bit graphic, the lower nibble corresponds to the first pixel out of both! And that accounts for the remaining 32768 bytes of the file
To extract font image from 0018.bin
(PS2) and 0000.bin
(PSP):
- take every 4 bits and draw a pixel any level from black to white according to it
- for example 0 -> black and 15 -> white
- then give it a width (I don't remember exacly, but it was a power of 2)
- That will effectively give you the font graphic file
- edit it, and reverse everything
- also update the font descriptor to keep it consistent with your editions
- though the game (probably) doesn't actually use the font descriptor, it's only useful to decode the text by a romhacker
- Thanks to Amarant01 for graphics design work for the fonts, check out his work here: https://www.behance.net/deco-7105af
- Thanks to Lanyn for allowing use of Tales of Destiny 2 English translation script, check out https://www.youtube.com/user/lanyn/videos
- Thanks to the Temple of Tales Translations team (http://temple-tales.ru/translations.html) for providing tools to extract the skits and scenarios
- Thanks to alizor for creating the Python scripts to extract and repack both PS2 and PSP versions of the game
- Thanks to SkyBladeCloud from GBATemp for tips on how the game / file works
- Thanks to flamethrower / flame1234 from GBATemp for having Python scripts available to extract the PSP version of the game