From 62df1ab1dd5bd04c5e6228cea09442c5177a955e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 9 Jul 2009 20:08:20 +0000 Subject: Select the game to configure automatically if the game name is found inside the name of the executable. Rename the executable for the Windows CE install packages. Subversion-branch: /branches/raven-branch Subversion-revision: 1612 --- src/m_argv.c | 18 ++++++++++++++++++ src/m_argv.h | 4 ++++ src/setup/mode.c | 28 +++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/m_argv.c b/src/m_argv.c index 1d07a196..e2b551f1 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -243,3 +243,21 @@ void M_FindResponseFile(void) } } +// Return the name of the executable used to start the program: + +char *M_GetExecutableName(void) +{ + char *sep; + + sep = strrchr(myargv[0], DIR_SEPARATOR); + + if (sep == NULL) + { + return myargv[0]; + } + else + { + return sep + 1; + } +} + diff --git a/src/m_argv.h b/src/m_argv.h index ef59f166..859f93e4 100644 --- a/src/m_argv.h +++ b/src/m_argv.h @@ -46,4 +46,8 @@ void M_FindResponseFile(void); boolean M_ParmExists(char *check); +// Get name of executable used to run this program: + +char *M_GetExecutableName(void); + #endif diff --git a/src/setup/mode.c b/src/setup/mode.c index e300dc9f..ea90c76f 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -197,6 +197,32 @@ static mission_config_t *GetMissionForName(char *name) return NULL; } +// Check the name of the executable. If it contains one of the game +// names (eg. chocolate-hexen-setup.exe) then use that game. + +static boolean CheckExecutableName(GameSelectCallback callback) +{ + mission_config_t *config; + char *exe_name; + int i; + + exe_name = M_GetExecutableName(); + + for (i=0; iname) != NULL) + { + SetMission(config); + callback(); + return true; + } + } + + return false; +} + static void GameSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(config)) { TXT_CAST_ARG(mission_config_t, config); @@ -293,7 +319,7 @@ void SetupMission(GameSelectCallback callback) SetMission(config); callback(); } - else + else if (!CheckExecutableName(callback)) { OpenGameSelectDialog(callback); } -- cgit v1.2.3