provide hatari config with launcher

This commit is contained in:
2026-08-11 14:30:27 +02:00
parent 1634ce806c
commit e704261ea4
5 changed files with 19 additions and 9 deletions
@@ -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;
+9 -2
View File
@@ -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": {