diff options
-rw-r--r-- | pkg/wince/doom-cab.cfg | 6 | ||||
-rw-r--r-- | pkg/wince/heretic-cab.cfg | 6 | ||||
-rw-r--r-- | pkg/wince/hexen-cab.cfg | 6 | ||||
-rw-r--r-- | src/m_argv.c | 18 | ||||
-rw-r--r-- | src/m_argv.h | 4 | ||||
-rw-r--r-- | src/setup/mode.c | 28 |
6 files changed, 58 insertions, 10 deletions
diff --git a/pkg/wince/doom-cab.cfg b/pkg/wince/doom-cab.cfg index f958ea92..2ffba5a3 100644 --- a/pkg/wince/doom-cab.cfg +++ b/pkg/wince/doom-cab.cfg @@ -12,8 +12,8 @@ s = "$(START_GAMES)/" src = "../../src/" files = { - d+"chocolate-doom.exe": src+"chocolate-doom.exe", - d+"chocolate-setup.exe": src+"chocolate-setup.exe", + d+"chocolate-doom.exe": src+"chocolate-doom.exe", + d+"chocolate-doom-setup.exe": src+"chocolate-setup.exe", } add_libraries(d, files) @@ -22,6 +22,6 @@ add_libraries(d, files) links = { s+"Chocolate Doom.lnk": d+"chocolate-doom.exe", - s+"Chocolate Doom Setup.lnk": d+"chocolate-setup.exe" + s+"Chocolate Doom Setup.lnk": d+"chocolate-doom-setup.exe" } diff --git a/pkg/wince/heretic-cab.cfg b/pkg/wince/heretic-cab.cfg index 28e0489d..ead2081f 100644 --- a/pkg/wince/heretic-cab.cfg +++ b/pkg/wince/heretic-cab.cfg @@ -12,8 +12,8 @@ s = "$(START_GAMES)/" src = "../../src/" files = { - d+"chocolate-heretic.exe": src+"chocolate-heretic.exe", - d+"chocolate-setup.exe": src+"chocolate-setup.exe", + d+"chocolate-heretic.exe": src+"chocolate-heretic.exe", + d+"chocolate-heretic-setup.exe": src+"chocolate-setup.exe", } add_libraries(d, files) @@ -22,6 +22,6 @@ add_libraries(d, files) links = { s+"Chocolate Heretic.lnk": d+"chocolate-heretic.exe", - s+"Chocolate Heretic Setup.lnk": d+"chocolate-setup.exe" + s+"Chocolate Heretic Setup.lnk": d+"chocolate-heretic-setup.exe" } diff --git a/pkg/wince/hexen-cab.cfg b/pkg/wince/hexen-cab.cfg index 24b68cd3..9d88f01d 100644 --- a/pkg/wince/hexen-cab.cfg +++ b/pkg/wince/hexen-cab.cfg @@ -12,8 +12,8 @@ s = "$(START_GAMES)/" src = "../../src/" files = { - d+"chocolate-hexen.exe": src+"chocolate-hexen.exe", - d+"chocolate-setup.exe": src+"chocolate-setup.exe", + d+"chocolate-hexen.exe": src+"chocolate-hexen.exe", + d+"chocolate-hexen-setup.exe": src+"chocolate-setup.exe", } add_libraries(d, files) @@ -22,6 +22,6 @@ add_libraries(d, files) links = { s+"Chocolate Hexen.lnk": d+"chocolate-hexen.exe", - s+"Chocolate Hexen Setup.lnk": d+"chocolate-setup.exe" + s+"Chocolate Hexen Setup.lnk": d+"chocolate-hexen-setup.exe" } 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; i<arrlen(mission_configs); ++i) + { + config = &mission_configs[i]; + + if (strstr(exe_name, config->name) != 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); } |