mirror of
https://github.com/skoelle/marcer-gamedvd-launcher.git
synced 2026-09-18 03:00:25 +00:00
provide hatari config with launcher
This commit is contained in:
@@ -5,6 +5,11 @@ namespace MarcerGameDvdLauncher
|
||||
{
|
||||
public class HatariLauncher
|
||||
{
|
||||
// The Hatari configuration file that is shipped with the launcher.
|
||||
// When Hatari.ConfigFile is not set in launcher.config.json, this file
|
||||
// (resolved relative to the executable directory) is used automatically.
|
||||
public const string DefaultConfigFile = "MarcerGameDvd-Hatari.cfg";
|
||||
|
||||
private readonly string _exePath;
|
||||
private readonly string _cfgPath;
|
||||
private readonly string _argsTemplate;
|
||||
|
||||
@@ -63,8 +63,15 @@ namespace MarcerGameDvdLauncher
|
||||
if (!File.Exists(cfg.Hatari.Executable))
|
||||
throw new InvalidOperationException($"Hatari executable not found: {cfg.Hatari.Executable}");
|
||||
|
||||
// Also validate the Hatari config file (if provided)
|
||||
if (!string.IsNullOrWhiteSpace(cfg.Hatari.ConfigFile) && !File.Exists(cfg.Hatari.ConfigFile))
|
||||
// If no Hatari config file was specified, fall back to the bundled
|
||||
// MarcerGameDvd-Hatari.cfg that ships with the launcher.
|
||||
if (string.IsNullOrWhiteSpace(cfg.Hatari.ConfigFile))
|
||||
{
|
||||
cfg.Hatari.ConfigFile = Path.Combine(exeDir, HatariLauncher.DefaultConfigFile);
|
||||
}
|
||||
|
||||
// Validate the Hatari config file (either user-specified or bundled fallback)
|
||||
if (!File.Exists(cfg.Hatari.ConfigFile))
|
||||
throw new InvalidOperationException($"Hatari configuration file not found: {cfg.Hatari.ConfigFile}");
|
||||
if (string.IsNullOrWhiteSpace(cfg.Hatari.ArgsTemplate) || !cfg.Hatari.ArgsTemplate.Contains("{zip}"))
|
||||
throw new InvalidOperationException("Hatari.ArgsTemplate must contain the {zip} placeholder.");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"PatchDirectory": "C:\\Games\\Hatari\\PATCH",
|
||||
"Hatari": {
|
||||
"Executable": "C:\\Tools\\hatari\\hatari.exe",
|
||||
"ConfigFile": "C:\\Tools\\hatari\\hatari-st.cfg",
|
||||
"ConfigFile": "",
|
||||
"ArgsTemplate": "-c \"{cfg}\" --disk-a \"{zip}\""
|
||||
},
|
||||
"Colors": {
|
||||
|
||||
Reference in New Issue
Block a user