Open NotKyon opened 6 years ago
I looked into the ponscripter source code (in sekaiproject/ponscripter-fork specifically). It seems that "compression type 4" is what they call NBZ. Which is an integer indicating the original length of the file, followed by a BZip2 compressed stream of data.
ponscripter/src/BaseReader.h shows the compression type listing.
ponscripter/src/DirectReader.cpp, line 394, shows their implementation of the read operation.
Here's the relevant code within the function:
fseek(fp, offset, SEEK_SET);
original_length = count = readLong(fp);
bfp = BZ2_bzReadOpen(&err, fp, 0, 0, NULL, 0);
if (bfp == NULL || err != BZ_OK) return 0;
while (err == BZ_OK && count > 0) {
if (count >= READ_LENGTH)
len = BZ2_bzRead(&err, bfp, buf, READ_LENGTH);
else
len = BZ2_bzRead(&err, bfp, buf, count);
count -= len;
buf += len;
}
Haven't confirmed whether this is truly the fix, but it seems to match pretty well with what it likely would be.
Game info
VNDB link: https://vndb.org/r41280 Release date: 2016-07-08 Original title: Umineko no Naku Koro ni
Details
Running the following command is unable to extract most files with an "Unknown compression type" error.
I modified src/dec/nscripter/nsa_archive_decoder.cc to also spew the compression type it's getting (as an integer). Here's a partial dump of the output.
Here's a gist of the full log.
https://gist.github.com/NotKyon/f98a129f495ca4b8d21512c6766be1a4
This is the function I've modified in src/dec/nscripter/nsa_archive_decoder.cc: