mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-02-22 11:11:25 +00:00
Use the same binary architecture to restart from IWAD picker
This commit is contained in:
parent
7286ee9626
commit
87472bf002
1 changed files with 19 additions and 2 deletions
|
@ -376,6 +376,19 @@ static NSArray* GetKnownExtensions()
|
||||||
|
|
||||||
EXTERN_CVAR(String, defaultiwad)
|
EXTERN_CVAR(String, defaultiwad)
|
||||||
|
|
||||||
|
static NSString* GetArchitectureString()
|
||||||
|
{
|
||||||
|
#ifdef __i386__
|
||||||
|
return @"i386";
|
||||||
|
#elif defined __x86_64__
|
||||||
|
return @"x86_64";
|
||||||
|
#elif defined __ppc__
|
||||||
|
return @"ppc";
|
||||||
|
#elif defined __ppc64__
|
||||||
|
return @"ppc64";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
||||||
{
|
{
|
||||||
assert(nil != parameters);
|
assert(nil != parameters);
|
||||||
|
@ -393,8 +406,12 @@ static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
||||||
assert(commandLineParametersCount > 0);
|
assert(commandLineParametersCount > 0);
|
||||||
|
|
||||||
NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)];
|
NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)];
|
||||||
|
NSString* architecture = GetArchitectureString();
|
||||||
|
|
||||||
NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:commandLineParametersCount + 3];
|
NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:commandLineParametersCount + 6];
|
||||||
|
[arguments addObject:@"-arch"];
|
||||||
|
[arguments addObject:architecture];
|
||||||
|
[arguments addObject:executablePath];
|
||||||
[arguments addObject:@"-wad_picker_restart"];
|
[arguments addObject:@"-wad_picker_restart"];
|
||||||
[arguments addObject:@"-iwad"];
|
[arguments addObject:@"-iwad"];
|
||||||
[arguments addObject:[NSString stringWithUTF8String:iwadPath]];
|
[arguments addObject:[NSString stringWithUTF8String:iwadPath]];
|
||||||
|
@ -419,7 +436,7 @@ static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
||||||
wordfree(&expansion);
|
wordfree(&expansion);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NSTask launchedTaskWithLaunchPath:executablePath arguments:arguments];
|
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/arch" arguments:arguments];
|
||||||
|
|
||||||
_exit(0); // to avoid atexit()'s functions
|
_exit(0); // to avoid atexit()'s functions
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue