Fix patch for LTCG optimized functions

TODO: This function works only on debug build, should be fix on release build.
This commit is contained in:
jarupxx 2018-04-09 19:40:13 +09:00
parent d4175ecd0d
commit ab0680c19a
2 changed files with 26 additions and 26 deletions

View File

@ -4784,22 +4784,25 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetVerticalBlankCallback)
}
// LTCG specific D3DDevice_SetTextureState_TexCoordIndex function...
// This uses a custom calling convention where parameter is passed in EAX, Value
// TODO: This function works only on debug build, should be fix on release build.
// Test-case: Metal Wolf Chaos
VOID XTL::EMUPATCH(D3DDevice_SetTextureState_TexCoordIndex_4)
VOID __stdcall XTL::EMUPATCH(D3DDevice_SetTextureState_TexCoordIndex_4)
(
DWORD Stage
)
{
FUNC_EXPORTS;
DWORD Value;
static uint32 returnAddr;
__asm {
mov Value, eax;
add esp, 4
pop returnAddr
push esi
call EmuPatch_D3DDevice_SetTextureState_TexCoordIndex
mov eax, 0
push returnAddr
ret
}
return EMUPATCH(D3DDevice_SetTextureState_TexCoordIndex)(Stage, Value);
}
// ******************************************************************
@ -4955,24 +4958,27 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetTextureState_ColorKeyColor)
}
// LTCG specific D3DDevice_SetTextureState_BumpEnv function...
// This uses a custom calling convention where parameter is passed in Stage, Type, EAX
// TODO: This function works only on debug build, should be fix on release build.
// Test-case: Metal Wolf Chaos
VOID XTL::EMUPATCH(D3DDevice_SetTextureState_BumpEnv_8)
VOID __stdcall XTL::EMUPATCH(D3DDevice_SetTextureState_BumpEnv_8)
(
X_D3DTEXTURESTAGESTATETYPE Type,
DWORD Stage
)
{
FUNC_EXPORTS;
DWORD Value;
static uint32 returnAddr;
__asm {
mov Value, eax;
add esp, 4
pop returnAddr
push eax
call EmuPatch_D3DDevice_SetTextureState_BumpEnv
mov eax, 0
push returnAddr
ret
}
}
return EMUPATCH(D3DDevice_SetTextureState_BumpEnv)(Stage, Type, Value);
}
// ******************************************************************
// * patch: D3DDevice_SetTextureState_BumpEnv
// ******************************************************************

View File

@ -935,10 +935,7 @@ VOID WINAPI EMUPATCH(D3DDevice_SetTextureState_TexCoordIndex)
DWORD Value
);
VOID EMUPATCH(D3DDevice_SetTextureState_TexCoordIndex_4)
(
DWORD Stage
);
VOID __stdcall EMUPATCH(D3DDevice_SetTextureState_TexCoordIndex_4)();
// ******************************************************************
// * patch: D3DDevice_SetRenderState_TwoSidedLighting
@ -988,11 +985,8 @@ VOID WINAPI EMUPATCH(D3DDevice_SetTextureState_BumpEnv)
DWORD Value
);
VOID EMUPATCH(D3DDevice_SetTextureState_BumpEnv_8)
(
X_D3DTEXTURESTAGESTATETYPE Type,
DWORD Stage
);
VOID __stdcall EMUPATCH(D3DDevice_SetTextureState_BumpEnv_8)();
// ******************************************************************
// * patch: D3DDevice_SetRenderState_FrontFace
// ******************************************************************