Fix detour of functions returning a float

Floats are always returned in FPU register st0. Since the value in st0 doesn't matter in a pre-hook before the function was executed, don't try to save and restore the value of the FPU stack top for a pre-hook.
Only replace st0 after a post hook.
This commit is contained in:
Peace-Maker
2018-08-18 12:54:30 +02:00
parent 6a98d26307
commit a89eb67124
3 changed files with 29 additions and 11 deletions
+1 -1
View File
@@ -387,7 +387,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
}
else if (pWrapper->returnType == ReturnType_Float)
{
*(float *)tempRetBuf = *(float *)returnStruct->newResult;
*(float *)&tempRetBuf = *(float *)returnStruct->newResult;
}
else
{