Skip to content

Commit 0487a70

Browse files
committed
d3d8ltcg: fix D3DDevice_SetTextureState_ColorKeyColor variant signatures
changed esi1 to eax1 register Updated: - 2024 to 3911 - 2036 to 5233 - 2048 to 5788
1 parent f3f7700 commit 0487a70

5 files changed

Lines changed: 58 additions & 40 deletions

File tree

src/OOVPADatabase/D3D8LTCG/3911.inl

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,27 @@ OOVPA_SIG_MATCH(
193193
// ******************************************************************
194194
// * D3DDevice_SetTextureState_ColorKeyColor
195195
// ******************************************************************
196-
//83C008C1E707890689 ...C3
197-
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_esi1_ebx2,
198-
2024)
196+
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_eax1_ebx2,
197+
3911)
199198
OOVPA_SIG_MATCH(
200199

201-
{ 0x01, 0x8B },
200+
// push esi
201+
OV_MATCH(0x00, 0x56),
202+
203+
// mov edi, param_1
204+
// mov eax, [e??]
205+
OV_MATCH(0x0B, 0x8B, 0xF8, 0x8B),
206+
// cmp eax, ecx
207+
// jne +0x07
208+
OV_MATCH(0x0F, 0x3B, 0xC1, 0x72, 0x07),
202209

203-
{ 0x26, 0x83 },
204-
{ 0x27, 0xC0 },
205-
{ 0x28, 0x08 },
206-
{ 0x29, 0xC1 },
207-
{ 0x2A, 0xE7 },
208-
{ 0x2B, 0x07 },
209-
{ 0x2C, 0x89 },
210-
{ 0x2D, 0x06 },
211-
{ 0x2E, 0x89 },
210+
// lea e??, [e?? * 0x04 + 0x40AE0] // 0x40AE0 is a reliable hardcoded value across all builds.
211+
OV_MATCH(0x1A, 0x8D),
212+
OV_MATCH(0x1D, 0xE0, 0x0A, 0x04, 0x00),
213+
214+
// This is required OV pair to tell the difference from the (symbol)_4__LTCG_eax1 signature.
215+
// ret
216+
OV_MATCH(0x36, 0xC3),
212217
//
213218
);
214219

src/OOVPADatabase/D3D8LTCG/5233.inl

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,27 @@ OOVPA_SIG_MATCH(
115115
// ******************************************************************
116116
// * D3DDevice_SetTextureState_ColorKeyColor
117117
// ******************************************************************
118-
//8D0CB5E00A0400 ...C3
119-
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_esi1_ebx2,
120-
2036)
118+
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_eax1_ebx2,
119+
5233)
121120
OOVPA_SIG_MATCH(
122121

123-
{ 0x00, 0x56 },
122+
// push esi
123+
OV_MATCH(0x00, 0x56),
124124

125-
{ 0x21, 0x8D },
126-
{ 0x22, 0x0C },
127-
{ 0x23, 0xB5 },
128-
{ 0x24, 0xE0 },
129-
{ 0x25, 0x0A },
130-
{ 0x26, 0x04 },
131-
{ 0x27, 0x00 },
125+
// mov esi, param_1
126+
// mov eax, [e??]
127+
OV_MATCH(0x0B, 0x8B, 0xF0, 0x8B),
128+
// cmp eax, ecx
129+
// jne +0x0E
130+
OV_MATCH(0x0F, 0x3B, 0xC1, 0x72, 0x0E),
132131

133-
{ 0x3D, 0xC3 },
132+
// lea e??, [e?? * 0x4 + 0x40AE0] // 0x40AE0 is a reliable hardcoded value across all builds.
133+
OV_MATCH(0x21, 0x8D),
134+
OV_MATCH(0x24, 0xE0, 0x0A, 0x04, 0x00),
135+
136+
// This is required OV pair to tell the difference from the (symbol)_4__LTCG_eax1 signature.
137+
// ret
138+
OV_MATCH(0x3D, 0xC3),
134139
//
135140
);
136141

src/OOVPADatabase/D3D8LTCG/5788.inl

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -482,20 +482,28 @@ OOVPA_SIG_MATCH(
482482
// ******************************************************************
483483
// * D3DDevice_SetTextureState_ColorKeyColor
484484
// ******************************************************************
485-
//E00A040089 ...C3
486-
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_esi1_ebx2,
487-
2048)
485+
// Generic OOVPA as of 5788 and newer
486+
OOVPA_SIG_HEADER_NO_XREF(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_eax1_ebx2,
487+
5788)
488488
OOVPA_SIG_MATCH(
489489

490-
{ 0x01, 0x57 },
491-
{ 0x0B, 0x8B },
492-
{ 0x1D, 0xE8 },
493-
494-
{ 0x25, 0xE0 },
495-
{ 0x26, 0x0A },
496-
{ 0x27, 0x04 },
497-
{ 0x28, 0x00 },
498-
{ 0x29, 0x89 },
490+
// push esi
491+
OV_MATCH(0x00, 0x56),
492+
493+
// mov esi, param_1
494+
// mov eax, [e??]
495+
OV_MATCH(0x0B, 0x8B, 0xF0, 0x8B),
496+
// cmp eax, ecx
497+
// jne +0x0F
498+
OV_MATCH(0x0F, 0x3B, 0xC1, 0x72, 0x0F),
499+
500+
// lea e??, [e?? * 0x04 + 0x40AE0] // 0x40AE0 is a reliable hardcoded value across all builds.
501+
OV_MATCH(0x22, 0x8D),
502+
OV_MATCH(0x25, 0xE0, 0x0A, 0x04, 0x00),
503+
504+
// This is required OV pair to tell the difference from the (symbol)_4__LTCG_eax1 signature.
505+
// ret
506+
OV_MATCH(0x3E, 0xC3),
499507
//
500508
);
501509

src/OOVPADatabase/D3D8LTCG_OOVPA.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ static OOVPATable D3D8LTCG_OOVPA_Table[] = {
340340
SYM_SIG(2024)),
341341
REGISTER_OOVPAS(SYM_FUN(D3DDevice_SetTextureState_ColorKeyColor, CALL(std), STACK(/*default*/), PARAMS(PARAM(psh, Stage), PARAM(psh, Value))),
342342
SYM_SIG(1024, 1036)),
343-
REGISTER_OOVPAS(SYM_FUN_LTCG(D3DDevice_SetTextureState_ColorKeyColor, CALL(unk), STACK(0), PARAMS(PARAM(esi, Stage), PARAM(ebx, Value))),
344-
SYM_SIG(2024, 2036, 2048)),
343+
REGISTER_OOVPAS(SYM_FUN_LTCG(D3DDevice_SetTextureState_ColorKeyColor, CALL(unk), STACK(0), PARAMS(PARAM(eax, Stage), PARAM(ebx, Value))),
344+
SYM_SIG(3911, 5233, 5788)),
345345
REGISTER_OOVPAS(SYM_FUN_LTCG(D3DDevice_SetTextureState_ColorKeyColor, CALL(unk), STACK(4), PARAMS(PARAM(eax, Stage), PARAM(psh, Value))),
346346
SYM_SIG(2048, 2060)),
347347
REGISTER_OOVPAS_M(SYM_FUN(D3DDevice_SetTextureState_TexCoordIndex, CALL(std), STACK(/*default*/), PARAMS(PARAM(psh, Stage), PARAM(psh, Value))),

src/test/libverify/D3D8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static const library_list database_full = {
327327
REGISTER_SYMBOL(D3DDevice_SetTextureState_BumpEnv_8__LTCG_eax1, VER_RANGE(3911))),
328328
REGISTER_SYMBOLS(D3DDevice_SetTextureState_ColorKeyColor,
329329
REGISTER_SYMBOL(D3DDevice_SetTextureState_ColorKeyColor, VER_RANGE(3911)),
330-
REGISTER_SYMBOL(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_esi1_ebx2, VER_RANGE(3911)),
330+
REGISTER_SYMBOL(D3DDevice_SetTextureState_ColorKeyColor_0__LTCG_eax1_ebx2, VER_RANGE(3911)),
331331
REGISTER_SYMBOL(D3DDevice_SetTextureState_ColorKeyColor_4__LTCG_eax1, VER_RANGE(3911))),
332332
REGISTER_SYMBOL_INLINE(D3DDevice_SetTextureState_Deferred, VER_RANGE(3911, 4034)),
333333
REGISTER_SYMBOLS(D3DDevice_SetTextureState_TexCoordIndex,

0 commit comments

Comments
 (0)