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
+1 -1
View File
@@ -14,7 +14,7 @@ The implementation is split into focused modules (files) under the `src/MarcerGa
- MarcerGameDvdLauncher/NavigationController.cs: Encapsulates selection, scrolling and relative-path navigation logic (cursor, page up/down, per-directory remembered selection/state); uses named scroll-fraction constants. - MarcerGameDvdLauncher/NavigationController.cs: Encapsulates selection, scrolling and relative-path navigation logic (cursor, page up/down, per-directory remembered selection/state); uses named scroll-fraction constants.
- MarcerGameDvdLauncher/MenuRenderer.cs: Console rendering logic — efficient per-line redraw, double-buffering, configurable color selection via injected `AppColorConfig`, and the help box overlay. - MarcerGameDvdLauncher/MenuRenderer.cs: Console rendering logic — efficient per-line redraw, double-buffering, configurable color selection via injected `AppColorConfig`, and the help box overlay.
- MarcerGameDvdLauncher/InputController.cs: Handles key events (arrow keys, Enter, Backspace, PageUp/Down, `*`, `?`, ESC) and the associated navigation/drawing logic; owns `ReloadGameEntries` and the virtual `Favorites` folder integration. - MarcerGameDvdLauncher/InputController.cs: Handles key events (arrow keys, Enter, Backspace, PageUp/Down, `*`, `?`, ESC) and the associated navigation/drawing logic; owns `ReloadGameEntries` and the virtual `Favorites` folder integration.
- MarcerGameDvdLauncher/HatariLauncher.cs: Responsible for validating the Hatari executable and starting Hatari with the configured argument template (replaces `{cfg}` and `{zip}`). - MarcerGameDvdLauncher/HatariLauncher.cs: Responsible for validating the Hatari executable and starting Hatari with the configured argument template (replaces `{cfg}` and `{zip}`). Exposes `DefaultConfigFile` constant (`MarcerGameDvd-Hatari.cfg`); when `Hatari.ConfigFile` is empty in `launcher.config.json`, the bundled config from the executable directory is used automatically.
- MarcerGameDvdLauncher/FavoritesService.cs: Manages the favorites/bookmark system — toggling favorites on ZIPs, persisting them to `favorites.txt` (via `DefaultFileName` constant), and providing the virtual `Favorites` folder view (via `FavoritesRootName` constant). - MarcerGameDvdLauncher/FavoritesService.cs: Manages the favorites/bookmark system — toggling favorites on ZIPs, persisting them to `favorites.txt` (via `DefaultFileName` constant), and providing the virtual `Favorites` folder view (via `FavoritesRootName` constant).
- MarcerGameDvdLauncher/UIErrorService.cs: Centralized UI error presentation using the console message helper. - MarcerGameDvdLauncher/UIErrorService.cs: Centralized UI error presentation using the console message helper.
+3 -5
View File
@@ -46,9 +46,7 @@ Download the ZIP for your platform from the [Releases](https://github.com/anomal
### 💻 System Requirements ### 💻 System Requirements
- **.NET Runtime 10** or later ([download](https://dotnet.microsoft.com/download/dotnet/10.0)) - **.NET Runtime 10** or later ([download](https://dotnet.microsoft.com/download/dotnet/10.0))
- **Hatari Emulator** with a working configuration file - **Hatari Emulator** (Windows native, or Linux/macOS via Wine or native build) — a Hatari configuration file (`MarcerGameDvd-Hatari.cfg`) is bundled with the launcher and used automatically when `Hatari.ConfigFile` is empty.
- Windows: native Hatari
- Linux / macOS: Hatari via Wine or native build
### ⚡ Quick Start ### ⚡ Quick Start
@@ -71,7 +69,7 @@ The launcher reads `launcher.config.json` from the same directory as the executa
"PatchDirectory": "C:\\Games\\Hatari\\PATCH", "PatchDirectory": "C:\\Games\\Hatari\\PATCH",
"Hatari": { "Hatari": {
"Executable": "C:\\Tools\\hatari\\hatari.exe", "Executable": "C:\\Tools\\hatari\\hatari.exe",
"ConfigFile": "C:\\Tools\\hatari\\hatari-st.cfg", "ConfigFile": "",
"ArgsTemplate": "-c \"{cfg}\" --disk-a \"{zip}\"" "ArgsTemplate": "-c \"{cfg}\" --disk-a \"{zip}\""
}, },
"Colors": { "Colors": {
@@ -93,7 +91,7 @@ The launcher reads `launcher.config.json` from the same directory as the executa
| `RootDirectory` | ✅ | Game root folder. Navigation never leaves this directory. | | `RootDirectory` | ✅ | Game root folder. Navigation never leaves this directory. |
| `PatchDirectory` | ❌ | Optional overlay/patch directory merged at runtime. | | `PatchDirectory` | ❌ | Optional overlay/patch directory merged at runtime. |
| `Hatari.Executable` | ✅ | Path to the Hatari executable. Validated at startup. | | `Hatari.Executable` | ✅ | Path to the Hatari executable. Validated at startup. |
| `Hatari.ConfigFile` | | Path to the Hatari configuration file. | | `Hatari.ConfigFile` | | Path to a Hatari configuration file. If empty, the bundled `MarcerGameDvd-Hatari.cfg` (shipped with the launcher) is used automatically. |
| `Hatari.ArgsTemplate` | ✅ | Argument template. Must contain `{zip}`, optionally `{cfg}`. | | `Hatari.ArgsTemplate` | ✅ | Argument template. Must contain `{zip}`, optionally `{cfg}`. |
| `Colors` | ❌ | Optional color overrides. See [Color Scheme](#-color-scheme) below. Missing or invalid values fall back to defaults. | | `Colors` | ❌ | Optional color overrides. See [Color Scheme](#-color-scheme) below. Missing or invalid values fall back to defaults. |
@@ -5,6 +5,11 @@ namespace MarcerGameDvdLauncher
{ {
public class HatariLauncher 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 _exePath;
private readonly string _cfgPath; private readonly string _cfgPath;
private readonly string _argsTemplate; private readonly string _argsTemplate;
+9 -2
View File
@@ -63,8 +63,15 @@ 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}");
// Also validate the Hatari config file (if provided) // If no Hatari config file was specified, fall back to the bundled
if (!string.IsNullOrWhiteSpace(cfg.Hatari.ConfigFile) && !File.Exists(cfg.Hatari.ConfigFile)) // 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}"); throw new InvalidOperationException($"Hatari configuration file not found: {cfg.Hatari.ConfigFile}");
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.");
@@ -3,7 +3,7 @@
"PatchDirectory": "C:\\Games\\Hatari\\PATCH", "PatchDirectory": "C:\\Games\\Hatari\\PATCH",
"Hatari": { "Hatari": {
"Executable": "C:\\Tools\\hatari\\hatari.exe", "Executable": "C:\\Tools\\hatari\\hatari.exe",
"ConfigFile": "C:\\Tools\\hatari\\hatari-st.cfg", "ConfigFile": "",
"ArgsTemplate": "-c \"{cfg}\" --disk-a \"{zip}\"" "ArgsTemplate": "-c \"{cfg}\" --disk-a \"{zip}\""
}, },
"Colors": { "Colors": {