Move LibrarySys from core to logic.

This commit is contained in:
David Anderson 2015-08-27 17:09:59 -04:00
parent 207f643d3a
commit 6503e92d66
9 changed files with 9 additions and 14 deletions

View File

@ -21,7 +21,6 @@ project.sources += [
'NextMap.cpp',
'ConCmdManager.cpp',
'ConVarManager.cpp',
'LibrarySys.cpp',
'PlayerManager.cpp',
'TimerSys.cpp',
'CoreConfig.cpp',

View File

@ -34,7 +34,6 @@
#include "sourcemm_api.h"
#include "sm_stringutil.h"
#include "Logger.h"
#include "LibrarySys.h"
#include "TimerSys.h"
#include "logic_bridge.h"
#include <sourcemod_version.h>

View File

@ -76,6 +76,7 @@ binary.sources += [
'smn_core.cpp',
'smn_menus.cpp',
'sprintf.cpp',
'LibrarySys.cpp',
]
if builder.target_platform == 'windows':
binary.sources += ['thread/WinThreads.cpp']

View File

@ -34,8 +34,8 @@
#include <stdarg.h>
#include <string.h>
#include <sm_platform.h>
#include "sm_stringutil.h"
#include "LibrarySys.h"
#include <amtl/am-string.h>
#include <amtl/os/am-path.h>
#include <amtl/os/am-fsutil.h>
@ -220,13 +220,13 @@ void LibrarySystem::GetPlatformErrorEx(int code, char *error, size_t maxlength)
maxlength,
NULL) == 0)
{
UTIL_Format(error, maxlength, "error code %08x", code);
ke::SafeSprintf(error, maxlength, "error code %08x", code);
}
#elif defined PLATFORM_LINUX
const char *ae = strerror_r(code, error, maxlength);
if (ae != error)
{
UTIL_Format(error, maxlength, "%s", ae);
ke::SafeSprintf(error, maxlength, "%s", ae);
}
#elif defined PLATFORM_POSIX
strerror_r(code, error, maxlength);
@ -305,12 +305,12 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
#endif
)
{
return UTIL_Format(buffer, maxlength, "%s", &path[i+1]);
return ke::SafeSprintf(buffer, maxlength, "%s", &path[i+1]);
}
}
/* We scanned and found no path separator */
return UTIL_Format(buffer, maxlength, "%s", path);
return ke::SafeSprintf(buffer, maxlength, "%s", path);
}
bool LibrarySystem::FileTime(const char *path, FileTimeType type, time_t *pTime)

View File

@ -52,13 +52,14 @@
#include "ProfileTools.h"
#include "Logger.h"
#include "sprintf.h"
#include "LibrarySys.h"
sm_core_t smcore;
IHandleSys *handlesys = &g_HandleSys;
IdentityToken_t *g_pCoreIdent;
SMGlobalClass *SMGlobalClass::head = NULL;
ISourceMod *g_pSM;
ILibrarySys *libsys;
ILibrarySys *libsys = &g_LibSys;
ITextParsers *textparser = &g_TextParser;
IVEngineServer *engine;
IShareSys *sharesys = &g_ShareSys;
@ -158,7 +159,6 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
memcpy(_logic, &logic, sizeof(sm_logic_t));
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
libsys = core->libsys;
engine = core->engine;
g_pSM = core->sm;
rootmenu = core->rootmenu;

View File

@ -52,7 +52,7 @@ using namespace SourceHook;
* 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 - 34)
#define SM_LOGIC_MAGIC (0x0F47C0DE - 35)
#if defined SM_LOGIC
class IVEngineServer
@ -280,7 +280,6 @@ struct sm_core_t
{
/* Objects */
ISourceMod *sm;
ILibrarySys *libsys;
IVEngineServer *engine;
IFileSystem *filesystem;
IPlayerInfo_Logic *playerInfo;

View File

@ -35,7 +35,6 @@
#include "sm_globals.h"
#include "sm_autonatives.h"
#include "logic/intercom.h"
#include "LibrarySys.h"
#include "sm_stringutil.h"
#include "Logger.h"
#include "sm_srvcmds.h"
@ -599,7 +598,6 @@ static sm_core_t core_bridge =
{
/* Objects */
&g_SourceMod,
&g_LibSys,
reinterpret_cast<IVEngineServer*>(&logic_engine),
reinterpret_cast<IFileSystem*>(&logic_filesystem),
&logic_playerinfo,

View File

@ -32,7 +32,6 @@
#include <stdio.h>
#include "sourcemod.h"
#include "sourcemm_api.h"
#include "LibrarySys.h"
#include <sh_string.h>
#include "CoreConfig.h"
#include "Logger.h"