run the game from inside the prefix, so it can save a replay

`Run-time error '76': Path not found` on finishing a game. Error 76 is VB6's
"path not found", and the path it could not find was the game's own.

Confining the prefix removed `z:`, which left `C:` as the only drive — and the
executable was in the plugin checkout, which `C:` does not cover. So wine gave
the game `\\?\unix\home\pastilhas\...\Minesweeper X.exe` as its own location
(confirmed with `winepath`), VB6 file I/O cannot write to a path of that shape,
and the first thing that needs to is the auto-saved recording. Which happens at
the END of a game, so the failure arrived after somebody had played.

The comment in prefix.ts already claimed "the game keeps its own directory, its
settings and its replays". It did not. It does now: `installGame` copies the
68 KB executable into `C:\Minesweeper` on every start and the game runs from
there, with cwd set to match so relative writes stop landing in C:\windows.

Copied rather than symlinked — a symlink out of drive_c is a door out of the
prefix, which is the exact thing confinePrefix exists to close. The cost is
that replays now live inside prefix/, so deleting it to unwedge wine takes them
along; that is in the README rather than left to be discovered.

Verified end to end rather than by inspection: set Auto-Save Recording to All,
played a beginner game to a loss, and
`Beg 1.16 - Aug 23 2026 22.09.18 PM (Lost).mvr` appeared in C:\Minesweeper.
Before this, that same moment was the error box. The default is "High scores",
which is why an ordinary losing game never reproduced it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Officer-Session: de3ed4e6-f88a-429c-94e6-a760336ba83b
This commit is contained in:
2026-08-23 22:10:30 +00:00
co-authored by Claude Opus 5
parent 26c8dd3e1a
commit 105068170c
4 changed files with 68 additions and 12 deletions
+16 -1
View File
@@ -30,9 +30,24 @@ export const RUN_DIR = join(STATE_DIR, 'run');
/** x11vnc's listening socket. A path, not a port: unreachable without traversing RUN_DIR. */
export const VNC_SOCKET = join(RUN_DIR, 'vnc.sock');
/** Ships with the plugin. `import.meta.dir` is `<plugin>/sidecar`. */
/** Ships with the plugin. `import.meta.dir` is `<plugin>/sidecar`. This is the SOURCE, not what runs. */
export const GAME_EXE = join(import.meta.dir, '..', 'game', 'Minesweeper X.exe');
/**
* Where the game actually runs from, and where its settings and replays land.
*
* Inside the prefix, because once `confinePrefix` removes `z:` there is no drive letter for anywhere else
* on the machine. Launched from the plugin directory, the game's own path came back as
* `\\?\unix\home\…`, VB6 could not write beside its executable, and finishing a game raised
* `Run-time error '76': Path not found` as it tried to save the replay.
*
* The cost is that this is inside `prefix/`, so deleting the prefix — still the right fix for a wedged
* wine — now takes the replays with it. The alternative was a symlink out of `drive_c`, which is a door
* out of the prefix and exactly what the confinement exists to close.
*/
export const GAME_DIR = join(WINEPREFIX, 'drive_c', 'Minesweeper');
export const GAME_IN_PREFIX = join(GAME_DIR, 'Minesweeper X.exe');
export function ensureDirs(): void {
mkdirSync(STATE_DIR, { recursive: true, mode: 0o700 });
mkdirSync(RUN_DIR, { recursive: true, mode: 0o700 });