Move memutils from core to logic (bug 4406, r=ds).
--HG-- rename : core/MemoryUtils.cpp => core/logic/MemoryUtils.cpp rename : core/MemoryUtils.h => core/logic/MemoryUtils.h rename : core/sm_symtable.h => core/logic/sm_symtable.h
This commit is contained in:
parent
0fba0923c8
commit
0032fcaa66
@ -60,7 +60,6 @@ for i in SM.sdkInfo:
|
|||||||
'smn_bitbuffer.cpp',
|
'smn_bitbuffer.cpp',
|
||||||
'smn_halflife.cpp',
|
'smn_halflife.cpp',
|
||||||
'Translator.cpp',
|
'Translator.cpp',
|
||||||
'MemoryUtils.cpp',
|
|
||||||
'PluginSys.cpp',
|
'PluginSys.cpp',
|
||||||
'smn_console.cpp',
|
'smn_console.cpp',
|
||||||
'smn_handles.cpp',
|
'smn_handles.cpp',
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
#include "HalfLife2.h"
|
#include "HalfLife2.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "ShareSys.h"
|
#include "ShareSys.h"
|
||||||
#include "MemoryUtils.h"
|
|
||||||
#include "LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
|
#include <IMemoryUtils.h>
|
||||||
#include "logic_bridge.h"
|
#include "logic_bridge.h"
|
||||||
|
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_LINUX
|
||||||
@ -558,7 +558,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||||
final_addr = g_MemUtils.ResolveSymbol(handle, &s_TempSig.sig[1]);
|
final_addr = memutils->ResolveSymbol(handle, &s_TempSig.sig[1]);
|
||||||
#else
|
#else
|
||||||
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
||||||
#endif
|
#endif
|
||||||
@ -591,7 +591,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
|
|
||||||
if (real_bytes >= 1)
|
if (real_bytes >= 1)
|
||||||
{
|
{
|
||||||
final_addr = g_MemUtils.FindPattern(addrInBase, (char*)real_sig, real_bytes);
|
final_addr = memutils->FindPattern(addrInBase, (char*)real_sig, real_bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ MMSOURCE17 = ../../mmsource-central
|
|||||||
|
|
||||||
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.cpp \
|
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.cpp \
|
||||||
Database.cpp DebugReporter.cpp EventManager.cpp GameConfigs.cpp HalfLife2.cpp Logger.cpp \
|
Database.cpp DebugReporter.cpp EventManager.cpp GameConfigs.cpp HalfLife2.cpp Logger.cpp \
|
||||||
MemoryUtils.cpp PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
|
PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
|
||||||
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||||
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
||||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \
|
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \
|
||||||
|
@ -32,6 +32,7 @@ files = [
|
|||||||
'smn_functions.cpp',
|
'smn_functions.cpp',
|
||||||
'smn_timers.cpp',
|
'smn_timers.cpp',
|
||||||
'smn_players.cpp',
|
'smn_players.cpp',
|
||||||
|
'MemoryUtils.cpp',
|
||||||
'sm_crc32.cpp'
|
'sm_crc32.cpp'
|
||||||
]
|
]
|
||||||
if AMBuild.target['platform'] == 'windows':
|
if AMBuild.target['platform'] == 'windows':
|
||||||
|
@ -28,6 +28,7 @@ OBJECTS = \
|
|||||||
smn_functions.cpp \
|
smn_functions.cpp \
|
||||||
sm_crc32.cpp \
|
sm_crc32.cpp \
|
||||||
smn_timers.cpp \
|
smn_timers.cpp \
|
||||||
|
MemoryUtils.cpp \
|
||||||
smn_players.cpp
|
smn_players.cpp
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MemoryUtils.h"
|
#include "MemoryUtils.h"
|
||||||
#include "ShareSys.h"
|
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
@ -69,7 +68,7 @@ MemoryUtils::~MemoryUtils()
|
|||||||
|
|
||||||
void MemoryUtils::OnSourceModAllInitialized()
|
void MemoryUtils::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
g_ShareSys.AddInterface(NULL, this);
|
sharesys->AddInterface(NULL, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
|
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
|
@ -30,8 +30,8 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||||
|
|
||||||
|
#include "common_logic.h"
|
||||||
#include <IMemoryUtils.h>
|
#include <IMemoryUtils.h>
|
||||||
#include "sm_globals.h"
|
|
||||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||||
#include <sh_vector.h>
|
#include <sh_vector.h>
|
||||||
#include "sm_symtable.h"
|
#include "sm_symtable.h"
|
@ -37,6 +37,7 @@
|
|||||||
#include "TextParsers.h"
|
#include "TextParsers.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include "sm_crc32.h"
|
#include "sm_crc32.h"
|
||||||
|
#include "MemoryUtils.h"
|
||||||
|
|
||||||
sm_core_t smcore;
|
sm_core_t smcore;
|
||||||
IHandleSys *handlesys;
|
IHandleSys *handlesys;
|
||||||
@ -59,6 +60,7 @@ static sm_logic_t logic =
|
|||||||
NULL,
|
NULL,
|
||||||
g_pThreader,
|
g_pThreader,
|
||||||
sm_profiler,
|
sm_profiler,
|
||||||
|
&g_MemUtils,
|
||||||
UTIL_CRC32
|
UTIL_CRC32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ using namespace SourceMod;
|
|||||||
* Add 1 to the RHS of this expression to bump the intercom file
|
* Add 1 to the RHS of this expression to bump the intercom file
|
||||||
* This is to prevent mismatching core/logic binaries
|
* This is to prevent mismatching core/logic binaries
|
||||||
*/
|
*/
|
||||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 5)
|
#define SM_LOGIC_MAGIC (0x0F47C0DE - 6)
|
||||||
|
|
||||||
#if defined SM_LOGIC
|
#if defined SM_LOGIC
|
||||||
class IVEngineServer
|
class IVEngineServer
|
||||||
@ -65,6 +65,7 @@ namespace SourceMod
|
|||||||
class IForwardManager;
|
class IForwardManager;
|
||||||
class ITimerSystem;
|
class ITimerSystem;
|
||||||
class IPlayerManager;
|
class IPlayerManager;
|
||||||
|
class IMemoryUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IVEngineServer;
|
class IVEngineServer;
|
||||||
@ -110,6 +111,7 @@ struct sm_logic_t
|
|||||||
SMGlobalClass *head;
|
SMGlobalClass *head;
|
||||||
IThreader *threader;
|
IThreader *threader;
|
||||||
IProfiler *profiler;
|
IProfiler *profiler;
|
||||||
|
IMemoryUtils *memutils;
|
||||||
unsigned int (*CRC32)(const void *, size_t);
|
unsigned int (*CRC32)(const void *, size_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ static LogicInitFunction logic_init_fn;
|
|||||||
IThreader *g_pThreader;
|
IThreader *g_pThreader;
|
||||||
ITextParsers *textparsers;
|
ITextParsers *textparsers;
|
||||||
SM_FN_CRC32 UTIL_CRC32;
|
SM_FN_CRC32 UTIL_CRC32;
|
||||||
|
IMemoryUtils *memutils;
|
||||||
|
|
||||||
class VEngineServer_Logic : public IVEngineServer_Logic
|
class VEngineServer_Logic : public IVEngineServer_Logic
|
||||||
{
|
{
|
||||||
@ -151,6 +152,7 @@ void InitLogicBridge()
|
|||||||
g_pThreader = logic.threader;
|
g_pThreader = logic.threader;
|
||||||
g_pSourcePawn2->SetProfiler(logic.profiler);
|
g_pSourcePawn2->SetProfiler(logic.profiler);
|
||||||
UTIL_CRC32 = logic.CRC32;
|
UTIL_CRC32 = logic.CRC32;
|
||||||
|
memutils = logic.memutils;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StartLogicBridge(char *error, size_t maxlength)
|
bool StartLogicBridge(char *error, size_t maxlength)
|
||||||
|
@ -201,10 +201,12 @@ namespace SourceMod
|
|||||||
{
|
{
|
||||||
class IThreader;
|
class IThreader;
|
||||||
class ITextParsers;
|
class ITextParsers;
|
||||||
|
class IMemoryUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern IThreader *g_pThreader;
|
extern IThreader *g_pThreader;
|
||||||
extern ITextParsers *textparsers;
|
extern ITextParsers *textparsers;
|
||||||
|
extern IMemoryUtils *memutils;
|
||||||
|
|
||||||
#include "sm_autonatives.h"
|
#include "sm_autonatives.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user