From 82fc6210bae73537ea017c99c6759e74b2bb92e7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 4 Oct 2007 19:18:19 +0000 Subject: [PATCH] fixed usermessages not printing removed old ConMsg extraction code --HG-- branch : sourcemm-1.6.0 extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.6.0%40450 --- sourcemm/episode2/provider_ep2.cpp | 54 ++---------------------------- sourcemm/metamod_console.cpp | 2 +- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/sourcemm/episode2/provider_ep2.cpp b/sourcemm/episode2/provider_ep2.cpp index f82052e..00dd8f6 100644 --- a/sourcemm/episode2/provider_ep2.cpp +++ b/sourcemm/episode2/provider_ep2.cpp @@ -58,7 +58,6 @@ struct UsrMsgInfo #undef CommandLine DLL_IMPORT ICommandLine *CommandLine(); /* Functions */ -CONPRINTF_FUNC ExtractRemotePrinter(void *addr); bool CacheUserMessages(); void ClientCommand(edict_t *pEdict, const CCommand &args); void LocalCommand_Meta(const CCommand &args); @@ -66,7 +65,6 @@ void _ServerCommand(); /* Variables */ bool usermsgs_extracted = false; CVector usermsgs_list; -CONPRINTF_FUNC echo_msg_func = NULL; ICvar *icvar = NULL; ISmmAPI *metamod_api = NULL; IVEngineServer *engine = NULL; @@ -81,14 +79,7 @@ SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, void BaseProvider::ConsolePrint(const char *str) { - if (echo_msg_func != NULL) - { - ConMsg("%s", str); - } - else - { - Msg("%s", str); - } + ConMsg("%s", str); } void BaseProvider::Notify_DLLInit_Pre(void *gamedll, @@ -118,7 +109,6 @@ void BaseProvider::Notify_DLLInit_Pre(void *gamedll, RegisterConCommandBase(&meta_local_cmd); conbases_unreg.push_back(&meta_local_cmd); - echo_msg_func = ExtractRemotePrinter(engineFactory); usermsgs_extracted = CacheUserMessages(); if (gameclients) @@ -141,7 +131,7 @@ void BaseProvider::Notify_DLLShutdown_Pre() bool BaseProvider::IsRemotePrintingAvailable() { - return (echo_msg_func != NULL); + return true; } void BaseProvider::ClientConsolePrint(edict_t *client, const char *message) @@ -428,46 +418,6 @@ bool vcmp(const void *_addr1, const void *_addr2, size_t len) return true; } -/* :TODO: I hope we can get rid of this in the future */ -CONPRINTF_FUNC ExtractRemotePrinter(void *addr) -{ - char path[256+10]; - if (!GetFileOfAddress(addr, path, sizeof(path))) - { - return NULL; - } - - char *ptr = NULL; -#if defined __linux__ - ptr = strstr(path, "engine_i486.so"); -#else - ptr = strstr(path, "engine.dll"); -#endif - - if (ptr == NULL) - { - return NULL; - } - -#if defined __linux__ - strcpy(ptr, "tier0_i486.so"); -#else - strcpy(ptr, "tier0.dll"); -#endif - - HINSTANCE handle = dlmount(path); - if (handle == NULL) - { - return NULL; - } - - void *func = dlsym(handle, "ConMsg"); - - dlclose(handle); - - return (CONPRINTF_FUNC)func; -} - ////////////////////////////////////////////////////////////////////// // EVEN MORE HACKS HERE! YOU HAVE BEEN WARNED! // // Signatures necessary in finding the pointer to the CUtlDict that // diff --git a/sourcemm/metamod_console.cpp b/sourcemm/metamod_console.cpp index 3c81b94..d84b8fa 100644 --- a/sourcemm/metamod_console.cpp +++ b/sourcemm/metamod_console.cpp @@ -88,7 +88,7 @@ bool Command_Meta(IMetamodSourceCommandInfo *info) // Display user messages int messages = g_Metamod.GetUserMessageCount(); - if (messages == -1) + if (messages != -1) { const char *msgname; int msgsize;