Skip to content

fix: resolve xdelta3 via bundled assets and make version dynamic (#176) - #182

Merged
ClausValcaTD merged 2 commits into
mainfrom
fix/xdelta3-resolution-and-dynamic-version
Oct 31, 2026
Merged

ClausValcaTD merged 2 commits into
mainfrom
fix/xdelta3-resolution-and-dynamic-version

Conversation

@ClausValcaTD

Copy link
Copy Markdown
Contributor

Summary

Fixes two problems reported in #176: xdelta patching fails on Windows, and the app's info/About tab shows 3.0.0 instead of the real version.

Closes #176.

Root cause

1. xdelta3 was never found. AppConfig.xdelta3Path (gui/lib/utils/config.dart) hard-coded a path next to the main executable (<exeDir>/xdelta3.exe) and ignored the bundled assets/ folder. In a real install, xdelta3.exe ships under assets/windows/…, so every xdelta patch failed with "xdelta3 binary not found".

2. The version was hard-coded. core/bin/openrom.dart (--version) fell back to a literal 'v3.0.0', and the About screen reads that via CoreBridge.getVersion() — hence "3.0.0".

Changes

xdelta3 resolution

File Change
gui/lib/utils/config.dart AppConfig.getToolPath now delegates to the core's core.getToolPath(), i.e. the standard chain: config.json override → bundled assets/<os>[/<arch>]/<tool> → OS PATH
core/lib/src/config.dart getDefaultBundledPath now also probes assets/windows/x86_64/<tool>.exe before assets/windows/<tool>.exe (matching the macOS/Linux behaviour)
gui/lib/patcher/xdelta_patcher.dart, xdelta_builder.dart existence preflight only rejects absolute paths, so a bare tool name resolved via the OS PATH is no longer falsely reported missing

Dynamic version

File Change
core/bin/openrom.dart --version uses readAppVersion() instead of the hard-coded 'v3.0.0' fallback → fixes CoreBridge.getVersion() and the About screen
core/lib/src/version_reader.dart also honours --dart-define=APP_VERSION (priority: define → VERSION next to exe → VERSION in CWD → unknown)
.github/workflows/Release.yml, flatpak/io.github.M5Devs.OpenROM.yml bundle the VERSION file next to the core (and GUI) binaries so readAppVersion() finds it at runtime

Docs

  • docs/DEVELOPER_ONBOARDING.md — architecture, IPC bridge, conversion pipeline, tool resolution, state management, and CI/CD packaging lifecycle.

Behaviour

# before
xdelta3 → <exeDir>/xdelta3.exe   (missing in packaged installs → patch fails)
--version → OpenROM v3.0.0        (hard-coded fallback)

# after
xdelta3 → assets/windows/x86_64/xdelta3.exe  (then assets/windows/, then PATH)
--version → OpenROM v<real version from bundled VERSION file>

Testing

  • ⚠️ Not run in this environment — no Dart/Flutter toolchain is available here, so flutter analyze / dart test were not executed. Changes were verified by inspection and are type-safe (removed the now-unused dart:io import; added the path import where needed).
  • Suggested verification: flutter analyze + flutter test in gui/, dart analyze + dart test in core/ (the quality.yml gate), and a manual xdelta patch on a Windows build.

This PR was created by an AI agent (OpenHands) on behalf of the user.

Comprehensive onboarding report covering the two-layer architecture (Flutter
gui/ + pure-Dart core/), the JSON-lines IPC bridge (CoreBridge <-> openrom-core),
the full conversion pipeline (GUI pick -> CLI -> external binary -> progress
parsing -> completion), third-party tool resolution and fallback paths per
platform, Flutter state management and screen map, and the CI/CD packaging
lifecycle (Windows ZIP/NSIS, Linux AppImage/ZIP + ARM64, macOS DMG, Android APK,
Flatpak).

Co-authored-by: openhands <openhands@all-hands.dev>
…amic (#176)

Issue #176 reported two problems on Windows: xdelta patching failed, and the
About screen showed "3.0.0" instead of the real version.

xdelta3 resolution:
- gui/lib/utils/config.dart: AppConfig.getToolPath now delegates to the core's
  core.getToolPath(), which searches config.json override -> bundled
  assets/<os>[/<arch>]/<tool> -> OS PATH, instead of only looking next to the
  main executable. Fixes xdelta3 (and any bundled tool) not being found when it
  ships in the release assets/ folder.
- core/lib/src/config.dart: getDefaultBundledPath also probes the arch subfolder
  on Windows (assets/windows/x86_64/<tool>.exe) before the flat
  assets/windows/<tool>.exe, matching macOS/Linux.
- gui/lib/patcher/xdelta_patcher.dart, xdelta_builder.dart: only fail the
  existence preflight for absolute paths, so a bare-name tool resolved via the
  OS PATH is not falsely reported missing.

Dynamic version:
- core/bin/openrom.dart: --version uses readAppVersion() instead of a hardcoded
  'v3.0.0' fallback, so CoreBridge.getVersion() and the About screen report the
  real version.
- core/lib/src/version_reader.dart: also honours --dart-define=APP_VERSION.
- Release.yml + flatpak manifest: bundle the VERSION file next to the core (and
  GUI) binaries so readAppVersion() finds it at runtime.

Co-authored-by: openhands <openhands@all-hands.dev>
@ClausValcaTD
ClausValcaTD merged commit 26c84e0 into main Oct 31, 2026
1 check failed
@ClausValcaTD
ClausValcaTD deleted the fix/xdelta3-resolution-and-dynamic-version branch October 31, 2026 16:08
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.

Error Patching xdelta

2 participants