From 0d737ee130def7ad89c9b9f555b193810a01e6cd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 21 Oct 2019 19:51:12 +0200 Subject: [PATCH] - removed all code related to the -usecwd command line switch. While feature-wise ok this was far too scattered throughout the frontends and needs to be done in a more concise way. --- source/blood/src/blood.cpp | 7 +------ source/blood/src/common.cpp | 7 ------- source/blood/src/common_game.h | 2 -- source/duke3d/src/cmdline.cpp | 1 - source/duke3d/src/common.cpp | 7 ------- source/duke3d/src/common_game.h | 3 --- source/duke3d/src/game.cpp | 32 +++----------------------------- source/rr/src/cmdline.cpp | 1 - source/rr/src/common.cpp | 7 ------- source/rr/src/common_game.h | 3 --- source/rr/src/game.cpp | 20 ++------------------ 11 files changed, 6 insertions(+), 84 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index cc967890a..08638108b 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -1408,7 +1408,6 @@ void ParseOptions(void) bNoAutoLoad = true; break; case 33: - g_useCwd = true; break; case 34: { @@ -1522,8 +1521,7 @@ int app_main(int argc, char const * const * argv) ParseOptions(); G_ExtInit(); - if (!g_useCwd) - G_AddSearchPaths(); + G_AddSearchPaths(); // used with binds for fast function lookup hash_init(&h_gamefuncs); @@ -1571,9 +1569,6 @@ int app_main(int argc, char const * const * argv) G_LoadGroups(!bNoAutoLoad && !gSetup.noautoload); - //if (!g_useCwd) - // G_CleanupSearchPaths(); - initprintf("Initializing OSD...\n"); //Bsprintf(tempbuf, HEAD2 " %s", s_buildRev); diff --git a/source/blood/src/common.cpp b/source/blood/src/common.cpp index 3fa72fcac..59e165911 100644 --- a/source/blood/src/common.cpp +++ b/source/blood/src/common.cpp @@ -102,14 +102,11 @@ void G_SetupGlobalPsky(void) static char g_rootDir[BMAX_PATH]; -int g_useCwd; int32_t g_groupFileHandle; struct strllist* CommandPaths, * CommandGrps; void G_ExtPreInit(int32_t argc,char const * const * argv) { - g_useCwd = G_CheckCmdSwitch(argc, argv, "-usecwd"); - #ifdef _WIN32 GetModuleFileNameA(NULL,g_rootDir,BMAX_PATH); Bcorrectfilename(g_rootDir,1); @@ -153,11 +150,7 @@ void G_ExtInit(void) } } -#if defined(_WIN32) if (!access("user_profiles_enabled", F_OK)) -#else - if (g_useCwd == 0 && access("user_profiles_disabled", F_OK)) -#endif { char *homedir; int32_t asperr; diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index eb130b1b4..d4ff9460f 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -31,8 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -extern int g_useCwd; - #define BLOODWIDESCREENDEF "blood_widescreen.def" #define BYTEVERSION 102 diff --git a/source/duke3d/src/cmdline.cpp b/source/duke3d/src/cmdline.cpp index 21e254e3c..20a3c0717 100644 --- a/source/duke3d/src/cmdline.cpp +++ b/source/duke3d/src/cmdline.cpp @@ -515,7 +515,6 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) } if (!Bstrcasecmp(c+1, "usecwd")) { - g_useCwd = 1; i++; continue; } diff --git a/source/duke3d/src/common.cpp b/source/duke3d/src/common.cpp index 115af03e0..ca4e9716f 100644 --- a/source/duke3d/src/common.cpp +++ b/source/duke3d/src/common.cpp @@ -247,15 +247,12 @@ static char g_rootDir[BMAX_PATH]; //char g_modDir[BMAX_PATH] = "/"; -int g_useCwd; static void G_LoadAddon(void); int32_t g_groupFileHandle; struct strllist* CommandPaths, * CommandGrps; void G_ExtPreInit(int32_t argc,char const * const * argv) { - g_useCwd = G_CheckCmdSwitch(argc, argv, "-usecwd"); - #ifdef _WIN32 GetModuleFileNameA(NULL,g_rootDir,BMAX_PATH); Bcorrectfilename(g_rootDir,1); @@ -304,11 +301,7 @@ void G_ExtInit(void) } } -#if defined(_WIN32) && !defined(EDUKE32_STANDALONE) if (buildvfs_exists("user_profiles_enabled")) -#else - if (g_useCwd == 0 && !buildvfs_exists("user_profiles_disabled")) -#endif { char *homedir; int32_t asperr; diff --git a/source/duke3d/src/common_game.h b/source/duke3d/src/common_game.h index 89483f448..4a1ee3abe 100644 --- a/source/duke3d/src/common_game.h +++ b/source/duke3d/src/common_game.h @@ -15,9 +15,6 @@ BEGIN_DUKE_NS -extern int g_useCwd; - - #define GAMEFLAG_DUKE 0x00000001 #define GAMEFLAG_NAM 0x00000002 #define GAMEFLAG_NAPALM 0x00000004 diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 72c4198c5..f539039d1 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -6332,7 +6332,7 @@ int G_FPSLimit(void) EDUKE32_STATIC_ASSERT(sizeof(actor_t)%4 == 0); EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0); -int app_main(int argc, char const * const * argv) +int app_main() { #ifndef NETCODE_DISABLE if (enet_initialize() != 0) @@ -6340,32 +6340,8 @@ int app_main(int argc, char const * const * argv) else atexit(enet_deinitialize); #endif -#ifdef _WIN32 - -#ifndef USE_PHYSFS -#ifdef DEBUGGINGAIDS - extern int32_t (*check_filename_casing_fn)(void); - check_filename_casing_fn = check_filename_casing; -#endif -#endif -#endif - G_ExtPreInit(argc, argv); -#ifdef __APPLE__ - if (!g_useCwd) - { - char cwd[BMAX_PATH]; - char *homedir = Bgethomedir(); - if (homedir) - Bsnprintf(cwd, sizeof(cwd), "%s/Library/Logs/" APPBASENAME ".log", homedir); - else - Bstrcpy(cwd, APPBASENAME ".log"); - OSD_SetLogFile(cwd); - Xfree(homedir); - } - else -#endif OSD_SetLogFile(APPBASENAME ".log"); OSD_SetFunctions(GAME_drawosdchar, @@ -6382,8 +6358,7 @@ int app_main(int argc, char const * const * argv) initprintf(HEAD2 " %s\n", s_buildRev); PrintBuildInfo(); - if (!g_useCwd) - G_AddSearchPaths(); + G_AddSearchPaths(); g_skillCnt = 4; ud.multimode = 1; @@ -6449,8 +6424,7 @@ int app_main(int argc, char const * const * argv) G_LoadGroups(!g_noAutoLoad && !ud.setup.noautoload); // flushlogwindow = 1; - if (!g_useCwd) - G_CleanupSearchPaths(); + G_CleanupSearchPaths(); #ifndef EDUKE32_STANDALONE G_SetupCheats(); diff --git a/source/rr/src/cmdline.cpp b/source/rr/src/cmdline.cpp index 31f7ce3d0..fd5814521 100644 --- a/source/rr/src/cmdline.cpp +++ b/source/rr/src/cmdline.cpp @@ -492,7 +492,6 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) } if (!Bstrcasecmp(c+1, "usecwd")) { - g_useCwd = 1; i++; continue; } diff --git a/source/rr/src/common.cpp b/source/rr/src/common.cpp index f485612cb..bdf39116a 100644 --- a/source/rr/src/common.cpp +++ b/source/rr/src/common.cpp @@ -212,15 +212,12 @@ void G_SetupGlobalPsky(void) ////////// static char g_rootDir[BMAX_PATH]; -int g_useCwd; static void G_LoadAddon(void); int32_t g_groupFileHandle; struct strllist* CommandPaths, * CommandGrps; void G_ExtPreInit(int32_t argc,char const * const * argv) { - g_useCwd = G_CheckCmdSwitch(argc, argv, "-usecwd"); - #ifdef _WIN32 GetModuleFileNameA(NULL,g_rootDir,BMAX_PATH); Bcorrectfilename(g_rootDir,1); @@ -264,11 +261,7 @@ void G_ExtInit(void) } } -#if defined(_WIN32) if (!access("user_profiles_enabled", F_OK)) -#else - if (g_useCwd == 0 && access("user_profiles_disabled", F_OK)) -#endif { char *homedir; int32_t asperr; diff --git a/source/rr/src/common_game.h b/source/rr/src/common_game.h index 2d2a60ee7..d1c38c434 100644 --- a/source/rr/src/common_game.h +++ b/source/rr/src/common_game.h @@ -13,9 +13,6 @@ BEGIN_RR_NS -extern int g_useCwd; - - #define GAMEFLAG_DUKE 0x00000001 #define GAMEFLAG_NAM 0x00000002 #define GAMEFLAG_NAPALM 0x00000004 diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 21787ccb8..601ac9c58 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7715,20 +7715,6 @@ int app_main(int argc, char const * const * argv) G_ExtPreInit(argc, argv); -#ifdef __APPLE__ - if (!g_useCwd) - { - char cwd[BMAX_PATH]; - char *homedir = Bgethomedir(); - if (homedir) - Bsnprintf(cwd, sizeof(cwd), "%s/Library/Logs/" APPBASENAME ".log", homedir); - else - Bstrcpy(cwd, APPBASENAME ".log"); - OSD_SetLogFile(cwd); - Bfree(homedir); - } - else -#endif OSD_SetLogFile(APPBASENAME ".log"); OSD_SetFunctions(GAME_drawosdchar, @@ -7745,8 +7731,7 @@ int app_main(int argc, char const * const * argv) initprintf(HEAD2 " %s\n", s_buildRev); PrintBuildInfo(); - if (!g_useCwd) - G_AddSearchPaths(); + G_AddSearchPaths(); g_skillCnt = 4; ud.multimode = 1; @@ -7816,8 +7801,7 @@ int app_main(int argc, char const * const * argv) G_LoadGroups(!g_noAutoLoad && !ud.setup.noautoload); // flushlogwindow = 1; - if (!g_useCwd) - G_CleanupSearchPaths(); + G_CleanupSearchPaths(); if (RR) {