So this is the next tentative dive for me. For those who those unfamiliar, I spent some time pulling apart the Castlevania: Resurrection proto here in this thread. It was a lot of fun, so I thought I would do another. I spoke with @Sega Dreamcast Info, and he informed me that Agartha might have a few secrets worth uncovering, so I started poking around.
Now most of the work I've done so far on it is just preliminary. To start off, I'm focusing on the April 18th release, which may be found here. The first obstacle was just getting the image mounted on my Linux machine. CDI images are proprietary, so usually I just convert them into an iso file and
So on the filesystem root we have a bunch of files:
The first interesting bit is the .mpg file, which is a 15 minute long video of the game, which is posted on @Sega Dreamcast Info's site. The 000DUMMY.DAT is the same file. I guess it's there to pad out the disk. Weird, but I've seen weirder. The ADX files are all music tracks, best as I can tell. They are playable using VLC or ffplay, but some seem broken or unsupported. The RESS directory is curiously sparse, so this means the assets are hiding somewhere... but where?
AGARTHA.PAK, of course.
However, when I popped it open in my hex editor it was immediately apparent this would be a more difficult task. The PAK file structure has no file manifest or anything, it's essentially just a big blob of data, yet there must be some way of mapping files to offsets somewhere. That's when I looked at AGARTHA.LST.
AGARTHA.LST is a big text file, with a bunch of file names inside it, one per line. This got me thinking, so I went back to my hex editor and sure enough, at the top of the file was a big blob of uints, and more interestingly, their values were all monotonic. I started jumping around inside the PAK file, treating each uint as an offset; sure enough, at each location was what appeared to be different files, and in the case of the PVR textures, their headers all lined up with the file names. This was the first important discovery in the journey of unlocking this treasure chest: The AGARTHA.LST contains a list of all files inside the AGARTHA.PAK; each file is written inside the PAK in the order it appears in the LST. There are 550 files total.
How ever, there's another big snag: the files are all compressed in what appears to be some form of LZW, or more probably, LZSS encoding. The give away here is that the early parts of the file are quite legible, but by the end of each file it's a binary mess. So in order to continue with the task of reversing Agartha, I have to figure out the decompression scheme. fortunately, LZW/LZSS isn't exactly black magic, but there are a ton of variations and at the moment I'm unsure of how to continue, so I have to ask: does anyone got any tips on reversing compression algorithms?
Now most of the work I've done so far on it is just preliminary. To start off, I'm focusing on the April 18th release, which may be found here. The first obstacle was just getting the image mounted on my Linux machine. CDI images are proprietary, so usually I just convert them into an iso file and
mount
will be happy, but these images would simply not convert using any software that I knew. I finally managed to get the contents open using gditools, which I think is written by members of this forum? if so - thanks!So on the filesystem root we have a bunch of files:
256344068 Apr 17 2001 000DUMMY.DAT
256344068 Apr 17 2001 0AGARTHA_DEMO2001.MPG
1105126 Apr 17 2001 1AGARTHA.BIN
3458 Mar 9 2001 ADXLISTDEMO.LST
36019 Apr 17 2001 AGARTHA.LST
13144526 Apr 17 2001 AGARTHA.PAK
18608 May 18 2000 AUDIO64.DRV
1021590 Mar 8 2001 BODNATH_EXTR01.ADX
1364634 Mar 8 2001 BODNATH_EXTR02.ADX
1311174 Feb 28 2001 BODNATH_EXTR08.ADX
1616130 Feb 28 2001 BODNATH_EXTR09.ADX
2110518 Feb 28 2001 GOKYO_EXTR01.ADX
1170810 Feb 28 2001 GOKYO_EXTR07.ADX
3225258 Feb 28 2001 GOSAINKUND_MOD_NIV_SHORT.ADX
1943910 Feb 28 2001 KALAPATHAR_EXTR01.ADX
1553346 Feb 28 2001 KALAPATHAR_EXTR03.ADX
992394 Feb 28 2001 KALIGANDAKI_EXTR03.ADX
1037214 Feb 28 2001 KALIGANDAKI_EXTR07.ADX
1254042 Feb 28 2001 KALIGANDAKI_EXTR09.ADX
1122066 Feb 28 2001 KALIGANDAKI_EXTR11.ADX
5826294 Feb 28 2001 KANCHENJUNGA_EQ.ADX
1533150 Feb 28 2001 KANCHENJUNGA_EXTR09.ADX
1560114 Feb 28 2001 KANCHENJUNGA_EXTR11.ADX
1130742 Feb 28 2001 KANCHENJUNGA_EXTR13.ADX
2034630 Feb 28 2001 KIANGJING_EXTR03.ADX
219474 Feb 28 2001 KIANGJING_EXTR06.ADX
1721718 Feb 28 2001 KIANGJING_EXTR07.ADX
860022 Feb 28 2001 LADAKH_EXTR02.ADX
2196882 Mar 9 2001 LOUPIOTV3.ADX
2159300 Feb 26 2001 MOULIN.F3D
1739538 Feb 28 2001 PE03_22_EXTR01.ADX
4096 May 15 18:24 RESS
The first interesting bit is the .mpg file, which is a 15 minute long video of the game, which is posted on @Sega Dreamcast Info's site. The 000DUMMY.DAT is the same file. I guess it's there to pad out the disk. Weird, but I've seen weirder. The ADX files are all music tracks, best as I can tell. They are playable using VLC or ffplay, but some seem broken or unsupported. The RESS directory is curiously sparse, so this means the assets are hiding somewhere... but where?
AGARTHA.PAK, of course.
However, when I popped it open in my hex editor it was immediately apparent this would be a more difficult task. The PAK file structure has no file manifest or anything, it's essentially just a big blob of data, yet there must be some way of mapping files to offsets somewhere. That's when I looked at AGARTHA.LST.
AGARTHA.LST is a big text file, with a bunch of file names inside it, one per line. This got me thinking, so I went back to my hex editor and sure enough, at the top of the file was a big blob of uints, and more interestingly, their values were all monotonic. I started jumping around inside the PAK file, treating each uint as an offset; sure enough, at each location was what appeared to be different files, and in the case of the PVR textures, their headers all lined up with the file names. This was the first important discovery in the journey of unlocking this treasure chest: The AGARTHA.LST contains a list of all files inside the AGARTHA.PAK; each file is written inside the PAK in the order it appears in the LST. There are 550 files total.
Code:
//Agartha.PAK template
LittleEndian ();
//one per entry in AGARTHA.LST
SetBackColor (cPurple);
const uint NUM_FILES = 550;
uint offsets[NUM_FILES];
//before each file
struct File
{
uint32 uncompressed;
uint32 compressed;
uint16 flags;
byte data[compressed];
};
local uint i = 0;
while (i < NUM_FILES)
{
FSeek (offsets[i]);
if (i%2 != 0) SetBackColor (cLtPurple);
else SetBackColor (cDkPurple);
File file;
i++;
}
How ever, there's another big snag: the files are all compressed in what appears to be some form of LZW, or more probably, LZSS encoding. The give away here is that the early parts of the file are quite legible, but by the end of each file it's a binary mess. So in order to continue with the task of reversing Agartha, I have to figure out the decompression scheme. fortunately, LZW/LZSS isn't exactly black magic, but there are a ton of variations and at the moment I'm unsure of how to continue, so I have to ask: does anyone got any tips on reversing compression algorithms?
Last edited: