mirror of
https://github.com/SphereServer/Source
synced 2026-08-13 10:26:05 -04:00
Removed some unused internal codes
This commit is contained in:
parent
d21f41ace9
commit
ee5deb683e
16 changed files with 21 additions and 811 deletions
|
|
@ -194,7 +194,6 @@ if defined GitRev (
|
|||
<ClCompile Include="src\common\CCacheableScriptFile.cpp" />
|
||||
<ClCompile Include="src\common\CCSVFile.cpp" />
|
||||
<ClCompile Include="src\common\CEncrypt.cpp" />
|
||||
<ClCompile Include="src\common\crashdump\crashdump.cpp" />
|
||||
<ClCompile Include="src\common\CVarFloat.cpp" />
|
||||
<ClCompile Include="src\common\sqlite\SQLite.cpp" />
|
||||
<ClCompile Include="src\common\sqlite\sqlite3.c" />
|
||||
|
|
@ -303,7 +302,6 @@ if defined GitRev (
|
|||
<ClInclude Include="src\common\CCSVFile.h" />
|
||||
<ClInclude Include="src\common\CEncrypt.h" />
|
||||
<ClInclude Include="src\common\CMD5.h" />
|
||||
<ClInclude Include="src\common\crashdump\crashdump.h" />
|
||||
<ClInclude Include="src\common\CVarFloat.h" />
|
||||
<ClInclude Include="src\common\CWindow.h" />
|
||||
<ClInclude Include="src\common\sqlite\SQLite.h" />
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@
|
|||
<Filter Include="common\twofish">
|
||||
<UniqueIdentifier>{353e7db8-874b-4551-8e15-0fcc9875d06e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="common\crashdump">
|
||||
<UniqueIdentifier>{bfcf28bb-2d0c-48a1-a304-037fb69f178b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="common\sqlite">
|
||||
<UniqueIdentifier>{19b83913-ef63-4820-9ae0-158e0c75d5b8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
|
@ -165,9 +162,6 @@
|
|||
<ClCompile Include="src\sphere\threads.cpp">
|
||||
<Filter>sphere</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\common\crashdump\crashdump.cpp">
|
||||
<Filter>common\crashdump</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\common\CVarFloat.cpp">
|
||||
<Filter>common</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -512,9 +506,6 @@
|
|||
<ClInclude Include="src\sphere\threads.h">
|
||||
<Filter>sphere</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\common\crashdump\crashdump.h">
|
||||
<Filter>common\crashdump</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\common\CVarFloat.h">
|
||||
<Filter>common</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ void Assert_CheckFail(LPCTSTR pszExp, LPCTSTR pszFile, long lLine)
|
|||
#ifdef _WIN32
|
||||
|
||||
#ifndef _DEBUG
|
||||
#include "./crashdump/crashdump.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
|
@ -21,11 +20,7 @@ void Assert_CheckFail(LPCTSTR pszExp, LPCTSTR pszFile, long lLine)
|
|||
|
||||
void _cdecl Sphere_Exception_Win32(unsigned int id, struct _EXCEPTION_POINTERS *pData)
|
||||
{
|
||||
#ifndef _NO_CRASHDUMP
|
||||
if ( CrashDump::IsEnabled() )
|
||||
CrashDump::StartCrashDump(GetCurrentProcessId(), GetCurrentThreadId(), pData);
|
||||
#endif
|
||||
// WIN32 gets an exception.
|
||||
// WIN32 gets an exception
|
||||
DWORD dwCodeStart = (DWORD_PTR)&globalstartsymbol; // sync up to MAP file
|
||||
DWORD dwAddr = (DWORD_PTR)pData->ExceptionRecord->ExceptionAddress;
|
||||
dwAddr -= dwCodeStart;
|
||||
|
|
|
|||
|
|
@ -210,7 +210,6 @@ public:
|
|||
static const char *m_sClassName;
|
||||
LPCTSTR m_pszAppName; // Specifies the name of the application. (display freindly)
|
||||
HINSTANCE m_hInstance; // Identifies the current instance of the application.
|
||||
LPTSTR m_lpCmdLine; // Points to a null-terminated string that specifies the command line for the application.
|
||||
CWindow * m_pMainWnd; // Holds a pointer to the application's main window. For an example of how to initialize m_pMainWnd, see InitInstance.
|
||||
CGString m_pszExeName; // The module name of the application.
|
||||
CGString m_pszProfileName; // the path to the profile.
|
||||
|
|
@ -220,7 +219,6 @@ public:
|
|||
{
|
||||
m_pszAppName = "";
|
||||
m_hInstance = NULL;
|
||||
m_lpCmdLine = NULL;
|
||||
m_pMainWnd = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -233,11 +231,10 @@ private:
|
|||
CWinApp& operator=(const CWinApp& other);
|
||||
|
||||
public:
|
||||
void InitInstance( LPCTSTR pszAppName, HINSTANCE hInstance, LPTSTR lpszCmdLine )
|
||||
void InitInstance(LPCTSTR pszAppName, HINSTANCE hInstance)
|
||||
{
|
||||
m_pszAppName = pszAppName; // assume this is a static data pointer valid forever.
|
||||
m_hInstance = hInstance;
|
||||
m_lpCmdLine = lpszCmdLine;
|
||||
|
||||
char szFileName[ _MAX_PATH ];
|
||||
if ( ! GetModuleFileName( m_hInstance, szFileName, sizeof( szFileName )))
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
#if defined(_WIN32) && !defined(_DEBUG) && !defined(_NO_CRASHDUMP)
|
||||
|
||||
#include "crashdump.h"
|
||||
|
||||
bool CrashDump::m_bEnabled = false;
|
||||
HMODULE CrashDump::m_hDll = NULL;
|
||||
MINIDUMPWRITEDUMP CrashDump::m_tDumpFunction = NULL;
|
||||
|
||||
bool CrashDump::IsEnabled()
|
||||
{
|
||||
return m_bEnabled;
|
||||
}
|
||||
|
||||
void CrashDump::Enable()
|
||||
{
|
||||
TCHAR szLibPath[MAX_PATH];
|
||||
GetSystemDirectory(szLibPath, sizeof(szLibPath));
|
||||
strncat(szLibPath, "\\dbghelp.dll", sizeof(szLibPath) - strlen(szLibPath) - 1);
|
||||
|
||||
m_hDll = LoadLibrary(szLibPath);
|
||||
if (!m_hDll)
|
||||
{
|
||||
m_bEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_tDumpFunction = reinterpret_cast<MINIDUMPWRITEDUMP>(GetProcAddress(m_hDll, "MiniDumpWriteDump"));
|
||||
if (!m_tDumpFunction)
|
||||
{
|
||||
m_bEnabled = false;
|
||||
FreeLibrary(m_hDll);
|
||||
return;
|
||||
}
|
||||
|
||||
m_bEnabled = true;
|
||||
}
|
||||
|
||||
void CrashDump::Disable()
|
||||
{
|
||||
m_bEnabled = false;
|
||||
|
||||
if (m_tDumpFunction != NULL)
|
||||
m_tDumpFunction = NULL;
|
||||
|
||||
if (m_hDll != NULL)
|
||||
{
|
||||
FreeLibrary(m_hDll);
|
||||
m_hDll = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CrashDump::StartCrashDump( DWORD processID, DWORD threadID, struct _EXCEPTION_POINTERS* pExceptionData )
|
||||
{
|
||||
if (!processID || !threadID || !pExceptionData)
|
||||
return;
|
||||
|
||||
HANDLE process = GetCurrentProcess();
|
||||
if (process == NULL)
|
||||
return;
|
||||
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime(&st);
|
||||
|
||||
char szFileName[FILENAME_MAX];
|
||||
snprintf(szFileName, sizeof(szFileName), "sphereCrash_%02hu%02hu-%02hu%02hu%02hu%04hu.dmp", st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
|
||||
|
||||
HANDLE dumpFile = CreateFile(szFileName, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0);
|
||||
if (dumpFile == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
||||
MINIDUMP_EXCEPTION_INFORMATION eInfo;
|
||||
eInfo.ThreadId = threadID;
|
||||
eInfo.ExceptionPointers = pExceptionData;
|
||||
eInfo.ClientPointers = true;
|
||||
|
||||
m_tDumpFunction(process, processID, dumpFile, MiniDumpWithDataSegs, &eInfo, NULL, NULL);
|
||||
|
||||
CloseHandle(dumpFile);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#if !defined(_CRASHDUMP_H) && defined(_WIN32) && !defined(_DEBUG) && !defined(_NO_CRASHDUMP)
|
||||
#define _CRASHDUMP_H
|
||||
|
||||
#include "../os_windows.h"
|
||||
#ifdef __MINGW32__
|
||||
#include "mingwdbghelp.h"
|
||||
#else // __MINGW32__
|
||||
#pragma warning(disable:4091)
|
||||
#include <Dbghelp.h>
|
||||
#pragma warning(default:4091)
|
||||
#endif // __MINGW32__
|
||||
#include <stdio.h>
|
||||
|
||||
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess,
|
||||
DWORD dwPid,
|
||||
HANDLE hFile,
|
||||
MINIDUMP_TYPE DumpType,
|
||||
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
|
||||
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
|
||||
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
|
||||
class CrashDump
|
||||
{
|
||||
private:
|
||||
static bool m_bEnabled;
|
||||
static HMODULE m_hDll;
|
||||
static MINIDUMPWRITEDUMP m_tDumpFunction;
|
||||
|
||||
public:
|
||||
static void StartCrashDump( DWORD , DWORD , struct _EXCEPTION_POINTERS* );
|
||||
static bool IsEnabled();
|
||||
static void Enable();
|
||||
static void Disable();
|
||||
|
||||
private:
|
||||
CrashDump(void);
|
||||
CrashDump(const CrashDump& copy);
|
||||
CrashDump& operator=(const CrashDump& other);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
/**
|
||||
* @file mingwdbghelp.h
|
||||
* This file is needed for mingw32 because dbghelp.h do not exists.
|
||||
*/
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifndef SPHERESERVER_MINGWDBGHELP_H_H
|
||||
#define SPHERESERVER_MINGWDBGHELP_H_H
|
||||
#include <windows.h>
|
||||
|
||||
typedef enum _MINIDUMP_TYPE {
|
||||
MiniDumpNormal = 0x00000000,
|
||||
MiniDumpWithDataSegs = 0x00000001,
|
||||
MiniDumpWithFullMemory = 0x00000002,
|
||||
MiniDumpWithHandleData = 0x00000004,
|
||||
MiniDumpFilterMemory = 0x00000008,
|
||||
MiniDumpScanMemory = 0x00000010,
|
||||
MiniDumpWithUnloadedModules = 0x00000020,
|
||||
MiniDumpWithIndirectlyReferencedMemory = 0x00000040,
|
||||
MiniDumpFilterModulePaths = 0x00000080,
|
||||
MiniDumpWithProcessThreadData = 0x00000100,
|
||||
MiniDumpWithPrivateReadWriteMemory = 0x00000200,
|
||||
MiniDumpWithoutOptionalData = 0x00000400,
|
||||
MiniDumpWithFullMemoryInfo = 0x00000800,
|
||||
MiniDumpWithThreadInfo = 0x00001000,
|
||||
MiniDumpWithCodeSegs = 0x00002000,
|
||||
MiniDumpWithoutAuxiliaryState = 0x00004000,
|
||||
MiniDumpWithFullAuxiliaryState = 0x00008000,
|
||||
MiniDumpWithPrivateWriteCopyMemory = 0x00010000,
|
||||
MiniDumpIgnoreInaccessibleMemory = 0x00020000,
|
||||
MiniDumpWithTokenInformation = 0x00040000,
|
||||
MiniDumpWithModuleHeaders = 0x00080000,
|
||||
MiniDumpFilterTriage = 0x00100000,
|
||||
MiniDumpValidTypeFlags = 0x001fffff
|
||||
} MINIDUMP_TYPE;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_EXCEPTION_INFORMATION {
|
||||
DWORD ThreadId;
|
||||
PEXCEPTION_POINTERS ExceptionPointers;
|
||||
BOOL ClientPointers;
|
||||
} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_USER_STREAM {
|
||||
ULONG32 Type;
|
||||
ULONG BufferSize;
|
||||
PVOID Buffer;
|
||||
} MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_USER_STREAM_INFORMATION {
|
||||
ULONG UserStreamCount;
|
||||
PMINIDUMP_USER_STREAM UserStreamArray;
|
||||
} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_THREAD_CALLBACK {
|
||||
ULONG ThreadId;
|
||||
HANDLE ThreadHandle;
|
||||
CONTEXT Context;
|
||||
ULONG SizeOfContext;
|
||||
ULONG64 StackBase;
|
||||
ULONG64 StackEnd;
|
||||
} MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_THREAD_EX_CALLBACK {
|
||||
ULONG ThreadId;
|
||||
HANDLE ThreadHandle;
|
||||
CONTEXT Context;
|
||||
ULONG SizeOfContext;
|
||||
ULONG64 StackBase;
|
||||
ULONG64 StackEnd;
|
||||
ULONG64 BackingStoreBase;
|
||||
ULONG64 BackingStoreEnd;
|
||||
} MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_MODULE_CALLBACK {
|
||||
PWCHAR FullPath;
|
||||
ULONG64 BaseOfImage;
|
||||
ULONG SizeOfImage;
|
||||
ULONG CheckSum;
|
||||
ULONG TimeDateStamp;
|
||||
VS_FIXEDFILEINFO VersionInfo;
|
||||
PVOID CvRecord;
|
||||
ULONG SizeOfCvRecord;
|
||||
PVOID MiscRecord;
|
||||
ULONG SizeOfMiscRecord;
|
||||
} MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK {
|
||||
ULONG ThreadId;
|
||||
} MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK {
|
||||
ULONG64 BaseOfImage;
|
||||
} MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_IO_CALLBACK {
|
||||
HANDLE Handle;
|
||||
ULONG64 Offset;
|
||||
PVOID Buffer;
|
||||
ULONG BufferBytes;
|
||||
} MINIDUMP_IO_CALLBACK, *PMINIDUMP_IO_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_READ_MEMORY_FAILURE_CALLBACK {
|
||||
ULONG64 Offset;
|
||||
ULONG Bytes;
|
||||
HRESULT FailureStatus;
|
||||
} MINIDUMP_READ_MEMORY_FAILURE_CALLBACK, *PMINIDUMP_READ_MEMORY_FAILURE_CALLBACK;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_CALLBACK_INPUT {
|
||||
ULONG ProcessId;
|
||||
HANDLE ProcessHandle;
|
||||
ULONG CallbackType;
|
||||
union {
|
||||
HRESULT Status;
|
||||
MINIDUMP_THREAD_CALLBACK Thread;
|
||||
MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
|
||||
MINIDUMP_MODULE_CALLBACK Module;
|
||||
MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
|
||||
MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
|
||||
MINIDUMP_IO_CALLBACK Io;
|
||||
MINIDUMP_READ_MEMORY_FAILURE_CALLBACK ReadMemoryFailure;
|
||||
ULONG SecondaryFlags;
|
||||
};
|
||||
} MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_MEMORY_INFO {
|
||||
ULONG64 BaseAddress;
|
||||
ULONG64 AllocationBase;
|
||||
ULONG32 AllocationProtect;
|
||||
ULONG32 __alignment1;
|
||||
ULONG64 RegionSize;
|
||||
ULONG32 State;
|
||||
ULONG32 Protect;
|
||||
ULONG32 Type;
|
||||
ULONG32 __alignment2;
|
||||
} MINIDUMP_MEMORY_INFO, *PMINIDUMP_MEMORY_INFO;
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_CALLBACK_OUTPUT {
|
||||
union {
|
||||
ULONG ModuleWriteFlags;
|
||||
ULONG ThreadWriteFlags;
|
||||
ULONG SecondaryFlags;
|
||||
struct {
|
||||
ULONG64 MemoryBase;
|
||||
ULONG MemorySize;
|
||||
};
|
||||
struct {
|
||||
BOOL CheckCancel;
|
||||
BOOL Cancel;
|
||||
};
|
||||
HANDLE Handle;
|
||||
};
|
||||
struct {
|
||||
MINIDUMP_MEMORY_INFO VmRegion;
|
||||
BOOL Continue;
|
||||
};
|
||||
HRESULT Status;
|
||||
} MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
|
||||
|
||||
|
||||
typedef BOOL (WINAPI * MINIDUMP_CALLBACK_ROUTINE) (
|
||||
IN PVOID CallbackParam,
|
||||
IN CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,
|
||||
IN OUT PMINIDUMP_CALLBACK_OUTPUT CallbackOutput
|
||||
);
|
||||
|
||||
|
||||
typedef struct _MINIDUMP_CALLBACK_INFORMATION {
|
||||
MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
|
||||
PVOID CallbackParam;
|
||||
} MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
|
||||
|
||||
|
||||
#endif //SPHERESERVER_MINGWDBGHELP_H_H
|
||||
#endif // __MINGW32__
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
#include <WinSock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
extern bool NTWindow_Init(HINSTANCE hInstance, LPTSTR lpCmdLinel, int nCmdShow);
|
||||
extern bool NTWindow_Init(HINSTANCE hInstance, int nCmdShow);
|
||||
extern void NTWindow_Exit();
|
||||
extern void NTWindow_DeleteIcon();
|
||||
extern bool NTWindow_OnTick(int iWaitmSec);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
bool CLog::OpenLog( LPCTSTR pszBaseDirName ) // name set previously.
|
||||
{
|
||||
if ( m_fLockOpen ) // the log is already locked open
|
||||
return false;
|
||||
if ( m_sBaseDir == NULL )
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ extern struct CLog : public CFileText, public CEventLog
|
|||
public:
|
||||
CLog()
|
||||
{
|
||||
m_fLockOpen = false;
|
||||
m_dwMsgMask = (LOGM_ACCOUNTS|LOGM_INIT|LOGM_SAVE|LOGM_CLIENTS_LOG|LOGM_GM_PAGE|LOGM_PLAYER_SPEAK|LOGM_GM_CMDS|LOGM_CHEAT|LOGM_KILLS|LOGM_HTTP);
|
||||
m_pScriptContext = NULL;
|
||||
m_pObjectContext = NULL;
|
||||
|
|
@ -123,7 +122,6 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
bool m_fLockOpen;
|
||||
SimpleMutex m_mutex;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -755,30 +755,15 @@ LRESULT WINAPI CNTWindow::WindowProc( HWND hWnd, UINT message, WPARAM wParam, LP
|
|||
|
||||
//************************************
|
||||
|
||||
bool NTWindow_Init(HINSTANCE hInstance, LPTSTR lpCmdLine, int nCmdShow)
|
||||
bool NTWindow_Init(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
theApp.InitInstance(SPHERE_TITLE "Server V" SPHERE_VER_STR_FULL, hInstance, lpCmdLine);
|
||||
theApp.InitInstance(SPHERE_TITLE "Server V" SPHERE_VER_STR_FULL, hInstance);
|
||||
|
||||
// read target window name from the arguments
|
||||
char className[32] = SPHERE_TITLE "Svr";
|
||||
TCHAR *argv[32];
|
||||
argv[0] = NULL;
|
||||
size_t argc = Str_ParseCmds(lpCmdLine, &argv[1], COUNTOF(argv)-1, " \t") + 1;
|
||||
if (( argc > 1 ) && _IS_SWITCH(*argv[1]) )
|
||||
{
|
||||
if ( argv[1][1] == 'c' )
|
||||
{
|
||||
if ( argv[1][2] )
|
||||
{
|
||||
strncpy(className, &argv[1][2], sizeof(className));
|
||||
className[sizeof(className) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
CNTWindow::RegisterClass(className);
|
||||
char *pszClassName = SPHERE_TITLE "Svr";
|
||||
CNTWindow::RegisterClass(pszClassName);
|
||||
|
||||
theApp.m_wndMain.m_hWnd = ::CreateWindow(
|
||||
className,
|
||||
pszClassName,
|
||||
SPHERE_TITLE_VER, // window name
|
||||
WS_OVERLAPPEDWINDOW, // window style
|
||||
CW_USEDEFAULT, // horizontal position of window
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
#include "../network/network.h"
|
||||
#include "../graysvr/CPingServer.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../common/crashdump/crashdump.h"
|
||||
#else
|
||||
#ifndef _WIN32
|
||||
#include "CUnixTerminal.h"
|
||||
#ifdef _LIBEV
|
||||
extern LinuxEv g_NetworkEvent;
|
||||
|
|
@ -442,121 +440,6 @@ int CServer::PrintPercent(long iCount, long iTotal)
|
|||
return iPercent;
|
||||
}
|
||||
|
||||
extern void defragSphere(char *);
|
||||
|
||||
bool CServer::CommandLine(int argc, TCHAR *argv[])
|
||||
{
|
||||
// Console command line
|
||||
// This runs after script file enum but before loading the world file
|
||||
// RETURN:
|
||||
// true = keep running after this
|
||||
|
||||
for ( int argn = 1; argn < argc; ++argn )
|
||||
{
|
||||
TCHAR *pszArg = argv[argn];
|
||||
if ( !_IS_SWITCH(pszArg[0]) )
|
||||
continue;
|
||||
|
||||
++pszArg;
|
||||
switch ( toupper(pszArg[0]) )
|
||||
{
|
||||
case '?':
|
||||
{
|
||||
PrintStr(SPHERE_TITLE " \n"
|
||||
"Command line switches:\n"
|
||||
#ifdef _WIN32
|
||||
"-cClassName Setup custom window class name for " SPHERE_TITLE " (default: " SPHERE_TITLE "Svr)\n"
|
||||
#else
|
||||
"-c Use colored console output (default: off)\n"
|
||||
#endif
|
||||
"-D Dump global variable DEFNAMEs to defs.txt\n"
|
||||
#if defined(_WIN32) && !defined(_DEBUG) && !defined(_NO_CRASHDUMP)
|
||||
"-E Enable crash dumper\n"
|
||||
#endif
|
||||
"-Gpath/to/saves/ Defrag " SPHERE_TITLE " saves\n"
|
||||
#ifdef _WIN32
|
||||
"-K install/remove Installs or removes NT Service\n"
|
||||
#endif
|
||||
"-Nstring Set the " SPHERE_TITLE " name\n"
|
||||
"-Ofilename Output console to this file name\n"
|
||||
"-P# Set the port number\n"
|
||||
"-Q Quit when finished\n"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
case 'C':
|
||||
case 'K':
|
||||
{
|
||||
// These are parsed in other places (NT service, NT window part, etc)
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
case 'C':
|
||||
{
|
||||
g_UnixTerminal.setColorEnabled(true);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
case 'P':
|
||||
{
|
||||
m_ip.SetPortStr(pszArg + 1);
|
||||
continue;
|
||||
}
|
||||
case 'N':
|
||||
{
|
||||
SetName(pszArg + 1);
|
||||
continue;
|
||||
}
|
||||
case 'D':
|
||||
{
|
||||
CFileText ft;
|
||||
if ( !ft.Open("defs.txt", OF_WRITE|OF_TEXT) )
|
||||
return false;
|
||||
|
||||
for ( size_t i = 0; i < g_Exp.m_VarDefs.GetCount(); ++i )
|
||||
{
|
||||
if ( (i % 0x1FF) == 0 )
|
||||
PrintPercent(i, g_Exp.m_VarDefs.GetCount());
|
||||
|
||||
CVarDefCont *pCont = g_Exp.m_VarDefs.GetAt(i);
|
||||
if ( pCont )
|
||||
ft.Printf("%s=%s\n", pCont->GetKey(), pCont->GetValStr());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#if defined(_WIN32) && !defined(_DEBUG) && !defined(_NO_CRASHDUMP)
|
||||
case 'E':
|
||||
{
|
||||
CrashDump::Enable();
|
||||
if ( CrashDump::IsEnabled() )
|
||||
PrintStr("Crash dump enabled\n");
|
||||
else
|
||||
PrintStr("Crash dump NOT enabled\n");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
case 'G':
|
||||
{
|
||||
defragSphere(pszArg + 1);
|
||||
continue;
|
||||
}
|
||||
case 'O':
|
||||
{
|
||||
if ( g_Log.Open(pszArg + 1, OF_SHARE_DENY_WRITE|OF_READWRITE|OF_TEXT) )
|
||||
g_Log.m_fLockOpen = true;
|
||||
continue;
|
||||
}
|
||||
case 'Q':
|
||||
return false;
|
||||
default:
|
||||
g_Log.Event(LOGL_CRIT, "Don't recognize command line data '%s'\n", static_cast<LPCTSTR>(argv[argn]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CServer::OnConsoleCmd(CGString &sText, CTextConsole *pSrc)
|
||||
{
|
||||
ADDTOCALLSTACK("CServer::OnConsoleCmd");
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ public:
|
|||
void PrintStr(LPCTSTR pszMsg) const;
|
||||
int PrintPercent(long iCount, long iTotal);
|
||||
|
||||
bool CommandLine(int argc, TCHAR *argv[]);
|
||||
bool OnConsoleCmd(CGString &sText, CTextConsole *pSrc);
|
||||
void ListClients(CTextConsole *pConsole) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,6 @@ public:
|
|||
void print(LPCTSTR pszText);
|
||||
void prepare();
|
||||
|
||||
void setColorEnabled(bool fSet)
|
||||
{
|
||||
m_fColorEnabled = fSet;
|
||||
}
|
||||
bool isColorEnabled() const
|
||||
{
|
||||
return m_fColorEnabled;
|
||||
|
|
|
|||
|
|
@ -563,10 +563,10 @@ extern CDataBaseAsyncHelper g_asyncHdb;
|
|||
|
||||
//*******************************************************************
|
||||
|
||||
int Sphere_InitServer( int argc, char *argv[] )
|
||||
int Sphere_InitServer()
|
||||
{
|
||||
#ifdef EXCEPTIONS_DEBUG
|
||||
const char *m_sClassName = "Sphere";
|
||||
const char *m_sClassName = SPHERE_TITLE;
|
||||
#endif
|
||||
EXC_TRY("Init");
|
||||
ASSERT(MAX_BUFFER >= sizeof(CEvent));
|
||||
|
|
@ -593,13 +593,6 @@ int Sphere_InitServer( int argc, char *argv[] )
|
|||
if ( !g_Serv.Load() )
|
||||
return -3;
|
||||
|
||||
if ( argc > 1 )
|
||||
{
|
||||
EXC_SET("cmdline");
|
||||
if ( !g_Serv.CommandLine(argc, argv) )
|
||||
return -1;
|
||||
}
|
||||
|
||||
WritePidFile(2);
|
||||
|
||||
EXC_SET("load world");
|
||||
|
|
@ -627,9 +620,6 @@ int Sphere_InitServer( int argc, char *argv[] )
|
|||
return g_Serv.m_iExitFlag;
|
||||
EXC_CATCH;
|
||||
|
||||
EXC_DEBUG_START;
|
||||
g_Log.EventDebug("cmdline argc=%d starting with %p (argv1='%s')\n", argc, static_cast<void *>(argv), ( argc > 2 ) ? argv[1] : "");
|
||||
EXC_DEBUG_END;
|
||||
return -10;
|
||||
}
|
||||
|
||||
|
|
@ -733,7 +723,7 @@ void CServer::ShipTimers_Delete(CItemShip *pShip)
|
|||
static void Sphere_MainMonitorLoop()
|
||||
{
|
||||
#ifdef EXCEPTIONS_DEBUG
|
||||
const char *m_sClassName = "Sphere";
|
||||
const char *m_sClassName = SPHERE_TITLE;
|
||||
#endif
|
||||
// Just make sure the main loop is alive every so often.
|
||||
// This should be the parent thread. try to restart it if it is not.
|
||||
|
|
@ -770,337 +760,26 @@ static void Sphere_MainMonitorLoop()
|
|||
|
||||
}
|
||||
|
||||
//******************************************************
|
||||
void dword_q_sort(DWORD numbers[], DWORD left, DWORD right)
|
||||
{
|
||||
DWORD pivot, l_hold, r_hold;
|
||||
|
||||
l_hold = left;
|
||||
r_hold = right;
|
||||
pivot = numbers[left];
|
||||
while (left < right)
|
||||
{
|
||||
while ( (numbers[right] >= pivot) && (left < right) )
|
||||
--right;
|
||||
if (left != right)
|
||||
{
|
||||
numbers[left] = numbers[right];
|
||||
++left;
|
||||
}
|
||||
|
||||
while ( (numbers[left] <= pivot) && (left < right) )
|
||||
++left;
|
||||
if (left != right)
|
||||
{
|
||||
numbers[right] = numbers[left];
|
||||
--right;
|
||||
}
|
||||
}
|
||||
numbers[left] = pivot;
|
||||
pivot = left;
|
||||
left = l_hold;
|
||||
right = r_hold;
|
||||
if (left < pivot) dword_q_sort(numbers, left, pivot-1);
|
||||
if (right > pivot) dword_q_sort(numbers, pivot+1, right);
|
||||
}
|
||||
|
||||
void defragSphere(char *path)
|
||||
{
|
||||
ASSERT(path != NULL);
|
||||
|
||||
CFileText inf;
|
||||
CGFile ouf;
|
||||
char z[256], z1[256], buf[1024];
|
||||
size_t i;
|
||||
DWORD uid = UID_CLEAR;
|
||||
char *p = NULL, *p1 = NULL;
|
||||
DWORD dBytesRead;
|
||||
DWORD dTotalMb;
|
||||
DWORD mb10 = 10 * 1024 * 1024;
|
||||
DWORD mb5 = 5 * 1024 * 1024;
|
||||
bool bSpecial;
|
||||
DWORD dTotalUIDs;
|
||||
|
||||
char c,c1,c2;
|
||||
DWORD d;
|
||||
|
||||
// NOTE: Sure I could use CVarDefArray, but it is extremely slow with memory allocation, takes hours
|
||||
// to read and save the data. Moreover, it takes less memory in this case and does less convertations.
|
||||
|
||||
g_Log.Event(LOGL_EVENT, "Defragmentation (UID alteration) of " SPHERE_TITLE " saves.\n"
|
||||
"Use it at your own risk and if you know what you are doing, since it can possibly harm your server.\n"
|
||||
"The process can take up to several hours depending on the CPU you have.\n"
|
||||
"After finished, you will have your '" SPHERE_FILE "*" SPHERE_SCRIPT "' save files converted to '" SPHERE_FILE "*" SPHERE_SCRIPT ".new'.\n");
|
||||
|
||||
DWORD *uids = static_cast<DWORD *>(calloc((SIZE_MAX / 2) / sizeof(DWORD), sizeof(DWORD)));
|
||||
for ( i = 0; i < 3; ++i )
|
||||
{
|
||||
strncpy(z, path, sizeof(z));
|
||||
z[sizeof(z) - 1] = '\0';
|
||||
if ( i == 0 )
|
||||
strncat(z, SPHERE_FILE "statics" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
else if ( i == 1 )
|
||||
strncat(z, SPHERE_FILE "world" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
else
|
||||
strncat(z, SPHERE_FILE "chars" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
|
||||
g_Log.Event(LOGL_EVENT, "Reading %s\n", z);
|
||||
if ( !inf.Open(z, OF_READ|OF_TEXT|OF_DEFAULTMODE) )
|
||||
{
|
||||
g_Log.Event(LOGL_EVENT, "Can't open file '%s' for reading. Skipped!\n", z);
|
||||
continue;
|
||||
}
|
||||
dBytesRead = dTotalMb = 0;
|
||||
while ( !feof(inf.m_pStream) )
|
||||
{
|
||||
fgets(buf, sizeof(buf), inf.m_pStream);
|
||||
dBytesRead += strlen(buf);
|
||||
if ( dBytesRead > mb10 )
|
||||
{
|
||||
dBytesRead -= mb10;
|
||||
dTotalMb += 10;
|
||||
g_Log.Event(LOGL_EVENT, "Total read %" FMTDWORD " Mb\n", dTotalMb);
|
||||
}
|
||||
if (( buf[0] == 'S' ) && ( strstr(buf, "SERIAL=") == buf ))
|
||||
{
|
||||
p = buf + 7;
|
||||
p1 = p;
|
||||
while ( *p1 && ( *p1 != '\r' ) && ( *p1 != '\n' ))
|
||||
++p1;
|
||||
*p1 = 0;
|
||||
|
||||
// prepare new uid
|
||||
*(p-1) = '0';
|
||||
*p = 'x';
|
||||
--p;
|
||||
uids[uid++] = strtoul(p, &p1, 16);
|
||||
}
|
||||
}
|
||||
inf.Close();
|
||||
}
|
||||
|
||||
dTotalUIDs = uid;
|
||||
if ( dTotalUIDs <= 0 )
|
||||
{
|
||||
g_Log.Event(LOGL_EVENT, "Save files are empty, defragmentation is not needed\n");
|
||||
free(uids);
|
||||
return;
|
||||
}
|
||||
|
||||
g_Log.Event(LOGL_EVENT, "Found %" FMTDWORD " UIDs (latest: 0%" FMTDWORDH ")\n", uid, uids[dTotalUIDs - 1]);
|
||||
g_Log.Event(LOGL_EVENT, "Quick-sorting UIDs array...\n");
|
||||
dword_q_sort(uids, 0, dTotalUIDs - 1);
|
||||
|
||||
for ( i = 0; i < 5; ++i )
|
||||
{
|
||||
strncpy(z, path, sizeof(z));
|
||||
z[sizeof(z) - 1] = '\0';
|
||||
if ( i == 0 )
|
||||
strncat(z, SPHERE_FILE "accu" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
else if ( i == 1 )
|
||||
strncat(z, SPHERE_FILE "chars" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
else if ( i == 2 )
|
||||
strncat(z, SPHERE_FILE "data" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
else if ( i == 3 )
|
||||
strncat(z, SPHERE_FILE "world" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
else if ( i == 4 )
|
||||
strncat(z, SPHERE_FILE "statics" SPHERE_SCRIPT, sizeof(z) - strlen(z) - 1);
|
||||
|
||||
g_Log.Event(LOGL_EVENT, "Updating UIDs in '%s' to '%s.new'\n", z, z);
|
||||
if ( !inf.Open(z, OF_READ|OF_TEXT|OF_DEFAULTMODE) )
|
||||
{
|
||||
g_Log.Event(LOGL_EVENT, "Can't open file '%s' for reading. Skipped!\n", z);
|
||||
continue;
|
||||
}
|
||||
strncat(z, ".new", sizeof(z) - strlen(z) - 1);
|
||||
if ( !ouf.Open(z, OF_WRITE|OF_CREATE|OF_DEFAULTMODE) )
|
||||
{
|
||||
g_Log.Event(LOGL_EVENT, "Can't open file '%s' for writing. Skipped!\n", z);
|
||||
continue;
|
||||
}
|
||||
dBytesRead = dTotalMb = 0;
|
||||
while ( inf.ReadString(buf, sizeof(buf)) )
|
||||
{
|
||||
uid = strlen(buf);
|
||||
if ( uid > sizeof(buf) - 3 )
|
||||
uid = sizeof(buf) - 3;
|
||||
|
||||
buf[uid] = buf[uid+1] = buf[uid+2] = 0; // just to be sure to be in line always
|
||||
// NOTE: it is much faster than to use memcpy to clear before reading
|
||||
bSpecial = false;
|
||||
dBytesRead += uid;
|
||||
if ( dBytesRead > mb5 )
|
||||
{
|
||||
dBytesRead -= mb5;
|
||||
dTotalMb += 5;
|
||||
g_Log.Event(LOGL_EVENT, "Total processed %" FMTDWORD " Mb\n", dTotalMb);
|
||||
}
|
||||
p = buf;
|
||||
|
||||
// Note 28-Jun-2004
|
||||
// mounts seems having ACTARG1 > 0x30000000. The actual UID is ACTARG1-0x30000000. The
|
||||
// new also should be new+0x30000000. need investigation if this can help making mounts
|
||||
// not to disappear after the defrag
|
||||
if (( buf[0] == 'A' ) && ( strstr(buf, "ACTARG1=0") == buf )) // ACTARG1=
|
||||
p += 8;
|
||||
else if (( buf[0] == 'C' ) && ( strstr(buf, "CONT=0") == buf )) // CONT=
|
||||
p += 5;
|
||||
else if (( buf[0] == 'C' ) && ( strstr(buf, "CHARUID=0") == buf )) // CHARUID=
|
||||
p += 8;
|
||||
else if (( buf[0] == 'L' ) && ( strstr(buf, "LASTCHARUID=0") == buf )) // LASTCHARUID=
|
||||
p += 12;
|
||||
else if (( buf[0] == 'L' ) && ( strstr(buf, "LINK=0") == buf )) // LINK=
|
||||
p += 5;
|
||||
else if (( buf[0] == 'M' ) && ( strstr(buf, "MEMBER=0") == buf )) // MEMBER=
|
||||
{
|
||||
p += 7;
|
||||
bSpecial = true;
|
||||
}
|
||||
else if (( buf[0] == 'M' ) && ( strstr(buf, "MORE1=0") == buf )) // MORE1=
|
||||
p += 6;
|
||||
else if (( buf[0] == 'M' ) && ( strstr(buf, "MORE2=0") == buf )) // MORE2=
|
||||
p += 6;
|
||||
else if (( buf[0] == 'S' ) && ( strstr(buf, "SERIAL=0") == buf )) // SERIAL=
|
||||
p += 7;
|
||||
else if ((( buf[0] == 'T' ) && ( strstr(buf, "TAG.") == buf )) || // TAG.=
|
||||
(( buf[0] == 'R' ) && ( strstr(buf, "REGION.TAG") == buf )))
|
||||
{
|
||||
while ( *p && (*p != '=') )
|
||||
++p;
|
||||
++p;
|
||||
}
|
||||
else if (( i == 2 ) && strchr(buf, '=')) // spheredata.scp - plain VARs
|
||||
{
|
||||
while ( *p && (*p != '=') )
|
||||
++p;
|
||||
++p;
|
||||
}
|
||||
else p = NULL;
|
||||
|
||||
// UIDs are always hex, so prefixed by 0
|
||||
if ( p && ( *p != '0' )) p = NULL;
|
||||
|
||||
// here we got potentialy UID-contained variable
|
||||
// check if it really is only UID-like var containing
|
||||
if ( p )
|
||||
{
|
||||
p1 = p;
|
||||
while ( *p1 && (((*p1 >= '0') && (*p1 <= '9')) || ((*p1 >= 'a') && (*p1 <= 'f'))) )
|
||||
++p1;
|
||||
|
||||
if ( !bSpecial )
|
||||
{
|
||||
if ( *p1 && ( *p1 != '\r' ) && ( *p1 != '\n' )) // some more text in line
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// here we definitely know that this is very uid-like
|
||||
if ( p )
|
||||
{
|
||||
c = *p1;
|
||||
|
||||
*p1 = 0;
|
||||
// here in p we have the current value of the line.
|
||||
// check if it is a valid UID
|
||||
|
||||
// prepare converting 0.. to 0x..
|
||||
c1 = *(p-1);
|
||||
c2 = *p;
|
||||
*(p-1) = '0';
|
||||
*p = 'x';
|
||||
--p;
|
||||
uid = strtoul(p, &p1, 16);
|
||||
++p;
|
||||
*(p-1) = c1;
|
||||
*p = c2;
|
||||
// Note 28-Jun-2004
|
||||
// The search algourytm is very simple and fast. But maybe integrate some other, at least /2 algorythm
|
||||
// since has amount/2 tryes at worst chance to get the item and never scans the whole array
|
||||
// It should improve speed since defragmenting 150Mb saves takes ~2:30 on 2.0Mhz CPU
|
||||
{
|
||||
DWORD dStep = dTotalUIDs/2;
|
||||
d = dStep;
|
||||
for (;;)
|
||||
{
|
||||
dStep /= 2;
|
||||
|
||||
if ( uids[d] == uid )
|
||||
{
|
||||
uid = d | (uids[d]&0xF0000000); // do not forget attach item and special flags like 04..
|
||||
break;
|
||||
}
|
||||
else if ( uids[d] < uid ) d += dStep;
|
||||
else d -= dStep;
|
||||
|
||||
if ( dStep == 1 )
|
||||
{
|
||||
uid = DWORD_MAX;
|
||||
break; // did not find the UID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Search for this uid in the table
|
||||
/*for ( d = 0; d < dTotalUIDs; ++d )
|
||||
{
|
||||
if ( !uids[d] ) // end of array
|
||||
{
|
||||
uid = DWORD_MAX;
|
||||
break;
|
||||
}
|
||||
else if ( uids[d] == uid )
|
||||
{
|
||||
uid = d | (uids[d]&0xF0000000); // do not forget attach item and special flags like 04..
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
// replace UID by the new one since it has been found
|
||||
*p1 = c;
|
||||
if ( uid != DWORD_MAX )
|
||||
{
|
||||
*p = 0;
|
||||
strncpy(z, p1, sizeof(z));
|
||||
z[sizeof(z) - 1] = '\0';
|
||||
snprintf(z1, sizeof(z1), "0%" FMTDWORDH, uid);
|
||||
strncat(buf, z1, sizeof(buf) - strlen(buf) - 1);
|
||||
strncat(buf, z, sizeof(buf) - strlen(buf) - 1);
|
||||
}
|
||||
}
|
||||
// output the resulting line
|
||||
ouf.Write(buf, strlen(buf));
|
||||
}
|
||||
inf.Close();
|
||||
ouf.Close();
|
||||
}
|
||||
free(uids);
|
||||
g_Log.Event(LOGL_EVENT, "Defragmentation complete\n");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
TCHAR *argv[32];
|
||||
argv[0] = NULL;
|
||||
int argc = Str_ParseCmds(lpCmdLine, &argv[1], COUNTOF(argv) - 1, " \t") + 1;
|
||||
|
||||
NTWindow_Init(hInstance, lpCmdLine, nCmdShow);
|
||||
int iRet = Sphere_MainEntryPoint(argc, argv);
|
||||
NTWindow_Init(hInstance, nShowCmd);
|
||||
int iRet = Sphere_MainEntryPoint();
|
||||
NTWindow_Exit();
|
||||
TerminateProcess(GetCurrentProcess(), iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
int Sphere_MainEntryPoint( int argc, char *argv[] )
|
||||
int Sphere_MainEntryPoint()
|
||||
#else
|
||||
int _cdecl main( int argc, char * argv[] )
|
||||
#endif
|
||||
{
|
||||
#ifdef EXCEPTIONS_DEBUG
|
||||
const char *m_sClassName = "Sphere";
|
||||
const char *m_sClassName = SPHERE_TITLE;
|
||||
#endif
|
||||
EXC_TRY("Main");
|
||||
|
||||
|
|
@ -1109,7 +788,7 @@ int _cdecl main( int argc, char * argv[] )
|
|||
g_UnixTerminal.prepare();
|
||||
#endif
|
||||
|
||||
g_Serv.m_iExitFlag = Sphere_InitServer( argc, argv );
|
||||
g_Serv.m_iExitFlag = Sphere_InitServer();
|
||||
if ( ! g_Serv.m_iExitFlag )
|
||||
{
|
||||
WritePidFile(0);
|
||||
|
|
|
|||
|
|
@ -237,9 +237,9 @@ private:
|
|||
|
||||
const LPCTSTR g_szCompiledDate = __DATE__;
|
||||
|
||||
extern int Sphere_InitServer( int argc, char *argv[] );
|
||||
extern int Sphere_InitServer();
|
||||
extern void Sphere_ExitServer();
|
||||
extern int Sphere_MainEntryPoint( int argc, char *argv[] );
|
||||
extern int Sphere_MainEntryPoint();
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// -CGrayUID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue