From fa64d4f8a8ae2ef14fe71d92793e104185705e2f Mon Sep 17 00:00:00 2001 From: Tom Kidd Date: Sat, 25 Sep 2021 21:30:03 -0500 Subject: [PATCH] Added rudimentary support for automatically finding Microsoft Store version of Quake 3 Unlike the Steam and GOG support I'm not doing a registry search as I don't see anything in the registry that would show us the path. If we find more official ways to search for it later we can address that, in the meantime the path is just hardcoded to where it's installed by default. --- code/qcommon/files.c | 5 +++++ code/qcommon/qcommon.h | 1 + code/sys/sys_win32.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 4a94463e..c643e584 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -254,6 +254,7 @@ static cvar_t *fs_apppath; #endif static cvar_t *fs_steampath; static cvar_t *fs_gogpath; +static cvar_t *fs_microsoftstorepath; static cvar_t *fs_basepath; static cvar_t *fs_basegame; @@ -3351,6 +3352,10 @@ static void FS_Startup( const char *gameName ) } // add search path elements in reverse priority order + fs_microsoftstorepath = Cvar_Get("fs_microsoftstorepath", Sys_MicrosoftStorePath(), CVAR_INIT | CVAR_PROTECTED); + if (fs_microsoftstorepath->string[0]) { + FS_AddGameDirectory(fs_microsoftstorepath->string, gameName); + } fs_gogpath = Cvar_Get ("fs_gogpath", Sys_GogPath(), CVAR_INIT|CVAR_PROTECTED ); if (fs_gogpath->string[0]) { FS_AddGameDirectory( fs_gogpath->string, gameName ); diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 4471198c..bd490382 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -1123,6 +1123,7 @@ void Sys_SetDefaultInstallPath(const char *path); char *Sys_DefaultInstallPath(void); char *Sys_SteamPath(void); char *Sys_GogPath(void); +char *Sys_MicrosoftStorePath(void); #ifdef __APPLE__ char *Sys_DefaultAppPath(void); diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index ee026bd8..f818bb04 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -52,6 +52,9 @@ static char steamPath[ MAX_OSPATH ] = { 0 }; // Used to store the GOG Quake 3 installation path static char gogPath[ MAX_OSPATH ] = { 0 }; +// Used to store the Microsoft Store Quake 3 installation path +static char microsoftStorePath[MAX_OSPATH] = { 0 }; + #ifndef DEDICATED static UINT timerResolution = 0; #endif @@ -222,6 +225,17 @@ char *Sys_GogPath( void ) return gogPath; } +/* +================ +Sys_MicrosoftStorePath +================ +*/ +char* Sys_MicrosoftStorePath(void) +{ + Q_strcat(microsoftStorePath, MAX_OSPATH, "C:\\Program Files\\ModifiableWindowsApps\\Quake 3\\EN"); + return microsoftStorePath; +} + /* ================ Sys_Milliseconds