mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-20 23:01:16 +00:00
Improve jumps
This commit is contained in:
parent
d52af801a0
commit
7306d7a992
@ -379,54 +379,75 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
|
|
||||||
skip_lines:
|
skip_lines:
|
||||||
// The layout in BETA10 strongly suggests that lots of `goto`s are used.
|
// The layout in BETA10 strongly suggests that lots of `goto`s are used.
|
||||||
|
// LINE: LEGO1 0x100bdb05
|
||||||
// LINE: BETA10 0x1013e684
|
// LINE: BETA10 0x1013e684
|
||||||
row += token;
|
row += token;
|
||||||
|
|
||||||
start_packet:
|
start_packet:
|
||||||
do {
|
do {
|
||||||
|
// LINE: LEGO1 0x100bdaef
|
||||||
// LINE: BETA10 0x1013e692
|
// LINE: BETA10 0x1013e692
|
||||||
token = *(short*) data;
|
token = *(short*) data;
|
||||||
data += 2;
|
data += 2;
|
||||||
|
// LINE: LEGO1 0x100bdafb
|
||||||
if (token >= 0) {
|
if (token >= 0) {
|
||||||
goto column_loop;
|
goto column_loop;
|
||||||
}
|
}
|
||||||
|
// LINE: LEGO1 0x100bdb00
|
||||||
if ((unsigned short) token & 0x4000) {
|
if ((unsigned short) token & 0x4000) {
|
||||||
goto skip_lines;
|
goto skip_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LINE: LEGO1 0x100bdb0a
|
||||||
WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token);
|
WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token);
|
||||||
token = *(short*) data;
|
token = *(short*) data;
|
||||||
data += 2;
|
data += 2;
|
||||||
|
|
||||||
|
// LINE: LEGO1 0x100bdb2f
|
||||||
// LINE: BETA10 0x1013e6ef
|
// LINE: BETA10 0x1013e6ef
|
||||||
if (!token) {
|
if (!token) {
|
||||||
row--;
|
row--;
|
||||||
if (--lines > 0) {
|
if (--lines > 0) {
|
||||||
goto start_packet;
|
goto start_packet;
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
// TODO: Something is still slightly incorrect here - orig has two `jmp`s, recomp only has one
|
column_loop:
|
||||||
|
// LINE: LEGO1 0x100bdb49
|
||||||
|
// LINE: BETA10 0x1013e71e
|
||||||
|
short column = xofs;
|
||||||
|
|
||||||
column_loop:
|
column_loop_inner:
|
||||||
// LINE: BETA10 0x1013e71e
|
// LINE: LEGO1 0x100bdb50
|
||||||
short column = xofs;
|
// LINE: BETA10 0x1013e726
|
||||||
|
column += *data++;
|
||||||
|
// LINE: BETA10 0x1013e73a
|
||||||
|
short type = *(char*) data++;
|
||||||
|
type += type;
|
||||||
|
|
||||||
column_loop_inner:
|
if (type >= 0) {
|
||||||
// LINE: BETA10 0x1013e726
|
WritePixels(p_bitmapHeader, p_pixelData, column, row, (BYTE*) data, type);
|
||||||
column += *data++;
|
column += type;
|
||||||
// LINE: BETA10 0x1013e73a
|
data += type;
|
||||||
short type = *(char*) data++;
|
// LINE: BETA10 0x1013e797
|
||||||
type += type;
|
if (--token != 0) {
|
||||||
|
goto column_loop_inner;
|
||||||
|
}
|
||||||
|
row--;
|
||||||
|
if (--lines > 0) {
|
||||||
|
goto start_packet;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (type >= 0) {
|
type = -type;
|
||||||
WritePixels(p_bitmapHeader, p_pixelData, column, row, (BYTE*) data, type);
|
WORD* p_pixel = (WORD*) data;
|
||||||
|
data += 2;
|
||||||
|
WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1);
|
||||||
column += type;
|
column += type;
|
||||||
data += type;
|
// LINE: BETA10 0x1013e813
|
||||||
// LINE: BETA10 0x1013e797
|
|
||||||
if (--token != 0) {
|
if (--token != 0) {
|
||||||
goto column_loop_inner;
|
goto column_loop_inner;
|
||||||
}
|
}
|
||||||
@ -434,24 +455,9 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
if (--lines > 0) {
|
if (--lines > 0) {
|
||||||
goto start_packet;
|
goto start_packet;
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
|
// the `while (0)` looks off, but produces the correct `jmp` instructions near the end
|
||||||
}
|
}
|
||||||
|
|
||||||
type = -type;
|
|
||||||
WORD* p_pixel = (WORD*) data;
|
|
||||||
data += 2;
|
|
||||||
WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1);
|
|
||||||
column += type;
|
|
||||||
// LINE: BETA10 0x1013e813
|
|
||||||
if (--token != 0) {
|
|
||||||
goto column_loop_inner;
|
|
||||||
}
|
|
||||||
row--;
|
|
||||||
if (--lines > 0) {
|
|
||||||
goto start_packet;
|
|
||||||
}
|
|
||||||
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