Skip to content

Commit

Permalink
Merge pull request #204 from RadWolfie/d3d8ltcg-missing-reset-sig
Browse files Browse the repository at this point in the history
Add LTCG symbols: CDevice_FreeFrameBuffers, CDevice_InitializeFrameBuffers, and D3DDevice_Reset variants
  • Loading branch information
ergo720 authored May 4, 2024
2 parents 4e459f5 + 0fdb09a commit 22110c6
Show file tree
Hide file tree
Showing 17 changed files with 696 additions and 114 deletions.
2 changes: 2 additions & 0 deletions include/xref/d3d8.def
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ XREF_SYMBOL(D3D8_Lock2DSurface)
XREF_SYMBOL(D3D8_Lock3DSurface)
XREF_SYMBOL(D3D8_Get2DSurfaceDesc)
// include D3D prefix
XREF_SYMBOL(D3D_CDevice_FreeFrameBuffers)
XREF_SYMBOL(D3D_CDevice_InitializeFrameBuffers)
XREF_SYMBOL(D3D_CDevice_KickOff)
XREF_SYMBOL(D3D_CDevice_MakeSpace)
XREF_SYMBOL(D3D_CDevice_SetStateUP)
Expand Down
93 changes: 73 additions & 20 deletions src/OOVPADatabase/D3D8/3911.inl
Original file line number Diff line number Diff line change
Expand Up @@ -5003,30 +5003,24 @@ OOVPA_SIG_MATCH(
// ******************************************************************
// * D3DDevice_Reset
// ******************************************************************
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_Reset,
3911)
// Generic OOVPA as of 3911 and newer
OOVPA_SIG_HEADER_XREF(D3DDevice_Reset,
3911,
XRefOne)
OOVPA_SIG_MATCH(
// call CDevice::FreeFrameBuffers
XREF_ENTRY(0x23, XREF_D3D_CDevice_FreeFrameBuffers),

// D3DDevice_Reset+0x00 : push ebx
{ 0x00, 0x53 },

// D3DDevice_Reset+0x15 : mov ecx, ebp
{ 0x15, 0x8B },
{ 0x16, 0xCD },

// D3DDevice_Reset+0x1E : jnz +0xF5
{ 0x1E, 0x75 },
{ 0x1F, 0xF5 },
// push ebx
OV_MATCH(0x00, 0x53),

// D3DDevice_Reset+0x27 : mov esi, [esp+0x14]
{ 0x27, 0x8B },
{ 0x28, 0x74 },
{ 0x29, 0x24 },
{ 0x2A, 0x14 },
// jnz +0xF5
OV_MATCH(0x1E, 0x75, 0xF5),

// D3DDevice_Reset+0x37 : jge +0x10
{ 0x37, 0x7D },
{ 0x38, 0x10 },
// call CDevice::FreeFrameBuffers
OV_MATCH(0x22, 0xE8),
// mov esi, [esp + param_1]
OV_MATCH(0x27, 0x8B, 0x74, 0x24, 0x14),
//
);

Expand Down Expand Up @@ -5944,3 +5938,62 @@ OOVPA_SIG_MATCH(
OV_MATCH(0x0D, 0xC3),
//
);

// ******************************************************************
// * D3D::CDevice::FreeFrameBuffers
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers,
3911,
XRefTwo)
OOVPA_SIG_MATCH(
// call [AvGetSavedDataAddress]
XREF_ENTRY(0x08, XREF_KT_FUNC_AvGetSavedDataAddress),
// call [AvSendTVEncoderOption]
XREF_ENTRY(0x20, XREF_KT_FUNC_AvSendTVEncoderOption),

// push ebx
// push ebp
// push esi
// push edi
OV_MATCH(0x00, 0x53, 0x55, 0x56, 0x57),
// mov esi, ecx
// call [AvGetSavedDataAddress]
OV_MATCH(0x04, 0x8B, 0xF1, 0xFF, 0x15),

// call [AvSendTVEncoderOption]
OV_MATCH(0x1E, 0xFF, 0x15),

// push edx
// call ????
OV_MATCH(0x6E, 0x52, 0xE8),
// mov [esi + 0x????], ebp
OV_MATCH(0x74, 0x89, 0xAE),

// cmp [esi + 0x????], ebp
OV_MATCH(0x7A, 0x39, 0xAE),
//
);

// ******************************************************************
// * D3D::CDevice::InitializeFrameBuffers
// ******************************************************************
// Generic OOVPA as of 3911 and newer.
OOVPA_SIG_HEADER_NO_XREF(CDevice_InitializeFrameBuffers,
3911)
OOVPA_SIG_MATCH(
// sub esp, 0x??
OV_MATCH(0x00, 0x83, 0xEC),

// jc +4
// mov [esp + 0x??], eax
OV_MATCH(0x1B, 0x72, 0x04, 0x89, 0x44, 0x24),

// push eax
// call ????
OV_MATCH(0x24, 0x50, 0xE8),

// mov e??, [e?? + 0x24]
OV_MATCH(0x2A, 0x8B),
OV_MATCH(0x2C, 0x24),
//
);
34 changes: 34 additions & 0 deletions src/OOVPADatabase/D3D8/4034.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1852,3 +1852,37 @@ OOVPA_SIG_MATCH(
OV_MATCH(0x54, 0x6A, 0x40),
//
);

// ******************************************************************
// * D3D::CDevice::FreeFrameBuffers
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers,
4034,
XRefTwo)
OOVPA_SIG_MATCH(
// call [AvGetSavedDataAddress]
XREF_ENTRY(0x07, XREF_KT_FUNC_AvGetSavedDataAddress),
// call [AvSendTVEncoderOption]
XREF_ENTRY(0x1F, XREF_KT_FUNC_AvSendTVEncoderOption),

// push ebp
// push esi
// push edi
OV_MATCH(0x00, 0x55, 0x56, 0x57),
// mov esi, ecx
// call [AvGetSavedDataAddress]
OV_MATCH(0x03, 0x8B, 0xF1, 0xFF, 0x15),

// call [AvSendTVEncoderOption]
OV_MATCH(0x1D, 0xFF, 0x15),

// push edx
// call ????
OV_MATCH(0x6D, 0x52, 0xE8),
// mov [esi + 0x????], ebp
OV_MATCH(0x73, 0x89, 0xAE),

// mov eax, [esi + 0x????]
OV_MATCH(0x79, 0x8B, 0x86),
//
);
34 changes: 34 additions & 0 deletions src/OOVPADatabase/D3D8/5455.inl
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,37 @@ OOVPA_SIG_MATCH(

//
);

// ******************************************************************
// * D3D::CDevice::FreeFrameBuffers
// ******************************************************************
// Generic OOVPA as of 5455 and newer.
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers,
5455,
XRefTwo)
OOVPA_SIG_MATCH(
// call [AvGetSavedDataAddress]
XREF_ENTRY(0x06, XREF_KT_FUNC_AvGetSavedDataAddress),
// call [AvSendTVEncoderOption]
XREF_ENTRY(0x1E, XREF_KT_FUNC_AvSendTVEncoderOption),

// push ebp
// push esi
OV_MATCH(0x00, 0x55, 0x56),
// mov esi, ecx
// call [AvGetSavedDataAddress]
OV_MATCH(0x02, 0x8B, 0xF1, 0xFF, 0x15),

// call [AvSendTVEncoderOption]
OV_MATCH(0x1C, 0xFF, 0x15),

// push edx
// call ????
OV_MATCH(0x6C, 0x52, 0xE8),
// mov [esi + 0x????], ebp
OV_MATCH(0x72, 0x89, 0xAE),

// mov eax, [esi + 0x????]
OV_MATCH(0x78, 0x8B, 0x86),
//
);
23 changes: 0 additions & 23 deletions src/OOVPADatabase/D3D8/5558.inl
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,6 @@ OOVPA_SIG_MATCH(
//
);

// ******************************************************************
// * D3DDevice_Reset
// ******************************************************************
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_Reset,
5558)
OOVPA_SIG_MATCH(

{ 0x00, 0x53 },
{ 0x27, 0x8B },
{ 0x28, 0x74 },
{ 0x29, 0x24 },
{ 0x2A, 0x14 },
{ 0x2B, 0x56 },
{ 0x2C, 0x8B },
{ 0x2D, 0xCF },
{ 0x2E, 0xE8 },
{ 0x8B, 0x6A },
{ 0x9A, 0xE8 },
{ 0x9F, 0x33 },
{ 0xA6, 0x04 },
//
);

// ******************************************************************
// * D3DDevice_SetGammaRamp
// ******************************************************************
Expand Down
81 changes: 81 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/3911.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1436,3 +1436,84 @@ OOVPA_SIG_MATCH(
OV_MATCH(0x33, 0xC3),
//
);

// ******************************************************************
// * D3D::CDevice::FreeFrameBuffers
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers_0__LTCG_ebx1,
3911,
XRefTwo)
OOVPA_SIG_MATCH(
// call [AvGetSavedDataAddress]
XREF_ENTRY(0x02, XREF_KT_FUNC_AvGetSavedDataAddress),
// call [AvSendTVEncoderOption]
XREF_ENTRY(0x18, XREF_KT_FUNC_AvSendTVEncoderOption),

// call [AvGetSavedDataAddress]
OV_MATCH(0x00, 0xFF, 0x15),

// call [AvSendTVEncoderOption]
OV_MATCH(0x16, 0xFF, 0x15),

// mov esi, [ebx + 0x????]
OV_MATCH(0x64, 0x8B, 0xB3),

// call ????
OV_MATCH(0x6A, 0xE8),
// mov [ebx + 0x????], e??
OV_MATCH(0x6F, 0x89),

// cmp [ebx + 0x????], e??
OV_MATCH(0x75, 0x39),
//
);

// ******************************************************************
// * D3D::CDevice::InitializeFrameBuffers
// ******************************************************************
OOVPA_SIG_HEADER_NO_XREF(CDevice_InitializeFrameBuffers_8,
3911)
OOVPA_SIG_MATCH(
// sub esp, 0x??
OV_MATCH(0x00, 0x83, 0xEC),

// jc +4
// mov [esp + 0x??], eax
OV_MATCH(0x19, 0x72, 0x04, 0x89, 0x44, 0x24),

// mov eax, [edi + 0x08]
// call ????
OV_MATCH(0x1F, 0x8B, 0x47, 0x08, 0xE8),

// mov e??, [e?? + 0x24]
OV_MATCH(0x29, 0x8B),
OV_MATCH(0x2B, 0x24),

// NOTE: Do not include ADD, DEC, and LEA instructions OVs. Because they
// are at different offsets and sometimes don't have a complete set
// of instructions. Plus it is unnecessary.
//
);

// ******************************************************************
// * D3DDevice_Reset
// ******************************************************************
OOVPA_SIG_HEADER_XREF(D3DDevice_Reset_0__LTCG_edi1,
3911,
XRefOne)
OOVPA_SIG_MATCH(
// call CDevice::FreeFrameBuffers
XREF_ENTRY(0x2C, XREF_D3D_CDevice_FreeFrameBuffers),

// push ebx
OV_MATCH(0x00, 0x53),

// jnz +0x??
OV_MATCH(0x29, 0x75),

// call CDevice::FreeFrameBuffers
OV_MATCH(0x2B, 0xE8),
// push param_1
OV_MATCH(0x30, 0x57),
//
);
35 changes: 35 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/4034.inl
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,38 @@ OOVPA_SIG_MATCH(
OV_MATCH(0x103, 0xC3), // LTCG 0xC3 vs non-LTCG 0xC2
//
);

// ******************************************************************
// * D3D::CDevice::FreeFrameBuffers
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers_0__LTCG_ebx1,
4034,
XRefTwo)
OOVPA_SIG_MATCH(
// call [AvGetSavedDataAddress]
XREF_ENTRY(0x02, XREF_KT_FUNC_AvGetSavedDataAddress),
// call [AvSendTVEncoderOption]
XREF_ENTRY(0x18, XREF_KT_FUNC_AvSendTVEncoderOption),

// call [AvGetSavedDataAddress]
OV_MATCH(0x00, 0xFF, 0x15),

// call [AvSendTVEncoderOption]
OV_MATCH(0x16, 0xFF, 0x15),

// This is a requirement to separate detection vs CDevice_FreeFrameBuffers_4 (4432)
// push ebp
OV_MATCH(0x22, 0x55),

// mov esi, [ebx + 0x????]
OV_MATCH(0x63, 0x8B, 0xB3),

// call ????
OV_MATCH(0x69, 0xE8),
// mov [ebx + 0x????], e??
OV_MATCH(0x6E, 0x89),

// cmp [ebx + 0x????], e??
OV_MATCH(0x74, 0x39),
//
);
Loading

0 comments on commit 22110c6

Please sign in to comment.