Fix data type

This commit is contained in:
jonschz 2025-05-04 14:33:58 +02:00
parent 84d3fc1582
commit cec1be50f7

View File

@ -365,11 +365,12 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
short xmax = xofs + width - 1; short xmax = xofs + width - 1;
// LINE: BETA10 0x1013e652 // LINE: BETA10 0x1013e652
short* data = (short*) p_data; BYTE* data = p_data;
// The first word in the data following the chunk header contains the number of lines in the chunk. // The first word in the data following the chunk header contains the number of lines in the chunk.
// The line count does not include skipped lines. // The line count does not include skipped lines.
short lines = *data++; short lines = *(short *)data;
data += 2;
// LINE: BETA10 0x1013e666 // LINE: BETA10 0x1013e666
short row = p_flcHeader->height - yofs - 1; short row = p_flcHeader->height - yofs - 1;
@ -384,9 +385,9 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
while (TRUE) { while (TRUE) {
row_loop: row_loop:
// TODO: Can the typecast be removed?
// LINE: BETA10 0x1013e692 // LINE: BETA10 0x1013e692
token = *((short*) data++); token = *(short*) data;
data += 2;
if (token < 0) { if (token < 0) {
if (token & 0x4000) { if (token & 0x4000) {
@ -394,49 +395,49 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
} }
WritePixel(p_bitmapHeader, p_pixelData, width, row, token); WritePixel(p_bitmapHeader, p_pixelData, width, row, token);
token = *((WORD*) data++); token = *(short*) data;
data += 2;
// LINE: BETA10 0x1013e6ef // LINE: BETA10 0x1013e6ef
if (!token) { if (!token) {
row--; row--;
if (--lines <= 0) { if (--lines > 0) {
return; continue;
// return;
} }
return;
// TODO: Something is off about these breaks and jumps -- too many JMP instructions // TODO: Something is off about these breaks and jumps -- too many JMP instructions
} }
else {
break;
}
} }
else { // LINE: BETA10 0x1013e71e
break;
}
short column = xofs; short column = xofs;
column_loop: column_loop:
column += *(data++); // TODO: some movzx / movsx discrepancy here
short type = *((char*) data++);
column += *data++;
short type = *data++;
type += type; type += type;
if (type >= 0) { if (type >= 0) {
WritePixels(p_bitmapHeader, p_pixelData, column, row, (BYTE*) data, type); WritePixels(p_bitmapHeader, p_pixelData, column, row, (BYTE*) data, type);
column += type; column += type;
data = (short*) ((char*) data + type); data += type;
// LINE: BETA10 0x1013e797 // LINE: BETA10 0x1013e797
if (--token != 0) { if (--token != 0) {
goto column_loop; goto column_loop;
} }
row--; row--;
if (--lines > 0) { if (--lines > 0) {
goto row_loop; continue;
} }
return; return;
} }
else { else {
type = -type; type = -type;
WORD* p_pixel = ((WORD*) data++); WORD* p_pixel = (WORD*) data;
data += 2;
WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1); WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1);
column += type; column += type;
// LINE: BETA10 0x1013e813 // LINE: BETA10 0x1013e813
@ -445,7 +446,7 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
} }
row--; row--;
if (--lines > 0) { if (--lines > 0) {
goto row_loop; continue;
} }
return; return;
} }