From 93ead5a2e036c44032afd6e23c2d4f6da1f35129 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Fri, 12 Oct 2007 20:14:10 +0000 Subject: [PATCH] Backwards compat with outdated sourcehook.h --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40506 --- sourcehook/sourcehook.cpp | 2 +- sourcehook/sourcehook_impl_cproto.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sourcehook/sourcehook.cpp b/sourcehook/sourcehook.cpp index d9f6731..2f4aa30 100644 --- a/sourcehook/sourcehook.cpp +++ b/sourcehook/sourcehook.cpp @@ -96,7 +96,7 @@ namespace SourceHook { if (p1->paramsPassInfo[i].type != p2->paramsPassInfo[i].type) return false; - if (p1->paramsPassInfo[i].flags != p2->paramsPassInfo[i].flags) + if (GetRealFlags(p1->paramsPassInfo[i]) != GetRealFlags(p2->paramsPassInfo[i])) return false; } } diff --git a/sourcehook/sourcehook_impl_cproto.h b/sourcehook/sourcehook_impl_cproto.h index a3b32d7..347ffd4 100644 --- a/sourcehook/sourcehook_impl_cproto.h +++ b/sourcehook/sourcehook_impl_cproto.h @@ -70,9 +70,15 @@ namespace SourceHook return m_Proto; } + // For old sourcehook.h: flags 0 -> assume ByVal + static unsigned int GetRealFlags(const PassInfo &info) + { + return (info.flags == 0) ? PassInfo::PassFlag_ByVal : info.flags; + } + static size_t GetRealSize(const PassInfo &info) { - if (info.flags & PassInfo::PassFlag_ByRef) + if (GetRealFlags(info) & PassInfo::PassFlag_ByRef) { return sizeof(void*); }