diff options
Diffstat (limited to 'pkg/osx')
-rw-r--r-- | pkg/osx/GNUmakefile | 6 | ||||
-rw-r--r-- | pkg/osx/IWADController.h | 4 | ||||
-rw-r--r-- | pkg/osx/IWADController.m | 35 | ||||
-rw-r--r-- | pkg/osx/LauncherManager.m | 26 |
4 files changed, 65 insertions, 6 deletions
diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index d53a9981..cf8c42fc 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -80,7 +80,11 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) ./cp-with-libs $(TOPLEVEL)/src/$(PROGRAM_PREFIX)doom "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/$(PROGRAM_PREFIX)doom" - ./cp-with-libs $(TOPLEVEL)/setup/$(PROGRAM_PREFIX)setup "$(APP_BIN_DIR)" + ./cp-with-libs $(TOPLEVEL)/src/$(PROGRAM_PREFIX)heretic "$(APP_BIN_DIR)" + $(STRIP) "$(APP_BIN_DIR)/$(PROGRAM_PREFIX)heretic" + ./cp-with-libs $(TOPLEVEL)/src/$(PROGRAM_PREFIX)hexen "$(APP_BIN_DIR)" + $(STRIP) "$(APP_BIN_DIR)/$(PROGRAM_PREFIX)hexen" + ./cp-with-libs $(TOPLEVEL)/src/$(PROGRAM_PREFIX)setup "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/$(PROGRAM_PREFIX)setup" $(TOPLEVEL)/man/simplecpp -DPRECOMPILED -D__MACOSX__ \ diff --git a/pkg/osx/IWADController.h b/pkg/osx/IWADController.h index 7464af9f..2f691f69 100644 --- a/pkg/osx/IWADController.h +++ b/pkg/osx/IWADController.h @@ -36,6 +36,9 @@ id doom2; id plutonia; id tnt; + + id heretic; + id hexen; } - (void) closeConfigWindow: (id)sender; @@ -47,6 +50,7 @@ - (void) saveConfig; - (char *) doomWadPath; - (void) setEnvironment; +- (const char *) getGameName; - (BOOL) addIWADPath: (NSString *) path; @end diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m index 0c55b3f5..b420d59d 100644 --- a/pkg/osx/IWADController.m +++ b/pkg/osx/IWADController.m @@ -33,6 +33,8 @@ typedef enum IWAD_TNT, IWAD_PLUTONIA, IWAD_CHEX, + IWAD_HERETIC, + IWAD_HEXEN, NUM_IWAD_TYPES } IWAD; @@ -42,7 +44,9 @@ static NSString *IWADLabels[NUM_IWAD_TYPES] = @"Doom II: Hell on Earth", @"Final Doom: TNT: Evilution", @"Final Doom: Plutonia Experiment", - @"Chex Quest" + @"Chex Quest", + @"Heretic", + @"Hexen" }; static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = @@ -52,6 +56,8 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = @"tnt.wad", @"plutonia.wad", @"chex.wad", + @"heretic.wad", + @"hexen.wad", @"undefined" }; @@ -64,6 +70,8 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = iwadList[IWAD_TNT] = self->tnt; iwadList[IWAD_PLUTONIA] = self->plutonia; iwadList[IWAD_CHEX] = self->chex; + iwadList[IWAD_HERETIC] = self->heretic; + iwadList[IWAD_HEXEN] = self->hexen; } - (IWAD) getSelectedIWAD @@ -102,6 +110,27 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = } } +// Get the name used for the executable for the selected IWAD. + +- (const char *) getGameName +{ + IWAD selectedIWAD; + + selectedIWAD = [self getSelectedIWAD]; + + switch (selectedIWAD) + { + case IWAD_HERETIC: + return "heretic"; + + case IWAD_HEXEN: + return "hexen"; + + default: + return "doom"; + } +} + - (void) setIWADConfig { IWADLocation *iwadList[NUM_IWAD_TYPES]; @@ -250,6 +279,10 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = - (void) awakeFromNib { + // TODO: This is temporary: + self->heretic = self->doom1; + self->hexen = self->doom2; + [self->configWindow center]; // Set configuration for all IWADs from configuration file. diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index 69c59577..a40ac7c9 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -278,6 +278,8 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) { NSString *iwad; NSString *args; + char *executable_name; + const char *game_name; [self saveConfig]; @@ -294,8 +296,12 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) return; } - ExecuteProgram(PROGRAM_PREFIX "doom", [iwad UTF8String], - [args UTF8String]); + game_name = [self->iwadController getGameName]; + executable_name = malloc(strlen(PROGRAM_PREFIX) + strlen(game_name) + 1); + sprintf(executable_name, "%s%s", PROGRAM_PREFIX, game_name); + + ExecuteProgram(executable_name, [iwad UTF8String], + [args UTF8String]); [NSApp terminate:sender]; } @@ -303,10 +309,22 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) - (void) runSetup: (id)sender { - [self saveConfig]; + const char *game_name; + char *arg; + [self saveConfig]; [self->iwadController setEnvironment]; - ExecuteProgram(PROGRAM_PREFIX "setup", NULL, NULL); + + // Provide the -game command line parameter to select the game + // to configure, based on the game selected in the dropdown. + + game_name = [self->iwadController getGameName]; + arg = malloc(strlen(game_name) + 8); + sprintf(arg, "-game %s", game_name); + + ExecuteProgram(PROGRAM_PREFIX "setup", NULL, arg); + + free(arg); } // Invoked when the "Terminal" option is selected from the menu, to open |