This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/game_launch/game.cpp

42 lines
1.5 KiB
C++
Raw Normal View History

2010-07-29 22:00:00 +02:00
//=======================================================================
// Copyright XashXT Group 2007 <20>
// game.cpp -- executable to run Xash Engine
//=======================================================================
#include <windows.h>
// NOTE: engine has a two methods to detect basedir:
// first method: by filename, e.g. spirit.exe will be use basedir 'spirit', hostname must be "normal"
2010-08-29 22:00:00 +02:00
// second method: by hostname with leading symbol '$'. e.g. hl.exe with hostname '$valve' set the basedir to 'valve'
2010-07-29 22:00:00 +02:00
// for dedicated servers rename 'YourExeName.exe' to '#YourExeName.exe'
2010-09-10 22:00:00 +02:00
// Keyword "normal" it's a reserved word which switch engine to game mode, other reserved words run Xash Tools.
2010-07-29 22:00:00 +02:00
//
2010-09-10 22:00:00 +02:00
#define GAME_PATH "$valve" // '$' indicates a start of basefolder name
2010-07-29 22:00:00 +02:00
typedef int (*pfnExecute)( const char *hostname, int console ); // engine entry point format
void Sys_Error( const char *errorstring )
{
MessageBox( NULL, errorstring, "Xash Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP );
exit( 1 );
}
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
HINSTANCE hmain;
2010-11-15 22:00:00 +01:00
if(( hmain = LoadLibrary( "launch.dll" )) == NULL )
2010-07-29 22:00:00 +02:00
{
2010-07-30 22:00:00 +02:00
Sys_Error( "Unable to load the launch.dll" );
2010-07-29 22:00:00 +02:00
}
pfnExecute mainFunc;
if(( mainFunc = (pfnExecute)GetProcAddress( hmain, "CreateAPI" )) == NULL )
{
2010-09-10 22:00:00 +02:00
Sys_Error( "Unable to find entry point in the launch.dll" );
2010-07-29 22:00:00 +02:00
}
return mainFunc( GAME_PATH, false );
}