Skip to content

feature: run palia on wine 11 with d3dmetal from gptk - #6

Merged
mgruszkiewicz merged 3 commits into
mainfrom
feature/wine11-engine
Nov 23, 2026
Merged

mgruszkiewicz merged 3 commits into
mainfrom
feature/wine11-engine

Conversation

@mgruszkiewicz

Copy link
Copy Markdown
Owner

Moves Palium from GPTK's Wine 7.7 to Sikarugir's Wine 11.0 engine, keeping Apple's D3DMetal from the user's own Game Porting Toolkit install. Existing installs are moved over on update, with no game download.

Why

Palia's update to Unreal Engine 5.7.4 broke the game on GPTK's Wine 7.7: it crashes about 50 seconds after start, every time, at the same instruction in libcef.dll (0x80000003). The crash is the same with the old and the new launch settings, so it comes from the game update, not from Palium. On the Wine 11 engine with the same D3DMetal 3.0, the game starts, logs in and plays.

What changes

  • Wine engine (WineEngine): downloads the engine (167 MB), checks a pinned SHA-256 and unpacks it through a .partial folder that is renamed into place only when complete.
  • D3DMetal (D3DMetal): finds GPTK and builds a folder of links to only D3DMetal's modules, prepended to Wine's module path. GPTK's lib/wine holds all of Wine 7.7; prepending that whole folder breaks Wine 11 (could not load kernel32.dll).
  • Migration (PrefixMigration): moves the game folder (AppData/Local/Palia, with Client and Saved) from the old prefix into prefix-w11 with one rename. A journal in UserDefaults records the move, so a force-quit at any point resolves on the next start. It refuses while Palia runs, never merges two installs and keeps the old prefix. After a move, file sizes are checked against the manifest and only differing files are repaired.
  • Prefix and environment: new prefixes map Command to Ctrl (so Cmd+V pastes in game). Every Wine process gets the same environment (msync, engine and D3DMetal variables), so its sync setting matches the running wineserver.
  • One engine: Whisky support and the Wine source picker are removed. GPTK is still required, but only for D3DMetal.
  • Renderer setting: DirectX 11 (default) or DirectX 12. Settings now decode with defaults for missing keys, so adding a setting no longer resets saved ones.
  • Troubleshooting: engine, D3DMetal and link checks. VC++ rows cover the DLLs the game imports and show whether each is Microsoft's or Wine's copy. Adds a button to remove the old prefix, and asks before deleting the prefix (which deletes the game).
  • Fixes found while testing:
    • Installers now go to C:\palium-downloads. Wine 11 links the Windows user's Downloads to the Mac's ~/Downloads.
    • The app skips its startup when it runs as the unit-test host. Before this, a test run started the real setup and could have moved the user's game.
  • scripts/palia_perf.py: summarises the frame-time telemetry Palia writes to its own log, for comparing setups.
  • docs/WINE11_MIGRATION.md: the plan, edge cases and remaining steps.

Testing

  • Unit tests pass. New ones cover:

    • the migration: move without copying (same inode), nothing to migrate, refusing while the game runs, a game in both prefixes, a folder without a game set aside, resuming before and after the rename;
    • engine install and the checksum marker;
    • the D3DMetal link folder;
    • the launch environment.
  • Real migration on an M3 Pro, macOS 27.2.1: an existing 22 GB install moved into the new prefix in about a second. No game files were downloaded, and the game launched from Palium.

  • Frame-time telemetry, village, 60 FPS cap:

    Wine 11, DX11, 1st session Wine 11, DX11, 2nd session Wine 11, DX12
    Typical worst frame per minute 285 ms 143 ms 125 ms
    Typical worst render-thread frame per minute 257 ms 95 ms 10 ms
    Minutes with a frame over 250 ms 88% 20% 14%

    The first session started with an empty shader cache, since the update replaced every shader. DX12 loads slower (148 s to gameplay against 88 s) but nearly removes graphics-side stutter, so it's worth considering as the default after more sessions.

  • Also checked: the intro video plays; it's skipped with Delete, which is Fn+Backspace on a Mac.

Not in this PR

  • A copy of the engine in a Palium release as the first download source. Today it downloads from Sikarugir's GitHub release, checked by SHA-256.
  • README and release notes (GPTK is needed only for D3DMetal; Whisky is gone).
  • An update test through Sparkle, from the current release to this build.

Palia's update to Unreal Engine 5.7.4 crashes about 50 seconds after start
in libcef.dll on GPTK's Wine 7.7, with any launch settings. It runs on
Sikarugir's Wine 11.0 engine with the D3DMetal from the user's GPTK install.

- WineEngine: download the Wine 11 engine, check its pinned SHA-256 and
  unpack it through a .partial folder.
- D3DMetal: find GPTK and link only D3DMetal's modules into a folder that is
  prepended to Wine's module path (GPTK's lib/wine holds all of Wine 7.7).
- PrefixMigration: move an existing game from the old prefix into the new
  prefix-w11 with one rename, recorded in a journal so an interrupted move
  resolves on the next start; the old prefix is kept. After a move, check file
  sizes against the manifest and repair only what differs.
- New prefixes map Command to Ctrl; every Wine process shares one environment
  (msync, engine and D3DMetal variables).
- Remove Whisky support and the Wine source picker.
- Add a DirectX 11/12 renderer setting (DirectX 11 default); settings decode
  with defaults for keys older versions lack.
- Troubleshooting: engine, D3DMetal and link checks; VC++ rows for the DLLs the
  game imports, showing Microsoft's or Wine's copy; remove the old prefix;
  confirm before deleting the prefix.
- Installers go to C:\palium-downloads, not the Windows user's Downloads,
  which Wine 11 links to the Mac's ~/Downloads.
- Skip startup when running as the unit-test host.
- scripts/palia_perf.py summarises the game's own frame-time telemetry.
- docs/WINE11_MIGRATION.md: the plan and its remaining steps.
- Setup failures name their real cause. Each stage of prepare wraps its errors
  (D3DMetal links, engine install, prefix, migration), and any other error shows
  as "Setup failed" instead of "Game Porting Toolkit not found".
- An incomplete prefix-w11 (e.g. a partly finished delete) no longer blocks
  every start: it is moved aside to prefix-w11.stale-<time>, never deleted, and
  the migration looks for a game there too.
- The size check after a move is recorded in the migration journal, so a start
  that fails after the move (offline, say) can't skip it. It is cleared only by
  a passed check, a repair, an update download or Verify & Repair. With no stored
  version, mismatched files are repaired instead of the install being marked
  ready, and "all files present" is logged only when it's true.
- Engine extraction can't hang: tar's messages go to a file instead of an
  unread pipe, and the wait no longer blocks a thread.
- Removing the old GPTK prefix runs off the main thread and stops its
  wineserver first. The button shows only when the old prefix holds no game, and
  refusing gives its own message.
- The VC++ install recognises Wine's own DLLs and tries the extraction fallback
  for them. The installed check still accepts them, since Palia runs on them.
- Status and log lines from setup are awaited on the main actor, so they arrive
  in order.
- palia_perf.py --by-map no longer crashes on a map without values.
A manually run workflow (engine-mirror.yml) downloads an engine archive on
GitHub's runner, refuses it unless the SHA-256 matches, attests it, and
publishes it as the release engine-<name>, with notes linking the LGPL sources.
The tag doesn't start with "v", so the app release doesn't run, and the release
is never marked Latest, so releases/latest still points at the app. Existing
engine releases are never replaced.

Palium tries this copy first and Sikarugir's release second; both are checked
against the pinned SHA-256. Until the first engine release is published, the
first URL returns 404 and the download falls back to the original.
@mgruszkiewicz
mgruszkiewicz merged commit d57b883 into main Nov 23, 2026
2 checks passed
@mgruszkiewicz
mgruszkiewicz deleted the feature/wine11-engine branch November 23, 2026 18:12
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