macOS: save data, caches and logs are written inside KytyPS5.app (replacing the app deletes saves) #2491

Open
opened 2026-11-26 10:21:16 +00:00 by github-bot · 0 comments
Owner

@⁠Fr0gzilla on GitHub · 2026-11-21 14:32 UTC · original

Summary

On macOS, the launcher starts kyty_emulator with the working directory set to the directory of the emulator binary (src/launcher/src/mainDialog.cpp:453):

process->setWorkingDirectory(QFileInfo(interpreter).absolutePath());

In the macOS build, the emulator lives inside the bundle (KytyPS5.app/Contents/MacOS/kyty_emulator), so the working directory is KytyPS5.app/Contents/MacOS. All emulator data uses paths relative to the working directory:

  • _SaveData (src/libs/libSaveData.cpp:30), the game saves
  • _PipelineCache (src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp:189, :434)
  • _TempData and _DownloadData (src/emulator.cpp:86-88)
  • the log, _kyty.txt (src/common/emulatorConfig.h:90)

So on macOS all of this ends up inside the application bundle. On Windows and Linux the same design puts the data next to the executable in the install folder, which is fine. On macOS the bundle is meant to be replaced as a whole.

Consequences

  • Saves are lost when the app is replaced. The usual way to update a Mac app is to replace KytyPS5.app with the new one (drag and drop into Applications, or delete and unzip the new release). That deletes Contents/MacOS/_SaveData along with the old bundle. The built-in updater replaces files one by one, so it keeps them, but a manual update doesn't.
  • Nothing can be written if the user can't write to the bundle, for example when KytyPS5.app sits in /Applications on a standard (non-admin) account.
  • The bundle's code signature seal is broken as soon as these folders are created, because new files appear inside Contents/MacOS after signing.

How I checked

I don't have a PS5 game, so I couldn't reach the save data code itself. I ran kyty_emulator from an empty directory, the way the launcher would but with that directory as working directory:

kyty_emulator --game <empty folder> --printf-direction File --printf-output-file _kyty.txt

_kyty.txt was created in that directory (the run then stopped at Vulkan device selection, #1068, before any game data). Combined with the setWorkingDirectory call above, the launcher would create it in KytyPS5.app/Contents/MacOS, and the save, cache and temp folders follow the same relative-path rule.

Possible fix

On macOS, use a per-user data directory as the working directory instead of the bundle, for example ~/Library/Application Support/KytyPS5 (QStandardPaths::AppDataLocation), created on first launch. Existing data found in Contents/MacOS could be moved there once. I'm happy to work on a PR if you agree with the approach, or to follow a different layout if you prefer.

Environment

  • KytyPS5 source build at 39936ff (main, 2026-11-21), Release, x86_64 under Rosetta 2
  • macOS 26.6 (25G72), Apple M5

AI disclosure: I used an AI assistant to audit the macOS code paths and write this report. I ran the working-directory check myself on my Mac.

**@⁠Fr0gzilla** on GitHub · 2026-11-21 14:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/2491) ## Summary On macOS, the launcher starts `kyty_emulator` with the working directory set to the directory of the emulator binary (`src/launcher/src/mainDialog.cpp:453`): ```cpp process->setWorkingDirectory(QFileInfo(interpreter).absolutePath()); ``` In the macOS build, the emulator lives inside the bundle (`KytyPS5.app/Contents/MacOS/kyty_emulator`), so the working directory is `KytyPS5.app/Contents/MacOS`. All emulator data uses paths relative to the working directory: - `_SaveData` (`src/libs/libSaveData.cpp:30`), the game saves - `_PipelineCache` (`src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp:189`, `:434`) - `_TempData` and `_DownloadData` (`src/emulator.cpp:86-88`) - the log, `_kyty.txt` (`src/common/emulatorConfig.h:90`) So on macOS all of this ends up inside the application bundle. On Windows and Linux the same design puts the data next to the executable in the install folder, which is fine. On macOS the bundle is meant to be replaced as a whole. ## Consequences - **Saves are lost when the app is replaced.** The usual way to update a Mac app is to replace `KytyPS5.app` with the new one (drag and drop into Applications, or delete and unzip the new release). That deletes `Contents/MacOS/_SaveData` along with the old bundle. The built-in updater replaces files one by one, so it keeps them, but a manual update doesn't. - **Nothing can be written if the user can't write to the bundle**, for example when KytyPS5.app sits in `/Applications` on a standard (non-admin) account. - **The bundle's code signature seal is broken** as soon as these folders are created, because new files appear inside `Contents/MacOS` after signing. ## How I checked I don't have a PS5 game, so I couldn't reach the save data code itself. I ran `kyty_emulator` from an empty directory, the way the launcher would but with that directory as working directory: ``` kyty_emulator --game <empty folder> --printf-direction File --printf-output-file _kyty.txt ``` `_kyty.txt` was created in that directory (the run then stopped at Vulkan device selection, #1068, before any game data). Combined with the `setWorkingDirectory` call above, the launcher would create it in `KytyPS5.app/Contents/MacOS`, and the save, cache and temp folders follow the same relative-path rule. ## Possible fix On macOS, use a per-user data directory as the working directory instead of the bundle, for example `~/Library/Application Support/KytyPS5` (`QStandardPaths::AppDataLocation`), created on first launch. Existing data found in `Contents/MacOS` could be moved there once. I'm happy to work on a PR if you agree with the approach, or to follow a different layout if you prefer. ## Environment - KytyPS5 source build at 39936ff (main, 2026-11-21), Release, x86_64 under Rosetta 2 - macOS 26.6 (25G72), Apple M5 AI disclosure: I used an AI assistant to audit the macOS code paths and write this report. I ran the working-directory check myself on my Mac.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:21:17 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/KytyPS5--KytyPS5#2491
No description provided.