From 7deea6cec5d2173f66d4c2dd75ca0b633b887bc7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 00:17:30 +0300 Subject: sounds packed into CMPlugin (reduces usage of hLangpack) --- src/mir_core/src/mir_core.def | 4 ---- src/mir_core/src/mir_core64.def | 4 ---- src/mir_core/src/miranda.cpp | 3 +++ src/mir_core/src/modules.cpp | 49 ----------------------------------------- 4 files changed, 3 insertions(+), 57 deletions(-) (limited to 'src/mir_core') diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 3940104584..eecbb7c04d 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -19,7 +19,6 @@ CreateServiceFunctionParam @18 DestroyHookableEvent @19 DestroyServiceFunction @20 GetExceptionFilter @21 -GetInstByAddress @22 HookEvent @23 HookEventMessage @24 HookEventObj @25 @@ -52,7 +51,6 @@ PathToAbsolute @51 PathToAbsoluteW @52 PathToRelative @53 PathToRelativeW @54 -RegisterModule @55 ReloadLangpack @56 ServiceExists @57 SetExceptionFilter @58 @@ -66,7 +64,6 @@ TranslateMenu_LP @65 TranslateW_LP @66 Ucs2toUtf8Len @67 UnhookEvent @68 -UnregisterModule @69 Utf8Decode @70 Utf8DecodeCP @71 Utf8DecodeW @72 @@ -1068,4 +1065,3 @@ IsTerminalDisconnected @1245 CallObjectEventHook @1259 ?db_get_sm@@YG?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @1260 NONAME ?db_get_wsm@@YG?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPBD0@Z @1261 NONAME -GetPluginByInstance @1262 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 2b6d5d926c..c0ebe31ddb 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -19,7 +19,6 @@ CreateServiceFunctionParam @18 DestroyHookableEvent @19 DestroyServiceFunction @20 GetExceptionFilter @21 -GetInstByAddress @22 HookEvent @23 HookEventMessage @24 HookEventObj @25 @@ -52,7 +51,6 @@ PathToAbsolute @51 PathToAbsoluteW @52 PathToRelative @53 PathToRelativeW @54 -RegisterModule @55 ReloadLangpack @56 ServiceExists @57 SetExceptionFilter @58 @@ -66,7 +64,6 @@ TranslateMenu_LP @65 TranslateW_LP @66 Ucs2toUtf8Len @67 UnhookEvent @68 -UnregisterModule @69 Utf8Decode @70 Utf8DecodeCP @71 Utf8DecodeW @72 @@ -1068,4 +1065,3 @@ IsTerminalDisconnected @1245 CallObjectEventHook @1259 ?db_get_sm@@YA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @1260 NONAME ?db_get_wsm@@YA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPEBD0@Z @1261 NONAME -GetPluginByInstance @1262 diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp index e4f0b50fe8..80d28cf277 100644 --- a/src/mir_core/src/miranda.cpp +++ b/src/mir_core/src/miranda.cpp @@ -40,6 +40,9 @@ void InitMetaContacts(); void InitTimeZones(); void InitWinver(); +static int _hLang = 0; +int &hLangpack(_hLang); + HINSTANCE g_hInst = nullptr; HCURSOR g_hCursorNS, g_hCursorWE; diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp index 6af89cbab2..921de193a0 100644 --- a/src/mir_core/src/modules.cpp +++ b/src/mir_core/src/modules.cpp @@ -695,55 +695,6 @@ static void DestroyServices() /////////////////////////////////////////////////////////////////////////////// -struct CMPlugin : public CMPluginBase -{ - CMPlugin() : - CMPluginBase(nullptr) - {} -} g_plugin; - -int &hLangpack(g_plugin.m_hLang); - -LIST pluginListAddr(10, HandleKeySortT); - -MIR_CORE_DLL(void) RegisterModule(CMPluginBase *pPlugin) -{ - if (pPlugin->getInst() != nullptr) - pluginListAddr.insert(pPlugin); -} - -MIR_CORE_DLL(void) UnregisterModule(CMPluginBase *pPlugin) -{ - pluginListAddr.remove(pPlugin); -} - -MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr) -{ - if (pluginListAddr.getCount() == 0) - return nullptr; - - int idx; - List_GetIndex((SortedList*)&pluginListAddr, (CMPluginBase*)&codePtr, &idx); - if (idx > 0) - idx--; - - HINSTANCE result = pluginListAddr[idx]->getInst(); - if (result < g_hInst && codePtr > g_hInst) - return g_hInst; - if (idx == 0 && codePtr < (void*)result) - return nullptr; - - return result; -} - -MIR_CORE_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst) -{ - CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst); - return (pPlugin == nullptr) ? g_plugin : *pPlugin; -} - -/////////////////////////////////////////////////////////////////////////////// - int InitialiseModularEngine(void) { mainThreadId = GetCurrentThreadId(); -- cgit v1.2.3