mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2025-01-07 22:03:19 +00:00
port EncodeLinePCX
This commit is contained in:
parent
f6b271bfc0
commit
971582c0a2
@ -69,10 +69,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 116)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">30.71% (374)</tspan> · <tspan class="known">66.83% (814)</tspan> · <tspan class="todo">0.57% (7)</tspan> · <tspan class="unused">1.89% (23)</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">30.79% (375)</tspan> · <tspan class="known">66.75% (813)</tspan> · <tspan class="todo">0.57% (7)</tspan> · <tspan class="unused">1.89% (23)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="229.37" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="499.23" height="6" x="229.37" y="0" class="known"/>
|
||||
<rect width="229.99" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="498.61" height="6" x="229.99" y="0" class="known"/>
|
||||
<rect width="4.29" height="6" x="728.60" y="0" class="todo"/>
|
||||
<rect width="14.11" height="6" x="732.89" y="0" class="unused"/>
|
||||
</g>
|
||||
@ -1119,7 +1119,7 @@
|
||||
<rect width="12" height="12" x="585" y="300" class="decompiled"><title>void __cdecl Shell_ExitSystem(const char *message);</title></rect>
|
||||
<rect width="12" height="12" x="600" y="300" class="decompiled"><title>void __cdecl ScreenShotPCX(void);</title></rect>
|
||||
<rect width="12" height="12" x="615" y="300" class="decompiled"><title>DWORD __cdecl CompPCX(BYTE *bitmap, DWORD width, DWORD height, RGB888 *palette, BYTE **pcx_data);</title></rect>
|
||||
<rect width="12" height="12" x="630" y="300" class="known"><title>DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);</title></rect>
|
||||
<rect width="12" height="12" x="630" y="300" class="decompiled"><title>DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);</title></rect>
|
||||
<rect width="12" height="12" x="645" y="300" class="decompiled"><title>DWORD __cdecl EncodePutPCX(BYTE value, BYTE num, BYTE *buffer);</title></rect>
|
||||
<rect width="12" height="12" x="660" y="300" class="known"><title>void __cdecl ScreenShot(LPDDS screen);</title></rect>
|
||||
<rect width="12" height="12" x="675" y="300" class="known"><title>void __cdecl do_inventory_options(INVENTORY_ITEM *item);</title></rect>
|
||||
@ -1299,10 +1299,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 546)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">28.62%</tspan> · <tspan class="known">71.06%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">28.68%</tspan> · <tspan class="known">70.99%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="213.77" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="530.79" height="6" x="213.77" y="0" class="known"/>
|
||||
<rect width="214.23" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="530.33" height="6" x="214.23" y="0" class="known"/>
|
||||
<rect width="0.12" height="6" x="744.56" y="0" class="todo"/>
|
||||
<rect width="2.32" height="6" x="744.68" y="0" class="unused"/>
|
||||
</g>
|
||||
@ -1738,7 +1738,7 @@
|
||||
<rect width="10.18" height="10.29" x="508.46" y="311.99" class="known"><title>void __cdecl CreateWindowPalette(void);</title></rect>
|
||||
<rect width="10.18" height="10.23" x="508.46" y="325.28" class="decompiled"><title>int32_t __cdecl Output_XGenX(const int16_t *obj_ptr);</title></rect>
|
||||
<rect width="10.18" height="10.23" x="508.46" y="338.50" class="known"><title>void __cdecl GeneralControl(int16_t item_num);</title></rect>
|
||||
<rect width="10.18" height="10.23" x="508.46" y="351.73" class="known"><title>DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);</title></rect>
|
||||
<rect width="10.18" height="10.23" x="508.46" y="351.73" class="decompiled"><title>DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);</title></rect>
|
||||
<rect width="10.18" height="10.04" x="508.46" y="364.96" class="known"><title>void __cdecl UpdateFrame(bool need_run_message_loop, LPRECT rect);</title></rect>
|
||||
<rect width="10.04" height="10.11" x="521.63" y="136.56" class="known"><title>void __cdecl Lara_TestWaterDepth(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
|
||||
<rect width="10.04" height="10.11" x="534.67" y="136.56" class="known"><title>void __cdecl GetCarriedItems(void);</title></rect>
|
||||
|
Before Width: | Height: | Size: 368 KiB After Width: | Height: | Size: 368 KiB |
@ -2773,7 +2773,7 @@ typedef enum GAME_OBJECT_ID {
|
||||
0044E890 0000003C + void __cdecl Shell_ExitSystem(const char *message);
|
||||
0044E8E0 0000010F +R void __cdecl ScreenShotPCX(void);
|
||||
0044E9F0 000000AE +R DWORD __cdecl CompPCX(BYTE *bitmap, DWORD width, DWORD height, RGB888 *palette, BYTE **pcx_data);
|
||||
0044EAA0 000000D2 -R DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);
|
||||
0044EAA0 000000D2 +R DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);
|
||||
0044EB80 0000003E +R DWORD __cdecl EncodePutPCX(BYTE value, BYTE num, BYTE *buffer);
|
||||
0044EBC0 000001F5 *R void __cdecl ScreenShot(LPDDS screen);
|
||||
0044EDC0 0000007F -R void __cdecl do_inventory_options(INVENTORY_ITEM *item);
|
||||
|
@ -197,6 +197,50 @@ size_t __cdecl CompPCX(
|
||||
return pic_data - *pcx_data + sizeof(RGB888) * 256;
|
||||
}
|
||||
|
||||
size_t __cdecl EncodeLinePCX(
|
||||
const uint8_t *src, const int32_t width, uint8_t *dst)
|
||||
{
|
||||
const uint8_t *const dst_start = dst;
|
||||
int32_t run_count = 1;
|
||||
uint8_t last = *src;
|
||||
|
||||
for (int32_t i = 1; i < width; i++) {
|
||||
uint8_t current = *src++;
|
||||
if (*src == last) {
|
||||
run_count++;
|
||||
if (run_count == 63) {
|
||||
const size_t add = EncodePutPCX(last, 0x3Fu, dst);
|
||||
if (add == 0) {
|
||||
return 0;
|
||||
}
|
||||
dst += add;
|
||||
run_count = 0;
|
||||
}
|
||||
} else {
|
||||
if (run_count != 0) {
|
||||
const size_t add = EncodePutPCX(last, run_count, dst);
|
||||
if (add == 0) {
|
||||
return 0;
|
||||
}
|
||||
dst += add;
|
||||
}
|
||||
last = current;
|
||||
run_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_count != 0) {
|
||||
const size_t add = EncodePutPCX(last, run_count, dst);
|
||||
if (add == 0) {
|
||||
return 0;
|
||||
}
|
||||
dst += add;
|
||||
}
|
||||
|
||||
const size_t total = dst - dst_start;
|
||||
return total;
|
||||
}
|
||||
|
||||
size_t __cdecl EncodePutPCX(uint8_t value, uint8_t num, uint8_t *buffer)
|
||||
{
|
||||
if (num == 0 || num > 63) {
|
||||
|
@ -15,4 +15,5 @@ void __cdecl ScreenShotPCX(void);
|
||||
size_t __cdecl CompPCX(
|
||||
uint8_t *bitmap, int32_t width, int32_t height, RGB888 *palette,
|
||||
uint8_t **pcx_data);
|
||||
size_t __cdecl EncodeLinePCX(const uint8_t *src, int32_t width, uint8_t *dst);
|
||||
size_t __cdecl EncodePutPCX(uint8_t value, uint8_t num, uint8_t *buffer);
|
||||
|
@ -677,7 +677,6 @@
|
||||
#define CalculateWibbleTable ((void __cdecl (*)(void))0x0044D780)
|
||||
#define WinGameStart ((int32_t __cdecl (*)(void))0x0044E7A0)
|
||||
#define Shell_Shutdown ((void __cdecl (*)(void))0x0044E820)
|
||||
#define EncodeLinePCX ((DWORD __cdecl (*)(BYTE *src, DWORD width, BYTE *dst))0x0044EAA0)
|
||||
#define ScreenShot ((void __cdecl (*)(LPDDS screen))0x0044EBC0)
|
||||
#define do_inventory_options ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044EDC0)
|
||||
#define do_passport_option ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044EED0)
|
||||
|
@ -59,6 +59,7 @@ static void Inject_Decomp(void)
|
||||
INJECT(1, 0x0044E700, GameInit);
|
||||
INJECT(1, 0x0044E8E0, ScreenShotPCX);
|
||||
INJECT(1, 0x0044E9F0, CompPCX);
|
||||
INJECT(1, 0x0044EAA0, EncodeLinePCX);
|
||||
INJECT(1, 0x0044EB80, EncodePutPCX);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user