Skip to content

Launch Workdir Fix and some detailed improvements - #711

Open
kingokksa wants to merge 10 commits into
WinNative-Emu:mainfrom
kingokksa:feature/launch-workdir
Open

Launch Workdir Fix and some detailed improvements#711
kingokksa wants to merge 10 commits into
WinNative-Emu:mainfrom
kingokksa:feature/launch-workdir

Conversation

@kingokksa

Copy link
Copy Markdown
Contributor

fix(launch): set guest working dir via Wine-mapped host path
chore: remove on-screen locale/codepage manifest warning prompt
fix(pip): guard enterPictureInPictureMode against exceptions
fix: guard renderDrawerMenu against uninitialized gestureProfileManager

Some games (Unity, e.g. MiSide) read language packs relative to the current
working directory, so launching from the imagefs root misses them. The
working dir is now resolved through the container-aware WineUtils.getNativePath
(C: -> the container's drive_c, custom games via hostPathToRootWinePath)
instead of the raw host game path, which is not under any Wine drive and
makes wine fall back to the Windows directory.
The WinToast shown when the locale manifest is silently ignored is not
needed; comment it out while keeping the warning drained.
The first renderDrawerMenu() call in onCreate happens before
gestureProfileManager is created, throwing a caught-but-noisy NPE stack
trace on every early render. Skip the gesture section when it is null;
it populates on the next render once the manager exists.
enterPictureInPictureMode(new Builder().build()) can throw — no aspect
ratio on API 26-30, stricter OEM builds, or a non-resumable window. PiP
itself needs no runtime permission (the system PiP allowance just makes it
return false), so the only crash vector was the unguarded call. Set an
explicit aspect ratio and wrap in try/catch so the button can never crash
the session.
@kingokksa
kingokksaforce-pushed the feature/launch-workdir branch from b0fffb2 to db23a0fCompareAugust 30, 2026 02:56
@maxjivi05

Copy link
Copy Markdown
Contributor

Thanks for these. The working-directory fix is the valuable part here — passing this.container into getNativePath is a real bug fix, since the 2-arg overload resolves against <imageFs>/home/xuser instead of the container's own home/xuser-<id>. Good catch.

A few things before this can go in:

1. Please delete the locale-warning code rather than commenting it out. Right now the three // lines stay in the file, and that leaves pendingLocaleManifestWarning with three .set() calls and zero reads, an AtomicReference import that exists only for it, and 69 translation strings across 23 locales that can never be shown. If the toast shouldn't appear, please remove the field, the three .set() calls, the import, and the strings — the existing Log.w lines already cover it. That turns this into a net deletion.

2. The PiP comment describes handling that isn't there. It says the per-app allowance "returns false (not an exception)", but the return value of enterPictureInPictureMode is never checked. Either check it or drop that sentence. Five lines is also more than this needs — one line about OEM builds throwing would do.

3. setAspectRatio can now throw where the old call couldn't. PiP requires a ratio between 1:2.39 and 2.39:1. On an unusually wide display the new params would throw and your catch would swallow it, so PiP silently stops working where it previously succeeded. A clamp would cost one line.

4. The working-dir change has no comment at all, and it's the subtlest change in the PR. One line explaining why you convert host → Wine → host (to re-resolve through the container's dosdevices symlinks) would help a lot.

Could you also post a short screen recording of the launch fix working? Specifically a custom game whose folder resolves correctly, and one where it doesn't, so we can see the new isDirectory() fallback. I could verify this compiles cleanly but I can't reproduce a live Wine session to test the launch path, so I'd rather see it than assume.

Last thing: this is four unrelated changes in one PR again (launch dir, a revert, a PiP guard, a drawer guard). Please split them next time — the workdir fix is the only one with real risk and it deserves to be reviewable on its own.

kingokksaand others added 6 commits September 2, 2026 19:07
Remove the on-screen locale manifest warning plumbing entirely: the
pendingLocaleManifestWarning field, its AtomicReference import, the
three .set() call sites, and the 69 strings across 23 locales. The
existing ContainerLaunch Log.w lines already cover this, so this is a
net deletion.
PiP requires an aspect ratio between 1:2.39 and 2.39:1. On an unusually
wide display the raw window ratio could exceed the bound and make
setAspectRatio throw, silently disabling PiP via the catch. Clamp the
ratio to the valid range and trim the comment to one line about OEM
builds throwing.
Explain why the custom-game working dir is converted host -> Wine ->
host: re-resolving through the container's dosdevices symlinks lands on
the container's own home/xuser-<id> that the guest actually sees, not
the generic <imageFs>/home/xuser the 2-arg overload would resolve to.
The custom_game_folder/game_install_path extra can be stale after the game
folder is moved or re-mounted (e.g. copied into a shared folder). Only trust
it when the directory actually contains the exe being launched; otherwise
re-derive the working dir from the resolved WIN exe path, which is always
the directory the game really runs from. Elevate the resulting working-dir
log to W so it survives the app log export filter for diagnostics.
The custom_game_folder/game_install_path extra can be stale after the game
folder is moved or re-mounted (e.g. copied into a shared folder). Only trust
it when the directory actually contains the exe being launched; otherwise
re-derive the working dir from the resolved WIN exe path, which is always
the directory the game really runs from.
@kingokksa

Copy link
Copy Markdown
ContributorAuthor

The video has already been posted on Discord, and the issues described have basically been resolved

Sign up for freeto 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.

2 participants

@kingokksa@maxjivi05