port WinVidStart

This commit is contained in:
Marcin Kurczewski 2024-06-12 10:40:26 +02:00
parent db6c1bf949
commit 25e1df2b27
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 61 additions and 13 deletions

View File

@ -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">42.28% (515)</tspan> · <tspan class="known">55.25% (673)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">42.36% (516)</tspan> · <tspan class="known">55.17% (672)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="315.85" height="6" x="0" y="0" class="decompiled"/>
<rect width="412.75" height="6" x="315.85" y="0" class="known"/>
<rect width="316.46" height="6" x="0" y="0" class="decompiled"/>
<rect width="412.14" height="6" x="316.46" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -945,7 +945,7 @@
<rect width="12" height="12" x="240" y="255" class="decompiled"><title>void __cdecl WinVidFreeWindow(void);</title></rect>
<rect width="12" height="12" x="255" y="255" class="decompiled"><title>void __cdecl WinVidExitMessage(void);</title></rect>
<rect width="12" height="12" x="270" y="255" class="decompiled"><title>DISPLAY_ADAPTER_NODE *__cdecl WinVidGetDisplayAdapter(GUID *lpGuid);</title></rect>
<rect width="12" height="12" x="285" y="255" class="known"><title>void __cdecl WinVidStart(void);</title></rect>
<rect width="12" height="12" x="285" y="255" class="decompiled"><title>void __cdecl WinVidStart(void);</title></rect>
<rect width="12" height="12" x="300" y="255" class="known"><title>void __cdecl WinVidFinish(void);</title></rect>
<rect width="12" height="12" x="315" y="255" class="known"><title>void __thiscall DisplayModeListInit(DISPLAY_MODE_LIST *pList);</title></rect>
<rect width="12" height="12" x="330" y="255" class="known"><title>void __thiscall DisplayModeListDelete(DISPLAY_MODE_LIST *pList);</title></rect>
@ -1298,10 +1298,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">39.26%</tspan> · <tspan class="known">60.42%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">39.52%</tspan> · <tspan class="known">60.16%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="293.25" height="6" x="0" y="0" class="decompiled"/>
<rect width="451.31" height="6" x="293.25" y="0" class="known"/>
<rect width="295.18" height="6" x="0" y="0" class="decompiled"/>
<rect width="449.38" height="6" x="295.18" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1388,7 +1388,7 @@
<rect width="24.49" height="24.02" x="267.09" y="164.97" class="known"><title>void __cdecl Room_SetBounds(int16_t *objptr, int32_t room_num, ROOM_INFO *parent);</title></rect>
<rect width="24.49" height="23.99" x="267.09" y="191.99" class="known"><title>void __cdecl AnimateShotgun(int32_t weapon_type);</title></rect>
<rect width="24.49" height="23.81" x="267.09" y="218.98" class="known"><title>void __cdecl Object_DrawAnimatingItem(ITEM_INFO *item);</title></rect>
<rect width="24.49" height="23.69" x="267.09" y="245.79" class="known"><title>void __cdecl WinVidStart(void);</title></rect>
<rect width="24.49" height="23.69" x="267.09" y="245.79" class="decompiled"><title>void __cdecl WinVidStart(void);</title></rect>
<rect width="24.49" height="23.63" x="267.09" y="272.48" class="decompiled"><title>void __cdecl Camera_Move(const GAME_VECTOR *target, int32_t speed);</title></rect>
<rect width="24.49" height="23.45" x="267.09" y="299.11" class="known"><title>void __cdecl Lara_InitialiseInventory(int32_t level_num);</title></rect>
<rect width="24.49" height="23.36" x="267.09" y="325.56" class="known"><title>void __cdecl RingNotActive(INVENTORY_ITEM *inv_item);</title></rect>

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 360 KiB

View File

@ -3057,7 +3057,7 @@ typedef struct {
0x00446B30 0x0022 +R void __cdecl WinVidFreeWindow(void);
0x00446B60 0x004D +R void __cdecl WinVidExitMessage(void);
0x00446BB0 0x0048 +R DISPLAY_ADAPTER_NODE *__cdecl WinVidGetDisplayAdapter(GUID *lpGuid);
0x00446C00 0x0374 -R void __cdecl WinVidStart(void);
0x00446C00 0x0374 +R void __cdecl WinVidStart(void);
0x00446F80 0x0013 -R void __cdecl WinVidFinish(void);
0x00446FA0 0x000D -R void __thiscall DisplayModeListInit(DISPLAY_MODE_LIST *pList);
0x00446FB0 0x0032 -R void __thiscall DisplayModeListDelete(DISPLAY_MODE_LIST *pList);

View File

@ -32,6 +32,8 @@ static bool InsertDisplayModeInListSorted(
static void __thiscall TmpDisplayModeListInit(DISPLAY_MODE_LIST *mode_list);
static void __thiscall TmpDisplayModeListDelete(DISPLAY_MODE_LIST *mode_list);
static bool TmpDisplayModeListCopy(
DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIST *src);
static DISPLAY_MODE *__thiscall TmpInsertDisplayMode(
DISPLAY_MODE_LIST *mode_list, DISPLAY_MODE_NODE *before);
static DISPLAY_MODE *__thiscall TmpInsertDisplayModeInListHead(
@ -55,7 +57,22 @@ static void __thiscall TmpDisplayModeListDelete(DISPLAY_MODE_LIST *mode_list)
nextNode = node->next;
operator_delete(node);
}
DisplayModeListInit(mode_list);
TmpDisplayModeListInit(mode_list);
}
static bool TmpDisplayModeListCopy(
DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIST *src)
{
if (dst == NULL || src == NULL || dst == src) {
return false;
}
TmpDisplayModeListDelete(dst);
for (DISPLAY_MODE_NODE *node = src->head; node != NULL; node = node->next) {
DISPLAY_MODE *dst_mode = TmpInsertDisplayModeInListTail(dst);
*dst_mode = node->body;
}
return true;
}
static DISPLAY_MODE *__thiscall TmpInsertDisplayMode(
@ -2490,8 +2507,8 @@ BOOL WINAPI EnumDisplayAdaptersCallback(
list_node->previous = adapter_list->tail;
S_FlaggedString_InitAdapter(&list_node->body);
DisplayModeListInit(&list_node->body.hw_disp_mode_list);
DisplayModeListInit(&list_node->body.sw_disp_mode_list);
TmpDisplayModeListInit(&list_node->body.hw_disp_mode_list);
TmpDisplayModeListInit(&list_node->body.sw_disp_mode_list);
if (!adapter_list->head) {
adapter_list->head = list_node;
@ -2879,3 +2896,33 @@ DISPLAY_ADAPTER_NODE *__cdecl WinVidGetDisplayAdapter(const GUID *guid_ptr)
}
return g_PrimaryDisplayAdapter;
}
void __cdecl WinVidStart(void)
{
if (g_SavedAppSettings.preferred_display_adapter == NULL) {
Shell_ExitSystem("Can't create DirectDraw");
}
DISPLAY_ADAPTER *preferred =
&g_SavedAppSettings.preferred_display_adapter->body;
g_CurrentDisplayAdapter = *preferred;
S_FlaggedString_Copy(
&g_CurrentDisplayAdapter.driver_desc, &preferred->driver_desc);
S_FlaggedString_Copy(
&g_CurrentDisplayAdapter.driver_name, &preferred->driver_name);
TmpDisplayModeListInit(&g_CurrentDisplayAdapter.hw_disp_mode_list);
TmpDisplayModeListCopy(
&g_CurrentDisplayAdapter.hw_disp_mode_list,
&preferred->hw_disp_mode_list);
TmpDisplayModeListInit(&g_CurrentDisplayAdapter.sw_disp_mode_list);
TmpDisplayModeListCopy(
&g_CurrentDisplayAdapter.sw_disp_mode_list,
&preferred->sw_disp_mode_list);
if (!DDrawCreate(g_CurrentDisplayAdapter.adapter_guid_ptr)) {
Shell_ExitSystem("Can't create DirectDraw");
}
}

View File

@ -125,3 +125,4 @@ bool __cdecl WinVidCreateGameWindow(void);
void __cdecl WinVidFreeWindow(void);
void __cdecl WinVidExitMessage(void);
DISPLAY_ADAPTER_NODE *__cdecl WinVidGetDisplayAdapter(const GUID *guid_ptr);
void __cdecl WinVidStart(void);

View File

@ -443,7 +443,6 @@
#define ControlLavaBlob ((void __cdecl (*)(int16_t fx_num))0x00442F40)
#define GiantYetiControl ((void __cdecl (*)(int16_t item_num))0x00443050)
#define YetiControl ((void __cdecl (*)(int16_t item_num))0x00443350)
#define WinVidStart ((void __cdecl (*)(void))0x00446C00)
#define WinVidFinish ((void __cdecl (*)(void))0x00446F80)
#define DisplayModeListInit ((void __thiscall (*)(DISPLAY_MODE_LIST *pList))0x00446FA0)
#define DisplayModeListDelete ((void __thiscall (*)(DISPLAY_MODE_LIST *pList))0x00446FB0)

View File

@ -164,6 +164,7 @@ static void Inject_Decomp(const bool enable)
INJECT(enable, 0x00446B30, WinVidFreeWindow);
INJECT(enable, 0x00446B60, WinVidExitMessage);
INJECT(enable, 0x00446BB0, WinVidGetDisplayAdapter);
INJECT(enable, 0x00446C00, WinVidStart);
}
static void Inject_Background(const bool enable)