VgaBlock::VgaBlock proper parsing of multi-chunk images


Tried reporting it on the ua.renois forums but my "registration is waiting for approval" for a week now so I gave up. Anyway...
In VgaBlock::VgaBlock chunkCount should be initialised to data[6], rather then guestimating it by scanning from the end of the decompressed dax-entry in the "while (dataStart > paletteEnd)" loop. This gets rid of the garbage pseudo-images at the start of doomsday/8x8d0.dax and similar.

file attachments

Closed Feb 21, 2011 at 2:33 PM by bsimser


SimeonPilgrim wrote Oct 28, 2010 at 5:15 PM

That alone (using data[6] and setting dataStart correctly) does not solve the problem, as 8x8d2 does not then load. But will investigate further.

Will also ask about your registration on the FRUA forum.

wrote Oct 28, 2010 at 5:45 PM

SimeonPilgrim wrote Oct 28, 2010 at 5:45 PM

The solution is to use data[6] and data[7] as an unsigned word. Then it works for all the 8x8 files.

Here's a patch for the above change.

denormative wrote Oct 29, 2010 at 1:22 AM

Ah, yes. I was using something like (short)&(data[6]), and forgot to mention it.

Strange about 8x8d2, it works fine with my old code in C++ and seems to spit out 256 correctly formed images. Assuming:
int rows = (uchar)entryData[0];
int cols = (uchar)entryData[1]*8;
int numEntries = (uchar)entryData[6] + (((int)(uchar)entryData[7])<<8);

for(int i=0; i<numEntries; ++i) {
    uchar *imageStart = (uchar *)entryData.data()+(entryData.size()-rows*cols*(numEntries-i));
    int imageSize = rows*cols;
(My code assumes the 0th image is the one lowest offset from the start of the file.)

I know quite a few files have "garbage" bytes between end of palette and start of the pixel data section, no idea what it's for though.

denormative wrote Oct 29, 2010 at 1:23 AM

Ah, ignore that. I thought comments were in chronological order, not reverse chronological order. :(

SimeonPilgrim wrote Nov 9, 2010 at 2:51 PM

Fixed by apply changes discussed.

wrote Feb 21, 2011 at 12:25 PM

wrote Feb 21, 2011 at 2:33 PM

wrote Feb 13, 2013 at 10:27 PM

wrote May 16, 2013 at 5:52 AM