mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-17 13:31:15 +00:00
Cleanup
This commit is contained in:
parent
9ca9ec60c1
commit
2a0e989a65
@ -375,27 +375,25 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
// LINE: BETA10 0x1013e666
|
// LINE: BETA10 0x1013e666
|
||||||
short row = p_flcHeader->height - yofs - 1;
|
short row = p_flcHeader->height - yofs - 1;
|
||||||
|
|
||||||
goto row_loop;
|
goto start_packet;
|
||||||
|
|
||||||
weird_code:
|
skip_lines:
|
||||||
// This is very ugly, but it does yield the correct layout. This _may_ be correct.
|
// The layout in BETA10 strongly suggests that lots of `goto`s are used.
|
||||||
// it may correlate to finishing one row of pixels.
|
|
||||||
// LINE: BETA10 0x1013e684
|
// LINE: BETA10 0x1013e684
|
||||||
row += token;
|
row += token;
|
||||||
|
|
||||||
row_loop:
|
start_packet:
|
||||||
// while (TRUE) {
|
|
||||||
do {
|
do {
|
||||||
// LINE: BETA10 0x1013e692
|
// LINE: BETA10 0x1013e692
|
||||||
token = *(short*) data;
|
token = *(short*) data;
|
||||||
data += 2;
|
data += 2;
|
||||||
|
|
||||||
if (token >= 0) {
|
if (token >= 0) {
|
||||||
goto column_loop_2;
|
goto column_loop;
|
||||||
}
|
}
|
||||||
// TODO: Can't get this if-check to be quite right. Union type didn't help either
|
// 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 skip_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token);
|
WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token);
|
||||||
@ -406,18 +404,17 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
if (!token) {
|
if (!token) {
|
||||||
row--;
|
row--;
|
||||||
if (--lines > 0) {
|
if (--lines > 0) {
|
||||||
goto row_loop;
|
goto start_packet;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
column_loop_2:
|
// TODO: Something is still slightly incorrect here - orig has two `jmp`s, recomp only has one
|
||||||
// LINE: BETA10 0x1013e71e
|
|
||||||
short column = xofs;
|
column_loop:
|
||||||
|
// LINE: BETA10 0x1013e71e
|
||||||
|
short column = xofs;
|
||||||
|
|
||||||
// do {
|
|
||||||
column_loop_inner:
|
column_loop_inner:
|
||||||
// LINE: BETA10 0x1013e726
|
// LINE: BETA10 0x1013e726
|
||||||
column += *data++;
|
column += *data++;
|
||||||
@ -435,7 +432,7 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
}
|
}
|
||||||
row--;
|
row--;
|
||||||
if (--lines > 0) {
|
if (--lines > 0) {
|
||||||
goto row_loop;
|
goto start_packet;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -447,14 +444,14 @@ 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) {
|
||||||
// Should be equivalent to `continue`, but it doesn't produce the same assembly
|
|
||||||
goto column_loop_inner;
|
goto column_loop_inner;
|
||||||
}
|
}
|
||||||
row--;
|
row--;
|
||||||
if (--lines > 0) {
|
if (--lines > 0) {
|
||||||
goto row_loop;
|
goto start_packet;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
// the `while (0)` looks off, but produces the correct `jmp` instructions near the end
|
||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user