Ticket #9374: pharkas_fixup_fix.patch

File pharkas_fixup_fix.patch, 944 bytes (added by SF/agf863, 13 years ago)

Patch to correct compress_sci "Pharkas Fixup"

  • engines/sci/compress_sci.cpp

    diff --git a/engines/sci/compress_sci.cpp b/engines/sci/compress_sci.cpp
    index 3d82b7e..d21c4b4 100644
    a b SciResourceDataType CompressSci::detectData(byte *header, bool compressMode) {  
    6767        byte buffer[20];
    6868        uint32 dataSize;
    6969        memcpy(&buffer, header, 6);
    70         if ((memcmp(buffer + 1, "RIFF", 4) == 0) || (memcmp(buffer + 1, "\x8d\x0bSOL", 4) == 0)) {
     70        int offset = (memcmp(buffer + 1, "RIFF", 4) == 0) * 5 + (memcmp(buffer + 1, "\x8d\x0bSOL\x00", 6) == 0) * 7;
     71        if (offset) {
    7172                // Fixup for pharkas resource.sfx, several WAVE files contain a size thats not right (-1 byte)
    72                 for (int i = 0; i < 5; i++)
     73                for (int i = 0; i < offset; i++)
    7374                        buffer[i] = buffer[i + 1];
    74                 _input.read_throwsOnError(&buffer[5], 1);
     75                _input.read_throwsOnError(&buffer[offset], 1);
    7576                _inputOffset++;
    7677                warning("WAVE resource position adjusted at %lx\n", _inputOffset);
    7778        }