From abc90fa8c2a33b504091c5eb46d03cef77aa89cf Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 8 Oct 2007 20:42:32 +0000 Subject: [PATCH] usermessage code works on linux again (used ds's suggestion) --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40488 --- sourcemm/episode2/provider_ep2.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sourcemm/episode2/provider_ep2.cpp b/sourcemm/episode2/provider_ep2.cpp index 00dd8f6..bdd2440 100644 --- a/sourcemm/episode2/provider_ep2.cpp +++ b/sourcemm/episode2/provider_ep2.cpp @@ -518,7 +518,24 @@ bool CacheUserMessages() #endif } - if (dict) + #if !defined OS_WIN32 + if (dict == NULL) + { + char path[255]; + if (GetFileOfAddress(vfunc, path, sizeof(path))) + { + void *handle = dlopen(path, RTLD_NOW); + if (handle != NULL) + { + void *addr = dlsym(handle, "usermessages"); + dict = (UserMsgDict *)*(void **)addr; + dlclose(handle); + } + } + } + #endif + + if (dict != NULL) { int msg_count = dict->Count();