Skip to content

Commit 22110c6

Browse files
authored
Merge pull request #204 from RadWolfie/d3d8ltcg-missing-reset-sig
Add LTCG symbols: CDevice_FreeFrameBuffers, CDevice_InitializeFrameBuffers, and D3DDevice_Reset variants
2 parents 4e459f5 + 0fdb09a commit 22110c6

17 files changed

Lines changed: 696 additions & 114 deletions

File tree

include/xref/d3d8.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ XREF_SYMBOL(D3D8_Lock2DSurface)
7676
XREF_SYMBOL(D3D8_Lock3DSurface)
7777
XREF_SYMBOL(D3D8_Get2DSurfaceDesc)
7878
// include D3D prefix
79+
XREF_SYMBOL(D3D_CDevice_FreeFrameBuffers)
80+
XREF_SYMBOL(D3D_CDevice_InitializeFrameBuffers)
7981
XREF_SYMBOL(D3D_CDevice_KickOff)
8082
XREF_SYMBOL(D3D_CDevice_MakeSpace)
8183
XREF_SYMBOL(D3D_CDevice_SetStateUP)

src/OOVPADatabase/D3D8/3911.inl

Lines changed: 73 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5003,30 +5003,24 @@ OOVPA_SIG_MATCH(
50035003
// ******************************************************************
50045004
// * D3DDevice_Reset
50055005
// ******************************************************************
5006-
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_Reset,
5007-
3911)
5006+
// Generic OOVPA as of 3911 and newer
5007+
OOVPA_SIG_HEADER_XREF(D3DDevice_Reset,
5008+
3911,
5009+
XRefOne)
50085010
OOVPA_SIG_MATCH(
5011+
// call CDevice::FreeFrameBuffers
5012+
XREF_ENTRY(0x23, XREF_D3D_CDevice_FreeFrameBuffers),
50095013

5010-
// D3DDevice_Reset+0x00 : push ebx
5011-
{ 0x00, 0x53 },
5012-
5013-
// D3DDevice_Reset+0x15 : mov ecx, ebp
5014-
{ 0x15, 0x8B },
5015-
{ 0x16, 0xCD },
5016-
5017-
// D3DDevice_Reset+0x1E : jnz +0xF5
5018-
{ 0x1E, 0x75 },
5019-
{ 0x1F, 0xF5 },
5014+
// push ebx
5015+
OV_MATCH(0x00, 0x53),
50205016

5021-
// D3DDevice_Reset+0x27 : mov esi, [esp+0x14]
5022-
{ 0x27, 0x8B },
5023-
{ 0x28, 0x74 },
5024-
{ 0x29, 0x24 },
5025-
{ 0x2A, 0x14 },
5017+
// jnz +0xF5
5018+
OV_MATCH(0x1E, 0x75, 0xF5),
50265019

5027-
// D3DDevice_Reset+0x37 : jge +0x10
5028-
{ 0x37, 0x7D },
5029-
{ 0x38, 0x10 },
5020+
// call CDevice::FreeFrameBuffers
5021+
OV_MATCH(0x22, 0xE8),
5022+
// mov esi, [esp + param_1]
5023+
OV_MATCH(0x27, 0x8B, 0x74, 0x24, 0x14),
50305024
//
50315025
);
50325026

@@ -5944,3 +5938,62 @@ OOVPA_SIG_MATCH(
59445938
OV_MATCH(0x0D, 0xC3),
59455939
//
59465940
);
5941+
5942+
// ******************************************************************
5943+
// * D3D::CDevice::FreeFrameBuffers
5944+
// ******************************************************************
5945+
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers,
5946+
3911,
5947+
XRefTwo)
5948+
OOVPA_SIG_MATCH(
5949+
// call [AvGetSavedDataAddress]
5950+
XREF_ENTRY(0x08, XREF_KT_FUNC_AvGetSavedDataAddress),
5951+
// call [AvSendTVEncoderOption]
5952+
XREF_ENTRY(0x20, XREF_KT_FUNC_AvSendTVEncoderOption),
5953+
5954+
// push ebx
5955+
// push ebp
5956+
// push esi
5957+
// push edi
5958+
OV_MATCH(0x00, 0x53, 0x55, 0x56, 0x57),
5959+
// mov esi, ecx
5960+
// call [AvGetSavedDataAddress]
5961+
OV_MATCH(0x04, 0x8B, 0xF1, 0xFF, 0x15),
5962+
5963+
// call [AvSendTVEncoderOption]
5964+
OV_MATCH(0x1E, 0xFF, 0x15),
5965+
5966+
// push edx
5967+
// call ????
5968+
OV_MATCH(0x6E, 0x52, 0xE8),
5969+
// mov [esi + 0x????], ebp
5970+
OV_MATCH(0x74, 0x89, 0xAE),
5971+
5972+
// cmp [esi + 0x????], ebp
5973+
OV_MATCH(0x7A, 0x39, 0xAE),
5974+
//
5975+
);
5976+
5977+
// ******************************************************************
5978+
// * D3D::CDevice::InitializeFrameBuffers
5979+
// ******************************************************************
5980+
// Generic OOVPA as of 3911 and newer.
5981+
OOVPA_SIG_HEADER_NO_XREF(CDevice_InitializeFrameBuffers,
5982+
3911)
5983+
OOVPA_SIG_MATCH(
5984+
// sub esp, 0x??
5985+
OV_MATCH(0x00, 0x83, 0xEC),
5986+
5987+
// jc +4
5988+
// mov [esp + 0x??], eax
5989+
OV_MATCH(0x1B, 0x72, 0x04, 0x89, 0x44, 0x24),
5990+
5991+
// push eax
5992+
// call ????
5993+
OV_MATCH(0x24, 0x50, 0xE8),
5994+
5995+
// mov e??, [e?? + 0x24]
5996+
OV_MATCH(0x2A, 0x8B),
5997+
OV_MATCH(0x2C, 0x24),
5998+
//
5999+
);

src/OOVPADatabase/D3D8/4034.inl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,3 +1852,37 @@ OOVPA_SIG_MATCH(
18521852
OV_MATCH(0x54, 0x6A, 0x40),
18531853
//
18541854
);
1855+
1856+
// ******************************************************************
1857+
// * D3D::CDevice::FreeFrameBuffers
1858+
// ******************************************************************
1859+
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers,
1860+
4034,
1861+
XRefTwo)
1862+
OOVPA_SIG_MATCH(
1863+
// call [AvGetSavedDataAddress]
1864+
XREF_ENTRY(0x07, XREF_KT_FUNC_AvGetSavedDataAddress),
1865+
// call [AvSendTVEncoderOption]
1866+
XREF_ENTRY(0x1F, XREF_KT_FUNC_AvSendTVEncoderOption),
1867+
1868+
// push ebp
1869+
// push esi
1870+
// push edi
1871+
OV_MATCH(0x00, 0x55, 0x56, 0x57),
1872+
// mov esi, ecx
1873+
// call [AvGetSavedDataAddress]
1874+
OV_MATCH(0x03, 0x8B, 0xF1, 0xFF, 0x15),
1875+
1876+
// call [AvSendTVEncoderOption]
1877+
OV_MATCH(0x1D, 0xFF, 0x15),
1878+
1879+
// push edx
1880+
// call ????
1881+
OV_MATCH(0x6D, 0x52, 0xE8),
1882+
// mov [esi + 0x????], ebp
1883+
OV_MATCH(0x73, 0x89, 0xAE),
1884+
1885+
// mov eax, [esi + 0x????]
1886+
OV_MATCH(0x79, 0x8B, 0x86),
1887+
//
1888+
);

src/OOVPADatabase/D3D8/5455.inl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,37 @@ OOVPA_SIG_MATCH(
354354

355355
//
356356
);
357+
358+
// ******************************************************************
359+
// * D3D::CDevice::FreeFrameBuffers
360+
// ******************************************************************
361+
// Generic OOVPA as of 5455 and newer.
362+
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers,
363+
5455,
364+
XRefTwo)
365+
OOVPA_SIG_MATCH(
366+
// call [AvGetSavedDataAddress]
367+
XREF_ENTRY(0x06, XREF_KT_FUNC_AvGetSavedDataAddress),
368+
// call [AvSendTVEncoderOption]
369+
XREF_ENTRY(0x1E, XREF_KT_FUNC_AvSendTVEncoderOption),
370+
371+
// push ebp
372+
// push esi
373+
OV_MATCH(0x00, 0x55, 0x56),
374+
// mov esi, ecx
375+
// call [AvGetSavedDataAddress]
376+
OV_MATCH(0x02, 0x8B, 0xF1, 0xFF, 0x15),
377+
378+
// call [AvSendTVEncoderOption]
379+
OV_MATCH(0x1C, 0xFF, 0x15),
380+
381+
// push edx
382+
// call ????
383+
OV_MATCH(0x6C, 0x52, 0xE8),
384+
// mov [esi + 0x????], ebp
385+
OV_MATCH(0x72, 0x89, 0xAE),
386+
387+
// mov eax, [esi + 0x????]
388+
OV_MATCH(0x78, 0x8B, 0x86),
389+
//
390+
);

src/OOVPADatabase/D3D8/5558.inl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -162,29 +162,6 @@ OOVPA_SIG_MATCH(
162162
//
163163
);
164164

165-
// ******************************************************************
166-
// * D3DDevice_Reset
167-
// ******************************************************************
168-
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_Reset,
169-
5558)
170-
OOVPA_SIG_MATCH(
171-
172-
{ 0x00, 0x53 },
173-
{ 0x27, 0x8B },
174-
{ 0x28, 0x74 },
175-
{ 0x29, 0x24 },
176-
{ 0x2A, 0x14 },
177-
{ 0x2B, 0x56 },
178-
{ 0x2C, 0x8B },
179-
{ 0x2D, 0xCF },
180-
{ 0x2E, 0xE8 },
181-
{ 0x8B, 0x6A },
182-
{ 0x9A, 0xE8 },
183-
{ 0x9F, 0x33 },
184-
{ 0xA6, 0x04 },
185-
//
186-
);
187-
188165
// ******************************************************************
189166
// * D3DDevice_SetGammaRamp
190167
// ******************************************************************

src/OOVPADatabase/D3D8LTCG/3911.inl

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,3 +1436,84 @@ OOVPA_SIG_MATCH(
14361436
OV_MATCH(0x33, 0xC3),
14371437
//
14381438
);
1439+
1440+
// ******************************************************************
1441+
// * D3D::CDevice::FreeFrameBuffers
1442+
// ******************************************************************
1443+
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers_0__LTCG_ebx1,
1444+
3911,
1445+
XRefTwo)
1446+
OOVPA_SIG_MATCH(
1447+
// call [AvGetSavedDataAddress]
1448+
XREF_ENTRY(0x02, XREF_KT_FUNC_AvGetSavedDataAddress),
1449+
// call [AvSendTVEncoderOption]
1450+
XREF_ENTRY(0x18, XREF_KT_FUNC_AvSendTVEncoderOption),
1451+
1452+
// call [AvGetSavedDataAddress]
1453+
OV_MATCH(0x00, 0xFF, 0x15),
1454+
1455+
// call [AvSendTVEncoderOption]
1456+
OV_MATCH(0x16, 0xFF, 0x15),
1457+
1458+
// mov esi, [ebx + 0x????]
1459+
OV_MATCH(0x64, 0x8B, 0xB3),
1460+
1461+
// call ????
1462+
OV_MATCH(0x6A, 0xE8),
1463+
// mov [ebx + 0x????], e??
1464+
OV_MATCH(0x6F, 0x89),
1465+
1466+
// cmp [ebx + 0x????], e??
1467+
OV_MATCH(0x75, 0x39),
1468+
//
1469+
);
1470+
1471+
// ******************************************************************
1472+
// * D3D::CDevice::InitializeFrameBuffers
1473+
// ******************************************************************
1474+
OOVPA_SIG_HEADER_NO_XREF(CDevice_InitializeFrameBuffers_8,
1475+
3911)
1476+
OOVPA_SIG_MATCH(
1477+
// sub esp, 0x??
1478+
OV_MATCH(0x00, 0x83, 0xEC),
1479+
1480+
// jc +4
1481+
// mov [esp + 0x??], eax
1482+
OV_MATCH(0x19, 0x72, 0x04, 0x89, 0x44, 0x24),
1483+
1484+
// mov eax, [edi + 0x08]
1485+
// call ????
1486+
OV_MATCH(0x1F, 0x8B, 0x47, 0x08, 0xE8),
1487+
1488+
// mov e??, [e?? + 0x24]
1489+
OV_MATCH(0x29, 0x8B),
1490+
OV_MATCH(0x2B, 0x24),
1491+
1492+
// NOTE: Do not include ADD, DEC, and LEA instructions OVs. Because they
1493+
// are at different offsets and sometimes don't have a complete set
1494+
// of instructions. Plus it is unnecessary.
1495+
//
1496+
);
1497+
1498+
// ******************************************************************
1499+
// * D3DDevice_Reset
1500+
// ******************************************************************
1501+
OOVPA_SIG_HEADER_XREF(D3DDevice_Reset_0__LTCG_edi1,
1502+
3911,
1503+
XRefOne)
1504+
OOVPA_SIG_MATCH(
1505+
// call CDevice::FreeFrameBuffers
1506+
XREF_ENTRY(0x2C, XREF_D3D_CDevice_FreeFrameBuffers),
1507+
1508+
// push ebx
1509+
OV_MATCH(0x00, 0x53),
1510+
1511+
// jnz +0x??
1512+
OV_MATCH(0x29, 0x75),
1513+
1514+
// call CDevice::FreeFrameBuffers
1515+
OV_MATCH(0x2B, 0xE8),
1516+
// push param_1
1517+
OV_MATCH(0x30, 0x57),
1518+
//
1519+
);

src/OOVPADatabase/D3D8LTCG/4034.inl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,38 @@ OOVPA_SIG_MATCH(
5555
OV_MATCH(0x103, 0xC3), // LTCG 0xC3 vs non-LTCG 0xC2
5656
//
5757
);
58+
59+
// ******************************************************************
60+
// * D3D::CDevice::FreeFrameBuffers
61+
// ******************************************************************
62+
OOVPA_SIG_HEADER_XREF(CDevice_FreeFrameBuffers_0__LTCG_ebx1,
63+
4034,
64+
XRefTwo)
65+
OOVPA_SIG_MATCH(
66+
// call [AvGetSavedDataAddress]
67+
XREF_ENTRY(0x02, XREF_KT_FUNC_AvGetSavedDataAddress),
68+
// call [AvSendTVEncoderOption]
69+
XREF_ENTRY(0x18, XREF_KT_FUNC_AvSendTVEncoderOption),
70+
71+
// call [AvGetSavedDataAddress]
72+
OV_MATCH(0x00, 0xFF, 0x15),
73+
74+
// call [AvSendTVEncoderOption]
75+
OV_MATCH(0x16, 0xFF, 0x15),
76+
77+
// This is a requirement to separate detection vs CDevice_FreeFrameBuffers_4 (4432)
78+
// push ebp
79+
OV_MATCH(0x22, 0x55),
80+
81+
// mov esi, [ebx + 0x????]
82+
OV_MATCH(0x63, 0x8B, 0xB3),
83+
84+
// call ????
85+
OV_MATCH(0x69, 0xE8),
86+
// mov [ebx + 0x????], e??
87+
OV_MATCH(0x6E, 0x89),
88+
89+
// cmp [ebx + 0x????], e??
90+
OV_MATCH(0x74, 0x39),
91+
//
92+
);

0 commit comments

Comments
 (0)