Merge `--gdi` handling into `ArgParser` (resolves #4201)
funny story, the `--gdi` handler didn't remove it from the `args` array,
so it's always been parsed as a rom filename and obviously failing, but
before bd58bde07
it was failing silently
This commit is contained in:
parent
4bc2f31d77
commit
a80399860d
|
@ -48,6 +48,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private static readonly BespokeOption<string?> OptionConfigFilePath = new(name: "--config", description: "path of config file to use");
|
||||
|
||||
private static readonly BespokeOption<bool> OptionGDIPlus = new(name: "--gdi", description: "pass to use the GDI+ display method rather than whatever preference is set in the config file");
|
||||
|
||||
private static readonly BespokeOption<string?> OptionHTTPClientURIGET = new(aliases: [ "--url-get", "--url_get" ], description: "string; URI to use for HTTP 'GET' IPC (Lua `comm.http*Get*`)");
|
||||
|
||||
private static readonly BespokeOption<string?> OptionHTTPClientURIPOST = new(aliases: [ "--url-post", "--url_post" ], description: "string; URI to use for HTTP 'POST' IPC (Lua `comm.http*Post*`)");
|
||||
|
@ -105,6 +107,7 @@ namespace BizHawk.Client.Common
|
|||
root.Add(/* --dump-name */ OptionAVDumpName);
|
||||
root.Add(/* --dump-type */ OptionAVDumpType);
|
||||
root.Add(/* --fullscreen */ OptionLaunchFullscreen);
|
||||
root.Add(/* --gdi */ OptionGDIPlus);
|
||||
root.Add(/* --load-slot */ OptionLoadQuicksaveSlot);
|
||||
root.Add(/* --load-state */ OptionLoadSavestateFilePath);
|
||||
root.Add(/* --lua */ OptionLuaFilePath);
|
||||
|
@ -219,6 +222,7 @@ namespace BizHawk.Client.Common
|
|||
autoCloseOnDump: result.GetValueForOption(OptionAVDumpQuitWhenDone),
|
||||
chromeless: result.GetValueForOption(OptionLaunchChromeless),
|
||||
startFullscreen: result.GetValueForOption(OptionLaunchFullscreen),
|
||||
gdiPlusRequested: result.GetValueForOption(OptionGDIPlus),
|
||||
luaScript: luaScript,
|
||||
luaConsole: luaConsole,
|
||||
socketAddress: socketAddress,
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public readonly bool startFullscreen;
|
||||
|
||||
public readonly bool GDIPlusRequested;
|
||||
|
||||
public readonly string? luaScript;
|
||||
|
||||
public readonly bool luaConsole;
|
||||
|
@ -64,6 +66,7 @@ namespace BizHawk.Client.Common
|
|||
bool autoCloseOnDump,
|
||||
bool chromeless,
|
||||
bool startFullscreen,
|
||||
bool gdiPlusRequested,
|
||||
string? luaScript,
|
||||
bool luaConsole,
|
||||
(string IP, ushort Port)? socketAddress,
|
||||
|
@ -87,6 +90,7 @@ namespace BizHawk.Client.Common
|
|||
_autoCloseOnDump = autoCloseOnDump;
|
||||
_chromeless = chromeless;
|
||||
this.startFullscreen = startFullscreen;
|
||||
GDIPlusRequested = gdiPlusRequested;
|
||||
this.luaScript = luaScript;
|
||||
this.luaConsole = luaConsole;
|
||||
SocketAddress = socketAddress;
|
||||
|
|
|
@ -220,6 +220,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
initialConfig = ConfigService.Load<Config>(configPath);
|
||||
}
|
||||
initialConfig.ResolveDefaults();
|
||||
if (cliFlags.GDIPlusRequested) initialConfig.DispMethod = EDispMethod.GdiPlus;
|
||||
if (initialConfig.SaveSlot is 0) initialConfig.SaveSlot = 10; //TODO remove after a while
|
||||
// initialConfig should really be globalConfig as it's mutable
|
||||
|
||||
|
@ -307,12 +308,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
// super hacky! this needs to be done first. still not worth the trouble to make this system fully proper
|
||||
if (Array.Exists(args, static arg => arg.StartsWithIgnoreCase("--gdi")))
|
||||
{
|
||||
initialConfig.DispMethod = EDispMethod.GdiPlus;
|
||||
}
|
||||
|
||||
var workingGL = TryInitIGL(initialConfig.DispMethod);
|
||||
|
||||
Sound globalSound = null;
|
||||
|
|
Loading…
Reference in New Issue