Skip to content

Add persistent directory overrides, Windows engine locality, and Games/Doom defaults - #53

Merged
lock14 merged 1 commit into
mainfrom
feature/windows-defaults-and-directory-overrides
Sep 6, 2026
Merged

lock14 merged 1 commit into
mainfrom
feature/windows-defaults-and-directory-overrides

Conversation

@lock14

@lock14 lock14 commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Description

This pull request introduces persistent directory overrides, resolves Windows engine configuration locality and companion asset extraction, standardizes Windows defaults to %USERPROFILE%\Games\Doom\, and performs a code refactoring pass for path and configuration handling:

  1. Windows Engine Configuration Locality & Working Directory:

    • On Windows, portable source ports (DSDA-Doom, UZDoom) resolve configurations relative to their program directory ($PROGDIR / BinDir), not %LOCALAPPDATA%. Deploys dsda-doom.cfg and autoexec.cfg directly to BinDir.
    • Sets cmd.Dir = filepath.Dir(plan.EngineBin) in engine/runner.go so executed portable engines read local assets and configurations correctly.
  2. Zip Slip Hardened Extraction & Companion File Discovery:

    • Fixed extractZipBinary in engine/installer.go where uzdoom.sf2 matched uzdoom.exe due to prefix matching.
    • Added exact binary matching and companion file extraction (.wad, .pk3, .dll, .sf2, .wopl, .wopn) preserving directory structure.
  3. Persistent Asset Directory Hierarchy:

    • Added persistent configuration (config.json) and CLI flags for --wads-dir, --bin-dir, and --soundfonts-dir.
    • Updated doom config get, set, and show to manage all three asset locations with support for short and long environment variable fallbacks (DOOM_* and short forms).
  4. Standardized Windows Default Layout:

    • Removed dynamic drive switching heuristic in favor of a deterministic, visible, OneDrive-immune layout:
      %USERPROFILE%\Games\Doom\
      ├── bin\           <-- uzdoom.exe, dsda-doom.exe, autoexec.cfg, dsda-doom.cfg
      ├── wads\          <-- IWADs, PWADs, and DeHackEd patches
      └── soundfonts\    <-- GeneralUser-GS.sf2
      
  5. Refactoring & Hygiene:

    • Encapsulated path mutations with paths.SetBinDir() and paths.SetSoundFontsDir() in internal/config.
    • Canonicalized configuration key parsing with canonicalConfigKey() in cmd/doom/config.go.
    • Streamlined flag extraction in cmd/doom/play.go using strings.Cut(arg, "=") against known flag maps.
    • Cleaned up companion file extension checks in internal/engine/installer.go.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New preset (new community megawad or engine preset in data/presets.json)
  • 🚀 New feature (CLI command, engine integration, or asset discovery enhancement)
  • 💥 Breaking change (fix or feature that would alter command line flags or existing config paths)
  • 🎨 Engine config optimization (tweaks to dsda-doom.cfg or autoexec.cfg)
  • 📝 Documentation update (README.md, CONTRIBUTING.md, AGENTS.md)
  • 🔧 Tooling / CI / Build configuration

Repository Design & Architecture Checklist

  • Declarative Presets: Presets are modified only in data/presets.json; generated files were compiled via doom presets build.
  • Portability & Path Invariants: Zero hardcoded usernames or personal paths committed; __HOME__, __RESOLUTION__, __REFRESH_RATE__, and __SOUNDFONT__ placeholders used where appropriate.
  • Destructive Safety: Configuration deployment includes timestamped backups (.bak.<timestamp>).
  • Strict Line Length: Code complies with the 120-character maximum line length limit.
  • Engine Selection: Engine choices, complevels, and DeHackEd load orders are properly configured.

Verification & Testing

  • Ran make format-check (or gofmt -s -w .).
  • Ran make tidy-check (go.mod and go.sum verified).
  • Ran make lint (go vet and revive pass with zero warnings).
  • Ran make check (all unit tests pass with -race and -shuffle=on, preset parity, path invariant audit).
  • Documentation (README.md, CONTRIBUTING.md, AGENTS.md) is updated and synchronized.

…s/Doom defaults

Fix Windows source port config locality by deploying autoexec.cfg and dsda-doom.cfg directly to BinDir and setting engine process working directory to binary parent folder.

Fix archive extraction matching in extractZipBinary to prevent uzdoom.sf2 from matching uzdoom.exe and recursively extract companion files.

Add persistent configuration and CLI flags for wads-dir, bin-dir, and soundfonts-dir in config.json and CLI hierarchy.

Migrate Windows default paths from dynamic drive root guessing to %USERPROFILE%\Games\Doom\ (bin, wads, soundfonts).

Refactor path mutators on config.Paths, canonicalize config keys in config.go, and streamline flag extraction in play.go.

Update documentation in README.md and encode architecture principles in AGENTS.md.
@lock14
lock14 merged commit 98f98a9 into main Sep 6, 2026
10 checks passed
@lock14
lock14 deleted the feature/windows-defaults-and-directory-overrides branch September 6, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant