mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 16:59:35 -04:00
c8c86661fa
feat: Added PS2Vfs for virtual file system operations, including file opening, reading, writing, and path resolution. feat: Improve VIF1 data processing to handle GIF image packets more efficiently.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "ps2x/iop/iop_types.h"
|
|
|
|
#include <cstdint>
|
|
#include <mutex>
|
|
#include <span>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
struct PS2RomProfile
|
|
{
|
|
std::string id;
|
|
std::string provider = "application";
|
|
ps2x::iop::GameMatcher matcher;
|
|
std::unordered_map<std::string, std::vector<uint8_t>> files;
|
|
};
|
|
|
|
class PS2RomDevice
|
|
{
|
|
public:
|
|
PS2RomDevice();
|
|
|
|
static void registerProfile(PS2RomProfile profile);
|
|
|
|
bool configure(const ps2x::iop::GameIdentity &identity, std::string *error = nullptr);
|
|
[[nodiscard]] bool readFile(std::string_view ps2Path, std::vector<uint8_t> &bytes) const;
|
|
[[nodiscard]] bool fileSize(std::string_view ps2Path, uint64_t &size) const;
|
|
[[nodiscard]] bool contains(std::string_view ps2Path) const;
|
|
[[nodiscard]] std::string_view activeProfile() const noexcept { return m_activeProfile; }
|
|
[[nodiscard]] std::string_view activeProvider() const noexcept { return m_activeProvider; }
|
|
|
|
private:
|
|
static std::string normalizePath(std::string_view path);
|
|
void mountBaseProfile();
|
|
void mountFiles(const std::unordered_map<std::string, std::vector<uint8_t>> &files);
|
|
|
|
std::unordered_map<std::string, std::vector<uint8_t>> m_files;
|
|
std::string m_activeProfile;
|
|
std::string m_activeProvider;
|
|
};
|