From 882dd889df96c987ea007722476b729ad9848413 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Wed, 13 Aug 2025 08:36:41 -0500 Subject: [PATCH] Add entries for . and .. in MntPoints::IterateDirectory (#3414) Grand Theft Auto V uses sceKernelGetdents in a loop to search through the contents of /download0, but will always check the first returned directory entry regardless of what value the function returns. As it turns out, this will never fail on real hardware because all directories have entries for . and .., while the game code throws an exception on shadPS4 because we don't emulate these entries. --- src/core/file_sys/fs.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/file_sys/fs.cpp b/src/core/file_sys/fs.cpp index 30c3957da..a6d57daa8 100644 --- a/src/core/file_sys/fs.cpp +++ b/src/core/file_sys/fs.cpp @@ -161,6 +161,10 @@ void MntPoints::IterateDirectory(std::string_view guest_directory, // Only need to consider patch path if it exists and does not resolve to the same as base. const auto apply_patch = base_path != patch_path && std::filesystem::exists(patch_path); + // Prepend entries for . and .., as both are treated as files on PS4. + callback(base_path / ".", false); + callback(base_path / "..", false); + // Pass 1: Any files that existed in the base directory, using patch directory if needed. if (std::filesystem::exists(base_path)) { for (const auto& entry : std::filesystem::directory_iterator(base_path)) {