mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 05:08:43 +00:00
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.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user