Fix CS_TerminateRound calls & detour (#893)

This commit is contained in:
Michael Flaherty
2018-10-03 22:50:31 -04:00
committed by Nicholas Hastings
parent 7ed329c11f
commit fc14e37d0f
2 changed files with 66 additions and 9 deletions
+22 -6
View File
@@ -126,7 +126,7 @@ DETOUR_DECL_MEMBER0(DetourWeaponPrice, int)
}
#endif
#if SOURCE_ENGINE != SE_CSGO || !defined(WIN32)
#if SOURCE_ENGINE != SE_CSGO
DETOUR_DECL_MEMBER2(DetourTerminateRound, void, float, delay, int, reason)
{
if (g_pIgnoreTerminateDetour)
@@ -135,20 +135,31 @@ DETOUR_DECL_MEMBER2(DetourTerminateRound, void, float, delay, int, reason)
DETOUR_MEMBER_CALL(DetourTerminateRound)(delay, reason);
return;
}
#elif !defined(WIN32)
DETOUR_DECL_MEMBER4(DetourTerminateRound, void, float, delay, int, reason, int, unknown, int, unknown2)
{
if (g_pIgnoreTerminateDetour)
{
g_pIgnoreTerminateDetour = false;
DETOUR_MEMBER_CALL(DetourTerminateRound)(delay, reason, unknown, unknown2);
return;
}
#else
//Windows CSGO
//char __userpurge TerminateRound(int a1@<ecx>, float a2@<xmm1>, int *a3)
// a1 - this
// a2 - delay
// a3 - reason
DETOUR_DECL_MEMBER1(DetourTerminateRound, void, int, reason)
// a4 - unknown
// a5 - unknown
DETOUR_DECL_MEMBER3(DetourTerminateRound, void, int, reason, int, unknown, int, unknown2)
{
float delay;
if (g_pIgnoreTerminateDetour)
{
g_pIgnoreTerminateDetour = false;
return DETOUR_MEMBER_CALL(DetourTerminateRound)(reason);
return DETOUR_MEMBER_CALL(DetourTerminateRound)(reason, unknown, unknown2);
}
//Save the delay
@@ -178,11 +189,16 @@ DETOUR_DECL_MEMBER1(DetourTerminateRound, void, int, reason)
reason++;
#endif
#if SOURCE_ENGINE != SE_CSGO || !defined(WIN32)
#if SOURCE_ENGINE != SE_CSGO
if (result == Pl_Changed)
return DETOUR_MEMBER_CALL(DetourTerminateRound)(delay, reason);
return DETOUR_MEMBER_CALL(DetourTerminateRound)(orgdelay, orgreason);
#elif !defined(WIN32)
if (result == Pl_Changed)
return DETOUR_MEMBER_CALL(DetourTerminateRound)(delay, reason, unknown, unknown2);
return DETOUR_MEMBER_CALL(DetourTerminateRound)(orgdelay, orgreason, unknown, unknown2);
#else
if (result == Pl_Changed)
{
@@ -190,13 +206,13 @@ DETOUR_DECL_MEMBER1(DetourTerminateRound, void, int, reason)
{
movss xmm1, delay
}
return DETOUR_MEMBER_CALL(DetourTerminateRound)(reason);
return DETOUR_MEMBER_CALL(DetourTerminateRound)(reason, unknown, unknown2);
}
__asm
{
movss xmm1, orgdelay
}
return DETOUR_MEMBER_CALL(DetourTerminateRound)(orgreason);
return DETOUR_MEMBER_CALL(DetourTerminateRound)(orgreason, unknown, unknown2);
#endif
}