mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 22:11:18 +00:00
Add Steam's Quake 3 Arena dir to game dirs on Windows.
This commit is contained in:
parent
3001cacf89
commit
f860a753e0
5 changed files with 85 additions and 0 deletions
|
@ -250,6 +250,7 @@ static cvar_t *fs_homepath;
|
|||
// Also search the .app bundle for .pk3 files
|
||||
static cvar_t *fs_apppath;
|
||||
#endif
|
||||
static cvar_t *fs_steampath;
|
||||
|
||||
static cvar_t *fs_basepath;
|
||||
static cvar_t *fs_basegame;
|
||||
|
@ -748,6 +749,21 @@ long FS_SV_FOpenFileRead(const char *filename, fileHandle_t *fp)
|
|||
fsh[f].handleSync = qfalse;
|
||||
}
|
||||
|
||||
// Check fs_steampath too
|
||||
if (!fsh[f].handleFiles.file.o && fs_steampath->string[0])
|
||||
{
|
||||
ospath = FS_BuildOSPath( fs_steampath->string, filename, "" );
|
||||
ospath[strlen(ospath)-1] = '\0';
|
||||
|
||||
if ( fs_debug->integer )
|
||||
{
|
||||
Com_Printf( "FS_SV_FOpenFileRead (fs_steampath): %s\n", ospath );
|
||||
}
|
||||
|
||||
fsh[f].handleFiles.file.o = Sys_FOpen( ospath, "rb" );
|
||||
fsh[f].handleSync = qfalse;
|
||||
}
|
||||
|
||||
if ( !fsh[f].handleFiles.file.o )
|
||||
{
|
||||
f = 0;
|
||||
|
@ -3280,6 +3296,10 @@ static void FS_Startup( const char *gameName )
|
|||
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
|
||||
|
||||
// add search path elements in reverse priority order
|
||||
fs_steampath = Cvar_Get ("fs_steampath", Sys_SteamPath(), CVAR_INIT|CVAR_PROTECTED );
|
||||
if (fs_steampath->string[0]) {
|
||||
FS_AddGameDirectory( fs_steampath->string, gameName );
|
||||
}
|
||||
if (fs_basepath->string[0]) {
|
||||
FS_AddGameDirectory( fs_basepath->string, gameName );
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define CLIENT_WINDOW_MIN_TITLE "changeme2"
|
||||
#define HOMEPATH_NAME_UNIX ".foo"
|
||||
#define HOMEPATH_NAME_WIN "FooBar"
|
||||
#define STEAMPATH_NAME "Foo Bar"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
#define GAMENAME_FOR_MASTER "foobar" // must NOT contain whitespace
|
||||
// #define LEGACY_PROTOCOL // You probably don't need this for your standalone game
|
||||
|
@ -43,6 +44,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define CLIENT_WINDOW_MIN_TITLE "ioq3"
|
||||
#define HOMEPATH_NAME_UNIX ".q3a"
|
||||
#define HOMEPATH_NAME_WIN "Quake3"
|
||||
#define STEAMPATH_NAME "Quake 3 Arena"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
#define GAMENAME_FOR_MASTER "Quake3Arena"
|
||||
#define LEGACY_PROTOCOL
|
||||
|
|
|
@ -1099,6 +1099,7 @@ FILE *Sys_Mkfifo( const char *ospath );
|
|||
char *Sys_Cwd( void );
|
||||
void Sys_SetDefaultInstallPath(const char *path);
|
||||
char *Sys_DefaultInstallPath(void);
|
||||
char *Sys_SteamPath(void);
|
||||
|
||||
#ifdef MACOS_X
|
||||
char *Sys_DefaultAppPath(void);
|
||||
|
|
|
@ -44,6 +44,9 @@ qboolean stdinIsATTY;
|
|||
// Used to determine where to store user-specific files
|
||||
static char homePath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
// Used to store the Steam Quake 3 installation path
|
||||
static char steamPath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_DefaultHomePath
|
||||
|
@ -78,6 +81,31 @@ char *Sys_DefaultHomePath(void)
|
|||
return homePath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_SteamPath
|
||||
================
|
||||
*/
|
||||
char *Sys_SteamPath( void )
|
||||
{
|
||||
// Disabled since Steam doesn't let you install Quake 3 on Mac/Linux
|
||||
#if 0
|
||||
char *p;
|
||||
|
||||
if( ( p = getenv( "HOME" ) ) != NULL )
|
||||
{
|
||||
#ifdef MACOS_X
|
||||
char *steamPathEnd = "/Library/Application Support/Steam/SteamApps/common/" STEAMPATH_NAME;
|
||||
#else
|
||||
char *steamPathEnd = "/.steam/steam/SteamApps/common/" STEAMPATH_NAME;
|
||||
#endif
|
||||
Com_sprintf(steamPath, sizeof(steamPath), "%s%s", p, steamPathEnd);
|
||||
}
|
||||
#endif
|
||||
|
||||
return steamPath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_Milliseconds
|
||||
|
|
|
@ -42,6 +42,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// Used to determine where to store user-specific files
|
||||
static char homePath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
// Used to store the Steam Quake 3 installation path
|
||||
static char steamPath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
#ifndef DEDICATED
|
||||
static UINT timerResolution = 0;
|
||||
#endif
|
||||
|
@ -126,6 +129,37 @@ char *Sys_DefaultHomePath( void )
|
|||
return homePath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_SteamPath
|
||||
================
|
||||
*/
|
||||
char *Sys_SteamPath( void )
|
||||
{
|
||||
HKEY steamRegKey;
|
||||
|
||||
if (!RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &steamRegKey))
|
||||
{
|
||||
DWORD pathLen = MAX_OSPATH;
|
||||
|
||||
if (RegQueryValueEx(steamRegKey, "SteamPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
|
||||
if (RegQueryValueEx(steamRegKey, "InstallPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
|
||||
steamPath[0] = '\0';
|
||||
|
||||
if (steamPath[0])
|
||||
{
|
||||
if (pathLen == MAX_OSPATH)
|
||||
pathLen--;
|
||||
|
||||
steamPath[pathLen] = '\0';
|
||||
|
||||
Q_strcat(steamPath, MAX_OSPATH, "\\SteamApps\\common\\" STEAMPATH_NAME );
|
||||
}
|
||||
}
|
||||
|
||||
return steamPath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_Milliseconds
|
||||
|
|
Loading…
Reference in a new issue