mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-26 12:55:14 -06:00
Quieted some messages (i'm lazy)
Converted DLC to qfs Stripping preexisting fs libs
This commit is contained in:
parent
ab5a9db46f
commit
6d02f5bb3b
@ -669,6 +669,7 @@ set(QUASIFS src/core/file_sys/quasifs/src/quasifs.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_inode_quasi_device.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_inode_quasi_directory.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_inode_quasi_file.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_inode_quasi_socket.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_inode_virtualfile.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_inode_symlink.cpp
|
||||
src/core/file_sys/quasifs/src/quasifs_partition.cpp
|
||||
|
||||
@ -12,35 +12,27 @@ namespace Core::FileSys {
|
||||
|
||||
bool MntPoints::ignore_game_patches = false;
|
||||
|
||||
std::string RemoveTrailingSlashes(const std::string& path) {
|
||||
// Remove trailing slashes to make comparisons simpler.
|
||||
std::string path_sanitized = path;
|
||||
while (path_sanitized.ends_with("/")) {
|
||||
path_sanitized.pop_back();
|
||||
}
|
||||
return path_sanitized;
|
||||
}
|
||||
|
||||
void MntPoints::Mount(const std::filesystem::path& host_folder, const std::string& guest_folder,
|
||||
bool read_only) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
const auto guest_folder_sanitized = RemoveTrailingSlashes(guest_folder);
|
||||
const auto guest_folder_sanitized = guest_folder;
|
||||
m_mnt_pairs.emplace_back(host_folder, guest_folder_sanitized, read_only);
|
||||
}
|
||||
|
||||
void MntPoints::Unmount(const std::filesystem::path& host_folder, const std::string& guest_folder) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
const auto guest_folder_sanitized = RemoveTrailingSlashes(guest_folder);
|
||||
auto it = std::remove_if(m_mnt_pairs.begin(), m_mnt_pairs.end(), [&](const MntPair& pair) {
|
||||
return pair.mount == guest_folder_sanitized;
|
||||
});
|
||||
m_mnt_pairs.erase(it, m_mnt_pairs.end());
|
||||
}
|
||||
// void MntPoints::Unmount(const std::filesystem::path& host_folder, const std::string&
|
||||
// guest_folder) {
|
||||
// std::scoped_lock lock{m_mutex};
|
||||
// const auto guest_folder_sanitized = guest_folder;
|
||||
// auto it = std::remove_if(m_mnt_pairs.begin(), m_mnt_pairs.end(), [&](const MntPair& pair) {
|
||||
// return pair.mount == guest_folder_sanitized;
|
||||
// });
|
||||
// m_mnt_pairs.erase(it, m_mnt_pairs.end());
|
||||
// }
|
||||
|
||||
void MntPoints::UnmountAll() {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
m_mnt_pairs.clear();
|
||||
}
|
||||
// void MntPoints::UnmountAll() {
|
||||
// std::scoped_lock lock{m_mutex};
|
||||
// m_mnt_pairs.clear();
|
||||
// }
|
||||
|
||||
std::filesystem::path MntPoints::GetHostPath(std::string_view path, bool* is_read_only,
|
||||
bool force_base_path) {
|
||||
@ -62,7 +54,7 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view path, bool* is_rea
|
||||
}
|
||||
|
||||
// Nothing to do if getting the mount itself.
|
||||
const auto corrected_path_sanitized = RemoveTrailingSlashes(corrected_path);
|
||||
const auto corrected_path_sanitized = corrected_path;
|
||||
if (corrected_path_sanitized == mount->mount) {
|
||||
return mount->host_path;
|
||||
}
|
||||
@ -209,12 +201,6 @@ int HandleTable::CreateHandle() {
|
||||
return m_files.size() - 1;
|
||||
}
|
||||
|
||||
void HandleTable::DeleteHandle(int d) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
delete m_files.at(d);
|
||||
m_files[d] = nullptr;
|
||||
}
|
||||
|
||||
File* HandleTable::GetFile(int d) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
if (d < 0 || d >= m_files.size()) {
|
||||
@ -244,14 +230,4 @@ File* HandleTable::GetFile(const std::filesystem::path& host_name) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -38,8 +38,8 @@ public:
|
||||
|
||||
void Mount(const std::filesystem::path& host_folder, const std::string& guest_folder,
|
||||
bool read_only = false);
|
||||
void Unmount(const std::filesystem::path& host_folder, const std::string& guest_folder);
|
||||
void UnmountAll();
|
||||
// void Unmount(const std::filesystem::path& host_folder, const std::string& guest_folder);
|
||||
// void UnmountAll();
|
||||
|
||||
std::filesystem::path GetHostPath(std::string_view guest_directory,
|
||||
bool* is_read_only = nullptr, bool force_base_path = false);
|
||||
@ -48,14 +48,6 @@ public:
|
||||
void IterateDirectory(std::string_view guest_directory,
|
||||
const IterateDirectoryCallback& callback);
|
||||
|
||||
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) {
|
||||
@ -98,13 +90,10 @@ public:
|
||||
virtual ~HandleTable() = default;
|
||||
|
||||
int CreateHandle();
|
||||
void DeleteHandle(int d);
|
||||
File* GetFile(int d);
|
||||
File* GetSocket(int d);
|
||||
File* GetFile(const std::filesystem::path& host_name);
|
||||
int GetFileDescriptor(File* file);
|
||||
|
||||
void CreateStdHandles();
|
||||
|
||||
private:
|
||||
std::vector<File*> m_files;
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
// INAA License @marecl 2025
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <format>
|
||||
|
||||
template <typename... Args>
|
||||
void LogCustom(const std::string_view fn, const std::string_view msg, std::format_string<Args...> fmt, Args &&...args)
|
||||
{
|
||||
std::cout << std::format("[{:^25s}] ", fn) << std::format("{}", msg) << std::format(fmt, std::forward<Args>(args)...) << "\n";
|
||||
}
|
||||
|
||||
#define Log(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
LogCustom(__FUNCTION__, "[INFO]\t", fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LogTest(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
LogCustom(__FUNCTION__, "\033[34;1m[TEST]\033[0m ", fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LogError(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
LogCustom(__FUNCTION__, "\033[31;1m[FAIL]\033[0m ", fmt " ({}:{})", ##__VA_ARGS__, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define LogSuccess(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
LogCustom(__FUNCTION__, "\033[32;1m[SUCC]\033[0m ", fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define UNIMPLEMENTED() \
|
||||
{ \
|
||||
LogTest("Unimplemented ({}:{})", __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
// return ENOSYS
|
||||
#define STUB() \
|
||||
LogError("Stub called in HostIO_Base: {}:{}", __FILE__, __LINE__); \
|
||||
return -38;
|
||||
|
||||
#define TEST(cond, success_fmt, fail_fmt, ...) \
|
||||
{ \
|
||||
if (cond) \
|
||||
{ \
|
||||
LogSuccess(success_fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
LogError(fail_fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
@ -40,6 +40,8 @@ using Directory = QuasiDirectory;
|
||||
using dir_ptr = std::shared_ptr<Directory>;
|
||||
class Device;
|
||||
using dev_ptr = std::shared_ptr<Device>;
|
||||
class Socket;
|
||||
using socket_ptr = std::shared_ptr<Socket>;
|
||||
|
||||
// resolve path into (parent_dir, leaf_name, inode)
|
||||
struct Resolved {
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
#include "quasi_errno.h"
|
||||
#include "quasi_types.h"
|
||||
#include "quasifs_inode.h"
|
||||
#include "quasifs_inode_quasi_directory.h"
|
||||
#include "quasifs_inode_symlink.h"
|
||||
|
||||
#include "../hostio/host_io.h"
|
||||
|
||||
@ -152,9 +150,10 @@ public:
|
||||
// Additional binds
|
||||
//
|
||||
|
||||
bool IsOpen(const s32 fd) noexcept;
|
||||
int SetSize(const s32 fd, uint64_t size) noexcept;
|
||||
s64 GetSize(const s32 fd) noexcept;
|
||||
bool IsOpen(const int fd) noexcept;
|
||||
int SetSize(const int fd, uint64_t size) noexcept;
|
||||
s64 GetSize(const int fd) noexcept;
|
||||
|
||||
// Not a port, used by 2-3 functions that ;
|
||||
s64 GetDirectorySize(const fs::path& path) noexcept;
|
||||
|
||||
|
||||
@ -46,19 +46,47 @@ public:
|
||||
}
|
||||
|
||||
virtual s64 readv(const Libraries::Kernel::OrbisKernelIovec* iov, int iovcnt) {
|
||||
return -QUASI_EBADF;
|
||||
u64 tb = 0;
|
||||
for (unsigned int idx = 0; idx < iovcnt; idx++) {
|
||||
int status = this->read(iov[idx].iov_base, iov[idx].iov_len);
|
||||
if (status < 0)
|
||||
return status;
|
||||
tb += status;
|
||||
}
|
||||
return tb;
|
||||
}
|
||||
|
||||
virtual s64 writev(const Libraries::Kernel::OrbisKernelIovec* iov, int iovcnt) {
|
||||
return -QUASI_EBADF;
|
||||
u64 tb = 0;
|
||||
for (unsigned int idx = 0; idx < iovcnt; idx++) {
|
||||
int status = this->write(iov[idx].iov_base, iov[idx].iov_len);
|
||||
if (status < 0)
|
||||
return status;
|
||||
tb += status;
|
||||
}
|
||||
return tb;
|
||||
}
|
||||
|
||||
virtual s64 preadv(const Libraries::Kernel::OrbisKernelIovec* iov, int iovcnt, u64 offset) {
|
||||
return -QUASI_EBADF;
|
||||
u64 tb = 0;
|
||||
for (unsigned int idx = 0; idx < iovcnt; idx++) {
|
||||
int status = this->pread(iov[idx].iov_base, iov[idx].iov_len, offset);
|
||||
if (status < 0)
|
||||
return status;
|
||||
tb += status;
|
||||
}
|
||||
return tb;
|
||||
}
|
||||
|
||||
virtual s64 pwritev(const Libraries::Kernel::OrbisKernelIovec* iov, int iovcnt, u64 offset) {
|
||||
return -QUASI_EBADF;
|
||||
u64 tb = 0;
|
||||
for (unsigned int idx = 0; idx < iovcnt; idx++) {
|
||||
int status = this->pwrite(iov[idx].iov_base, iov[idx].iov_len,offset);
|
||||
if (status < 0)
|
||||
return status;
|
||||
tb += status;
|
||||
}
|
||||
return tb;
|
||||
}
|
||||
|
||||
virtual s64 lseek(s64 offset, int whence) {
|
||||
|
||||
@ -29,6 +29,7 @@ public:
|
||||
s64 write(const void* buf, size_t count) override;
|
||||
s64 pread(void* buf, size_t count, u64 offset) override;
|
||||
s64 pwrite(const void* buf, size_t count, u64 offset) override;
|
||||
|
||||
s32 ftruncate(s64 length) override;
|
||||
};
|
||||
|
||||
|
||||
26
src/core/file_sys/quasifs/quasifs_inode_quasi_socket.h
Normal file
26
src/core/file_sys/quasifs/quasifs_inode_quasi_socket.h
Normal file
@ -0,0 +1,26 @@
|
||||
// INAA License @marecl 2025
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/assert.h"
|
||||
|
||||
#include "quasi_types.h"
|
||||
#include "quasifs_inode.h"
|
||||
|
||||
namespace QuasiFS {
|
||||
|
||||
class Socket : public Inode {
|
||||
|
||||
public:
|
||||
Socket();
|
||||
~Socket();
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static dev_ptr Create(Args&&... args) {
|
||||
if constexpr (std::is_base_of_v<Socket, T>)
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
UNREACHABLE();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace QuasiFS
|
||||
18
src/core/file_sys/quasifs/src/quasifs_inode_quasi_socket.cpp
Normal file
18
src/core/file_sys/quasifs/src/quasifs_inode_quasi_socket.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// INAA License @marecl 2025
|
||||
|
||||
#include "core/file_sys/quasifs/quasifs_inode_quasi_socket.h"
|
||||
|
||||
namespace QuasiFS {
|
||||
|
||||
Socket::Socket() {
|
||||
// fileno and blkdev assigned by partition
|
||||
this->st.st_size = 0;
|
||||
this->st.st_blksize = 0;
|
||||
this->st.st_blocks = 0;
|
||||
|
||||
this->st.st_mode |= QUASI_S_IFSOCK;
|
||||
}
|
||||
|
||||
Socket::~Socket() = default;
|
||||
|
||||
} // namespace QuasiFS
|
||||
@ -14,6 +14,11 @@
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/system/systemservice.h"
|
||||
|
||||
#include "core/file_sys/quasifs/quasifs.h"
|
||||
#include "core/file_sys/quasifs/quasifs_partition.h"
|
||||
|
||||
static QuasiFS::QFS* g_qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
|
||||
namespace Libraries::AppContent {
|
||||
|
||||
struct AddContInfo {
|
||||
@ -104,7 +109,14 @@ int PS4_SYSV_ABI sceAppContentAddcontMount(u32 service_label,
|
||||
auto entitlement_id = content_id.value().substr(ORBIS_APP_CONTENT_ENTITLEMENT_LABEL_OFFSET);
|
||||
if (strncmp(entitlement_id.data(), entitlement_label->data, entitlement_id.length()) == 0) {
|
||||
// We've located the correct folder.
|
||||
mnt->Mount(entry.path(), mount_point->data);
|
||||
|
||||
g_qfs->Operation.MKDir(mount_point->data, 0555 /* I think it's like /app0*/);
|
||||
QuasiFS::partition_ptr partition_dlc = QuasiFS::Partition::Create(entry.path(), 0555);
|
||||
g_qfs->Mount(mount_point->data, partition_dlc, QuasiFS::MountOptions::MOUNT_RW);
|
||||
g_qfs->SyncHost(mount_point->data);
|
||||
g_qfs->Mount(mount_point->data, partition_dlc,
|
||||
QuasiFS::MountOptions::MOUNT_REMOUNT | QuasiFS::MountOptions::MOUNT_NOOPT);
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,8 +9,7 @@
|
||||
#include "common/logging/log.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_sys/directories/normal_directory.h"
|
||||
#include "core/file_sys/directories/pfs_directory.h"
|
||||
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/kernel/file_system.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
@ -34,19 +33,6 @@ namespace qfs = QuasiFS;
|
||||
|
||||
static QuasiFS::QFS* g_qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
|
||||
// #define GET_DEVICE_FD(fd) \
|
||||
// [](u32, const char*, int, u16) { \
|
||||
// return Common::Singleton<Core::FileSys::HandleTable>::Instance()->GetFile(fd)->device; \
|
||||
// }
|
||||
|
||||
// // prefix path, only dev devices
|
||||
// static std::map<std::string, FactoryDevice> available_device = {
|
||||
// // clang-format off
|
||||
// {"/dev/console", &D::ConsoleDevice::Create },
|
||||
// {"/dev/deci_tty6",&D::DeciTty6Device::Create }
|
||||
// // clang-format on
|
||||
// };
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) {
|
||||
@ -145,6 +131,7 @@ s64 PS4_SYSV_ABI readv(s32 fd, const OrbisKernelIovec* iov, s32 iovcnt) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
s64 total_read = 0;
|
||||
for (s32 i = 0; i < iovcnt; i++) {
|
||||
total_read += ReadFile(file->f, iov[i].iov_base, iov[i].iov_len);
|
||||
@ -237,11 +224,11 @@ s64 PS4_SYSV_ABI sceKernelLseek(s32 fd, s64 offset, s32 whence) {
|
||||
}
|
||||
|
||||
s64 PS4_SYSV_ABI read(s32 fd, void* buf, u64 nbytes) {
|
||||
// const auto* memory = Core::Memory::Instance();
|
||||
const auto* memory = Core::Memory::Instance();
|
||||
// // Invalidate up to the actual number of bytes that could be read.
|
||||
// const auto remaining = file.GetSize() - file.Tell();
|
||||
const auto remaining = g_qfs->GetSize(fd) - g_qfs->Operation.Tell(fd);
|
||||
|
||||
// memory->InvalidateMemory(reinterpret_cast<VAddr>(buf), std::min<u64>(nbytes, remaining));
|
||||
memory->InvalidateMemory(reinterpret_cast<VAddr>(buf), std::min<u64>(nbytes, remaining));
|
||||
|
||||
int result = g_qfs->Operation.Read(fd, buf, nbytes);
|
||||
if (result < 0)
|
||||
@ -372,9 +359,9 @@ s32 PS4_SYSV_ABI sceKernelCheckReachability(const char* path) {
|
||||
s32 PS4_SYSV_ABI fstat(s32 fd, OrbisKernelStat* sb) {
|
||||
LOG_DEBUG(Kernel_Fs, "(PARTIAL) fd = {}", fd);
|
||||
|
||||
Libraries::Kernel::OrbisKernelStat st;
|
||||
// Libraries::Kernel::OrbisKernelStat st;
|
||||
|
||||
int result = g_qfs->Operation.FStat(fd, &st);
|
||||
int result = g_qfs->Operation.FStat(fd, sb);
|
||||
if (result < 0) {
|
||||
*__Error() = -result;
|
||||
return -1;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "common/logging/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_format/playgo_chunk.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/file_sys/quasifs/quasifs.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/system/systemservice.h"
|
||||
@ -252,8 +252,9 @@ s32 PS4_SYSV_ABI scePlayGoInitialize(OrbisPlayGoInitParams* param) {
|
||||
|
||||
playgo = std::make_unique<PlaygoFile>();
|
||||
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto file_path = mnt->GetHostPath("/app0/sce_sys/playgo-chunk.dat");
|
||||
QuasiFS::QFS* qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
std::filesystem::path file_path{};
|
||||
int status = qfs->GetHostPath(file_path, "/app0/sce_sys/playgo-chunk.dat");
|
||||
if (!playgo->Open(file_path)) {
|
||||
LOG_WARNING(Lib_PlayGo, "Could not open PlayGo file");
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include "common/singleton.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/file_format/psf.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/file_sys/quasifs/quasifs.h"
|
||||
#include "core/libraries/save_data/save_instance.h"
|
||||
#include "imgui/imgui_std.h"
|
||||
#include "savedatadialog_ui.h"
|
||||
@ -27,9 +27,6 @@ static constexpr ImVec2 BUTTON_SIZE{100.0f, 30.0f};
|
||||
constexpr auto FOOTER_HEIGHT = BUTTON_SIZE.y + 15.0f;
|
||||
static constexpr float PROGRESS_BAR_WIDTH{0.8f};
|
||||
|
||||
static ::Core::FileSys::MntPoints* g_mnt =
|
||||
Common::Singleton<::Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
static std::string SpaceSizeToString(size_t size) {
|
||||
std::string size_str;
|
||||
if (size > 1024 * 1024 * 1024) { // > 1GB
|
||||
@ -60,6 +57,8 @@ void SaveDialogResult::CopyTo(OrbisSaveDataDialogResult& result) const {
|
||||
}
|
||||
|
||||
SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
|
||||
QuasiFS::QFS* qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
|
||||
this->mode = param.mode;
|
||||
this->type = param.dispType;
|
||||
this->user_data = param.userData;
|
||||
@ -140,7 +139,8 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
|
||||
auto buf = (u8*)new_item->iconBuf;
|
||||
icon = RefCountedTexture::DecodePngTexture({buf, buf + new_item->iconSize});
|
||||
} else {
|
||||
const auto& src_icon = g_mnt->GetHostPath("/app0/sce_sys/save_data.png");
|
||||
std::filesystem::path src_icon{};
|
||||
int status = qfs->GetHostPath(src_icon, "/app0/sce_sys/save_data.png");
|
||||
if (std::filesystem::exists(src_icon)) {
|
||||
icon = RefCountedTexture::DecodePngFile(src_icon);
|
||||
}
|
||||
|
||||
@ -19,9 +19,8 @@ constexpr auto OrbisSaveDataBlocksMin2 = 96; // 3MiB
|
||||
constexpr auto OrbisSaveDataBlocksMax = 32768; // 1 GiB
|
||||
constexpr std::string_view sce_sys = "sce_sys"; // system folder inside save
|
||||
|
||||
// static Core::FileSys::MntPoints* g_mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
static QuasiFS::QFS* g_qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
namespace qfs = QuasiFS;
|
||||
static qfs::QFS* g_qfs = Common::Singleton<qfs::QFS>::Instance();
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@ -193,9 +192,9 @@ void SaveInstance::SetupAndMount(bool read_only, bool copy_icon, bool ignore_cor
|
||||
max_blocks = static_cast<int>(GetMaxBlockFromSFO(param_sfo));
|
||||
|
||||
g_qfs->Operation.MKDir(mount_point);
|
||||
auto part = QuasiFS::Partition::Create(save_path);
|
||||
auto part = qfs::Partition::Create(save_path);
|
||||
g_qfs->Mount(mount_point, part,
|
||||
read_only ? QuasiFS::MountOptions::MOUNT_NOOPT : QuasiFS::MountOptions::MOUNT_RW);
|
||||
read_only ? qfs::MountOptions::MOUNT_NOOPT : qfs::MountOptions::MOUNT_RW);
|
||||
g_qfs->SyncHost(mount_point);
|
||||
|
||||
mounted = true;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include "common/path_util.h"
|
||||
#include "common/singleton.h"
|
||||
#include "common/thread.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/file_sys/quasifs/quasifs.h"
|
||||
#include "core/libraries/system/msgdialog_ui.h"
|
||||
#include "save_instance.h"
|
||||
|
||||
@ -31,8 +31,6 @@ constexpr std::string_view CorruptFileName = "corrupted";
|
||||
|
||||
namespace Libraries::SaveData::SaveMemory {
|
||||
|
||||
static Core::FileSys::MntPoints* g_mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
struct SlotData {
|
||||
OrbisUserServiceUserId user_id{};
|
||||
std::string game_serial;
|
||||
@ -135,11 +133,14 @@ size_t SetupSaveMemory(OrbisUserServiceUserId user_id, u32 slot_id, std::string_
|
||||
}
|
||||
|
||||
void SetIcon(u32 slot_id, void* buf, size_t buf_size) {
|
||||
QuasiFS::QFS* qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
|
||||
std::lock_guard lck{g_slot_mtx};
|
||||
const auto& data = g_attached_slots[slot_id];
|
||||
const auto icon_path = data.folder_path / sce_sys / "icon0.png";
|
||||
if (buf == nullptr) {
|
||||
const auto& src_icon = g_mnt->GetHostPath("/app0/sce_sys/save_data.png");
|
||||
fs::path src_icon{};
|
||||
int status = qfs->GetHostPath(src_icon, "/app0/sce_sys/save_data.png");
|
||||
if (fs::exists(icon_path)) {
|
||||
fs::remove(icon_path);
|
||||
}
|
||||
@ -148,9 +149,9 @@ void SetIcon(u32 slot_id, void* buf, size_t buf_size) {
|
||||
fs::copy_file(src_icon, icon_path);
|
||||
}
|
||||
} else {
|
||||
IOFile file(icon_path, Common::FS::FileAccessMode::Write);
|
||||
file.WriteRaw<u8>(buf, buf_size);
|
||||
file.Close();
|
||||
int fd = qfs->Operation.Open(icon_path, QUASI_O_WRONLY | QUASI_O_TRUNC);
|
||||
qfs->Operation.Write(fd, buf, buf_size);
|
||||
qfs->Operation.Close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,8 @@
|
||||
|
||||
Frontend::WindowSDL* g_window = nullptr;
|
||||
|
||||
namespace qfs = QuasiFS;
|
||||
|
||||
namespace Core {
|
||||
|
||||
Emulator::Emulator() {
|
||||
@ -92,29 +94,29 @@ void Emulator::LoadFilesystem(const std::filesystem::path& game_folder, const st
|
||||
std::filesystem::create_directory(mount_download_dir);
|
||||
}
|
||||
|
||||
auto* qfs = Common::Singleton<QuasiFS::QFS>::Instance();
|
||||
auto* qfs = Common::Singleton<qfs::QFS>::Instance();
|
||||
|
||||
qfs->Operation.Chmod("/", 0777);
|
||||
QuasiFS::partition_ptr partition_av_contents = QuasiFS::Partition::Create("", 0775, 512, 16384);
|
||||
QuasiFS::partition_ptr partition_av_contents_photo =
|
||||
QuasiFS::Partition::Create("", 0755, 4096, 32768);
|
||||
QuasiFS::partition_ptr partition_av_contents_thumbs =
|
||||
QuasiFS::Partition::Create("", 0755, 4096, 32768);
|
||||
QuasiFS::partition_ptr partition_av_contents_video =
|
||||
QuasiFS::Partition::Create("", 0755, 4096, 32768);
|
||||
qfs::partition_ptr partition_av_contents = qfs::Partition::Create("", 0775, 512, 16384);
|
||||
qfs::partition_ptr partition_av_contents_photo =
|
||||
qfs::Partition::Create("", 0755, 4096, 32768);
|
||||
qfs::partition_ptr partition_av_contents_thumbs =
|
||||
qfs::Partition::Create("", 0755, 4096, 32768);
|
||||
qfs::partition_ptr partition_av_contents_video =
|
||||
qfs::Partition::Create("", 0755, 4096, 32768);
|
||||
|
||||
QuasiFS::partition_ptr partition_app0 =
|
||||
QuasiFS::Partition::Create(game_folder, 0555, 512, 65536);
|
||||
QuasiFS::partition_ptr partition_data =
|
||||
QuasiFS::Partition::Create(mount_data_dir, 0777, 4096, 32768);
|
||||
QuasiFS::partition_ptr partition_dev = QuasiFS::Partition::Create("", 0755, 16384, 16384);
|
||||
qfs::partition_ptr partition_app0 =
|
||||
qfs::Partition::Create(game_folder, 0555, 512, 65536);
|
||||
qfs::partition_ptr partition_data =
|
||||
qfs::Partition::Create(mount_data_dir, 0777, 4096, 32768);
|
||||
qfs::partition_ptr partition_dev = qfs::Partition::Create("", 0755, 16384, 16384);
|
||||
// no idea what are the block sizes for these 3
|
||||
QuasiFS::partition_ptr partition_download =
|
||||
QuasiFS::Partition::Create(mount_download_dir, 0777, 512, 65536);
|
||||
QuasiFS::partition_ptr partition_hostapp =
|
||||
QuasiFS::Partition::Create(game_folder, 0777, 2048, 16384);
|
||||
QuasiFS::partition_ptr partition_temp =
|
||||
QuasiFS::Partition::Create(mount_temp_dir, 0777, 512, 16384);
|
||||
qfs::partition_ptr partition_download =
|
||||
qfs::Partition::Create(mount_download_dir, 0777, 512, 65536);
|
||||
qfs::partition_ptr partition_hostapp =
|
||||
qfs::Partition::Create(game_folder, 0777, 2048, 16384);
|
||||
qfs::partition_ptr partition_temp =
|
||||
qfs::Partition::Create(mount_temp_dir, 0777, 512, 16384);
|
||||
|
||||
qfs->Operation.MKDir("/av_contents", 0775);
|
||||
qfs->Operation.MKDir("/av_contents/photo", 0755);
|
||||
@ -128,31 +130,31 @@ void Emulator::LoadFilesystem(const std::filesystem::path& game_folder, const st
|
||||
qfs->Operation.MKDir("/temp", 0777);
|
||||
qfs->Operation.MKDir("/temp0", 0777);
|
||||
|
||||
qfs->Mount("/av_contents", partition_av_contents, QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/av_contents/photo", partition_av_contents_photo, QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/av_contents", partition_av_contents, qfs::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/av_contents/photo", partition_av_contents_photo, qfs::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/av_contents/thumbnails", partition_av_contents_thumbs,
|
||||
QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/av_contents/video", partition_av_contents_video, QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/av_contents/video", partition_av_contents_video, qfs::MountOptions::MOUNT_RW);
|
||||
|
||||
qfs->Mount("/app0", partition_app0, QuasiFS::MountOptions::MOUNT_NOOPT);
|
||||
qfs->Mount("/data", partition_data, QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/dev", partition_dev, QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/download0", partition_download, QuasiFS::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/app0", partition_app0, qfs::MountOptions::MOUNT_NOOPT);
|
||||
qfs->Mount("/data", partition_data, qfs::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/dev", partition_dev, qfs::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/download0", partition_download, qfs::MountOptions::MOUNT_RW);
|
||||
// qfs->Mount("/hostapp", partition_hostapp,
|
||||
// QuasiFS::MountOptions::MOUNT_NOOPT | QuasiFS::MountOptions::MOUNT_BIND);
|
||||
qfs->Mount("/temp", partition_temp, QuasiFS::MountOptions::MOUNT_RW);
|
||||
// qfs::MountOptions::MOUNT_NOOPT | qfs::MountOptions::MOUNT_BIND);
|
||||
qfs->Mount("/temp", partition_temp, qfs::MountOptions::MOUNT_RW);
|
||||
qfs->Mount("/temp0", partition_temp,
|
||||
QuasiFS::MountOptions::MOUNT_RW | QuasiFS::MountOptions::MOUNT_BIND);
|
||||
qfs::MountOptions::MOUNT_RW | qfs::MountOptions::MOUNT_BIND);
|
||||
|
||||
//
|
||||
// Setup /dev
|
||||
//
|
||||
|
||||
qfs->Operation.MKDir("/dev/fd");
|
||||
qfs->ForceInsert("/dev/fd", "0", QuasiFS::Device::Create<Devices::ZeroDevice>());
|
||||
qfs->ForceInsert("/dev/fd", "1", QuasiFS::Device::Create<Devices::Logger>("stdout", false));
|
||||
qfs->ForceInsert("/dev/fd", "0", qfs::Device::Create<Devices::ZeroDevice>());
|
||||
qfs->ForceInsert("/dev/fd", "1", qfs::Device::Create<Devices::Logger>("stdout", false));
|
||||
// qfs->ForceInsert("/dev/fd", "1", std::make_shared<Devices::Logger>("stdout", false));
|
||||
qfs->ForceInsert("/dev/fd", "2", QuasiFS::Device::Create<Devices::Logger>("stderr", true));
|
||||
qfs->ForceInsert("/dev/fd", "2", qfs::Device::Create<Devices::Logger>("stderr", true));
|
||||
// stdin is unavailable from within the app???
|
||||
qfs->Operation.LinkSymbolic("/dev/fd/0", "/dev/stdin");
|
||||
qfs->Operation.LinkSymbolic("/dev/fd/1", "/dev/stdout");
|
||||
@ -161,13 +163,13 @@ void Emulator::LoadFilesystem(const std::filesystem::path& game_folder, const st
|
||||
qfs->Operation.LinkSymbolic("/dev/fd/1", "/dev/deci_stdout");
|
||||
qfs->Operation.LinkSymbolic("/dev/fd/2", "/dev/deci_stderr");
|
||||
|
||||
qfs->ForceInsert("/dev", "console", QuasiFS::Device::Create<Devices::ConsoleDevice>());
|
||||
qfs->ForceInsert("/dev", "deci_tty6", QuasiFS::Device::Create<Devices::DeciTty6Device>());
|
||||
qfs->ForceInsert("/dev", "random", QuasiFS::Device::Create<Devices::RandomDevice>());
|
||||
qfs->ForceInsert("/dev", "urandom", QuasiFS::Device::Create<Devices::RandomDevice>());
|
||||
qfs->ForceInsert("/dev", "srandom", QuasiFS::Device::Create<Devices::SRandomDevice>());
|
||||
qfs->ForceInsert("/dev", "zero", QuasiFS::Device::Create<Devices::ZeroDevice>());
|
||||
qfs->ForceInsert("/dev", "null", QuasiFS::Device::Create<Devices::NullDevice>());
|
||||
qfs->ForceInsert("/dev", "console", qfs::Device::Create<Devices::ConsoleDevice>());
|
||||
qfs->ForceInsert("/dev", "deci_tty6", qfs::Device::Create<Devices::DeciTty6Device>());
|
||||
qfs->ForceInsert("/dev", "random", qfs::Device::Create<Devices::RandomDevice>());
|
||||
qfs->ForceInsert("/dev", "urandom", qfs::Device::Create<Devices::RandomDevice>());
|
||||
qfs->ForceInsert("/dev", "srandom", qfs::Device::Create<Devices::SRandomDevice>());
|
||||
qfs->ForceInsert("/dev", "zero", qfs::Device::Create<Devices::ZeroDevice>());
|
||||
qfs->ForceInsert("/dev", "null", qfs::Device::Create<Devices::NullDevice>());
|
||||
|
||||
qfs->Operation.Chmod("/dev/deci_stderr", 0666);
|
||||
qfs->Operation.Chmod("/dev/deci_stdout", 0666);
|
||||
@ -192,7 +194,7 @@ void Emulator::LoadFilesystem(const std::filesystem::path& game_folder, const st
|
||||
|
||||
qfs->SyncHost();
|
||||
|
||||
// QuasiFS::printTree(qfs->GetRoot(), "/");
|
||||
// qfs::printTree(qfs->GetRoot(), "/");
|
||||
}
|
||||
|
||||
void Emulator::Run(std::filesystem::path file, const std::vector<std::string> args) {
|
||||
|
||||
@ -282,7 +282,7 @@ const GraphicsPipeline* PipelineCache::GetGraphicsPipeline() {
|
||||
const auto [it, is_new] = graphics_pipelines.try_emplace(graphics_key);
|
||||
if (is_new) {
|
||||
const auto pipeline_hash = std::hash<GraphicsPipelineKey>{}(graphics_key);
|
||||
LOG_INFO(Render_Vulkan, "Compiling graphics pipeline {:#x}", pipeline_hash);
|
||||
// LOG_INFO(Render_Vulkan, "Compiling graphics pipeline {:#x}", pipeline_hash);
|
||||
|
||||
it.value() = std::make_unique<GraphicsPipeline>(instance, scheduler, desc_heap, profile,
|
||||
graphics_key, *pipeline_cache, infos,
|
||||
@ -506,8 +506,8 @@ bool PipelineCache::RefreshComputeKey() {
|
||||
vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::RuntimeInfo& runtime_info,
|
||||
std::span<const u32> code, size_t perm_idx,
|
||||
Shader::Backend::Bindings& binding) {
|
||||
LOG_INFO(Render_Vulkan, "Compiling {} shader {:#x} {}", info.stage, info.pgm_hash,
|
||||
perm_idx != 0 ? "(permutation)" : "");
|
||||
// LOG_INFO(Render_Vulkan, "Compiling {} shader {:#x} {}", info.stage, info.pgm_hash,
|
||||
// perm_idx != 0 ? "(permutation)" : "");
|
||||
DumpShader(code, info.pgm_hash, info.stage, perm_idx, "bin");
|
||||
|
||||
const auto ir_program = Shader::TranslateProgram(code, pools, info, runtime_info, profile);
|
||||
|
||||
@ -137,9 +137,9 @@ vk::Pipeline TileManager::GetTilingPipeline(const ImageInfo& info, bool is_tiler
|
||||
vk::ShaderStageFlagBits::eCompute, device, defines);
|
||||
const auto module_name = fmt::format("{}_{} {}", magic_enum::enum_name(info.tile_mode),
|
||||
info.num_bits, is_tiler ? "tiler" : "detiler");
|
||||
LOG_WARNING(Render_Vulkan, "Compiling shader {}", module_name);
|
||||
// LOG_WARNING(Render_Vulkan, "Compiling shader {}", module_name);
|
||||
for (const auto& def : defines) {
|
||||
LOG_WARNING(Render_Vulkan, "#define {}", def);
|
||||
// LOG_WARNING(Render_Vulkan, "#define {}", def);
|
||||
}
|
||||
Vulkan::SetObjectName(device, module, module_name);
|
||||
const vk::PipelineShaderStageCreateInfo shader_ci = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user