launcher fixes - hatari config fixes

This commit is contained in:
2026-08-11 19:30:35 +02:00
parent 5d8db1347b
commit dd17b60784
3 changed files with 41 additions and 38 deletions
+4 -4
View File
@@ -8,7 +8,7 @@ namespace MarcerGameDvdLauncher
// The Hatari configuration file that is shipped with the launcher. // The Hatari configuration file that is shipped with the launcher.
// When Hatari.ConfigFile is not set in launcher.config.json, this file // When Hatari.ConfigFile is not set in launcher.config.json, this file
// (resolved relative to the executable directory) is used automatically. // (resolved relative to the executable directory) is used automatically.
public const string DefaultConfigFile = "MarcerGameDvd-Hatari.cfg"; private const string DEFAULT_CONFIG_FILE = "MarcerGameDvd-Hatari.cfg";
private readonly string _exePath; private readonly string _exePath;
private readonly string _cfgPath; private readonly string _cfgPath;
@@ -26,6 +26,8 @@ namespace MarcerGameDvdLauncher
// Validate argsTemplate // Validate argsTemplate
if (string.IsNullOrWhiteSpace(argsTemplate) || !argsTemplate.Contains("{zip}")) if (string.IsNullOrWhiteSpace(argsTemplate) || !argsTemplate.Contains("{zip}"))
throw new ArgumentException("Hatari.ArgsTemplate must contain the {zip} placeholder.", nameof(argsTemplate)); throw new ArgumentException("Hatari.ArgsTemplate must contain the {zip} placeholder.", nameof(argsTemplate));
if (string.IsNullOrWhiteSpace(argsTemplate) || !argsTemplate.Contains("{cfg}"))
throw new ArgumentException("Hatari.ArgsTemplate must contain the {cfg} placeholder.", nameof(argsTemplate));
_exePath = exePath; _exePath = exePath;
_cfgPath = cfgPath; _cfgPath = cfgPath;
@@ -42,7 +44,6 @@ namespace MarcerGameDvdLauncher
throw new ArgumentException("ZIP archive path must not be empty.", nameof(zipFilePath)); throw new ArgumentException("ZIP archive path must not be empty.", nameof(zipFilePath));
try try
{ {
// Build arguments: only include config section if cfgPath is not empty
string args = _argsTemplate; string args = _argsTemplate;
if (!string.IsNullOrWhiteSpace(_cfgPath)) if (!string.IsNullOrWhiteSpace(_cfgPath))
{ {
@@ -50,8 +51,7 @@ namespace MarcerGameDvdLauncher
} }
else else
{ {
// Remove {cfg} placeholder entirely if config file is empty args = args.Replace("{cfg}", Path.Combine(Directory.GetCurrentDirectory(),DEFAULT_CONFIG_FILE));
args = args.Replace("{cfg}", string.Empty);
} }
args = args.Replace("{zip}", zipFilePath); args = args.Replace("{zip}", zipFilePath);
+3 -9
View File
@@ -63,17 +63,11 @@ namespace MarcerGameDvdLauncher
if (!File.Exists(cfg.Hatari.Executable)) if (!File.Exists(cfg.Hatari.Executable))
throw new InvalidOperationException($"Hatari executable not found: {cfg.Hatari.Executable}"); throw new InvalidOperationException($"Hatari executable not found: {cfg.Hatari.Executable}");
// If no Hatari config file was specified, fall back to the bundled
// MarcerGameDvd-Hatari.cfg that ships with the launcher.
// Use current working directory to allow running from different locations
if (string.IsNullOrWhiteSpace(cfg.Hatari.ConfigFile))
{
cfg.Hatari.ConfigFile = Path.Combine(Directory.GetCurrentDirectory(), HatariLauncher.DefaultConfigFile);
}
// Validate the Hatari config file (either user-specified or bundled fallback) // Validate the Hatari config file (either user-specified or bundled fallback)
if (!File.Exists(cfg.Hatari.ConfigFile)) if (!string.IsNullOrEmpty(cfg.Hatari.ConfigFile) && !File.Exists(cfg.Hatari.ConfigFile))
throw new InvalidOperationException($"Hatari configuration file not found: {cfg.Hatari.ConfigFile}"); throw new InvalidOperationException($"Hatari configuration file not found: {cfg.Hatari.ConfigFile}");
if (string.IsNullOrWhiteSpace(cfg.Hatari.ArgsTemplate) || !cfg.Hatari.ArgsTemplate.Contains("{cfg}"))
throw new InvalidOperationException("Hatari.ArgsTemplate must contain the {cfg} placeholder.");
if (string.IsNullOrWhiteSpace(cfg.Hatari.ArgsTemplate) || !cfg.Hatari.ArgsTemplate.Contains("{zip}")) if (string.IsNullOrWhiteSpace(cfg.Hatari.ArgsTemplate) || !cfg.Hatari.ArgsTemplate.Contains("{zip}"))
throw new InvalidOperationException("Hatari.ArgsTemplate must contain the {zip} placeholder."); throw new InvalidOperationException("Hatari.ArgsTemplate must contain the {zip} placeholder.");
@@ -11,12 +11,14 @@ bConsoleWindow = FALSE
nNumberBase = 10 nNumberBase = 10
nSymbolLines = -1 nSymbolLines = -1
nMemdumpLines = -1 nMemdumpLines = -1
nFindLines = -1
nDisasmLines = -1 nDisasmLines = -1
nBacktraceLines = 0 nBacktraceLines = 0
nExceptionDebugMask = 1073741830 nExceptionDebugMask = 1073741830
nDisasmOptions = 7 nDisasmOptions = 7
nMemConvLocale = FALSE
bDisasmUAE = TRUE bDisasmUAE = TRUE
bSymbolsAutoLoad = TRUE nSymbolsAutoLoad = 1
bMatchAllSymbols = FALSE bMatchAllSymbols = FALSE
[Screen] [Screen]
@@ -42,13 +44,14 @@ nMaxHeight = 1024
nZoomFactor = 3 nZoomFactor = 3
bUseSdlRenderer = FALSE bUseSdlRenderer = FALSE
ScreenShotFormat = 2 ScreenShotFormat = 2
szScreenShotDir =
bUseVsync = FALSE bUseVsync = FALSE
[Joystick0] [Joystick0]
nJoystickMode = 0 nJoystickMode = 0
bEnableAutoFire = FALSE bEnableAutoFire = FALSE
bEnableJumpOnFire2 = TRUE bEnableJumpOnFire2 = TRUE
nJoyId = -1 nJoyId = 0
nJoyBut1Index = 0 nJoyBut1Index = 0
nJoyBut2Index = 1 nJoyBut2Index = 1
nJoyBut3Index = 2 nJoyBut3Index = 2
@@ -76,7 +79,7 @@ kFire = Right Ctrl
nJoystickMode = 0 nJoystickMode = 0
bEnableAutoFire = FALSE bEnableAutoFire = FALSE
bEnableJumpOnFire2 = TRUE bEnableJumpOnFire2 = TRUE
nJoyId = -1 nJoyId = 0
nJoyBut1Index = 0 nJoyBut1Index = 0
nJoyBut2Index = 1 nJoyBut2Index = 1
nJoyBut3Index = 2 nJoyBut3Index = 2
@@ -106,7 +109,7 @@ kButton9 = 9
nJoystickMode = 0 nJoystickMode = 0
bEnableAutoFire = FALSE bEnableAutoFire = FALSE
bEnableJumpOnFire2 = TRUE bEnableJumpOnFire2 = TRUE
nJoyId = -1 nJoyId = 0
nJoyBut1Index = 0 nJoyBut1Index = 0
nJoyBut2Index = 1 nJoyBut2Index = 1
nJoyBut3Index = 2 nJoyBut3Index = 2
@@ -136,7 +139,7 @@ kButton9 =
nJoystickMode = 0 nJoystickMode = 0
bEnableAutoFire = FALSE bEnableAutoFire = FALSE
bEnableJumpOnFire2 = TRUE bEnableJumpOnFire2 = TRUE
nJoyId = -1 nJoyId = 0
nJoyBut1Index = 0 nJoyBut1Index = 0
nJoyBut2Index = 1 nJoyBut2Index = 1
nJoyBut3Index = 2 nJoyBut3Index = 2
@@ -150,7 +153,7 @@ kFire = Right Ctrl
nJoystickMode = 0 nJoystickMode = 0
bEnableAutoFire = FALSE bEnableAutoFire = FALSE
bEnableJumpOnFire2 = TRUE bEnableJumpOnFire2 = TRUE
nJoyId = -1 nJoyId = 0
nJoyBut1Index = 0 nJoyBut1Index = 0
nJoyBut2Index = 1 nJoyBut2Index = 1
nJoyBut3Index = 2 nJoyBut3Index = 2
@@ -161,7 +164,7 @@ kRight = Right
kFire = Right Ctrl kFire = Right Ctrl
[Keyboard] [Keyboard]
bDisableKeyRepeat = FALSE bFastForwardKeyRepeat = TRUE
nKeymapType = 0 nKeymapType = 0
nCountryCode = -1 nCountryCode = -1
nKbdLayout = -1 nKbdLayout = -1
@@ -224,7 +227,7 @@ bEnableSound = TRUE
bEnableSoundSync = FALSE bEnableSoundSync = FALSE
nPlaybackFreq = 44100 nPlaybackFreq = 44100
nSdlAudioBufferSize = 0 nSdlAudioBufferSize = 0
szYMCaptureFileName = szYMCaptureFileName =
YmVolumeMixing = 2 YmVolumeMixing = 2
[Memory] [Memory]
@@ -232,7 +235,7 @@ nMemorySize = 1024
nTTRamSize = 28672 nTTRamSize = 28672
bAutoSave = FALSE bAutoSave = FALSE
szMemoryCaptureFileName = szMemoryCaptureFileName =
szAutoSaveFileName = szAutoSaveFileName =
[Floppy] [Floppy]
bAutoInsertDiskB = FALSE bAutoInsertDiskB = FALSE
@@ -246,19 +249,23 @@ szDiskAZipPath =
szDiskAFileName = szDiskAFileName =
szDiskBZipPath = szDiskBZipPath =
szDiskBFileName = szDiskBFileName =
szDiskImageDirectory = szDiskImageDirectory =
[HardDisk] [HardDisk]
nGemdosDrive = 0 nGemdosDrive = 0
bBootFromHardDisk = FALSE bBootFromHardDisk = FALSE
bUseHardDiskDirectory = FALSE bUseHardDiskDirectory = FALSE
szHardDiskDirectory = R:\ szHardDiskDirectory = R:
nGemdosCase = 0 nGemdosCase = 0
nWriteProtection = 0 nWriteProtection = 0
bFilenameConversion = FALSE bFilenameConversion = FALSE
bGemdosHostTime = FALSE bGemdosHostTime = FALSE
[ACSI] [ACSI]
bUseDevice0 = FALSE
sDeviceFile0 =
nBlockSize0 = 512
nAcsiVersion0 = 1
[SCSI] [SCSI]
@@ -266,6 +273,7 @@ bGemdosHostTime = FALSE
[IDE] [IDE]
[ROM] [ROM]
szTosImageFileName = TOS.IMG szTosImageFileName = TOS.IMG
bPatchTos = TRUE bPatchTos = TRUE
@@ -273,35 +281,35 @@ szCartridgeImageFileName =
[LILO] [LILO]
Args = root=/dev/ram video=atafb:vga16 load_ramdisk=1 Args = root=/dev/ram video=atafb:vga16 load_ramdisk=1
Kernel = Kernel =
Symbols = Symbols =
Ramdisk = Ramdisk =
HaltOnReboot = TRUE HaltOnReboot = TRUE
KernelToFastRam = TRUE KernelToFastRam = TRUE
RamdiskToFastRam = TRUE RamdiskToFastRam = TRUE
[RS232] [RS232]
bEnableRS232 = FALSE bEnableRS232 = FALSE
szOutFileName = szOutFileName =
szInFileName = szInFileName =
EnableSccA = FALSE EnableSccA = FALSE
SccAOutFileName = SccAOutFileName =
SccAInFileName = SccAInFileName =
EnableSccALan = FALSE EnableSccALan = FALSE
SccALanOutFileName = SccALanOutFileName =
SccALanInFileName = SccALanInFileName =
EnableSccB = FALSE EnableSccB = FALSE
SccBOutFileName = SccBOutFileName =
SccBInFileName = SccBInFileName =
[Printer] [Printer]
bEnablePrinting = FALSE bEnablePrinting = FALSE
szPrintToFileName = szPrintToFileName =
[Midi] [Midi]
bEnableMidi = FALSE bEnableMidi = FALSE
sMidiInFileName = sMidiInFileName =
sMidiOutFileName = sMidiOutFileName =
sMidiInPortName = Off sMidiInPortName = Off
sMidiOutPortName = Off sMidiOutPortName = Off
@@ -312,13 +320,13 @@ bCompatibleCpu = TRUE
nModelType = 0 nModelType = 0
bBlitter = FALSE bBlitter = FALSE
nDSPType = 0 nDSPType = 0
nVMEType = 1
nRtcYear = 0 nRtcYear = 0
bPatchTimerD = FALSE bPatchTimerD = FALSE
bFastBoot = FALSE bFastBoot = FALSE
bFastForward = FALSE bFastForward = FALSE
bAddressSpace24 = TRUE bAddressSpace24 = TRUE
bCycleExactCpu = TRUE bCycleExactCpu = TRUE
bCpuDataCache = TRUE
n_FPUType = 0 n_FPUType = 0
bSoftFloatFPU = FALSE bSoftFloatFPU = FALSE
bMMU = TRUE bMMU = TRUE
@@ -328,3 +336,4 @@ VideoTiming = 3
AviRecordVcodec = 2 AviRecordVcodec = 2
AviRecordFps = 0 AviRecordFps = 0
AviRecordFile = AviRecordFile =