Quite decent match

This commit is contained in:
jonschz 2025-05-09 20:14:36 +02:00
parent b91f8d37da
commit 9ca9ec60c1

View File

@ -384,7 +384,8 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
row += token; row += token;
row_loop: row_loop:
while (TRUE) { // while (TRUE) {
do {
// LINE: BETA10 0x1013e692 // LINE: BETA10 0x1013e692
token = *(short*) data; token = *(short*) data;
data += 2; data += 2;
@ -392,7 +393,7 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
if (token >= 0) { if (token >= 0) {
goto column_loop_2; goto column_loop_2;
} }
// TODO: Can't get this if-check to be quite right. Maybe a union type? // TODO: Can't get this if-check to be quite right. Union type didn't help either
if (token & 0x4000) { if (token & 0x4000) {
goto weird_code; goto weird_code;
} }
@ -405,17 +406,20 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
if (!token) { if (!token) {
row--; row--;
if (--lines > 0) { if (--lines > 0) {
continue; goto row_loop;
}
return;
} }
break;
} }
break;
// }
column_loop_2: column_loop_2:
// LINE: BETA10 0x1013e71e // LINE: BETA10 0x1013e71e
short column = xofs; short column = xofs;
column_loop: // do {
column_loop_inner:
// LINE: BETA10 0x1013e726
column += *data++; column += *data++;
// LINE: BETA10 0x1013e73a // LINE: BETA10 0x1013e73a
short type = *(char*) data++; short type = *(char*) data++;
@ -427,13 +431,13 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
data += type; data += type;
// LINE: BETA10 0x1013e797 // LINE: BETA10 0x1013e797
if (--token != 0) { if (--token != 0) {
goto column_loop; goto column_loop_inner;
} }
row--; row--;
if (--lines > 0) { if (--lines > 0) {
goto row_loop; goto row_loop;
} }
return; break;
} }
type = -type; type = -type;
@ -443,12 +447,15 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
column += type; column += type;
// LINE: BETA10 0x1013e813 // LINE: BETA10 0x1013e813
if (--token != 0) { if (--token != 0) {
goto column_loop; // Should be equivalent to `continue`, but it doesn't produce the same assembly
goto column_loop_inner;
} }
row--; row--;
if (--lines > 0) { if (--lines > 0) {
goto row_loop; goto row_loop;
} }
return;
} while (0);
} }
// FUNCTION: LEGO1 0x100bdc00 // FUNCTION: LEGO1 0x100bdc00