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:
David Anderson 2010-05-14 16:14:59 -07:00
parent 0fba0923c8
commit 0032fcaa66
12 changed files with 17 additions and 9 deletions

View File

@ -60,7 +60,6 @@ for i in SM.sdkInfo:
'smn_bitbuffer.cpp',
'smn_halflife.cpp',
'Translator.cpp',
'MemoryUtils.cpp',
'PluginSys.cpp',
'smn_console.cpp',
'smn_handles.cpp',

View File

@ -36,9 +36,9 @@
#include "HalfLife2.h"
#include "Logger.h"
#include "ShareSys.h"
#include "MemoryUtils.h"
#include "LibrarySys.h"
#include "HandleSys.h"
#include <IMemoryUtils.h>
#include "logic_bridge.h"
#if defined PLATFORM_LINUX
@ -558,7 +558,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
if (handle)
{
#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
final_addr = dlsym(handle, &s_TempSig.sig[1]);
#endif
@ -591,7 +591,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
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);
}
}

View File

@ -16,7 +16,7 @@ MMSOURCE17 = ../../mmsource-central
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.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 \
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \

View File

@ -32,6 +32,7 @@ files = [
'smn_functions.cpp',
'smn_timers.cpp',
'smn_players.cpp',
'MemoryUtils.cpp',
'sm_crc32.cpp'
]
if AMBuild.target['platform'] == 'windows':

View File

@ -28,6 +28,7 @@ OBJECTS = \
smn_functions.cpp \
sm_crc32.cpp \
smn_timers.cpp \
MemoryUtils.cpp \
smn_players.cpp
##############################################

View File

@ -28,7 +28,6 @@
*/
#include "MemoryUtils.h"
#include "ShareSys.h"
#ifdef PLATFORM_LINUX
#include <fcntl.h>
#include <link.h>
@ -69,7 +68,7 @@ MemoryUtils::~MemoryUtils()
void MemoryUtils::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)

View File

@ -30,8 +30,8 @@
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
#include "common_logic.h"
#include <IMemoryUtils.h>
#include "sm_globals.h"
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
#include <sh_vector.h>
#include "sm_symtable.h"

View File

@ -37,6 +37,7 @@
#include "TextParsers.h"
#include "Profiler.h"
#include "sm_crc32.h"
#include "MemoryUtils.h"
sm_core_t smcore;
IHandleSys *handlesys;
@ -59,6 +60,7 @@ static sm_logic_t logic =
NULL,
g_pThreader,
sm_profiler,
&g_MemUtils,
UTIL_CRC32
};

View File

@ -42,7 +42,7 @@ using namespace SourceMod;
* Add 1 to the RHS of this expression to bump the intercom file
* This is to prevent mismatching core/logic binaries
*/
#define SM_LOGIC_MAGIC (0x0F47C0DE - 5)
#define SM_LOGIC_MAGIC (0x0F47C0DE - 6)
#if defined SM_LOGIC
class IVEngineServer
@ -65,6 +65,7 @@ namespace SourceMod
class IForwardManager;
class ITimerSystem;
class IPlayerManager;
class IMemoryUtils;
}
class IVEngineServer;
@ -110,6 +111,7 @@ struct sm_logic_t
SMGlobalClass *head;
IThreader *threader;
IProfiler *profiler;
IMemoryUtils *memutils;
unsigned int (*CRC32)(const void *, size_t);
};

View File

@ -54,6 +54,7 @@ static LogicInitFunction logic_init_fn;
IThreader *g_pThreader;
ITextParsers *textparsers;
SM_FN_CRC32 UTIL_CRC32;
IMemoryUtils *memutils;
class VEngineServer_Logic : public IVEngineServer_Logic
{
@ -151,6 +152,7 @@ void InitLogicBridge()
g_pThreader = logic.threader;
g_pSourcePawn2->SetProfiler(logic.profiler);
UTIL_CRC32 = logic.CRC32;
memutils = logic.memutils;
}
bool StartLogicBridge(char *error, size_t maxlength)

View File

@ -201,10 +201,12 @@ namespace SourceMod
{
class IThreader;
class ITextParsers;
class IMemoryUtils;
}
extern IThreader *g_pThreader;
extern ITextParsers *textparsers;
extern IMemoryUtils *memutils;
#include "sm_autonatives.h"