Triggering build against new mac libprotobuf.
3 * =============================================================================
5 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
33 #include "sm_globals.h"
34 #include "HandleSys.h"
35 #include "LibrarySys.h"
36 #include "sm_stringutil.h"
38 #include "PluginSys.h"
39 #include "sourcemm_api.h"
40 #include "ForwardSys.h"
42 SH_DECL_HOOK1_void(IVEngineServer, LogPrint, SH_NOATTRIB, false, const char *);
44 HandleType_t g_FileType;
45 HandleType_t g_DirType;
46 IChangeableForward *g_pLogHook = NULL;
50 public IHandleTypeDispatch,
51 public IPluginsListener
56 m_bIsLoggingHooked = false;
58 virtual void OnSourceModAllInitialized()
60 g_FileType = g_HandleSys.CreateType("File", this, 0, NULL, NULL, g_pCoreIdent, NULL);
61 g_DirType = g_HandleSys.CreateType("Directory", this, 0, NULL, NULL, g_pCoreIdent, NULL);
62 g_pLogHook = g_Forwards.CreateForwardEx(NULL, ET_Hook, 1, NULL, Param_String);
63 g_PluginSys.AddPluginsListener(this);
65 virtual void OnSourceModShutdown()
67 g_PluginSys.RemovePluginsListener(this);
68 if (m_bIsLoggingHooked)
70 SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, LogPrint, engine, this, &FileNatives::LogPrint, false);
71 m_bIsLoggingHooked = false;
73 g_Forwards.ReleaseForward(g_pLogHook);
74 g_HandleSys.RemoveType(g_DirType, g_pCoreIdent);
75 g_HandleSys.RemoveType(g_FileType, g_pCoreIdent);
79 virtual void OnHandleDestroy(HandleType_t type, void *object)
81 if (type == g_FileType)
83 FILE *fp = (FILE *)object;
86 else if (type == g_DirType)
88 IDirectory *pDir = (IDirectory *)object;
89 g_LibSys.CloseDirectory(pDir);
92 virtual void OnPluginDestroyed(IPlugin *plugin)
94 if (m_bIsLoggingHooked && g_pLogHook->GetFunctionCount() == 0)
96 SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, LogPrint, engine, this, &FileNatives::LogPrint, false);
97 m_bIsLoggingHooked = false;
100 virtual void AddLogHook(IPluginFunction *pFunc)
102 if (!m_bIsLoggingHooked)
104 SH_ADD_HOOK_MEMFUNC(IVEngineServer, LogPrint, engine, this, &FileNatives::LogPrint, false);
105 m_bIsLoggingHooked = true;
108 g_pLogHook->AddFunction(pFunc);
110 virtual void RemoveLogHook(IPluginFunction *pFunc)
112 g_pLogHook->RemoveFunction(pFunc);
114 if (m_bIsLoggingHooked && g_pLogHook->GetFunctionCount() == 0)
116 SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, LogPrint, engine, this, &FileNatives::LogPrint, false);
117 m_bIsLoggingHooked = false;
120 virtual void LogPrint(const char *msg)
126 g_in_game_log_hook = true;
127 g_pLogHook->PushString(msg);
128 g_pLogHook->Execute(&result);
129 g_in_game_log_hook = false;
131 if (result >= Pl_Handled)
133 RETURN_META(MRES_SUPERCEDE);
137 bool m_bIsLoggingHooked;
140 static cell_t sm_OpenDirectory(IPluginContext *pContext, const cell_t *params)
144 if ((err=pContext->LocalToString(params[1], &path)) != SP_ERROR_NONE)
146 pContext->ThrowNativeErrorEx(err, NULL);
150 char realpath[PLATFORM_MAX_PATH];
151 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", path);
153 IDirectory *pDir = g_LibSys.OpenDirectory(realpath);
159 return g_HandleSys.CreateHandle(g_DirType, pDir, pContext->GetIdentity(), g_pCoreIdent, NULL);
162 static cell_t sm_ReadDirEntry(IPluginContext *pContext, const cell_t *params)
164 Handle_t hndl = static_cast<Handle_t>(params[1]);
171 sec.pIdentity = g_pCoreIdent;
173 if ((herr=g_HandleSys.ReadHandle(hndl, g_DirType, &sec, (void **)&pDir))
176 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
179 if (!pDir->MoreFiles())
185 if ((err=pContext->LocalToPhysAddr(params[4], &filetype)) != SP_ERROR_NONE)
187 pContext->ThrowNativeErrorEx(err, NULL);
191 if (pDir->IsEntryDirectory())
194 } else if (pDir->IsEntryFile()) {
200 const char *path = pDir->GetEntryName();
201 if ((err=pContext->StringToLocalUTF8(params[2], params[3], path, NULL))
204 pContext->ThrowNativeErrorEx(err, NULL);
213 static cell_t sm_OpenFile(IPluginContext *pContext, const cell_t *params)
217 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
219 pContext->ThrowNativeErrorEx(err, NULL);
222 if ((err=pContext->LocalToString(params[2], &mode)) != SP_ERROR_NONE)
224 pContext->ThrowNativeErrorEx(err, NULL);
228 char realpath[PLATFORM_MAX_PATH];
229 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
231 FILE *pFile = fopen(realpath, mode);
237 return g_HandleSys.CreateHandle(g_FileType, pFile, pContext->GetIdentity(), g_pCoreIdent, NULL);
240 static cell_t sm_DeleteFile(IPluginContext *pContext, const cell_t *params)
244 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
246 pContext->ThrowNativeErrorEx(err, NULL);
250 char realpath[PLATFORM_MAX_PATH];
251 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
253 return (unlink(realpath)) ? 0 : 1;
256 static cell_t sm_ReadFileLine(IPluginContext *pContext, const cell_t *params)
258 Handle_t hndl = static_cast<Handle_t>(params[1]);
265 sec.pIdentity = g_pCoreIdent;
267 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
270 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
274 if ((err=pContext->LocalToString(params[2], &buf)) != SP_ERROR_NONE)
276 pContext->ThrowNativeErrorEx(err, NULL);
280 if (fgets(buf, params[3], pFile) == NULL)
288 static cell_t sm_IsEndOfFile(IPluginContext *pContext, const cell_t *params)
290 Handle_t hndl = static_cast<Handle_t>(params[1]);
296 sec.pIdentity = g_pCoreIdent;
298 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
301 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
304 return (feof(pFile)) ? 1 : 0;
307 static cell_t sm_FileSeek(IPluginContext *pContext, const cell_t *params)
309 Handle_t hndl = static_cast<Handle_t>(params[1]);
315 sec.pIdentity = g_pCoreIdent;
317 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
320 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
323 fseek(pFile, params[2], params[3]);
328 static cell_t sm_FilePosition(IPluginContext *pContext, const cell_t *params)
330 Handle_t hndl = static_cast<Handle_t>(params[1]);
336 sec.pIdentity = g_pCoreIdent;
338 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
341 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
347 static cell_t sm_FileExists(IPluginContext *pContext, const cell_t *params)
351 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
353 pContext->ThrowNativeErrorEx(err, NULL);
357 if (params[0] >= 2 && params[2] == 1)
359 return basefilesystem->FileExists(name) ? 1 : 0;
362 char realpath[PLATFORM_MAX_PATH];
363 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
364 #ifdef PLATFORM_WINDOWS
366 if (_stat(realpath, &s) != 0)
370 if (s.st_mode & S_IFREG)
375 #elif defined PLATFORM_POSIX
377 if (stat(realpath, &s) != 0)
381 if (S_ISREG(s.st_mode))
389 static cell_t sm_RenameFile(IPluginContext *pContext, const cell_t *params)
391 char *newpath, *oldpath;
393 if ((err=pContext->LocalToString(params[1], &newpath)) != SP_ERROR_NONE)
395 pContext->ThrowNativeErrorEx(err, NULL);
398 if ((err=pContext->LocalToString(params[2], &oldpath)) != SP_ERROR_NONE)
400 pContext->ThrowNativeErrorEx(err, NULL);
404 char new_realpath[PLATFORM_MAX_PATH];
405 g_SourceMod.BuildPath(Path_Game, new_realpath, sizeof(new_realpath), "%s", newpath);
406 char old_realpath[PLATFORM_MAX_PATH];
407 g_SourceMod.BuildPath(Path_Game, old_realpath, sizeof(old_realpath), "%s", oldpath);
409 #ifdef PLATFORM_WINDOWS
410 return (MoveFileA(old_realpath, new_realpath)) ? 1 : 0;
411 #elif defined PLATFORM_POSIX
412 return (rename(old_realpath, new_realpath)) ? 0 : 1;
416 static cell_t sm_DirExists(IPluginContext *pContext, const cell_t *params)
420 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
422 pContext->ThrowNativeErrorEx(err, NULL);
426 char realpath[PLATFORM_MAX_PATH];
427 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
428 #ifdef PLATFORM_WINDOWS
430 if (_stat(realpath, &s) != 0)
434 if (s.st_mode & S_IFDIR)
439 #elif defined PLATFORM_POSIX
441 if (stat(realpath, &s) != 0)
445 if (S_ISDIR(s.st_mode))
453 static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params)
457 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
459 pContext->ThrowNativeErrorEx(err, NULL);
463 char realpath[PLATFORM_MAX_PATH];
464 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
465 #ifdef PLATFORM_WINDOWS
467 if (_stat(realpath, &s) != 0)
471 if (s.st_mode & S_IFREG)
473 return static_cast<cell_t>(s.st_size);
476 #elif defined PLATFORM_POSIX
478 if (stat(realpath, &s) != 0)
482 if (S_ISREG(s.st_mode))
484 return static_cast<cell_t>(s.st_size);
490 static cell_t sm_CreateDirectory(IPluginContext *pContext, const cell_t *params)
493 char realpath[PLATFORM_MAX_PATH];
495 pContext->LocalToString(params[1], &name);
496 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
498 #if defined PLATFORM_WINDOWS
499 return mkdir(realpath) == 0;
501 return mkdir(realpath, params[2]) == 0;
505 static cell_t sm_RemoveDir(IPluginContext *pContext, const cell_t *params)
509 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
511 pContext->ThrowNativeErrorEx(err, NULL);
515 char realpath[PLATFORM_MAX_PATH];
516 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
518 return (rmdir(realpath)) ? 0 : 1;
521 static cell_t sm_WriteFileLine(IPluginContext *pContext, const cell_t *params)
523 Handle_t hndl = static_cast<Handle_t>(params[1]);
529 sec.pIdentity = g_pCoreIdent;
531 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
534 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
539 if ((err=pContext->LocalToString(params[2], &fmt)) != SP_ERROR_NONE)
541 pContext->ThrowNativeErrorEx(err, NULL);
547 atcprintf(buffer, sizeof(buffer), fmt, pContext, params, &arg);
548 fprintf(pFile, "%s\n", buffer);
553 static cell_t sm_FlushFile(IPluginContext *pContext, const cell_t *params)
555 Handle_t hndl = static_cast<Handle_t>(params[1]);
561 sec.pIdentity = g_pCoreIdent;
563 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
566 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
569 return (fflush(pFile) == 0) ? 1 : 0;
572 static cell_t sm_BuildPath(IPluginContext *pContext, const cell_t *params)
574 char path[PLATFORM_MAX_PATH], *fmt, *buffer;
576 pContext->LocalToString(params[2], &buffer);
577 pContext->LocalToString(params[4], &fmt);
579 atcprintf(path, sizeof(path), fmt, pContext, params, &arg);
581 return g_SourceMod.BuildPath(Path_SM_Rel, buffer, params[3], "%s", path);
584 static cell_t sm_LogToGame(IPluginContext *pContext, const cell_t *params)
586 g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
589 size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
591 if (pContext->GetLastNativeError() != SP_ERROR_NONE)
596 if (len >= sizeof(buffer)-2)
601 buffer[len++] = '\n';
605 Engine_LogPrintWrapper(buffer);
610 static cell_t sm_LogMessage(IPluginContext *pContext, const cell_t *params)
612 g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
615 g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
617 if (pContext->GetLastNativeError() != SP_ERROR_NONE)
622 CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
623 g_Logger.LogMessage("[%s] %s", pPlugin->GetFilename(), buffer);
628 static cell_t sm_LogError(IPluginContext *pContext, const cell_t *params)
630 g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
633 g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
635 if (pContext->GetLastNativeError() != SP_ERROR_NONE)
640 CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
641 g_Logger.LogError("[%s] %s", pPlugin->GetFilename(), buffer);
646 static cell_t sm_GetFileTime(IPluginContext *pContext, const cell_t *params)
650 if ((err=pContext->LocalToString(params[1], &name)) != SP_ERROR_NONE)
652 pContext->ThrowNativeErrorEx(err, NULL);
657 char realpath[PLATFORM_MAX_PATH];
658 g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
660 if (!g_LibSys.FileTime(realpath, (FileTimeType)params[2], &time_val))
665 return (cell_t)time_val;
668 static cell_t sm_LogToOpenFile(IPluginContext *pContext, const cell_t *params)
670 Handle_t hndl = static_cast<Handle_t>(params[1]);
676 sec.pIdentity = g_pCoreIdent;
678 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
681 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
685 g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
686 g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
688 if (pContext->GetLastNativeError() != SP_ERROR_NONE)
693 CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
694 g_Logger.LogToOpenFile(pFile, "[%s] %s", pPlugin->GetFilename(), buffer);
699 static cell_t sm_LogToOpenFileEx(IPluginContext *pContext, const cell_t *params)
701 Handle_t hndl = static_cast<Handle_t>(params[1]);
707 sec.pIdentity = g_pCoreIdent;
709 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
712 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
716 g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
717 g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
719 if (pContext->GetLastNativeError() != SP_ERROR_NONE)
724 g_Logger.LogToOpenFile(pFile, "%s", buffer);
729 static cell_t sm_ReadFile(IPluginContext *pContext, const cell_t *params)
731 Handle_t hndl = static_cast<Handle_t>(params[1]);
733 HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
737 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
740 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
743 if (params[4] != 1 && params[4] != 2 && params[4] != 4)
745 return pContext->ThrowNativeError("Invalid size specifier (%d is not 1, 2, or 4)", params[4]);
749 pContext->LocalToPhysAddr(params[2], &data);
753 read = fread(data, sizeof(cell_t), params[3], pFile);
755 else if (params[4] == 2)
758 for (cell_t i = 0; i < params[3]; i++)
760 if (fread(&val, sizeof(uint16_t), 1, pFile) != 1)
767 else if (params[4] == 1)
770 for (cell_t i = 0; i < params[3]; i++)
772 if (fread(&val, sizeof(uint8_t), 1, pFile) != 1)
780 if (read != (size_t)params[3] && ferror(pFile) != 0)
788 static cell_t sm_ReadFileString(IPluginContext *pContext, const cell_t *params)
790 Handle_t hndl = static_cast<Handle_t>(params[1]);
792 HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
796 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
799 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
803 pContext->LocalToString(params[2], &buffer);
807 if (size_t(params[4]) > size_t(params[3]))
809 return pContext->ThrowNativeError("read_count (%u) is greater than buffer size (%u)",
814 num_read = (cell_t)fread(buffer, 1, params[4], pFile);
816 if (num_read != params[4] && ferror(pFile))
827 if (params[3] == 0 || num_read >= params[3] - 1)
831 if (fread(&val, sizeof(val), 1, pFile) != 1)
843 if (params[3] > 0 && num_read < params[3] - 1)
845 buffer[num_read++] = val;
851 buffer[num_read] = '\0';
857 static cell_t sm_WriteFile(IPluginContext *pContext, const cell_t *params)
859 Handle_t hndl = static_cast<Handle_t>(params[1]);
861 HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
864 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
867 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
871 pContext->LocalToPhysAddr(params[2], &data);
873 if (params[4] != 1 && params[4] != 2 && params[4] != 4)
875 return pContext->ThrowNativeError("Invalid size specifier (%d is not 1, 2, or 4)", params[4]);
878 /* :NOTE: This really isn't compatible with big endian but we will never have to worry about that. */
882 if (fwrite(data, sizeof(cell_t), params[3], pFile) != (size_t)params[3])
887 else if (params[4] == 2)
889 for (cell_t i = 0; i < params[3]; i++)
891 if (fwrite(&data[i], sizeof(int16_t), 1, pFile) != 1)
897 else if (params[4] == 1)
899 for (cell_t i = 0; i < params[3]; i++)
901 if (fwrite(&data[i], sizeof(int8_t), 1, pFile) != 1)
911 static cell_t sm_WriteFileString(IPluginContext *pContext, const cell_t *params)
913 Handle_t hndl = static_cast<Handle_t>(params[1]);
915 HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
918 if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
921 return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
925 pContext->LocalToString(params[2], &buffer);
927 size_t len = strlen(buffer);
934 return (fwrite(buffer, sizeof(char), len, pFile) == len) ? 1 : 0;
937 static cell_t sm_AddGameLogHook(IPluginContext *pContext, const cell_t *params)
939 IPluginFunction *pFunction;
941 if ((pFunction=pContext->GetFunctionById(params[1])) == NULL)
943 return pContext->ThrowNativeError("Function id %x is invalid", params[1]);
946 s_FileNatives.AddLogHook(pFunction);
951 static cell_t sm_RemoveGameLogHook(IPluginContext *pContext, const cell_t *params)
953 IPluginFunction *pFunction;
955 if ((pFunction=pContext->GetFunctionById(params[1])) == NULL)
957 return pContext->ThrowNativeError("Function id %x is invalid", params[1]);
960 s_FileNatives.RemoveLogHook(pFunction);
965 REGISTER_NATIVES(filesystem)
967 {"OpenDirectory", sm_OpenDirectory},
968 {"ReadDirEntry", sm_ReadDirEntry},
969 {"OpenFile", sm_OpenFile},
970 {"DeleteFile", sm_DeleteFile},
971 {"ReadFileLine", sm_ReadFileLine},
972 {"IsEndOfFile", sm_IsEndOfFile},
973 {"FileSeek", sm_FileSeek},
974 {"FilePosition", sm_FilePosition},
975 {"FileExists", sm_FileExists},
976 {"RenameFile", sm_RenameFile},
977 {"DirExists", sm_DirExists},
978 {"FileSize", sm_FileSize},
979 {"RemoveDir", sm_RemoveDir},
980 {"WriteFileLine", sm_WriteFileLine},
981 {"BuildPath", sm_BuildPath},
982 {"LogToGame", sm_LogToGame},
983 {"LogMessage", sm_LogMessage},
984 {"LogError", sm_LogError},
985 {"FlushFile", sm_FlushFile},
986 {"GetFileTime", sm_GetFileTime},
987 {"LogToOpenFile", sm_LogToOpenFile},
988 {"LogToOpenFileEx", sm_LogToOpenFileEx},
989 {"ReadFile", sm_ReadFile},
990 {"ReadFileString", sm_ReadFileString},
991 {"WriteFile", sm_WriteFile},
992 {"WriteFileString", sm_WriteFileString},
993 {"AddGameLogHook", sm_AddGameLogHook},
994 {"RemoveGameLogHook", sm_RemoveGameLogHook},
995 {"CreateDirectory", sm_CreateDirectory},