mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-07 11:13:15 +00:00
fix: file name typo constant_propogation_pass.cpp fix typo from 'symbol_vitrual_addr' variable fix typo in emit_spirv_context_get_set.cpp fix typo from constant_propagation_pass.cpp in CMakeLists fix typo in these some config.cpp functions - setSliderPosition - setSliderPositionGrid - getSliderPosition - getSliderPositionGrid fix typo inside src\core\aerolib\stubs.cpp fix typo in a comment from src\core\file_format\pkg.cpp fix typo inside src\core\file_sys\fs.cpp + fs.h - NeedsCaseInsensiveSearch -> NeedsCaseInsensitiveSearch fix 2 function typos: sceAppContentAddcontEnqueueDownloadByEntitlemetId and sceAppContentAddcontMountByEntitlemetId fix typo on comment inside src\core\libraries\kernel\file_system.cpp fix typo on src\core\libraries\videoout\driver.cpp fix typo in src\core\memory.cpp fix typo from comment in src\qt_gui\game_list_utils.h fix typo in src\video_core\amdgpu\liverpool.h - window_offset_disble to window_offset_disable fix typo from comments in src\video_core\host_shaders\detile_m32x1.comp + detile_m32x2.comp - subotimal -> suboptimal fix typo from comment in src\video_core\renderer_vulkan\renderer_vulkan.cpp - dimentions -> dimensions fix typo from enum in src\common\debug.h and other files - MarkersPallete -> MarkersPalette fix last typo in src\video_core\amdgpu\pm4_opcodes.h - PremableCntl -> PreambleCntl
80 lines
2 KiB
C++
80 lines
2 KiB
C++
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <tsl/robin_map.h>
|
|
#include "common/io_file.h"
|
|
|
|
namespace Core::FileSys {
|
|
|
|
class MntPoints {
|
|
#ifdef _WIN64
|
|
static constexpr bool NeedsCaseInsensitiveSearch = false;
|
|
#else
|
|
static constexpr bool NeedsCaseInsensitiveSearch = true;
|
|
#endif
|
|
public:
|
|
struct MntPair {
|
|
std::filesystem::path host_path;
|
|
std::string mount; // e.g /app0/
|
|
};
|
|
|
|
explicit MntPoints() = default;
|
|
~MntPoints() = default;
|
|
|
|
void Mount(const std::filesystem::path& host_folder, const std::string& guest_folder);
|
|
void Unmount(const std::filesystem::path& host_folder, const std::string& guest_folder);
|
|
void UnmountAll();
|
|
|
|
std::filesystem::path GetHostPath(std::string_view guest_directory);
|
|
|
|
const MntPair* GetMount(const std::string& guest_path) {
|
|
const auto it = std::ranges::find_if(
|
|
m_mnt_pairs, [&](const auto& mount) { return guest_path.starts_with(mount.mount); });
|
|
return it == m_mnt_pairs.end() ? nullptr : &*it;
|
|
}
|
|
|
|
private:
|
|
std::vector<MntPair> m_mnt_pairs;
|
|
std::vector<std::filesystem::path> path_parts;
|
|
tsl::robin_map<std::filesystem::path, std::filesystem::path> path_cache;
|
|
std::mutex m_mutex;
|
|
};
|
|
|
|
struct DirEntry {
|
|
std::string name;
|
|
bool isFile;
|
|
};
|
|
|
|
struct File {
|
|
std::atomic_bool is_opened{};
|
|
std::atomic_bool is_directory{};
|
|
std::filesystem::path m_host_name;
|
|
std::string m_guest_name;
|
|
Common::FS::IOFile f;
|
|
std::vector<DirEntry> dirents;
|
|
u32 dirents_index;
|
|
std::mutex m_mutex;
|
|
};
|
|
|
|
class HandleTable {
|
|
public:
|
|
HandleTable() = default;
|
|
virtual ~HandleTable() = default;
|
|
|
|
int CreateHandle();
|
|
void DeleteHandle(int d);
|
|
File* GetFile(int d);
|
|
File* GetFile(const std::filesystem::path& host_name);
|
|
|
|
private:
|
|
std::vector<File*> m_files;
|
|
std::mutex m_mutex;
|
|
};
|
|
|
|
} // namespace Core::FileSys
|