feat: Enhance CLI and GUI to support configurable game data directory persistence

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-23 19:19:50 +01:00
parent 5ef59d9980
commit 569a3386a8
14 changed files with 402 additions and 66 deletions
@@ -1,15 +1,42 @@
library;
import 'package:flutter/material.dart';
import 'package:wolf_3d_dart/wolf_3d_data_types.dart';
import 'package:wolf_3d_dart/wolf_3d_menu.dart';
/// Fallback screen shown when no Wolf3D game data files are discovered.
class NoGameDataScreen extends StatelessWidget {
const NoGameDataScreen({super.key});
const NoGameDataScreen({
super.key,
this.configuredDataDirectory,
});
/// Previously configured external game-data directory, if any.
final String? configuredDataDirectory;
static Color _colorFromVgaIndex(int index) {
final int packed = ColorPalette.vga32Bit[index]; // 0xAABBGGRR
final int r = packed & 0xFF;
final int g = (packed >> 8) & 0xFF;
final int b = (packed >> 16) & 0xFF;
return Color((0xFF << 24) | (r << 16) | (g << 8) | b);
}
static final Color _backgroundColor = _colorFromVgaIndex(111);
static final Color _panelColor = _colorFromVgaIndex(103);
static final Color _borderColor = _colorFromVgaIndex(87);
static final Color _titleColor = _colorFromVgaIndex(
WolfMenuPalette.headerTextIndex,
);
static final Color _bodyColor = _colorFromVgaIndex(
WolfMenuPalette.unselectedTextIndex,
);
static final Color _emphasisColor = _colorFromVgaIndex(10);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF140000),
backgroundColor: _backgroundColor,
body: Center(
child: Padding(
padding: const EdgeInsets.all(24),
@@ -17,10 +44,10 @@ class NoGameDataScreen extends StatelessWidget {
constraints: const BoxConstraints(maxWidth: 640),
child: DecoratedBox(
decoration: BoxDecoration(
color: const Color(0xFF590002),
border: Border.all(color: const Color(0xFFB00000), width: 2),
color: _panelColor,
border: Border.all(color: _borderColor, width: 2),
),
child: const Padding(
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -29,25 +56,44 @@ class NoGameDataScreen extends StatelessWidget {
Text(
'WOLF3D DATA NOT FOUND',
style: TextStyle(
color: Color(0xFFFFF700),
color: _titleColor,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
Text(
'No game files were discovered.\n\n'
'Add Wolfenstein 3D data files to one of these locations:\n'
'- packages/wolf_3d_assets/assets/retail\n'
'- packages/wolf_3d_assets/assets/shareware\n'
'- or a discoverable local game-data folder.\n\n'
'Restart the app after adding the files.',
'Select a game-data directory in setup.',
style: TextStyle(
color: Colors.white,
color: _bodyColor,
fontSize: 15,
height: 1.4,
),
),
const SizedBox(height: 12),
Text(
'Once all required files are present, the game starts automatically.',
style: TextStyle(
color: _emphasisColor,
fontSize: 14,
height: 1.35,
fontWeight: FontWeight.w600,
),
),
if (configuredDataDirectory != null &&
configuredDataDirectory!.trim().isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 12),
child: Text(
'Configured data directory: ${configuredDataDirectory!.trim()}',
style: TextStyle(
color: _bodyColor,
fontSize: 13,
height: 1.3,
),
),
),
],
),
),