This commit is contained in:
romkazvo
2023-08-07 19:29:24 +08:00
commit 34d6c5d489
4832 changed files with 1389451 additions and 0 deletions

View File

@@ -0,0 +1,504 @@
#include "stdafx.h"
//#ifdef NONWIN32TESTCOMPILE
#include "BasicConsole.h"
#include <vector> // STL vector<>, used by IGame, why?
#include <stdlib.h>
#include <stdio.h>
#if !defined(LINUX)
#include <conio.h> // getch()
#else
extern bool g_OnQuit;
#endif
#include <platform.h> // string
#include "Cry_Math.h"
#include <Cry_Camera.h>
#include <IRenderer.h>
#include <ILog.h>
#include <ISystem.h>
#include <ITimer.h>
#include <IInput.h>
#include <IConsole.h> // IOutputPrintSink
#include <IGame.h> // IGame
#include "DedicatedServer.h" // InitDedicatedServer
char g_szInputLine[256]=""; //!<
int g_iCursorPos=0; //!<
bool g_bInputVisible=false; //!< true=visible, false=hidden
//
void HideInputLine(const bool cRemovePrompt = true)
{
g_bInputVisible=false;
int i;
int iLen=(int)strlen(g_szInputLine);
if(cRemovePrompt)
iLen += 2;
// remove string and prompt
for(i=0;i<iLen;++i)
printf("%c",8); // backspace
// clear line
for(i=0;i<iLen;++i)
printf(" "); // space
for(i=0;i<iLen;++i)
printf("%c",8); // go to beginning of line
}
//
void ShowInputLine()
{
g_bInputVisible=true;
printf("> %s",g_szInputLine);
#if defined(LINUX)
fflush(stdout);
#endif
}
//
void ChangeInputLine( const char *szNewLine)
{
HideInputLine();
strcpy(g_szInputLine,szNewLine);
g_iCursorPos=strlen(g_szInputLine);
ShowInputLine();
}
// -----------------------------------------------------------------
class COutputPrintSinkCON :public IOutputPrintSink
{
public:
//! constructor
COutputPrintSinkCON() {};
//! destructor
virtual ~COutputPrintSinkCON() {};
// interface IOutputPrintSink ------------------------
virtual void Print( const char *inszText )
{
const char *szStripped = Strip(inszText);
if(g_bInputVisible)
{
// while the user console input line is shown
HideInputLine();
printf("%s\n",szStripped);
ShowInputLine();
}
else
{
// during executing a console command (console input line is hidden)
printf("%s\n",szStripped);
}
}
};
// -----------------------------------------------------------------
#if defined(LINUX)
void ClearAndSetCursorToStart(const bool cShowPrompt = true)
{
printf("\033[2K"); //clear current line
printf("\033[%dD",cShowPrompt?g_iCursorPos : g_iCursorPos+2); //position cursor to the start
g_iCursorPos=0;
fflush(stdout);
}
void ClearInputLine(const bool bResetInputLine = true)
{
if(g_iCursorPos == 0)
return;//already empty
ClearAndSetCursorToStart(false);
if(bResetInputLine)
strcpy(g_szInputLine,"");
ShowInputLine(); // show prompt
}
#endif
#if defined(LINUX)
void DisplayFrameRate(const float cFrameRate)
{
printf("\033[s");//save cursor pos
printf("\033[0;0H");
printf(" FPS");
printf("\033[5m");
printf(":");
fflush(stdout);
printf("\033[0m");
fflush(stdout);
printf("%4.2f \n",cFrameRate);
printf(" \n");
printf("\033[u");//restore cursor pos
printf("\033[s");//save cursor pos
fflush(stdout);
}
void ResetFrameRate()
{
printf("\033[s");//save cursor pos
printf("\033[0;0H");
for(int i=0; i<2; ++i)
printf(" \n");
printf("\033[u");//restore cursor pos
printf("\033[s");//save cursor pos
fflush(stdout);
}
#endif
#if !defined(LINUX)
#include <windows.h>
#endif
#if defined(LINUX)
int MainCON( const char *szCmdLine, const bool cIsDaemon)
#else
int MainCON( const char *szCmdLine)
#endif
{
COutputPrintSinkCON OutputSinkCON; //!<
// how to add the console window to win32 application http://phoenix.liunet.edu/~mdevi/win32gui/Win32Apps.htm
AllocConsole(); // Creates a new Console Window, if one has not already been created
#if !defined(LINUX)
freopen("CONIN$","rb",stdin); // reopen stdin handle as console window input
freopen("CONOUT$","wb",stdout); // reopen stout handle as console window output
freopen("CONOUT$","wb",stderr); // reopen stderr handle as console window output
#endif
printf("Initializing...\n");
InitDedicatedServer_System(szCmdLine); // is executing early commands (e.g. -DEVMODE, -IP)
// redirect console output
IConsole *pConsole = GetISystem()->GetIConsole();
pConsole->AddOutputPrintSink(&OutputSinkCON);
PrintDedicatedServerStatus();
InitDedicatedServer_Game(szCmdLine); // is executing the console commands specified in szCmdLine
PrintWelcomeMessage();
bool bRelaunch;
ShowInputLine(); // show prompt
#if defined(LINUX)
//store server start time into linux system variable to make sure it exists just once
struct timeval t;
gettimeofday( &t, NULL );
float frameRate = 0.f;
ICVar * psvDisplayInfo= pConsole->GetCVar("r_DisplayInfo");
bool frameRateDisplayed = false;
bool frameRateDisplayedLastFrame = false;
unsigned long long lastSecond = t.tv_sec;
bool bFirstTime = true; //for sleep
bool bLoop = true;
unsigned char cursorPressed = 0;
static const unsigned char scCursorUp = 1, scCursorDown = 2;//constants for cursor key processing
printf("\033[s");//save cursor pos
fflush(stdout);
#endif
// main loop
while( GetISystem()->GetIGame()->Run( bRelaunch ) )
{
#if defined(LINUX)
if(!cIsDaemon)
{
bLoop = true;//only used for continue statements
cursorPressed = 0; //reset
while(kbhit() && bLoop)
{
char c=readch();//internal stuff going on, can't use getch itself even it exists under linux
if((int)c == 27)
{
bool bEscapeSequStarted = false;
while(kbhit())
{
c=readch();
if(c == '[')
{
bEscapeSequStarted = true;
break;
}
}
if(bEscapeSequStarted)
{
c=readch();
switch(c)
{
case 'A':
cursorPressed = scCursorUp;
break;
case 'B':
cursorPressed = scCursorDown;
break;
default:
break;
}
}
while(kbhit()){c = readch();}//flush input buffer
//is escape sequence
bLoop = false;
printf("\033[u");//restore cursor pos
fflush(stdout);
if(!cursorPressed)//continue if no cursor has been pressed
continue;
}
// tab (auto completion)
if(c==-1)
{
readch();
continue;
}
// tab (auto completion)
if(c != 9)
pConsole->ResetAutoCompletion();
if(c==9)
{
g_bInputVisible=false;
printf("\033[u");//restore cursor pos
fflush(stdout);
char *szResult=pConsole->ProcessCompletion(g_szInputLine);
if(*szResult=='\\')
{
ClearAndSetCursorToStart(false);
strcpy(g_szInputLine,szResult+1);
g_iCursorPos=strlen(g_szInputLine);
ShowInputLine();
}
}
else
if(cursorPressed)
{
switch(cursorPressed)
{
case scCursorUp: // cursor up
{
const char *szHistoryLine=pConsole->GetHistoryElement(true); // true=UP
if(szHistoryLine)
ChangeInputLine(szHistoryLine);
}
break;
case scCursorDown: // cursor down
{
const char *szHistoryLine=pConsole->GetHistoryElement(false); // false=DOWN
if(szHistoryLine)
ChangeInputLine(szHistoryLine);
}
break;
}
}
else
// usual key
if(c>=32 && c<127)
{
if(g_iCursorPos<200)
{
g_szInputLine[g_iCursorPos++]=c;
g_szInputLine[g_iCursorPos]=0;
}
}
else
// backspace
if(c==8 || c==127)
{
if(g_iCursorPos > 0)
{
printf("\b \b"); // clear character and go back
fflush(stdout);
g_szInputLine[--g_iCursorPos]=0;
}
}
else
// return (execute command)
if(c==13 || c==10)
{
printf("\033[1A");
printf("\033[2K"); //clear current line
printf("> ");
fflush(stdout);
char szInputLine[256];
g_bInputVisible=false;
strcpy(szInputLine,g_szInputLine);
strcpy(g_szInputLine,""); // clear it early to avoid wrong console printout after execution
const string cCommandLine(szInputLine);
if(cCommandLine == "quit")
{
g_OnQuit = true;
}
pConsole->ExecuteString(szInputLine);
pConsole->AddCommandToHistory(szInputLine);
ClearAndSetCursorToStart(false);
ShowInputLine(); // show prompt
g_iCursorPos=0;
fflush(stdout);
}
else
{
printf("\033[u");//restore cursor pos
fflush(stdout);
}
printf("\033[s");//save cursor pos
fflush(stdout);
}
}
#else
while(kbhit())
{
unsigned char c=getch();
// tab (auto completion)
if(c==9)
{
// remove line
HideInputLine();
char *szResult=pConsole->ProcessCompletion(g_szInputLine);
if(*szResult=='\\')
{
strcpy(g_szInputLine,szResult+1);
// printf("%s",&g_szInputLine[g_iCursorPos]);
g_iCursorPos=strlen(g_szInputLine);
}
ShowInputLine(); // show prompt with autocompleted string
}
else pConsole->ResetAutoCompletion();
// special keys (second value in the input buffer nees different treatment)
if(c==224)
{
unsigned char c2=getch();
switch(c2)
{
case 'H': // cursor up
{
const char *szHistoryLine=pConsole->GetHistoryElement(true); // true=UP
if(szHistoryLine)
ChangeInputLine(szHistoryLine);
}
break;
case 'P': // cursor down
{
const char *szHistoryLine=pConsole->GetHistoryElement(false); // false=DOWN
if(szHistoryLine)
ChangeInputLine(szHistoryLine);
}
break;
}
continue;
}
// usual key
if(c>=32)
{
if(g_iCursorPos<200)
{
g_szInputLine[g_iCursorPos++]=c;
printf("%c",c); // show character
g_szInputLine[g_iCursorPos]=0;
}
}
// backspace
if(c==8 && g_iCursorPos>0)
{
g_szInputLine[--g_iCursorPos]=0;
printf("%c %c",8,8); // clear character and go back
}
// return (execute command)
if(c==13 || c==10)
{
char szInputLine[256];
HideInputLine(false); // hide prompt
strcpy(szInputLine,g_szInputLine);
strcpy(g_szInputLine,""); // clear it early to avoid wrong console printout after execution
pConsole->ExecuteString(szInputLine);
pConsole->AddCommandToHistory(szInputLine);
ShowInputLine(); // show prompt
g_iCursorPos=0;
}
}
#endif
#if defined(LINUX)
if(!cIsDaemon)
{
gettimeofday( &t, NULL );
if(t.tv_sec > lastSecond)
{
//get new framerate
frameRate = GetISystem()->GetITimer()->GetFrameRate();
if(psvDisplayInfo && psvDisplayInfo->GetIVal() == 1)
{
frameRateDisplayed = true;
DisplayFrameRate(frameRate);
frameRateDisplayedLastFrame = true;
}
else
{
if(frameRateDisplayedLastFrame)
ResetFrameRate();
frameRateDisplayedLastFrame = false;
}
lastSecond = t.tv_sec;
}
}
SleepIfNeeded(bFirstTime);
#else
SleepIfNeeded();
#endif
}
PrintGoodbyeMessage();
DeInitDedicatedServer();
FreeConsole(); // Close a console window
#if defined(LINUX)
if(frameRateDisplayed)
ResetFrameRate();
#endif
return 1;
}
//#endif // NONWIN32TESTCOMPILE

View File

@@ -0,0 +1,11 @@
#ifndef _BASICCONSOLE
#define _BASICCONSOLE
#endif // _BASICCONSOLE

View File

@@ -0,0 +1,326 @@
#include "stdafx.h"
#include "DedicatedServer.h"
#include "CryLibrary.h"
#include <IConsole.h> // ICVar
#include <ITimer.h> // CTimeValue
static HMODULE g_hSystemHandle=NULL;
#if !defined(LINUX)
#define DLL_SYSTEM "CrySystem.dll"
#define DLL_GAME "CryGame.dll"
#else
#define DLL_SYSTEM "crysystem.so"
#define DLL_GAME "crygame.so"
#endif
SSystemInitParams g_SystemInitParams; //!< inital statup parameters system
static ISystem * g_pISystem=NULL; //!<
ICVar * g_psvDedicatedMaxRate=NULL; //!<
//
ISystem *GetISystem()
{
return g_pISystem;
}
//////////////////////////////////////////////////////////////////////////
// Timur.
// This is FarCry.exe authentication function, this code is not for public release!!
//////////////////////////////////////////////////////////////////////////
void AuthCheckFunction( void *data )
{
// src and trg can be the same pointer (in place encryption)
// len must be in bytes and must be multiple of 8 byts (64bits).
// key is 128bit: int key[4] = {n1,n2,n3,n4};
// void encipher(unsigned int *const v,unsigned int *const w,const unsigned int *const k )
#define TEA_ENCODE( src,trg,len,key ) {\
register unsigned int *v = (src), *w = (trg), *k = (key), nlen = (len) >> 3; \
register unsigned int delta=0x9E3779B9,a=k[0],b=k[1],c=k[2],d=k[3]; \
while (nlen--) {\
register unsigned int y=v[0],z=v[1],n=32,sum=0; \
while(n-->0) { sum += delta; y += (z << 4)+a ^ z+sum ^ (z >> 5)+b; z += (y << 4)+c ^ y+sum ^ (y >> 5)+d; } \
w[0]=y; w[1]=z; v+=2,w+=2; }}
// src and trg can be the same pointer (in place decryption)
// len must be in bytes and must be multiple of 8 byts (64bits).
// key is 128bit: int key[4] = {n1,n2,n3,n4};
// void decipher(unsigned int *const v,unsigned int *const w,const unsigned int *const k)
#define TEA_DECODE( src,trg,len,key ) {\
register unsigned int *v = (src), *w = (trg), *k = (key), nlen = (len) >> 3; \
register unsigned int delta=0x9E3779B9,a=k[0],b=k[1],c=k[2],d=k[3]; \
while (nlen--) { \
register unsigned int y=v[0],z=v[1],sum=0xC6EF3720,n=32; \
while(n-->0) { z -= (y << 4)+c ^ y+sum ^ (y >> 5)+d; y -= (z << 4)+a ^ z+sum ^ (z >> 5)+b; sum -= delta; } \
w[0]=y; w[1]=z; v+=2,w+=2; }}
// Data assumed to be 32 bytes.
int key1[4] = {389623487,373673863,657846392,378467832};
TEA_DECODE( (unsigned int*)data,(unsigned int*)data,32,(unsigned int*)key1 );
int key2[4] = {1982697467,3278962783,278963782,287678311};
TEA_ENCODE( (unsigned int*)data,(unsigned int*)data,32,(unsigned int*)key2 );
}
void print( const char *insTxt, ... )
{
if (!g_pISystem)
{
return;
}
va_list ArgList;
assert(g_pISystem);
ILog *pLog = g_pISystem->GetILog(); assert(pLog);
va_start(ArgList,insTxt);
pLog->LogV(IMiniLog::eAlways, insTxt, ArgList);
va_end(ArgList);
}
// returns the decimal string representation of the given int
std::string IntToString (int nNumber)
{
char szNumber[16];
sprintf (szNumber, "%d", nNumber);
return szNumber;
}
// returns hexadecimal string representation of the given dword
std::string UIntToHexString(unsigned long dwNumber)
{
char szNumber[24];
sprintf (szNumber, "0x%X", dwNumber);
return szNumber;
}
bool InitDedicatedServer_System( const char *sInCmdLine )
{
#if defined(LINUX)
g_SystemInitParams.sLogFileName = "log_LinuxSV.txt";
#else
g_SystemInitParams.sLogFileName = "log_WinSV.txt";
#endif
#ifndef _XBOX
g_hSystemHandle = CryLoadLibrary(DLL_SYSTEM);
if (!g_hSystemHandle)
{
#if defined(LINUX)
printf ("CrySystem.so Loading Failed: %s\n", dlerror());
#else
MessageBox( NULL,"CrySystem.dll Loading Failed (wrong working directory?):\n","FarCry Error",MB_OK|MB_ICONERROR );
#endif
return false;
}
assert(g_hSystemHandle);
PFNCREATESYSTEMINTERFACE pfnCreateSystemInterface =
(PFNCREATESYSTEMINTERFACE) CryGetProcAddress( g_hSystemHandle,"CreateSystemInterface" );
// Initialize with instance and window handles.
g_SystemInitParams.hInstance = NULL;
g_SystemInitParams.hWnd = NULL;
g_SystemInitParams.bDedicatedServer=true;
strcpy( g_SystemInitParams.szSystemCmdLine,sInCmdLine );
g_SystemInitParams.pCheckFunc = AuthCheckFunction;
// initialize the system
g_pISystem = pfnCreateSystemInterface( g_SystemInitParams );
if (!g_pISystem)
{
MessageBox( NULL,"CreateSystemInterface Failed","FarCry Error",MB_OK|MB_ICONERROR );
return false;
}
IConsole *pConsole = g_pISystem->GetIConsole();
g_psvDedicatedMaxRate = pConsole->CreateVariable("sv_DedicatedMaxRate","80",0,
"Set the maximum update frequency (per second) for the dedicated server. Higher values may improve the network quality.\n"
"Lower values free processor resources (better multitasking).\n"
"Usage: sv_DedicatedMaxRate 20\n"
"Default value is 80.");
// don't load lightmaps
{
ICVar *pLightmapVar=pConsole->GetCVar("e_light_maps"); assert(pLightmapVar);
assert((pLightmapVar->GetFlags()&VF_DUMPTODISK)==0);
assert((pLightmapVar->GetFlags()&VF_SAVEGAME)==0);
pLightmapVar->Set(0);
}
#else
// initialize the system
g_pISystem = CreateSystemInterface( g_SystemInitParams );
#endif
// Enable Log verbosity.
g_pISystem->GetILog()->EnableVerbosity(true);
return true;
}
bool InitDedicatedServer_Game( const char *sInCmdLine )
{
/////////////////////////////////////////////////////////////////////
// INITIAL CONSOLE STATUS IS ACTIVE
/////////////////////////////////////////////////////////////////////
g_pISystem->GetIConsole()->ShowConsole(true);
SGameInitParams ip;
ip.bDedicatedServer=true;
ip.sGameDLL = DLL_GAME;
#if defined(WIN32) || defined(LINUX)
strncpy(ip.szGameCmdLine,sInCmdLine,sizeof(ip.szGameCmdLine));
if (!g_pISystem->CreateGame( ip ))
{
MessageBox( NULL,"CreateGame Failed: CryGame.dll","FarCry Error",MB_OK|MB_ICONERROR );
return false;
}
#else
if (!g_pISystem->CreateGame( ip ))
{
//Error( "CreateGame Failed" );
return false;
}
#endif
return true;
}
//!
void PrintDedicatedServerStatus()
{
assert(g_psvDedicatedMaxRate);
print("FAR CRY dedicated server\n\n");
print("sv_DedicatedMaxRate=%.2f\n",g_psvDedicatedMaxRate->GetFVal());
}
void DeInitDedicatedServer()
{
if (g_psvDedicatedMaxRate)
g_psvDedicatedMaxRate->Release();
g_psvDedicatedMaxRate = 0;
SAFE_RELEASE(g_pISystem);
g_pISystem = NULL;
#ifdef WIN32
::FreeLibrary(g_hSystemHandle);
#endif;
}
void PrintGoodbyeMessage()
{
print("------------------------------------------------------ \n\n");
print(" <RETURN>\n");
}
void PrintWelcomeMessage()
{
print("--------------------------------------------------------------------------------\n");
print("To run a dedicated server you should save a server-profile in the game.\n");
print("With the following commands you can run this profile.\n");
print("\n");
print("SProfile_run <profilename> .. to start the game with the settings/map in the profile\n");
print("start_server <map> .. to start a different map (set g_gametype before e.g. ASSAULT)\n");
print("\n\n");
}
#if defined(LINUX)
void SleepIfNeeded(bool &bFirstTime)
#else
void SleepIfNeeded()
#endif
{
ITimer *pTimer=GetISystem()->GetITimer();
static CTimeValue timPrevTime=pTimer->GetCurrTimePrecise();
CTimeValue timNewTime=pTimer->GetCurrTimePrecise();
CTimeValue timPassed=timNewTime-timPrevTime;
timPrevTime=timNewTime;
float fStepsPerSecond = g_psvDedicatedMaxRate->GetFVal();
float used_ms=timPassed.GetMilliSeconds();
float min_ms=1000.0f/fStepsPerSecond;
int sleep=(int)(min_ms-used_ms);
#if defined(LINUX)
if(!bFirstTime)
{
if(sleep > 0 && sleep<100) // sleep might be very big when loading a level (because of resetting the timer)
Sleep(sleep); // server should not run at 100%
}
bFirstTime = false;
#else
if(sleep > 0 && sleep<100) // sleep might be very big when loading a level (because of resetting the timer)
Sleep(sleep); // server should not run at 100%
#endif
}
//-------------------------------------------------------------------------------------------------
const char *Strip(const char *inszText)
{
static char buf[2048];
char *in = (char *)inszText;
char *out = (char *)buf;
char ch;
while (*in)
{
ch = *in;
if (ch == '$')
{
if (*(in+1))
{
in++;
if ((*in) == '$')
{
*out++ = ch;
}
}
else
{
*out++ = ch;
}
}
else
{
*out++ = ch;
}
++in;
}
*out = 0;
return buf;
};

View File

@@ -0,0 +1,51 @@
#ifndef _DEDICATEDSERVER
#define _DEDICATEDSERVER
#include <ISystem.h> // ISystem, SSystemInitParams
struct ICVar;
//! This is FarCry.exe authentication function, this code is not for public release!!
void AuthCheckFunction( void *data );
//!
bool InitDedicatedServer_System( const char *sInCmdLine );
//!
bool InitDedicatedServer_Game( const char *sInCmdLine );
//!
void PrintDedicatedServerStatus();
//!
void DeInitDedicatedServer();
//!
void PrintGoodbyeMessage();
//!
void PrintWelcomeMessage();
//! to make use of g_psvDedicatedMaxRate
#if defined(LINUX)
void SleepIfNeeded(bool &bFirstTime);
#else
void SleepIfNeeded();
#endif
//!
ISystem *GetISystem();
//!
void print( const char *insTxt, ... );
//! returns the decimal string representation of the given int
std::string IntToString (int nNumber);
//! returns hexadecimal string representation of the given dword
std::string UIntToHexString(unsigned long dwNumber);
const char *Strip(const char *inszText);
extern SSystemInitParams g_SystemInitParams; //!< inital statup parameters system
extern ICVar * g_psvDedicatedMaxRate; //!<
#endif // _DEDICATEDSERVER

BIN
FarCry_WinSV/FarCry.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Crytek"
VALUE "FileDescription", "Far Cry Server"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Far Cry Server"
VALUE "LegalCopyright", "Copyright (C) 2003 Crytek"
VALUE "OriginalFilename", "FarCry_WinSV.exe"
VALUE "ProductName", " Far Cry Server"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON ICON "FarCry.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,33 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FarCry_WinSV", "FarCry_WinSV.vcproj", "{83A6397D-190A-4ACD-9A29-2A25091DECE0}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Debug64 = Debug64
Hybrid64 = Hybrid64
Profile = Profile
Release = Release
Release64 = Release64
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Debug.ActiveCfg = Debug|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Debug.Build.0 = Debug|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Debug64.ActiveCfg = Debug64|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Debug64.Build.0 = Debug64|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Hybrid64.ActiveCfg = Hybrid64|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Hybrid64.Build.0 = Hybrid64|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Profile.ActiveCfg = Profile|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Profile.Build.0 = Profile|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Release.ActiveCfg = Release|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Release.Build.0 = Release|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Release64.ActiveCfg = Release64|Win32
{83A6397D-190A-4ACD-9A29-2A25091DECE0}.Release64.Build.0 = Release64|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,385 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="FarCry_WinSV"
ProjectGUID="{8FC8C385-9DDB-4D31-8B6D-7D4246A6EFAF}"
SccProjectName="Perforce Project"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:Perforce SCM"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="D:\Games\FC\Bin32"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="0"
AdditionalIncludeDirectories=".\,..\CryCommon"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/FarCry_WinSV.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="D:\Games\FC\Bin32"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
EnableFiberSafeOptimizations="FALSE"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="FALSE"
AdditionalIncludeDirectories=".\,..\CryCommon"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_RELEASE"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="FALSE"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Profile|Win32"
OutputDirectory="D:\Games\FC\Bin32"
IntermediateDirectory="Profile"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
EnableFiberSafeOptimizations="FALSE"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="FALSE"
AdditionalIncludeDirectories=".\,..\CryCommon"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="FALSE"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
BaseAddress="0x37000000"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug64|Win32"
OutputDirectory="D:\Games\FC\Bin32"
IntermediateDirectory="Debug64"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\,..\CryCommon"
PreprocessorDefinitions="WIN64,WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
BufferSecurityCheck="FALSE"
UsePrecompiledHeader="3"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(ProjectName).pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:AMD64"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
SubSystem="2"
LargeAddressAware="2"
TargetMachine="0"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; c:\MasterCD"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release64|Win32"
OutputDirectory="D:\Games\FC\Bin32"
IntermediateDirectory="Release64"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
AdditionalIncludeDirectories=".\,..\CryCommon"
PreprocessorDefinitions="_RELEASE;NDEBUG;WIN64;WIN32;_AMD64_;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="0"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
UsePrecompiledHeader="3"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(ProjectName).pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:AMD64"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
SubSystem="2"
LargeAddressAware="2"
TargetMachine="0"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; c:\MasterCD"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath=".\BasicConsole.h">
</File>
<File
RelativePath=".\DedicatedServer.h">
</File>
<File
RelativePath=".\resource.h">
</File>
<File
RelativePath="stdafx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath=".\FarCry.ico">
</File>
<File
RelativePath=".\FarCry_WinSV.rc">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath=".\BasicConsole.cpp">
</File>
<File
RelativePath=".\DedicatedServer.cpp">
</File>
<File
RelativePath="FarCry_WinSV.cpp">
</File>
<File
RelativePath="stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Profile|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug64|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release64|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath=".\WinAndConsole.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:FarCry_WinSV"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[FarCry_WinSV.vcproj]
SCC_Aux_Path = "P4SCC#perforce:1666##marcoc_code##PC018"
SCC_Project_Name = Perforce Project

View File

@@ -0,0 +1,85 @@
#include "StdAfx.h"
#include <windows.h>
// Windows Applications that Have Access To Console Features
// http://www.codeguru.com/Cpp/W-D/console/redirection/article.php/c3961/
//#ifdef _CONSOLEWIN
//Set subsystem to console, just overwrites the default windows subsystem
#pragma comment ( linker, "/subsystem:console" )
BOOL WINAPI ConsoleWinHandlerRoutine( unsigned long dwCtrlType )
{
// Signal type
switch( dwCtrlType )
{
case CTRL_C_EVENT:
case CTRL_BREAK_EVENT:
case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
// You can stop here gracefully:
//
// AfxGetMainWnd()->SendMessage( WM_CLOSE, 0, 0 );
// WaitForSingleObject( AfxGetThread(), INFINITE );
//
ExitProcess(0);
break;
}
return TRUE;
}
// Console main function, this code is from WinMainCRTStartup()
int _tmain( unsigned long, TCHAR**, TCHAR** )
{
#define SPACECHAR _T(' ')
#define DQUOTECHAR _T('\"')
// Set the new handler
SetConsoleCtrlHandler( ConsoleWinHandlerRoutine, TRUE );
// Get command line
LPTSTR lpszCommandLine = ::GetCommandLine();
if(lpszCommandLine == NULL)
return -1;
// Skip past program name (first token in command line).
// Check for and handle quoted program name.
if(*lpszCommandLine == DQUOTECHAR)
{
// Scan, and skip over, subsequent characters until
// another double-quote or a null is encountered.
do
{
lpszCommandLine = ::CharNext(lpszCommandLine);
} while((*lpszCommandLine != DQUOTECHAR) && (*lpszCommandLine != _T('\0')));
// If we stopped on a double-quote (usual case), skip over it.
if(*lpszCommandLine == DQUOTECHAR)
lpszCommandLine = ::CharNext(lpszCommandLine);
}
else
{
while(*lpszCommandLine > SPACECHAR)
lpszCommandLine = ::CharNext(lpszCommandLine);
}
// Skip past any white space preceeding the second token.
while(*lpszCommandLine && (*lpszCommandLine <= SPACECHAR))
lpszCommandLine = ::CharNext(lpszCommandLine);
STARTUPINFO StartupInfo;
StartupInfo.dwFlags = 0;
::GetStartupInfo(&StartupInfo);
// Your original windows application will be started
return _tWinMain(::GetModuleHandle(NULL), NULL, lpszCommandLine,
(StartupInfo.dwFlags & STARTF_USESHOWWINDOW) ?
StartupInfo.wShowWindow : SW_SHOWDEFAULT);
}
//#endif

17
FarCry_WinSV/resource.h Normal file
View File

@@ -0,0 +1,17 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by FarCry_SV.rc
//
#define IDI_ICON 101
#define IDC_EDITLINE 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

8
FarCry_WinSV/stdafx.cpp Normal file
View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// FarCry_SV.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

22
FarCry_WinSV/stdafx.h Normal file
View File

@@ -0,0 +1,22 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#if !defined(LINUX)
#include <tchar.h>
#else
#include <curses.h> // getch()
#endif
#if !defined(LINUX)
#define NOT_USE_CRY_MEMORY_MANAGER
#endif
#include <platform.h>
// TODO: reference additional headers your program requires here