port CreateRenderBuffer

This commit is contained in:
Marcin Kurczewski 2024-05-09 17:19:46 +02:00
parent 4099a8d38f
commit b64b30dd58
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 32 additions and 10 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">38.51% (469)</tspan> · <tspan class="known">59.03% (719)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">38.59% (470)</tspan> · <tspan class="known">58.95% (718)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="287.64" height="6" x="0" y="0" class="decompiled"/>
<rect width="440.96" height="6" x="287.64" y="0" class="known"/>
<rect width="288.25" height="6" x="0" y="0" class="decompiled"/>
<rect width="440.35" height="6" x="288.25" y="0" class="known"/>
<rect width="3.07" height="6" x="728.60" y="0" class="todo"/>
<rect width="15.33" height="6" x="731.67" y="0" class="unused"/>
</g>
@ -1015,7 +1015,7 @@
<rect width="12" height="12" x="525" y="270" class="decompiled"><title>void __cdecl CreateWindowPalette(void);</title></rect>
<rect width="12" height="12" x="540" y="270" class="decompiled"><title>void __cdecl CreateZBuffer(void);</title></rect>
<rect width="12" height="12" x="555" y="270" class="decompiled"><title>DWORD __cdecl GetZBufferDepth(void);</title></rect>
<rect width="12" height="12" x="570" y="270" class="known"><title>void __cdecl CreateRenderBuffer(void);</title></rect>
<rect width="12" height="12" x="570" y="270" class="decompiled"><title>void __cdecl CreateRenderBuffer(void);</title></rect>
<rect width="12" height="12" x="585" y="270" class="known"><title>void __cdecl CreatePictureBuffer(void);</title></rect>
<rect width="12" height="12" x="600" y="270" class="known"><title>void __cdecl ClearBuffers(DWORD flags, DWORD fill_color);</title></rect>
<rect width="12" height="12" x="615" y="270" class="decompiled"><title>void __cdecl RestoreLostBuffers(void);</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">35.97%</tspan> · <tspan class="known">63.71%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">36.01%</tspan> · <tspan class="known">63.66%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="268.66" height="6" x="0" y="0" class="decompiled"/>
<rect width="475.90" height="6" x="268.66" y="0" class="known"/>
<rect width="269.01" height="6" x="0" y="0" class="decompiled"/>
<rect width="475.54" height="6" x="269.01" y="0" class="known"/>
<rect width="0.10" height="6" x="744.56" y="0" class="todo"/>
<rect width="2.40" height="6" x="744.60" y="0" class="unused"/>
</g>
@ -1837,7 +1837,7 @@
<rect width="8.45" height="8.75" x="615.23" y="173.80" class="known"><title>bool __cdecl LoadTexturePage(int32_t page_idx, bool reset);</title></rect>
<rect width="8.38" height="8.75" x="626.68" y="173.80" class="decompiled"><title>void __cdecl Output_AlterFOV(int16_t fov);</title></rect>
<rect width="8.38" height="8.75" x="638.06" y="173.80" class="decompiled"><title>void __cdecl Matrix_RotYXZsuperpack(int16_t **pprot, int32_t skip);</title></rect>
<rect width="8.38" height="8.75" x="649.44" y="173.80" class="known"><title>void __cdecl CreateRenderBuffer(void);</title></rect>
<rect width="8.38" height="8.75" x="649.44" y="173.80" class="decompiled"><title>void __cdecl CreateRenderBuffer(void);</title></rect>
<rect width="8.31" height="8.75" x="660.82" y="173.80" class="decompiled"><title>int32_t __cdecl LOS_Check(const GAME_VECTOR *start, GAME_VECTOR *target);</title></rect>
<rect width="8.24" height="8.75" x="672.12" y="173.80" class="decompiled"><title>const int16_t *__cdecl Output_InsertObjectGT3_Sorted(const int16_t *obj_ptr, int32_t num, SORT_TYPE sort_type);</title></rect>
<rect width="8.24" height="8.75" x="683.36" y="173.80" class="known"><title>void __cdecl setup_screen_size(void);</title></rect>

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 360 KiB

View File

@ -3113,7 +3113,7 @@ typedef enum {
0x00448750 0x00D3 +R void __cdecl CreateWindowPalette(void);
0x00448830 0x00BC +R void __cdecl CreateZBuffer(void);
0x004488F0 0x002B +R DWORD __cdecl GetZBufferDepth(void);
0x00448920 0x00A1 -R void __cdecl CreateRenderBuffer(void);
0x00448920 0x00A1 +R void __cdecl CreateRenderBuffer(void);
0x004489D0 0x0070 -R void __cdecl CreatePictureBuffer(void);
0x00448A40 0x01A4 -R void __cdecl ClearBuffers(DWORD flags, DWORD fill_color);
0x00448BF0 0x013C +R void __cdecl RestoreLostBuffers(void);

View File

@ -1478,6 +1478,27 @@ int32_t __cdecl GetZBufferDepth(void)
return 8;
}
void __cdecl CreateRenderBuffer(void)
{
DDSDESC dsp = {
.dwSize = sizeof(DDSDESC),
.dwFlags = DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS,
.dwWidth = g_GameVid_BufWidth,
.dwHeight = g_GameVid_BufHeight,
.ddsCaps = {
.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN,
},
};
if (FAILED(DDrawSurfaceCreate(&dsp, &g_RenderBufferSurface))) {
Shell_ExitSystem("Failed to create render buffer");
}
if (!WinVidClearBuffer(g_RenderBufferSurface, NULL, 0)) {
Shell_ExitSystem("Failed to clear render buffer");
}
}
void __cdecl UpdateFrame(const bool need_run_message_loop, LPRECT rect)
{
if (rect == NULL) {

View File

@ -75,6 +75,7 @@ void __cdecl CreateClipper(void);
void __cdecl CreateWindowPalette(void);
void __cdecl CreateZBuffer(void);
int32_t __cdecl GetZBufferDepth(void);
void __cdecl CreateRenderBuffer(void);
void __cdecl UpdateFrame(bool need_run_message_loop, LPRECT rect);
void __cdecl RestoreLostBuffers(void);
void __cdecl WaitPrimaryBufferFlip(void);

View File

@ -505,7 +505,6 @@
#define TempVideoRemove ((void __cdecl (*)(void))0x004479D0)
#define S_FadeInInventory ((void __cdecl (*)(BOOL isFade))0x00447A10)
#define S_FadeOutInventory ((void __cdecl (*)(BOOL isFade))0x00447A50)
#define CreateRenderBuffer ((void __cdecl (*)(void))0x00448920)
#define CreatePictureBuffer ((void __cdecl (*)(void))0x004489D0)
#define ClearBuffers ((void __cdecl (*)(DWORD flags, DWORD fill_color))0x00448A40)
#define RenderStart ((void __cdecl (*)(bool is_reset))0x00448E50)

View File

@ -123,6 +123,7 @@ static void Inject_Decomp(const bool enable)
INJECT(enable, 0x00448750, CreateWindowPalette);
INJECT(enable, 0x00448830, CreateZBuffer);
INJECT(enable, 0x004488F0, GetZBufferDepth);
INJECT(enable, 0x00448920, CreateRenderBuffer);
INJECT(enable, 0x00448D30, UpdateFrame);
INJECT(enable, 0x00448BF0, RestoreLostBuffers);
INJECT(enable, 0x00448E00, WaitPrimaryBufferFlip);