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

Author Topic: What are these PS2 .DAT files ?  (Read 4850 times)

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
What are these PS2 .DAT files ?
« on: February 24, 2012, 07:04:22 pm »
Hi everybody,

I'm currently trying to remake a game (I find that fun, I don't know why), that is Phantasy Star Generations 2 (PS2).

I'd like to look into the files, for graphics, sounds, maps, or (japanese) text.

I don't know anything about PS2 programmation, file formats or anything (but I have some knowledge in programmation, algorithms, and languages, including Assembler and C, in case of).

The CD contains 6 .DAT files with evocative (SOUND, MAPDATE, EVENTS) or less evocative (BTLSYS, BTLDAT, MONDAT) names, a quite big SLPM_625.53 file (2 Mo) and a MODULE directory containing 12 small IRX fles, that I suspect being code.

I suppose I can find happiness in DAT files, but don't know anything about them.  :P

Are they compressed ? How ?
How are data (graphics, sound, text) stocked inside ?
Are there efficient tools for these ?

I read (here for example) that some have deciphered scripts, so I hope it's feasible.

So, I thank in advance anyone that can help or guide me (what to read on the subject ? I didn't find any documetation on PS2 on the main site).  :beer:

CUE

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Nasío pa'jakear
Re: What are these PS2 .DAT files ?
« Reply #1 on: February 26, 2012, 02:07:37 pm »
Files are compressed and packed (same structure in PSG1 and PSG2).

The compression is a LZ Renau.

Code: [Select]
/*------------------------------------------------------------------------------
 DAT file structure:
 - header
   + 4 bytes: number of files, low endian
   + for each file
     - 4 bytes: LBA, low endian
   + fill
     - aligned to 0x800 bytes, padded with 0x00
 - data
   + X bytes: encoded data
   + fill
     - aligned to 0x800 bytes, padded with 0x00
------------------------------------------------------------------------------*/

Code: [Select]
/*------------------------------------------------------------------------------
 LZR file structure:
 - header
   + 2 bytes: signature, always "CM"
   + 4 bytes: decoded length, low endian
   + 4 bytes: encoded data length, low endian
 - data
   + X bytes: encoded data
   + Y bytes: flags
 - fill
   + aligned to 0x800 bytes, padded with 0x00

 'flag' data, 8 bits, right to left:
 - 0: uncompressed data, copy 1 byte to 'target'
 - 1: compressed data, copy 'length+3' bytes from 'target-offset-1' to 'target'
      + 12-bits offset, bits 0-11
      + 4-bits length, bits 12-15
------------------------------------------------------------------------------*/
« Last Edit: February 26, 2012, 02:17:43 pm by CUE »