port HWR_VertexBufferFull

This commit is contained in:
Marcin Kurczewski 2024-07-15 18:09:25 +02:00
parent 2827cc986a
commit 31042837af
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
8 changed files with 21 additions and 12 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">43.84% (534)</tspan> · <tspan class="known">53.69% (654)</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">43.92% (535)</tspan> · <tspan class="known">53.61% (653)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="327.50" height="6" x="0" y="0" class="decompiled"/>
<rect width="401.10" height="6" x="327.50" y="0" class="known"/>
<rect width="328.12" height="6" x="0" y="0" class="decompiled"/>
<rect width="400.49" height="6" x="328.12" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1095,7 +1095,7 @@
<rect width="12" height="12" x="240" y="300" class="decompiled"><title>void __cdecl HWR_LoadTexturePages(int32_t pages_count, void *pages_buf, RGB_888 *palette);</title></rect>
<rect width="12" height="12" x="255" y="300" class="decompiled"><title>void __cdecl HWR_FreeTexturePages(void);</title></rect>
<rect width="12" height="12" x="270" y="300" class="decompiled"><title>void __cdecl HWR_GetPageHandles(void);</title></rect>
<rect width="12" height="12" x="285" y="300" class="known"><title>bool __cdecl HWR_VertexBufferFull(void);</title></rect>
<rect width="12" height="12" x="285" y="300" class="decompiled"><title>bool __cdecl HWR_VertexBufferFull(void);</title></rect>
<rect width="12" height="12" x="300" y="300" class="known"><title>bool __cdecl HWR_Init(void);</title></rect>
<rect width="12" height="12" x="315" y="300" class="known"><title>BOOL __cdecl S_InitialiseSystem(void);</title></rect>
<rect width="12" height="12" x="330" y="300" class="known"><title>void __cdecl GameBuf_Shutdown(void);</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.99%</tspan> · <tspan class="known">59.69%</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.99%</tspan> · <tspan class="known">59.68%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="298.70" height="6" x="0" y="0" class="decompiled"/>
<rect width="445.86" height="6" x="298.70" y="0" class="known"/>
<rect width="298.76" height="6" x="0" y="0" class="decompiled"/>
<rect width="445.80" height="6" x="298.76" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -2419,7 +2419,7 @@
<rect width="1.91" height="1.40" x="708.89" y="373.60" class="decompiled"><title>bool __cdecl S_Audio_Sample_DSoundEnumerate(SOUND_ADAPTER_LIST *adapter_list);</title></rect>
<rect width="1.51" height="1.78" x="713.79" y="341.96" class="decompiled"><title>int32_t __fastcall Math_SinImpl(int16_t angle);</title></rect>
<rect width="1.51" height="1.60" x="713.79" y="346.74" class="known"><title>int32_t __cdecl GetDebouncedInput(int32_t input);</title></rect>
<rect width="1.51" height="1.60" x="713.79" y="351.34" class="known"><title>bool __cdecl HWR_VertexBufferFull(void);</title></rect>
<rect width="1.51" height="1.60" x="713.79" y="351.34" class="decompiled"><title>bool __cdecl HWR_VertexBufferFull(void);</title></rect>
<rect width="1.51" height="1.41" x="713.79" y="355.94" class="decompiled"><title>void __cdecl Lara_State_SlideBack(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
<rect width="1.51" height="1.41" x="713.79" y="360.35" class="known"><title>void __cdecl draw_flare_meshes(void);</title></rect>
<rect width="1.51" height="1.41" x="713.79" y="364.76" class="known"><title>void __cdecl undraw_flare_meshes(void);</title></rect>

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 360 KiB

View File

@ -3207,7 +3207,7 @@ typedef struct {
0x0044D490 0x008E +R void __cdecl HWR_LoadTexturePages(int32_t pages_count, void *pages_buf, RGB_888 *palette);
0x0044D520 0x004A +R void __cdecl HWR_FreeTexturePages(void);
0x0044D570 0x0035 +R void __cdecl HWR_GetPageHandles(void);
0x0044D5B0 0x0019 -R bool __cdecl HWR_VertexBufferFull(void);
0x0044D5B0 0x0019 +R bool __cdecl HWR_VertexBufferFull(void);
0x0044D5E0 0x0022 -R bool __cdecl HWR_Init(void);
0x0044D610 0x005C *R BOOL __cdecl S_InitialiseSystem(void);
0x0044D670 0x0011 * void __cdecl GameBuf_Shutdown(void);
@ -3629,7 +3629,7 @@ typedef struct {
0x004D9EAC - int32_t g_IsFMVPlaying;
0x004D9EC0 - int32_t g_CurrentLevel;
0x004D9EC4 - int32_t g_LevelComplete;
0x004D9ED8 - D3DTLVERTEX g_HWR_VertexBuffer[0x2000];
0x004D9ED8 - D3DTLVERTEX g_HWR_VertexBuffer[MAX_VERTICES];
0x00519EE0 - HWR_TEXTURE_HANDLE g_HWR_PageHandles[32];
0x00519F60 - D3DTLVERTEX *g_HWR_VertexPtr;
0x0051A0CC - void *g_GameMemoryPtr;

View File

@ -266,3 +266,10 @@ void __cdecl HWR_GetPageHandles(void)
GetTexturePageHandle(g_HWR_TexturePageIndexes[i]);
}
}
bool __cdecl HWR_VertexBufferFull(void)
{
const int32_t index =
(g_HWR_VertexPtr - g_HWR_VertexBuffer) / sizeof(D3DTLVERTEX);
return index >= MAX_VERTICES;
}

View File

@ -23,3 +23,4 @@ void __cdecl HWR_LoadTexturePages(
int pages_count, const void *pages_buffer, const RGB_888 *palette);
void __cdecl HWR_FreeTexturePages(void);
void __cdecl HWR_GetPageHandles(void);
bool __cdecl HWR_VertexBufferFull(void);

View File

@ -38,6 +38,7 @@
#define MAX_AUDIO_SAMPLE_BUFFERS 256
#define MAX_AUDIO_SAMPLE_TRACKS 32
#define MAX_TEXTURE_PAGES 32
#define MAX_VERTICES 0x2000
#define MAX_EFFECTS 100
#define MAX_PICKUPS 12

View File

@ -512,7 +512,6 @@
#define S_FrontEndCheck ((BOOL __cdecl (*)(void))0x0044CCB0)
#define S_SaveGame ((int32_t __cdecl (*)(const void *save_data, uint32_t save_size, int32_t slot_num))0x0044CE20)
#define S_LoadGame ((int32_t __cdecl (*)(void *save_data, uint32_t save_size, int32_t slot_num))0x0044CF40)
#define HWR_VertexBufferFull ((bool __cdecl (*)(void))0x0044D5B0)
#define HWR_Init ((bool __cdecl (*)(void))0x0044D5E0)
#define S_InitialiseSystem ((BOOL __cdecl (*)(void))0x0044D610)
#define GameBuf_Shutdown ((void __cdecl (*)(void))0x0044D670)

View File

@ -260,7 +260,7 @@ extern const char *g_TR2XVersion;
#define g_IsFMVPlaying (*(int32_t*)0x004D9EAC)
#define g_CurrentLevel (*(int32_t*)0x004D9EC0)
#define g_LevelComplete (*(int32_t*)0x004D9EC4)
#define g_HWR_VertexBuffer (*(D3DTLVERTEX(*)[0x2000])0x004D9ED8)
#define g_HWR_VertexBuffer (*(D3DTLVERTEX(*)[MAX_VERTICES])0x004D9ED8)
#define g_CurrentTexSource (*(D3DTEXTUREHANDLE*)0x00519ED8)
#define g_HWR_PageHandles (*(HWR_TEXTURE_HANDLE(*)[32])0x00519EE0)
#define g_HWR_VertexPtr (*(D3DTLVERTEX **)0x00519F60)

View File

@ -184,6 +184,7 @@ static void Inject_HWR(bool enable)
INJECT(enable, 0x0044D490, HWR_LoadTexturePages);
INJECT(enable, 0x0044D520, HWR_FreeTexturePages);
INJECT(enable, 0x0044D570, HWR_GetPageHandles);
INJECT(enable, 0x0044D5B0, HWR_VertexBufferFull);
}
static void Inject_Background(const bool enable)