Skip to content

Commit

Permalink
d3d8ltcg: add D3DDevice_Create(Cube|Volume)Texture signatures
Browse files Browse the repository at this point in the history
Added:
- D3DDevice_CreateCubeTexture (4432)
- D3DDevice_CreateCubeTexture_4__LTCG_eax1_edx3_ecx4_edi6 (4039)
- D3DDevice_CreateVolumeTexture_12__LTCG_edx4_ecx5_eax6_edi8 (4039)
  • Loading branch information
RadWolfie committed Feb 27, 2023
1 parent 12128ca commit bbfcb66
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 24 deletions.
33 changes: 11 additions & 22 deletions src/OOVPADatabase/D3D8/3911.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2293,32 +2293,21 @@ OOVPA_SIG_HEADER_NO_XREF(D3DDevice_CreateCubeTexture,
3911)
OOVPA_SIG_MATCH(

// D3DDevice_CreateCubeTexture+0x00 : mov eax, [esp+0x1C]
{ 0x00, 0x8B },
{ 0x01, 0x44 },
{ 0x02, 0x24 },
{ 0x03, 0x18 },
// mov eax,[esp + 0x1C]
OV_MATCH(0x00, 0x8B, 0x44, 0x24, 0x18),

// D3DDevice_CreateCubeTexture+0x0C : push eax
{ 0x0C, 0x50 },

// D3DDevice_CreateCubeTexture+0x11 : push 0
{ 0x11, 0x6A },
{ 0x12, 0x00 },
// push eax
OV_MATCH(0x0C, 0x50),

// D3DDevice_CreateCubeTexture+0x13 : push 1
{ 0x13, 0x6A },
{ 0x14, 0x01 },
// push 0
// push 1
OV_MATCH(0x11, 0x6A, 0x00, 0x6A, 0x01),

// D3DDevice_CreateCubeTexture+0x18 : mov eax, [esp+0x1C]
{ 0x18, 0x8B },
{ 0x19, 0x44 },
{ 0x1A, 0x24 },
{ 0x1B, 0x1C },
// mov eax,[esp + 0x1C]
OV_MATCH(0x18, 0x8B, 0x44, 0x24, 0x1C),

// D3DDevice_CreateCubeTexture+0x25 : retn 0x18
{ 0x25, 0xC2 },
{ 0x26, 0x18 },
// retn 0x18
OV_MATCH(0x25, 0xC2, 0x18),
//
);

Expand Down
63 changes: 63 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/4039.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1517,3 +1517,66 @@ OOVPA_SIG_MATCH(
OV_MATCH(0x18, 0xC2, 0x0C),
//
);

// ******************************************************************
// * D3DDevice_CreateVolumeTexture
// ******************************************************************
// NOTE: param 7 is unused.
OOVPA_SIG_HEADER_XREF(D3DDevice_CreateVolumeTexture_12__LTCG_edx4_ecx5_eax6_edi8,
4039,
XRefOne)
OOVPA_SIG_MATCH(

// call D3D::CreateTexture
XREF_ENTRY(0x17, XREF_D3D_CreateTexture),

// push 0x0
// push param_6
OV_MATCH(0x00, 0x6A, 0x00, 0x50),

// push param_5
OV_MATCH(0x07, 0x51),

// push param_4
OV_MATCH(0x0C, 0x52),

// mov edx,0x01
// call D3D::CreateTexture
OV_MATCH(0x14, 0xB2, 0x01, 0xE8),
// ret 0x8
OV_MATCH(0x1B, 0xC2, 0x10),
//
);

// ******************************************************************
// * D3DDevice_CreateCubeTexture
// ******************************************************************
// NOTE: param 5 is unused.
OOVPA_SIG_HEADER_XREF(D3DDevice_CreateCubeTexture_4__LTCG_eax1_edx3_ecx4_edi6,
4039,
XRefOne)
OOVPA_SIG_MATCH(

// call D3D::CreateTexture
XREF_ENTRY(0x10, XREF_D3D_CreateTexture),

// push 0x1
// push param_4
OV_MATCH(0x00, 0x6A, 0x01, 0x51),

// push param_3
OV_MATCH(0x07, 0x52),
// push param_2
//OV_MATCH(0x08, 0x51),

// push 0x1
// push param_1
// push param_1
OV_MATCH(0x09, 0x6A, 0x01, 0x50, 0x50),
// xor dl,dl
// call D3D::CreateTexture
OV_MATCH(0x0D, 0x32, 0xD2, 0xE8),
// ret 0x8
OV_MATCH(0x14, 0xC2, 0x08),
//
);
37 changes: 37 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/4432.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1093,3 +1093,40 @@ OOVPA_SIG_MATCH(
OV_MATCH(0x2A, 0xC3),
//
);

// ******************************************************************
// * D3DDevice_CreateCubeTexture
// ******************************************************************
// TODO: Might be possible to move it early as 4039 since this function
// is compatible with D3D::CreateTexture's 4039 LTCG signature.
OOVPA_SIG_HEADER_XREF(D3DDevice_CreateCubeTexture,
4432,
XRefOne)
OOVPA_SIG_MATCH(

// call D3D::CreateTexture
XREF_ENTRY(0x21, XREF_D3D_CreateTexture),

// mov eax,[esp + param_4]
OV_MATCH(0x00, 0x8B, 0x44, 0x24, 0x10),

// push 0x1
// push param_4
OV_MATCH(0x11, 0x6A, 0x01, 0x50),

// push param_3
OV_MATCH(0x18, 0x51),
// push param_2
// OV_MATCH(0x19, 0x52),

// push 0x1
// push param_1
// push param_1
OV_MATCH(0x1A, 0x6A, 0x01, 0x50, 0x50),
// xor dl,dl
// call D3D::CreateTexture
OV_MATCH(0x1E, 0x32, 0xD2, 0xE8),
// ret 0x18
OV_MATCH(0x26, 0xC2, 0x18),
//
);
3 changes: 3 additions & 0 deletions src/OOVPADatabase/D3D8LTCG_OOVPA.inl
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ OOVPATable D3D8LTCG_OOVPA[] = {
REGISTER_OOVPAS(D3DDevice_BlockUntilVerticalBlank, 1024), // NOTE: NASCAR Heat 2002 reveal this function is inlined, need some sort of indicator which is inline or not.
REGISTER_OOVPAS(D3DDevice_Clear, 1024, 1036),
REGISTER_OOVPAS(D3DDevice_CopyRects, 1024, 1036, 1048),
REGISTER_OOVPAS(D3DDevice_CreateCubeTexture, 4432),
REGISTER_OOVPAS_BIND_XREF(D3DDevice_CreateCubeTexture_4__LTCG_eax1_edx3_ecx4_edi6, D3DDevice_CreateCubeTexture, 4039),
REGISTER_OOVPAS(D3DDevice_CreatePixelShader, 1024),
REGISTER_OOVPAS(D3DDevice_CreateTexture, 1024),
REGISTER_OOVPAS_BIND_XREF(D3DDevice_CreateTexture_8__LTCG_edx3_ecx4_eax5_edi7, D3DDevice_CreateTexture, 4039),
REGISTER_OOVPAS(D3DDevice_CreateTexture2, 1024, 1048),
REGISTER_OOVPAS(D3DDevice_CreateVertexShader, 1024),
REGISTER_OOVPAS_BIND_XREF(D3DDevice_CreateVolumeTexture_12__LTCG_edx4_ecx5_eax6_edi8, D3DDevice_CreateVolumeTexture, 4039),
REGISTER_OOVPAS_BIND_XREF(D3DDevice_DeletePixelShader_0, D3DDevice_DeletePixelShader, 2024),
REGISTER_OOVPAS(D3DDevice_DeleteStateBlock, 1024),
REGISTER_OOVPAS_BIND_XREF(D3DDevice_DeleteVertexShader_0, D3DDevice_DeleteVertexShader, 3911, 5344), // Final generic OOVPA: 5344; Removed: 0
Expand Down
8 changes: 6 additions & 2 deletions src/test/libverify/D3D8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ static const library_list database_full = {
REGISTER_SYMBOL_INLINE(D3DDevice_CaptureStateBlock, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_Clear, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CopyRects, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateCubeTexture, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOLS(D3DDevice_CreateCubeTexture,
REGISTER_SYMBOL(D3DDevice_CreateCubeTexture, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL(D3DDevice_CreateCubeTexture_4__LTCG_eax1_edx3_ecx4_edi6, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE))),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateImageSurface, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateIndexBuffer, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateIndexBuffer2, VER_RANGE(4627, VER_MAX, VER_NONE, VER_NONE)),
Expand All @@ -90,7 +92,9 @@ static const library_list database_full = {
REGISTER_SYMBOL_INLINE(D3DDevice_CreateVertexBuffer, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateVertexBuffer2, VER_RANGE(4627, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateVertexShader, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL_INLINE(D3DDevice_CreateVolumeTexture, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOLS(D3DDevice_CreateVolumeTexture,
REGISTER_SYMBOL(D3DDevice_CreateVolumeTexture, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOL(D3DDevice_CreateVolumeTexture_12__LTCG_edx4_ecx5_eax6_edi8, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE))),
REGISTER_SYMBOL_INLINE(D3DDevice_DeletePatch, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
REGISTER_SYMBOLS(D3DDevice_DeletePixelShader,
REGISTER_SYMBOL(D3DDevice_DeletePixelShader, VER_RANGE(3911, VER_MAX, VER_NONE, VER_NONE)),
Expand Down

0 comments on commit bbfcb66

Please sign in to comment.