Author Topic: [FFVII PSX] CHOCOBO.DAT format  (Read 7026 times)

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
[FFVII PSX] CHOCOBO.DAT format
« on: 2009-05-28 03:08:19 »
Hi guys,

i've been trying to understand how the chocobo mini game graphics are compressed in the PSX version of the game. For what i can tell, CHOCOBO.DAT contains the graphics but i can't seem to understand the file format. It looks different from all of the other formats in the game. One thing i can tell is that the file is not compressed, or at least that's what it looks like.

I hope somebody can help me shed some light on this mystery
« Last Edit: 2009-05-30 13:43:02 by _Ombra_ »

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #1 on: 2009-06-03 04:05:01 »
Ok, 50 watches and no reply. Anyway, looks like they were compressed after all.

So far a member of our team managed to extract some of the graphics:





so far extracted in raw format. As soon as i can i'll post more info. If somebody knows a bit more about the structure of this file please feel free to post.

Aali

  • *
  • Posts: 1196
    • View Profile
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #2 on: 2009-06-03 04:08:25 »
Wouldn't it be easier to extract the data from the PC version? They're regular .tex and .p files there.

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #3 on: 2009-06-03 04:20:04 »
We have done that already for our PC translation. We are porting it to PSX now so we need to be able to change the PSX version too

EDIT:

CHOCOBO.DAT is the same for NTSC and PAL-E versions

First file is LZS compressed. The size of it is the first 4 bytes of the file + 4. It ends at 0x0004C063

-GFX Automatic/Manual Sequence, Long race: from 0x04C800 to 0x055026 (1024x256, 4bpp)

palettes for Automatic starts at 0x10100 (65792, 32 bytes)
                 Manual starts at 0x10300 (66304, 32 bytes)

-GFX Automatic/Manual Sequence, Short race: from 0xx97000 to 0x09D6C9 (1024x256, 4bpp)

-GFX Race A CLASS, etc.: starts at 0x0C2000 ends at 0x0CF8ED (1536x256, 4bpp)

-GFX Race B Class: starts at 0x0D0000 ends at 0x0E2860 (1536x256, 4bpp)

-GFX Race C Class: starts at 0x0E3000 ends at 0x10409B (1536x256, 4bpp)

-GFX Race S Class: starts at 0x104800 ends at 0x119D59 (1536x256, 4bpp)

We where able to modify the graphics and luckily the new compressed files where smaller but we are still missing the index which might be inside CHOCOBO.BIN. If somebody is willing to explore it i'll appreciate it
« Last Edit: 2009-06-03 13:29:13 by _Ombra_ »

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #4 on: 2009-06-04 05:25:44 »
You wouldn't happen to have a 3d rendering of the chocobo race circuit do you?

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #5 on: 2009-06-05 13:16:54 »
Nope, we don't need to modify the 3D part of the game so we never looked into it. I guess is either the first compressed file on one of the others. That "scanlined" looking image i think is the background sky during the race.

I still can't find the index so if somebody still feels like he can help, you are welcome

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #6 on: 2009-06-06 16:19:46 »
I can't say whether this will help or not, but I believe the image s multipaletted, as the chocobo faces were many colors, and I see only one set of them there.

Also, you may look into a program called YanePack, I've had success opening .DATs and extracting files from them with it... no telling whether it only works for a specific type of DAT though...

Then again I suppose you already know what should be in there, if you messed with the PC version...

Gemini

  • *
  • Posts: 260
  • Not learner's Guru
    • View Profile
    • Devil Hackers
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #7 on: 2010-05-14 23:06:52 »
Time for some useful NECROPOSTING! :o Seems like nobody was able to locate those indexes, but that doesn't really surprise me when I see the way they are stored.

Let's decompress gzip file MINI\CHOCOBO.BIN, which is a code overlay containing everything for chocobo races, including our indexes. The format is a bit weird as it refers to absolute LBA values on disk (maybe CHOCOBO.DAT was originally supposed to be more than just one file?) and each LBA/size pair is defined through code, instead of storing them as simple data like the rest of the allocation tables (clear sign that this module was developed by somebody who didn't collaborate much with the original team). CHOCOBO.BIN is stored at 0x800A0000 in ram and the following lines of code refer to that "header" value:
Code: [Select]
ROM:800A2EA0                 li      $a0, 968         # segment 3
ROM:800A2EA4                 lui     $a1, 2           # 0x20000, 131072
Code: [Select]
ROM:800A2EC0                 li      $a0, 819         # segment 1
ROM:800A2EC4                 lui     $a1, 2           # 0x20000, 131072
Code: [Select]
ROM:800A2F2C                 li      $a0, 1016        # segment 5
ROM:800A2F30                 li      $a1, 122880
Code: [Select]
ROM:800A2F50                 li      $a0, 981         # segment 4
ROM:800A2F54                 li      $a1, 124928
Code: [Select]
ROM:800A2FDC                 li      $a0, 1120        # segment 8
ROM:800A2FE0                 lui     $a1, 3           # 0x30000, 196608
Code: [Select]
ROM:800A2FFC                 li      $a0, 1082        # segment 7
ROM:800A3000                 lui     $a1, 3           # 0x30000, 196608
Code: [Select]
ROM:800A301C                 li      $a0, 1054        # segment 6
ROM:800A3020                 lui     $a1, 3           # 0x30000, 196608
Code: [Select]
ROM:800A303C                 li      $a0, 1187        # segment 9
ROM:800A3040                 lui     $a1, 3           # 0x30000, 196608
Code: [Select]
ROM:800A30B0                 li      $a0, 837         # segment 2
ROM:800A30B4                 li      $a1, 434176
Code: [Select]
ROM:800A30D4                 li      $a0, 666         # segment 0
ROM:800A30D8                 li      $a1, 512000
Register a0 contains the LBA value, while a1 is the decompression size. There's also a couple more parameters for each segment, but you don't really need to know about these as they are of no interest for gfx hacking, like destination in ram and a flag parameter that is always set to 0. Also keep in mind that these values refer to the International version, so they might be different for other regions. I'm pretty sure the LBA value for CHOCOBO.DAT is 659 for PAL-UK disks, while it's 666 in my case.

Curious fact: each segment is filled with random trash bytes that come right after LZSS data and they fill the sector padding region. I guess whoever programmed this didn't want us to easily find the data or something. :-X

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #8 on: 2010-05-14 23:31:25 »
Jesus Christ, nothing can stop this guy.

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #9 on: 2010-05-15 05:42:54 »
You should compare/contrast with the files in the PC version. We can probably ID which files are which and even come up with file names.

Gemini

  • *
  • Posts: 260
  • Not learner's Guru
    • View Profile
    • Devil Hackers
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #10 on: 2010-05-15 09:24:36 »
I'd say yes to that suggestion, if I only had the PC version and if I could give a damn about it. :P Plus, I'm no x86 expert, so I'll leave that task to somebody else who's more willing to look into it.
« Last Edit: 2010-05-15 09:32:43 by Gemini »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #11 on: 2010-05-17 15:48:07 »
Yeah if anyone finds out how to replace "Automatic Sequence" with "Automatic" and "manual operation" with Manual for PC

let me know :)

sl1982

  • Administrator
  • *
  • Posts: 3764
  • GUI Master :P
    • View Profile
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #12 on: 2010-05-17 15:50:14 »
Just change the texture file?

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: [FFVII PSX] CHOCOBO.DAT format
« Reply #13 on: 2010-05-17 15:55:13 »
scrap that, I see what you mean.
« Last Edit: 2010-05-17 15:57:12 by seif »