port RenderFinish

This commit is contained in:
Marcin Kurczewski 2024-05-29 19:13:25 +02:00
parent d30da66343
commit 894859cdaf
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 66 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.83% (473)</tspan> · <tspan class="known">58.70% (715)</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.92% (474)</tspan> · <tspan class="known">58.62% (714)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="290.09" height="6" x="0" y="0" class="decompiled"/>
<rect width="438.51" height="6" x="290.09" y="0" class="known"/>
<rect width="290.70" height="6" x="0" y="0" class="decompiled"/>
<rect width="437.90" height="6" x="290.70" 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>
@ -1023,7 +1023,7 @@
<rect width="12" height="12" x="645" y="270" class="decompiled"><title>void __cdecl WaitPrimaryBufferFlip(void);</title></rect>
<rect width="12" height="12" x="660" y="270" class="decompiled"><title>bool __cdecl RenderInit(void);</title></rect>
<rect width="12" height="12" x="675" y="270" class="decompiled"><title>void __cdecl RenderStart(bool is_reset);</title></rect>
<rect width="12" height="12" x="690" y="270" class="known"><title>void __cdecl RenderFinish(bool need_to_clear_textures);</title></rect>
<rect width="12" height="12" x="690" y="270" class="decompiled"><title>void __cdecl RenderFinish(bool need_to_clear_textures);</title></rect>
<rect width="12" height="12" x="705" y="270" class="known"><title>bool __cdecl ApplySettings(APP_SETTINGS *new_settings);</title></rect>
<rect width="12" height="12" x="720" y="270" class="known"><title>void __cdecl FmvBackToGame(void);</title></rect>
<rect width="12" height="12" x="735" y="270" class="known"><title>void __cdecl GameApplySettings(APP_SETTINGS *new_settings);</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">36.44%</tspan> · <tspan class="known">63.23%</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.51%</tspan> · <tspan class="known">63.16%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="272.22" height="6" x="0" y="0" class="decompiled"/>
<rect width="472.34" height="6" x="272.22" y="0" class="known"/>
<rect width="272.72" height="6" x="0" y="0" class="decompiled"/>
<rect width="471.84" height="6" x="272.72" 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>
@ -1700,7 +1700,7 @@
<rect width="10.66" height="11.04" x="494.80" y="280.46" class="decompiled"><title>int32_t __cdecl Lara_TestWaterStepOut(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
<rect width="10.66" height="11.04" x="494.80" y="294.50" class="decompiled"><title>int32_t __cdecl S_Audio_Sample_Play(int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan, int32_t flags);</title></rect>
<rect width="10.66" height="10.98" x="494.80" y="308.54" class="known"><title>void __cdecl LavaBurn(ITEM_INFO *item);</title></rect>
<rect width="10.66" height="10.98" x="494.80" y="322.51" class="known"><title>void __cdecl RenderFinish(bool need_to_clear_textures);</title></rect>
<rect width="10.66" height="10.98" x="494.80" y="322.51" class="decompiled"><title>void __cdecl RenderFinish(bool need_to_clear_textures);</title></rect>
<rect width="10.66" height="10.86" x="494.80" y="336.49" class="known"><title>bool __cdecl DInputJoystickCreate(void);</title></rect>
<rect width="10.66" height="10.86" x="494.80" y="350.35" class="known"><title>void __cdecl S_InitialisePolyList(BOOL clear_back_buffer);</title></rect>
<rect width="10.66" height="10.80" x="494.80" y="364.20" class="decompiled"><title>void __cdecl Effect_Kill(int16_t fx_num);</title></rect>

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 360 KiB

View File

@ -3134,7 +3134,7 @@ typedef struct {
0x00448E00 0x003B +R void __cdecl WaitPrimaryBufferFlip(void);
0x00448E40 0x0003 +R bool __cdecl RenderInit(void);
0x00448E50 0x03A5 +R void __cdecl RenderStart(bool is_reset);
0x00449200 0x00E6 -R void __cdecl RenderFinish(bool need_to_clear_textures);
0x00449200 0x00E6 +R void __cdecl RenderFinish(bool need_to_clear_textures);
0x004492F0 0x0204 -R bool __cdecl ApplySettings(APP_SETTINGS *new_settings);
0x00449500 0x0105 -R void __cdecl FmvBackToGame(void);
0x00449610 0x023A *R void __cdecl GameApplySettings(APP_SETTINGS *new_settings);

View File

@ -1747,3 +1747,58 @@ void __cdecl RenderStart(const bool is_reset)
setup_screen_size();
g_NeedToReloadTextures = true;
}
void __cdecl RenderFinish(bool need_to_clear_textures)
{
if (g_SavedAppSettings.render_mode == RM_HARDWARE) {
if (need_to_clear_textures) {
HWR_FreeTexturePages();
CleanupTextures();
}
Direct3DRelease();
if (g_ZBufferSurface != NULL) {
IDirectDrawSurface_Release(g_ZBufferSurface);
g_ZBufferSurface = NULL;
}
} else {
if (need_to_clear_textures && g_PictureBufferSurface != NULL) {
IDirectDrawSurface_Release(g_PictureBufferSurface);
g_PictureBufferSurface = NULL;
}
if (g_RenderBufferSurface != NULL) {
IDirectDrawSurface_Release(g_RenderBufferSurface);
g_RenderBufferSurface = NULL;
}
}
if (g_DDrawPalette != NULL) {
IDirectDrawPalette_Release(g_DDrawPalette);
g_DDrawPalette = NULL;
}
if (g_DDrawClipper != NULL) {
IDirectDrawClipper_Release(g_DDrawClipper);
g_DDrawClipper = NULL;
}
if (g_ThirdBufferSurface != NULL) {
IDirectDrawSurface_Release(g_ThirdBufferSurface);
g_ThirdBufferSurface = NULL;
}
if (g_BackBufferSurface != NULL) {
IDirectDrawSurface_Release(g_BackBufferSurface);
g_BackBufferSurface = NULL;
}
if (g_PrimaryBufferSurface != NULL) {
IDirectDrawSurface_Release(g_PrimaryBufferSurface);
g_PrimaryBufferSurface = NULL;
}
if (need_to_clear_textures) {
g_NeedToReloadTextures = false;
}
}

View File

@ -83,3 +83,4 @@ void __cdecl RestoreLostBuffers(void);
void __cdecl WaitPrimaryBufferFlip(void);
bool __cdecl RenderInit(void);
void __cdecl RenderStart(bool is_reset);
void __cdecl RenderFinish(bool need_to_clear_textures);

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 RenderFinish ((void __cdecl (*)(bool need_to_clear_textures))0x00449200)
#define ApplySettings ((bool __cdecl (*)(APP_SETTINGS *new_settings))0x004492F0)
#define FmvBackToGame ((void __cdecl (*)(void))0x00449500)
#define GameApplySettings ((void __cdecl (*)(APP_SETTINGS *new_settings))0x00449610)

View File

@ -131,6 +131,7 @@ static void Inject_Decomp(const bool enable)
INJECT(enable, 0x00448E00, WaitPrimaryBufferFlip);
INJECT(enable, 0x00448E40, RenderInit);
INJECT(enable, 0x00448E50, RenderStart);
INJECT(enable, 0x00449200, RenderFinish);
}
static void Inject_Camera(const bool enable)