From d38d2f56e168524c3cf2e5323340b13c0d362b89 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Sat, 12 May 2007 13:16:05 +0000 Subject: [PATCH] Fixed large return values (Vectors) in MSVC. --- dlls/hamsandwich/hook_callbacks.cpp | 13 ++++++++++--- dlls/hamsandwich/hook_callbacks.h | 12 +++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/hamsandwich/hook_callbacks.cpp b/dlls/hamsandwich/hook_callbacks.cpp index 68d42433..31bdc443 100644 --- a/dlls/hamsandwich/hook_callbacks.cpp +++ b/dlls/hamsandwich/hook_callbacks.cpp @@ -123,11 +123,12 @@ extern bool gDoForwards; if (thisresult < HAM_OVERRIDE) \ { \ memcpy(out, &origret, sizeof(Vector)); \ - return; \ + return; \ } + void Hook_Void_Void(Hook *hook, void *pthis) { PUSH_VOID() @@ -652,8 +653,11 @@ void *Hook_Cbase_Void(Hook *hook, void *pthis) } - +#ifdef _WIN32 +void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out) +#elif defined __linux__ void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis) +#endif { Vector ret; Vector origret; @@ -683,8 +687,11 @@ void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis) memcpy(out, &ret, sizeof(Vector)); } - +#ifdef _WIN32 +void Hook_Vector_pVector(Hook *hook, void *pthis, Vector *out, Vector *v1) +#elif defined __linux__ void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1) +#endif { Vector ret; Vector origret; diff --git a/dlls/hamsandwich/hook_callbacks.h b/dlls/hamsandwich/hook_callbacks.h index 8b02a51e..21a01674 100644 --- a/dlls/hamsandwich/hook_callbacks.h +++ b/dlls/hamsandwich/hook_callbacks.h @@ -89,13 +89,23 @@ const bool RT_Cbase_Void = false; const int PC_Cbase_Void = 0; void *Hook_Cbase_Void(Hook *hook, void *pthis); -const bool RT_Vector_Void = true; +// HACK: I'm too lazy to fix up trampoline generator to deal with +// special return values. this is so much easier. +const bool RT_Vector_Void = false; const int PC_Vector_Void = 1; +#ifdef _WIN32 +void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out); +#elif defined __linux__ void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis); +#endif const bool RT_Vector_pVector = true; const int PC_Vector_pVector = 2; +#ifdef _WIN32 +void Hook_Vector_pVector(Hook *hook, void *pthis, Vector *out, Vector *v1); +#elif defined __linux__ void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1); +#endif const bool RT_Int_pVector = false; const int PC_Int_pVector = 1;