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.
This commit is contained in:
parent
81b5839ab1
commit
3aefe2f23c
6 changed files with 89 additions and 9 deletions
|
|
@ -113,6 +113,19 @@
|
|||
{
|
||||
[self->launcherManager addFileToCommandLine: fileName
|
||||
forArgument: @"-deh"];
|
||||
[self->launcherManager selectGameByName: "doom"];
|
||||
}
|
||||
else if (![extension caseInsensitiveCompare: @"hhe"])
|
||||
{
|
||||
[self->launcherManager addFileToCommandLine: fileName
|
||||
forArgument: @"-deh"];
|
||||
[self->launcherManager selectGameByName: "heretic"];
|
||||
}
|
||||
else if (![extension caseInsensitiveCompare: @"seh"])
|
||||
{
|
||||
[self->launcherManager addFileToCommandLine: fileName
|
||||
forArgument: @"-deh"];
|
||||
[self->launcherManager selectGameByName: "strife"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
- (void) setEnvironment;
|
||||
- (const char *) getGameName;
|
||||
- (BOOL) addIWADPath: (NSString *) path;
|
||||
- (BOOL) selectGameByName: (const char *) name;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Dehacked patch</string>
|
||||
<string>Doom Dehacked patch</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>wadfile.icns</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
|
|
@ -55,6 +55,30 @@
|
|||
<string>deh</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Heretic HHE patch</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>wadfile.icns</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>hhe</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Strife Sehacked patch</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>wadfile.icns</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>seh</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
- (BOOL) addIWADPath: (NSString *) path;
|
||||
- (void) addFileToCommandLine: (NSString *) fileName
|
||||
forArgument: (NSString *) args;
|
||||
- (BOOL) selectGameByName: (const char *) name;
|
||||
- (void) openTerminal: (id) sender;
|
||||
|
||||
- (void) openREADME: (id) sender;
|
||||
|
|
|
|||
|
|
@ -388,5 +388,10 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName)
|
|||
return [self->iwadController addIWADPath: path];
|
||||
}
|
||||
|
||||
- (BOOL) selectGameByName: (const char *) name
|
||||
{
|
||||
return [self->iwadController selectGameByName: name];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue