Move LibrarySys from core to logic.
This commit is contained in:
parent
207f643d3a
commit
6503e92d66
@ -21,7 +21,6 @@ project.sources += [
|
|||||||
'NextMap.cpp',
|
'NextMap.cpp',
|
||||||
'ConCmdManager.cpp',
|
'ConCmdManager.cpp',
|
||||||
'ConVarManager.cpp',
|
'ConVarManager.cpp',
|
||||||
'LibrarySys.cpp',
|
|
||||||
'PlayerManager.cpp',
|
'PlayerManager.cpp',
|
||||||
'TimerSys.cpp',
|
'TimerSys.cpp',
|
||||||
'CoreConfig.cpp',
|
'CoreConfig.cpp',
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "LibrarySys.h"
|
|
||||||
#include "TimerSys.h"
|
#include "TimerSys.h"
|
||||||
#include "logic_bridge.h"
|
#include "logic_bridge.h"
|
||||||
#include <sourcemod_version.h>
|
#include <sourcemod_version.h>
|
||||||
|
@ -76,6 +76,7 @@ binary.sources += [
|
|||||||
'smn_core.cpp',
|
'smn_core.cpp',
|
||||||
'smn_menus.cpp',
|
'smn_menus.cpp',
|
||||||
'sprintf.cpp',
|
'sprintf.cpp',
|
||||||
|
'LibrarySys.cpp',
|
||||||
]
|
]
|
||||||
if builder.target_platform == 'windows':
|
if builder.target_platform == 'windows':
|
||||||
binary.sources += ['thread/WinThreads.cpp']
|
binary.sources += ['thread/WinThreads.cpp']
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sm_platform.h>
|
#include <sm_platform.h>
|
||||||
#include "sm_stringutil.h"
|
|
||||||
#include "LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
|
#include <amtl/am-string.h>
|
||||||
#include <amtl/os/am-path.h>
|
#include <amtl/os/am-path.h>
|
||||||
#include <amtl/os/am-fsutil.h>
|
#include <amtl/os/am-fsutil.h>
|
||||||
|
|
||||||
@ -220,13 +220,13 @@ void LibrarySystem::GetPlatformErrorEx(int code, char *error, size_t maxlength)
|
|||||||
maxlength,
|
maxlength,
|
||||||
NULL) == 0)
|
NULL) == 0)
|
||||||
{
|
{
|
||||||
UTIL_Format(error, maxlength, "error code %08x", code);
|
ke::SafeSprintf(error, maxlength, "error code %08x", code);
|
||||||
}
|
}
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX
|
||||||
const char *ae = strerror_r(code, error, maxlength);
|
const char *ae = strerror_r(code, error, maxlength);
|
||||||
if (ae != error)
|
if (ae != error)
|
||||||
{
|
{
|
||||||
UTIL_Format(error, maxlength, "%s", ae);
|
ke::SafeSprintf(error, maxlength, "%s", ae);
|
||||||
}
|
}
|
||||||
#elif defined PLATFORM_POSIX
|
#elif defined PLATFORM_POSIX
|
||||||
strerror_r(code, error, maxlength);
|
strerror_r(code, error, maxlength);
|
||||||
@ -305,12 +305,12 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
|
|||||||
#endif
|
#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 */
|
/* 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)
|
bool LibrarySystem::FileTime(const char *path, FileTimeType type, time_t *pTime)
|
@ -52,13 +52,14 @@
|
|||||||
#include "ProfileTools.h"
|
#include "ProfileTools.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
|
#include "LibrarySys.h"
|
||||||
|
|
||||||
sm_core_t smcore;
|
sm_core_t smcore;
|
||||||
IHandleSys *handlesys = &g_HandleSys;
|
IHandleSys *handlesys = &g_HandleSys;
|
||||||
IdentityToken_t *g_pCoreIdent;
|
IdentityToken_t *g_pCoreIdent;
|
||||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||||
ISourceMod *g_pSM;
|
ISourceMod *g_pSM;
|
||||||
ILibrarySys *libsys;
|
ILibrarySys *libsys = &g_LibSys;
|
||||||
ITextParsers *textparser = &g_TextParser;
|
ITextParsers *textparser = &g_TextParser;
|
||||||
IVEngineServer *engine;
|
IVEngineServer *engine;
|
||||||
IShareSys *sharesys = &g_ShareSys;
|
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(_logic, &logic, sizeof(sm_logic_t));
|
||||||
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
|
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
|
||||||
|
|
||||||
libsys = core->libsys;
|
|
||||||
engine = core->engine;
|
engine = core->engine;
|
||||||
g_pSM = core->sm;
|
g_pSM = core->sm;
|
||||||
rootmenu = core->rootmenu;
|
rootmenu = core->rootmenu;
|
||||||
|
@ -52,7 +52,7 @@ using namespace SourceHook;
|
|||||||
* 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 - 34)
|
#define SM_LOGIC_MAGIC (0x0F47C0DE - 35)
|
||||||
|
|
||||||
#if defined SM_LOGIC
|
#if defined SM_LOGIC
|
||||||
class IVEngineServer
|
class IVEngineServer
|
||||||
@ -280,7 +280,6 @@ struct sm_core_t
|
|||||||
{
|
{
|
||||||
/* Objects */
|
/* Objects */
|
||||||
ISourceMod *sm;
|
ISourceMod *sm;
|
||||||
ILibrarySys *libsys;
|
|
||||||
IVEngineServer *engine;
|
IVEngineServer *engine;
|
||||||
IFileSystem *filesystem;
|
IFileSystem *filesystem;
|
||||||
IPlayerInfo_Logic *playerInfo;
|
IPlayerInfo_Logic *playerInfo;
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_autonatives.h"
|
#include "sm_autonatives.h"
|
||||||
#include "logic/intercom.h"
|
#include "logic/intercom.h"
|
||||||
#include "LibrarySys.h"
|
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "sm_srvcmds.h"
|
#include "sm_srvcmds.h"
|
||||||
@ -599,7 +598,6 @@ static sm_core_t core_bridge =
|
|||||||
{
|
{
|
||||||
/* Objects */
|
/* Objects */
|
||||||
&g_SourceMod,
|
&g_SourceMod,
|
||||||
&g_LibSys,
|
|
||||||
reinterpret_cast<IVEngineServer*>(&logic_engine),
|
reinterpret_cast<IVEngineServer*>(&logic_engine),
|
||||||
reinterpret_cast<IFileSystem*>(&logic_filesystem),
|
reinterpret_cast<IFileSystem*>(&logic_filesystem),
|
||||||
&logic_playerinfo,
|
&logic_playerinfo,
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "LibrarySys.h"
|
|
||||||
#include <sh_string.h>
|
#include <sh_string.h>
|
||||||
#include "CoreConfig.h"
|
#include "CoreConfig.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user