[PR #2868] [MERGED] libkernel: Various filesystem fixes #3041

Closed
opened 2026-02-27 22:02:13 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2868
Author: @StevenMiller123
Created: 5/1/2025
Status: Merged
Merged: 5/1/2025
Merged by: @georgemoralis

Base: mainHead: fs-fixes


📝 Commits (10+)

  • 83926f9 Proper handling of whence 3 & 4
  • 4118b5f Accurate directory handling in open
  • 9081778 Mount /app0 as read only
  • 7ab496b Proper directory flag handling.
  • 5f3da89 Check for read only directories
  • 384e036 Earlier ro check in posix_rmdir
  • ad089f0 Clear temp folder on boot
  • d17297c Merge branch 'shadps4-emu:main' into fs-fixes
  • 5a5a42c Clang
  • 32b34f9 Add missing DeleteHandle calls

📊 Changes

4 files changed (+131 additions, -83 deletions)

View changed files

📝 src/common/io_file.cpp (+1 -3)
📝 src/common/io_file.h (+0 -2)
📝 src/core/libraries/kernel/file_system.cpp (+121 -73)
📝 src/emulator.cpp (+9 -5)

📄 Description

This PR makes some filesystem changes to improve shadPS4's accuracy when compared against a PS4.

  • Improved open flag handling. There were many inaccuracies visible in my tests, which either led to files opening that shouldn't open, or throwing errors when a file would open successfully on real hardware.
  • Mount /app0 and /hostapp as read-only. Some games, particularly Unity games, will make modifications to their own game files if you don't handle this properly.
  • Clear /temp and /temp0 on boot. On real hardware, the console will freshly format a partition to mount to these paths. While emulating it that closely is unfeasible, clearing the temp directory will lead to a similar effect in practice.
  • Proper handling of whence extensions on lseek. It appears that Sony disabled these extensions on PS4s, and trying to use them throws a unique error code.
  • Remove read-only mode modification in posix_stat. The reduced permissions this reported before caused Bloodborne to disable audio entirely when /app0 is mounted as read only.

Below are the results of my hardware tests, which all of the open changes were based on.
Hardware tests:
image

This PR:
image

Main:
image

So far, these fixes appear to progress KINGDOM HEARTS Melody of Memory (CUSA18900) further in loading, though the game still loops the same loading screen endlessly. Beyond this, I've seen no regressions in my testing.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/2868 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 5/1/2025 **Status:** ✅ Merged **Merged:** 5/1/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `fs-fixes` --- ### 📝 Commits (10+) - [`83926f9`](https://github.com/shadps4-emu/shadPS4/commit/83926f90ebad869f41e605b6c0ba2bfe6a03a239) Proper handling of whence 3 & 4 - [`4118b5f`](https://github.com/shadps4-emu/shadPS4/commit/4118b5f87ff9b9e6b5b1792860d772e744ecb0b4) Accurate directory handling in open - [`9081778`](https://github.com/shadps4-emu/shadPS4/commit/9081778f9b221e2e20fa82ea321b51cd827ac841) Mount /app0 as read only - [`7ab496b`](https://github.com/shadps4-emu/shadPS4/commit/7ab496b435aa62b8decb9c911057960ba8a79f29) Proper directory flag handling. - [`5f3da89`](https://github.com/shadps4-emu/shadPS4/commit/5f3da890914bfeb4639990fe925ef30ed1817f76) Check for read only directories - [`384e036`](https://github.com/shadps4-emu/shadPS4/commit/384e036533ac36db9791e606ee5cf4641e193068) Earlier ro check in posix_rmdir - [`ad089f0`](https://github.com/shadps4-emu/shadPS4/commit/ad089f014ed70ccf0df2098ee269c31817ea22a0) Clear temp folder on boot - [`d17297c`](https://github.com/shadps4-emu/shadPS4/commit/d17297cea292495ca9a23001624e7a8283df4574) Merge branch 'shadps4-emu:main' into fs-fixes - [`5a5a42c`](https://github.com/shadps4-emu/shadPS4/commit/5a5a42c50353f858f2f6ae949ddd3043507eb640) Clang - [`32b34f9`](https://github.com/shadps4-emu/shadPS4/commit/32b34f92615caeb7f73d1ec46898cd4856b6eef5) Add missing DeleteHandle calls ### 📊 Changes **4 files changed** (+131 additions, -83 deletions) <details> <summary>View changed files</summary> 📝 `src/common/io_file.cpp` (+1 -3) 📝 `src/common/io_file.h` (+0 -2) 📝 `src/core/libraries/kernel/file_system.cpp` (+121 -73) 📝 `src/emulator.cpp` (+9 -5) </details> ### 📄 Description This PR makes some filesystem changes to improve shadPS4's accuracy when compared against a PS4. - Improved `open` flag handling. There were many inaccuracies visible in my tests, which either led to files opening that shouldn't open, or throwing errors when a file would open successfully on real hardware. - Mount `/app0` and `/hostapp` as read-only. Some games, particularly Unity games, will make modifications to their own game files if you don't handle this properly. - Clear `/temp` and `/temp0` on boot. On real hardware, the console will freshly format a partition to mount to these paths. While emulating it that closely is unfeasible, clearing the temp directory will lead to a similar effect in practice. - Proper handling of whence extensions on `lseek`. It appears that Sony disabled these extensions on PS4s, and trying to use them throws a unique error code. - Remove read-only mode modification in `posix_stat`. The reduced permissions this reported before caused Bloodborne to disable audio entirely when `/app0` is mounted as read only. Below are the results of my hardware tests, which all of the `open` changes were based on. Hardware tests: ![image](https://github.com/user-attachments/assets/a01fe938-6b9e-432e-9c6d-3f58a8c1d6b2) This PR: ![image](https://github.com/user-attachments/assets/f991af09-a093-4533-9237-f9a0c4c1b8db) Main: ![image](https://github.com/user-attachments/assets/b088bd79-6664-486b-994d-91444006215e) So far, these fixes appear to progress KINGDOM HEARTS Melody of Memory (CUSA18900) further in loading, though the game still loops the same loading screen endlessly. Beyond this, I've seen no regressions in my testing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:13 +03:00
Sign in to join this conversation.
No milestone
No project
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
starred/shadPS4#3041
No description provided.