summaryrefslogtreecommitdiff
path: root/pkg/osx/IWADController.m
diff options
context:
space:
mode:
authorSimon Howard2014-04-26 21:15:08 -0400
committerSimon Howard2014-04-26 21:15:08 -0400
commit3aefe2f23c84f19044ed12264dba4f917d302f80 (patch)
tree686be173c2d33adea26cb2aacde7fb04a1164748 /pkg/osx/IWADController.m
parent81b5839ab1ee28a5acd1e903ae83064bd5c80283 (diff)
downloadchocolate-doom-3aefe2f23c84f19044ed12264dba4f917d302f80.tar.gz
chocolate-doom-3aefe2f23c84f19044ed12264dba4f917d302f80.tar.bz2
chocolate-doom-3aefe2f23c84f19044ed12264dba4f917d302f80.zip
osx: Handle .hhe, .seh file extensions.
These are the equivalents of .deh for Heretic and Strife. Add these as file associations and auto-switch to the appropriate game type when opened.
Diffstat (limited to 'pkg/osx/IWADController.m')
-rw-r--r--pkg/osx/IWADController.m52
1 files changed, 44 insertions, 8 deletions
diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m
index fb9223c8..c2e6bf45 100644
--- a/pkg/osx/IWADController.m
+++ b/pkg/osx/IWADController.m
@@ -114,15 +114,9 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
}
}
-// Get the name used for the executable for the selected IWAD.
-
-- (const char *) getGameName
+static const char *NameForIWAD(IWAD iwad)
{
- IWAD selectedIWAD;
-
- selectedIWAD = [self getSelectedIWAD];
-
- switch (selectedIWAD)
+ switch (iwad)
{
case IWAD_HERETIC:
return "heretic";
@@ -138,6 +132,13 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
}
}
+// Get the name used for the executable for the selected IWAD.
+
+- (const char *) getGameName
+{
+ return NameForIWAD([self getSelectedIWAD]);
+}
+
- (void) setIWADConfig
{
IWADLocation *iwadList[NUM_IWAD_TYPES];
@@ -416,5 +417,40 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
return NO;
}
+- (BOOL) selectGameByName: (const char *) name
+{
+ IWADLocation *iwadList[NUM_IWAD_TYPES];
+ NSString *location;
+ const char *name2;
+ int i;
+
+ // Already selected an IWAD of the desired type? Just return
+ // success.
+ if (!strcmp(name, [self getGameName]))
+ {
+ return YES;
+ }
+
+ // Search through the configured IWADs and try to select the
+ // desired game.
+ [self getIWADList: iwadList];
+
+ for (i = 0; i < NUM_IWAD_TYPES; ++i)
+ {
+ location = [iwadList[i] getLocation];
+ name2 = NameForIWAD(i);
+
+ if (!strcmp(name, name2)
+ && location != nil && [location length] > 0)
+ {
+ [self->iwadSelector selectItemWithTitle:IWADLabels[i]];
+ return YES;
+ }
+ }
+
+ // User hasn't configured any WAD(s) for the desired game type.
+ return NO;
+}
+
@end