mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-13 07:08:49 +00:00
More Fixes for Separate Update (#1487)
* handle getdents + fix condition + add info to description * fix not handling dents errors * to not overwrite it, only gather separate update entries when normal folder is done * fix always setting entries to 0 and guest name including "UPDATE" * reset indexes on completion * don't use concat, fixes long standing bug * make sce_module module loading take both paths into account
This commit is contained in:
@@ -199,4 +199,14 @@ void HandleTable::CreateStdHandles() {
|
||||
setup("/dev/stderr", new Devices::Logger("stderr", true)); // stderr
|
||||
}
|
||||
|
||||
int HandleTable::GetFileDescriptor(File* file) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
auto it = std::find(m_files.begin(), m_files.end(), file);
|
||||
|
||||
if (it != m_files.end()) {
|
||||
return std::distance(m_files.begin(), it);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace Core::FileSys
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <vector>
|
||||
#include <tsl/robin_map.h>
|
||||
#include "common/io_file.h"
|
||||
#include "common/logging/formatter.h"
|
||||
#include "core/devices/base_device.h"
|
||||
|
||||
namespace Core::FileSys {
|
||||
@@ -37,6 +38,14 @@ public:
|
||||
std::filesystem::path GetHostPath(std::string_view guest_directory,
|
||||
bool* is_read_only = nullptr);
|
||||
|
||||
const MntPair* GetMountFromHostPath(const std::string& host_path) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
const auto it = std::ranges::find_if(m_mnt_pairs, [&](const MntPair& mount) {
|
||||
return host_path.starts_with(std::string{fmt::UTF(mount.host_path.u8string()).data});
|
||||
});
|
||||
return it == m_mnt_pairs.end() ? nullptr : &*it;
|
||||
}
|
||||
|
||||
const MntPair* GetMount(const std::string& guest_path) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
const auto it = std::ranges::find_if(m_mnt_pairs, [&](const auto& mount) {
|
||||
@@ -86,6 +95,7 @@ public:
|
||||
void DeleteHandle(int d);
|
||||
File* GetFile(int d);
|
||||
File* GetFile(const std::filesystem::path& host_name);
|
||||
int GetFileDescriptor(File* file);
|
||||
|
||||
void CreateStdHandles();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user