NEC Interchannel Package Format

NEC Interchannel’s package format is used in the Sentimental Graffiti games to store scripts and other data. The format appears in both Sentimental Graffiti on Sega Saturn and Sentimental Graffiti 2 on Dreamcast..

The format is similar to Fastfile in that it is done to cut down on how many open streams the game needs, but it differs in its structure. Instead of running the files together, it arranges the files so all begin at the next sector of the CD-ROM. Since sectors are 0×800 bytes in length, you can multiply the sector count given in the header by 0×800 to get the start offset for each file. The file is padded out to the next sector by 0×00 bytes.

All values are stored in big endian byte order, since the SH2 and SH4 are big endian processors:

File count [4 bytes, long]
(file loop)
  File offset [4 bytes, long]
  File size [4 bytes, long]
  File name [16 bytes, string]
(end loop)

A proof of concept extractor is shown below:

$fd = fopen('SCRIPT.PAK', 'rb');
list($junk, $count) = unpack('N*', fread($fd, 4));
$offset = array();
$filesize = array();
$name = array();
for($i=0; $i< $count; $i++) {
  list($junk, $offset[$i]) = unpack('N*', fread($fd, 4));
  $offset[$i] = 0x800 * $offset[$i];
  list($junk, $filesize[$i]) = unpack('N*', fread($fd, 4));
  $filename[$i] = rtrim(fread($fd, 16));
}
for($i=0; $i<$count; $i++) {
  $fo = fopen($filename[$i], 'w');
  fseek($fd, $offset[$i], SEEK_SET);
  fputs($fo, fread($fd, $filesize[$i]));
  fclose($fo);
}
fclose($fd);


Info

My name is Derrick Sobodash.

I live in Beijing, China, where I work as a professional copy editor and freelance journalist. My articles have appeared in The Oakland Press, Beijing Today and PiQ.

You may contact me for any reason at derrickļ¼ cinnamonpirate.com or find me on Facebook and Flickr.

Photostream

Dusk across from the Silk MarketSunset on Jianguomen WaiGardens at West Longtan LakeGrounds crew in West Longtan LakePracticing Olympic songsFamilies fishing in West Longtan LakePreening ducksComing in for a landingDucks taking offDucks chasing each other in West LongtanStretching his wingsDuck cleaning its feathers