port CreateBackBuffer

This commit is contained in:
Marcin Kurczewski 2024-05-09 16:52:26 +02:00
parent f607d781ea
commit 9a61a8877d
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
7 changed files with 35 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.10% (464)</tspan> · <tspan class="known">59.44% (724)</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.18% (465)</tspan> · <tspan class="known">59.36% (723)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="284.57" height="6" x="0" y="0" class="decompiled"/>
<rect width="444.03" height="6" x="284.57" y="0" class="known"/>
<rect width="285.18" height="6" x="0" y="0" class="decompiled"/>
<rect width="443.42" height="6" x="285.18" 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>
@ -1010,7 +1010,7 @@
<rect width="12" height="12" x="450" y="270" class="todo"><title>sub_448420</title></rect>
<rect width="12" height="12" x="465" y="270" class="decompiled"><title>void __cdecl CreateScreenBuffers(void);</title></rect>
<rect width="12" height="12" x="480" y="270" class="decompiled"><title>void __cdecl CreatePrimarySurface(void);</title></rect>
<rect width="12" height="12" x="495" y="270" class="known"><title>void __cdecl CreateBackBuffer(void);</title></rect>
<rect width="12" height="12" x="495" y="270" class="decompiled"><title>void __cdecl CreateBackBuffer(void);</title></rect>
<rect width="12" height="12" x="510" y="270" class="known"><title>void __cdecl CreateClipper(void);</title></rect>
<rect width="12" height="12" x="525" y="270" class="known"><title>void __cdecl CreateWindowPalette(void);</title></rect>
<rect width="12" height="12" x="540" y="270" class="known"><title>void __cdecl CreateZBuffer(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.75%</tspan> · <tspan class="known">63.93%</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">35.79%</tspan> · <tspan class="known">63.88%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="267.02" height="6" x="0" y="0" class="decompiled"/>
<rect width="477.54" height="6" x="267.02" y="0" class="known"/>
<rect width="267.35" height="6" x="0" y="0" class="decompiled"/>
<rect width="477.21" height="6" x="267.35" 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>
@ -1855,7 +1855,7 @@
<rect width="8.17" height="8.37" x="545.84" y="254.35" class="known"><title>int16_t __cdecl Room_GetTiltType(FLOOR_INFO *floor, int32_t x, int32_t y, int32_t z);</title></rect>
<rect width="8.17" height="8.37" x="545.84" y="265.72" class="decompiled"><title>void __cdecl Lara_Col_FastFall(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
<rect width="8.17" height="8.29" x="545.84" y="277.09" class="known"><title>void __cdecl WarriorSparkleTrail(ITEM_INFO *item);</title></rect>
<rect width="8.17" height="8.29" x="545.84" y="288.38" class="known"><title>void __cdecl CreateBackBuffer(void);</title></rect>
<rect width="8.17" height="8.29" x="545.84" y="288.38" class="decompiled"><title>void __cdecl CreateBackBuffer(void);</title></rect>
<rect width="8.17" height="8.29" x="545.84" y="299.68" class="known"><title>bool __cdecl CreateTexturePageSurface(TEXPAGE_DESC *desc);</title></rect>
<rect width="8.17" height="8.22" x="545.84" y="310.97" class="decompiled"><title>void __cdecl Overlay_DrawAirBar(bool flash_state);</title></rect>
<rect width="8.17" height="8.22" x="545.84" y="322.19" class="known"><title>void __cdecl AdjustTextureUVs(bool reset_uv_add);</title></rect>

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 360 KiB

View File

@ -3108,7 +3108,7 @@ typedef enum {
0x00448420 0x0001 -R sub_448420
0x00448430 0x013B +R void __cdecl CreateScreenBuffers(void);
0x00448570 0x0094 +R void __cdecl CreatePrimarySurface(void);
0x00448610 0x0098 -R void __cdecl CreateBackBuffer(void);
0x00448610 0x0098 +R void __cdecl CreateBackBuffer(void);
0x004486B0 0x009D -R void __cdecl CreateClipper(void);
0x00448750 0x00D3 -R void __cdecl CreateWindowPalette(void);
0x00448830 0x00BC -R void __cdecl CreateZBuffer(void);
@ -3719,3 +3719,5 @@ typedef enum {
0x004D9328 - RECT g_GameVidRect;
0x004D9358 - LPDDS g_BackBufferSurface;
0x004D9350 - bool g_GameVid_IsVga;
0x004D9344 - int32_t g_GameVid_BufWidth;
0x004D9348 - int32_t g_GameVid_BufHeight;

View File

@ -1363,6 +1363,26 @@ void __cdecl CreatePrimarySurface(void)
}
}
void __cdecl CreateBackBuffer(void)
{
DDSDESC dsp = {
.dwSize = sizeof(DDSDESC),
.dwFlags = DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS,
.dwWidth = g_GameVid_BufWidth,
.dwHeight = g_GameVid_BufHeight,
.ddsCaps = {
.dwCaps = DDSCAPS_3DDEVICE|DDSCAPS_OFFSCREENPLAIN,
},
};
if (g_SavedAppSettings.render_mode == RM_HARDWARE) {
dsp.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
}
if (FAILED(DDrawSurfaceCreate(&dsp, &g_BackBufferSurface))) {
Shell_ExitSystem("Failed to create back screen buffer");
}
WinVidClearBuffer(g_BackBufferSurface, 0, 0);
}
void __cdecl UpdateFrame(const bool need_run_message_loop, LPRECT rect)
{
if (rect == NULL) {

View File

@ -70,6 +70,7 @@ void __cdecl CutscenePlayerGen_Initialise(int16_t item_num);
int32_t __cdecl Level_Initialise(int32_t level_num, int32_t level_type);
void __cdecl CreateScreenBuffers(void);
void __cdecl CreatePrimarySurface(void);
void __cdecl CreateBackBuffer(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 CreateBackBuffer ((void __cdecl (*)(void))0x00448610)
#define CreateClipper ((void __cdecl (*)(void))0x004486B0)
#define CreateWindowPalette ((void __cdecl (*)(void))0x00448750)
#define CreateZBuffer ((void __cdecl (*)(void))0x00448830)

View File

@ -227,6 +227,8 @@ extern const char *g_TR2XVersion;
#define g_GameVidWidth (*(int32_t*)0x004D9338)
#define g_GameVidHeight (*(int32_t*)0x004D933C)
#define g_GameVidBPP (*(int32_t*)0x004D9340)
#define g_GameVid_BufWidth (*(int32_t*)0x004D9344)
#define g_GameVid_BufHeight (*(int32_t*)0x004D9348)
#define g_UVAdd (*(int32_t*)0x004D934C)
#define g_GameVid_IsVga (*(bool*)0x004D9350)
#define g_GameVid_IsWindowedVGA (*(int8_t*)0x004D9351)

View File

@ -118,6 +118,7 @@ static void Inject_Decomp(const bool enable)
INJECT(enable, 0x0043A280, Level_Initialise);
INJECT(enable, 0x00448430, CreateScreenBuffers);
INJECT(enable, 0x00448570, CreatePrimarySurface);
INJECT(enable, 0x00448610, CreateBackBuffer);
INJECT(enable, 0x00448D30, UpdateFrame);
INJECT(enable, 0x00448BF0, RestoreLostBuffers);
INJECT(enable, 0x00448E00, WaitPrimaryBufferFlip);