mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: Remove XASH3D_MIRRORDIR
also make XASH3D_GAME for all platforms
This commit is contained in:
parent
a89f9fa181
commit
2b436dced0
@ -1402,11 +1402,6 @@ void FS_Rescan( void )
|
|||||||
FS_AddPak_Fullpath( va( "%sextras.pak", SDL_GetBasePath() ), NULL, extrasFlags );
|
FS_AddPak_Fullpath( va( "%sextras.pak", SDL_GetBasePath() ), NULL, extrasFlags );
|
||||||
FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags );
|
FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags );
|
||||||
}
|
}
|
||||||
#elif XASH_HAIKU
|
|
||||||
if( ( dir = getenv( "XASH3D_MIRRORDIR" ) ) )
|
|
||||||
FS_AddPak_Fullpath( va( "%s/extras.pak", dir ), NULL, extrasFlags );
|
|
||||||
if( ( dir = getenv( "XASH3D_BASEDIR" ) ) )
|
|
||||||
FS_AddPak_Fullpath( va( "%s/%s/extras.pak", dir , GI->gamefolder ), NULL, extrasFlags );
|
|
||||||
#else
|
#else
|
||||||
str = getenv( "XASH3D_EXTRAS_PAK1" );
|
str = getenv( "XASH3D_EXTRAS_PAK1" );
|
||||||
if( COM_CheckString( str ) )
|
if( COM_CheckString( str ) )
|
||||||
|
@ -90,24 +90,6 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
|
|||||||
return Platform_POSIX_LoadLibrary( dllname );
|
return Platform_POSIX_LoadLibrary( dllname );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_HAIKU
|
|
||||||
// First look for libraries in the mirror directory
|
|
||||||
libdir = getenv( "XASH3D_MIRRORDIR" );
|
|
||||||
if( libdir ) {
|
|
||||||
char path[MAX_SYSPATH];
|
|
||||||
char game[MAX_SYSPATH] = { 0 };
|
|
||||||
if( GI && !Q_strstr( dllname, "menu" ) )
|
|
||||||
Q_snprintf( game, MAX_SYSPATH, "/%s", GI->gamefolder );
|
|
||||||
Q_snprintf( path, MAX_SYSPATH, "%s%s/%s", libdir, game, dllname );
|
|
||||||
pHandle = dlopen( path, RTLD_NOW );
|
|
||||||
if( pHandle )
|
|
||||||
return pHandle;
|
|
||||||
|
|
||||||
COM_PushLibraryError( dlerror() );
|
|
||||||
}
|
|
||||||
// Then through FS_FindLibrary() function in the gamebase directory
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// platforms where gameinfo mechanism is working goes here
|
// platforms where gameinfo mechanism is working goes here
|
||||||
// and use FS_FindLibrary
|
// and use FS_FindLibrary
|
||||||
hInst = FS_FindLibrary( dllname, directpath );
|
hInst = FS_FindLibrary( dllname, directpath );
|
||||||
|
@ -20,14 +20,8 @@ GNU General Public License for more details.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__unix__)
|
#if defined(__APPLE__) || defined(__unix__) || defined(__HAIKU__)
|
||||||
#define XASHLIB "libxash." OS_LIB_EXT
|
#define XASHLIB "libxash." OS_LIB_EXT
|
||||||
#elif __HAIKU__
|
|
||||||
#include <libgen.h>
|
|
||||||
#define XASHLIB "libxash." OS_LIB_EXT
|
|
||||||
#define E_GAME "XASH3D_GAME"
|
|
||||||
#define E_BASEDIR "XASH3D_BASEDIR"
|
|
||||||
#define E_MIRRORDIR "XASH3D_MIRRORDIR"
|
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#if !__MINGW32__ && _MSC_VER >= 1200
|
#if !__MINGW32__ && _MSC_VER >= 1200
|
||||||
#define USE_WINMAIN
|
#define USE_WINMAIN
|
||||||
@ -37,6 +31,7 @@ GNU General Public License for more details.
|
|||||||
#include <shellapi.h> // CommandLineToArgvW
|
#include <shellapi.h> // CommandLineToArgvW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@ -48,6 +43,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
||||||
#define GAME_PATH "valve" // default dir to start from
|
#define GAME_PATH "valve" // default dir to start from
|
||||||
|
|
||||||
typedef void (*pfnChangeGame)( const char *progname );
|
typedef void (*pfnChangeGame)( const char *progname );
|
||||||
@ -93,15 +89,7 @@ static const char *GetStringLastError()
|
|||||||
|
|
||||||
static void Sys_LoadEngine( void )
|
static void Sys_LoadEngine( void )
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
|
||||||
char path[PATH_MAX];
|
|
||||||
char *engine = getenv( E_MIRRORDIR );
|
|
||||||
strncpy( path, engine, PATH_MAX );
|
|
||||||
strncat( path, "/"XASHLIB, PATH_MAX );
|
|
||||||
if(( hEngine = LoadLibrary( path )) == NULL )
|
|
||||||
#else
|
|
||||||
if(( hEngine = LoadLibrary( XASHLIB )) == NULL )
|
if(( hEngine = LoadLibrary( XASHLIB )) == NULL )
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Xash_Error("Unable to load the " XASHLIB ": %s", dlerror() );
|
Xash_Error("Unable to load the " XASHLIB ": %s", dlerror() );
|
||||||
}
|
}
|
||||||
@ -152,12 +140,11 @@ _inline int Sys_Start( void )
|
|||||||
changeGame = Sys_ChangeGame;
|
changeGame = Sys_ChangeGame;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
char *game = getenv( E_GAME );
|
||||||
const char* game = getenv( E_GAME );
|
if( !game )
|
||||||
|
game = GAME_PATH;
|
||||||
|
|
||||||
ret = Xash_Main( szArgc, szArgv, game, 0, changeGame );
|
ret = Xash_Main( szArgc, szArgv, game, 0, changeGame );
|
||||||
#else
|
|
||||||
ret = Xash_Main( szArgc, szArgv, GAME_PATH, 0, changeGame );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Sys_UnloadEngine();
|
Sys_UnloadEngine();
|
||||||
|
|
||||||
@ -170,35 +157,6 @@ int main( int argc, char **argv )
|
|||||||
szArgc = argc;
|
szArgc = argc;
|
||||||
szArgv = argv;
|
szArgv = argv;
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
|
||||||
// To make it able to start from Deskbar
|
|
||||||
chdir( dirname( argv[0] ) );
|
|
||||||
char path[PATH_MAX];
|
|
||||||
getcwd( path, PATH_MAX );
|
|
||||||
const char *game = getenv( E_GAME );
|
|
||||||
if( !game )
|
|
||||||
setenv( E_GAME, GAME_PATH, 1 );
|
|
||||||
const char *basedir = getenv( E_BASEDIR );
|
|
||||||
if( !basedir )
|
|
||||||
setenv( E_BASEDIR, path, 1 );
|
|
||||||
const char *mirrordir = getenv( E_MIRRORDIR );
|
|
||||||
// The mirror "extras/" directory structure for Haiku OS which is needeed for the HPGK-package:
|
|
||||||
// extras.pak
|
|
||||||
// libmenu.so
|
|
||||||
// libxash.so
|
|
||||||
// valve/
|
|
||||||
// cl_dlls/
|
|
||||||
// client_haiku_amd64.so
|
|
||||||
// dlls/
|
|
||||||
// hl_haiku_amd64.so
|
|
||||||
if( !mirrordir )
|
|
||||||
{
|
|
||||||
strncpy( path, getenv( E_BASEDIR ), PATH_MAX );
|
|
||||||
strncat( path, "/extras", PATH_MAX );
|
|
||||||
setenv( E_MIRRORDIR, path, 1 );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return Sys_Start();
|
return Sys_Start();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user