From fbaa9221e34dc27f7131afe4a0fe1040d85c0163 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Mon, 26 Mar 2007 19:44:04 +0000 Subject: [PATCH] Added a check for relative jump in GetUserMessageInfo's vtable entry Also, added more games to list... --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40351 --- sourcemm/CSmmAPI.cpp | 13 +++++++++++++ sourcemm/GAMES.txt | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sourcemm/CSmmAPI.cpp b/sourcemm/CSmmAPI.cpp index 497b98f..ea5f6d6 100644 --- a/sourcemm/CSmmAPI.cpp +++ b/sourcemm/CSmmAPI.cpp @@ -553,6 +553,19 @@ bool CSmmAPI::CacheUserMessages() vfunc = vtable[info.vtblindex]; } + /* Oh dear, we have a relative jump on our hands + * PVK II on Windows made me do this, but I suppose it doesn't hurt to check this on Linux too... + */ + if (*vfunc == '\xE9') + { + /* Get address from displacement... + * + * Add 5 because it's relative to next instruction: + * Opcode <1 byte> + 32-bit displacement <4 bytes> + */ + vfunc = vfunc + *reinterpret_cast(vfunc + 1) + 5; + } + UserMsgDict *dict = NULL; if (vcmp(vfunc, MSGCLASS_SIG, MSGCLASS_SIGLEN)) diff --git a/sourcemm/GAMES.txt b/sourcemm/GAMES.txt index 6386650..2848dde 100644 --- a/sourcemm/GAMES.txt +++ b/sourcemm/GAMES.txt @@ -10,7 +10,9 @@ User Message API Functions - GetUserMessageCount(), FindUserMessage(), GetUserMe - Day of Defeat: Source - Dystopia - Garry's Mod 10 + - Half-Life 2: Capture the Flag - Half-Life 2: Deathmatch + - The Hidden: Source + - Pirates, Vikings, and Knights II - The Ship - SourceForts - \ No newline at end of file