Repository navigation
fix(launcher): a game on an external drive waits for macOS's answer before the engine starts - #122
Merged
Merged
Conversation
…efore the engine starts A games folder on an external drive is a removable volume to macOS, and the game runs there as its own app (opened through NSWorkspace, unsigned), so its first reads of the drive bring up "would like to access files on a removable volume". Until now the launch script's first step was a cd into the drive and the engine started right after, so the game's own reads could meet the prompt on the first start. The launch script now reads the game's param.json first, before any cd into the drive, and tries again every 0.2 s for up to two minutes until the read gets through. The engine starts once the player has answered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Mac launcher, for a games folder on an external drive (refs #120).
The launcher opens a game's bundle through NSWorkspace (
AppModel.start), so macOS treats the game as its own app, and that bundle and its files are in the games folder's.AnyPS5store, on the drive itself (Installer.bundle(for:root:),Installer.dataFolder). The bundle is unsigned. So the game's first reads of the drive raise macOS's "would like to access files on a removable volume" prompt. The launcher has already been reading and writing the folder, so the launcher does not get the prompt. The game does, which is why the report lists the game in Files and Folders and not AnyPS5. Until now the launch script's first step was acdinto the drive, followed byexecof the engine. No step waited for the player's answer.With this change the launch script reads the game's
app0/sce_sys/param.jsonfirst, before anycdinto the drive. Every game the launcher lists has that file. If the read fails, the script tries again every 0.2 s for up to two minutes, then goes on as before. The engine starts once the read gets through, so the game's own reads come after the player has answered. A folder on the internal disk reads at once and starts as before. A copy unlocked by an older launcher picks up the new script when it is rebuilt, which an engine update does before the next start.Not done here: the prompt still comes back after every rebuild, and maybe on every start, because the bundle has no signature that macOS could tie the permission to. Relinked executables are not signed, so that stays as it is.
Tested
LaunchScriptTestsrun the generated script the way macOS starts a bundle (through its#!line). Aparam.jsonwithout read permission stands in for the read macOS holds back. The tests check that a readable game starts at once in its game folder, that the engine waits until the file becomes readable, that a read that never gets through still starts the game after the wait, and that the read comes before anycd. They run in CI.sh -non the generated head, plus one manual run of it with the file unreadable for one second.python3 tools/check_conventions.py --base origin/mainpassed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)