mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
Merge pull request #172 from STL1te/fix/savedata-params
fix(savedata): the native module keeps save directory params and moun…
This commit is contained in:
@@ -6,8 +6,13 @@
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <filesystem>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@@ -129,6 +134,76 @@ bool read_file_all(const std::string& path, std::vector<char>& out) {
|
||||
return static_cast<bool>(f);
|
||||
}
|
||||
|
||||
std::string param_path(const std::string& real_path) {
|
||||
return real_path + ".param";
|
||||
}
|
||||
|
||||
bool read_param_file(const std::string& path, SaveDataParam* param) {
|
||||
if (!std::filesystem::exists(path)) {
|
||||
return false;
|
||||
}
|
||||
std::vector<char> bytes;
|
||||
if (!read_file_all(path, bytes)) {
|
||||
throw std::runtime_error("SaveData: cannot read param file " + path);
|
||||
}
|
||||
if (bytes.size() != sizeof(SaveDataParam)) {
|
||||
throw std::runtime_error("SaveData: param file " + path + " is " + std::to_string(bytes.size()) + " bytes, expected " + std::to_string(sizeof(SaveDataParam)) + " (outdated format)");
|
||||
}
|
||||
std::memcpy(param, bytes.data(), sizeof(SaveDataParam));
|
||||
return true;
|
||||
}
|
||||
|
||||
SaveDataParam load_param(const std::string& real_path) {
|
||||
SaveDataParam param{};
|
||||
read_param_file(param_path(real_path), ¶m);
|
||||
if (param.mtime == 0) {
|
||||
std::error_code ec;
|
||||
const auto written = std::filesystem::last_write_time(real_path, ec);
|
||||
if (!ec) {
|
||||
const auto system = std::chrono::clock_cast<std::chrono::system_clock>(written);
|
||||
param.mtime = std::chrono::duration_cast<std::chrono::seconds>(system.time_since_epoch()).count();
|
||||
}
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
bool store_param(const std::string& real_path, const SaveDataParam& param) {
|
||||
std::vector<char> bytes(sizeof(param));
|
||||
std::memcpy(bytes.data(), ¶m, sizeof(param));
|
||||
return write_file_replace(param_path(real_path), bytes);
|
||||
}
|
||||
|
||||
struct ParamField {
|
||||
std::size_t offset;
|
||||
std::size_t size;
|
||||
bool text;
|
||||
};
|
||||
|
||||
bool param_field(std::uint32_t param_type, ParamField* field) {
|
||||
switch (param_type) {
|
||||
case SAVE_DATA_PARAM_TYPE_ALL: *field = {0, sizeof(SaveDataParam), false}; return true;
|
||||
case SAVE_DATA_PARAM_TYPE_TITLE: *field = {offsetof(SaveDataParam, title), sizeof(SaveDataParam::title), true}; return true;
|
||||
case SAVE_DATA_PARAM_TYPE_SUB_TITLE: *field = {offsetof(SaveDataParam, sub_title), sizeof(SaveDataParam::sub_title), true}; return true;
|
||||
case SAVE_DATA_PARAM_TYPE_DETAIL: *field = {offsetof(SaveDataParam, detail), sizeof(SaveDataParam::detail), true}; return true;
|
||||
case SAVE_DATA_PARAM_TYPE_USER_PARAM: *field = {offsetof(SaveDataParam, user_param), sizeof(SaveDataParam::user_param), false}; return true;
|
||||
case SAVE_DATA_PARAM_TYPE_MTIME: *field = {offsetof(SaveDataParam, mtime), sizeof(SaveDataParam::mtime), false}; return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
int traceLimit() {
|
||||
static const int limit = std::getenv("APS5_SAVEDATA_TRACE") != nullptr ? std::numeric_limits<int>::max() : 3;
|
||||
return limit;
|
||||
}
|
||||
#define SAVEDATA_TRACE(...) \
|
||||
do { \
|
||||
static std::atomic<int> traceCount{0}; \
|
||||
if (traceCount.fetch_add(1, std::memory_order_relaxed) < traceLimit()) { \
|
||||
std::fprintf(stderr, "[SAVEDATA:native] " __VA_ARGS__); \
|
||||
std::fputc('\n', stderr); \
|
||||
std::fflush(stderr); \
|
||||
} \
|
||||
} while (0)
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
@@ -160,7 +235,7 @@ int APS5_VABI sceSaveDataCreateTransactionResource(uint32_t size) {
|
||||
return g_transaction_counter.fetch_add(1);
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataDelete(const SaveDataDelete* del) {
|
||||
static int deleteSave(const SaveDataDelete* del) {
|
||||
if (del == nullptr || del->dir_name == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataDelete: null argument");
|
||||
}
|
||||
@@ -168,15 +243,23 @@ int APS5_VABI sceSaveDataDelete(const SaveDataDelete* del) {
|
||||
if (std::filesystem::is_directory(path)) {
|
||||
std::filesystem::remove_all(path);
|
||||
}
|
||||
std::error_code ec;
|
||||
std::filesystem::remove(param_path(path), ec);
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataDelete(const SaveDataDelete* del) {
|
||||
const int rc = deleteSave(del);
|
||||
SAVEDATA_TRACE("delete dir=%s -> 0x%08x", del != nullptr && del->dir_name != nullptr ? del->dir_name->data : "(null)", static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataDeleteTransactionResource(int32_t resource) {
|
||||
(void)resource;
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataDirNameSearch(const SaveDataDirNameSearchCond* cond, SaveDataDirNameSearchResult* result) {
|
||||
static int dirNameSearch(const SaveDataDirNameSearchCond* cond, SaveDataDirNameSearchResult* result) {
|
||||
if (cond == nullptr || result == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataDirNameSearch: null argument");
|
||||
}
|
||||
@@ -201,7 +284,7 @@ int APS5_VABI sceSaveDataDirNameSearch(const SaveDataDirNameSearchCond* cond, Sa
|
||||
if (result->dir_names != nullptr && set < result->dir_names_num) {
|
||||
std::snprintf(result->dir_names[set].data, sizeof(result->dir_names[set].data), "%s", name.c_str());
|
||||
if (result->params != nullptr) {
|
||||
std::memset(&result->params[set], 0, sizeof(SaveDataParam));
|
||||
result->params[set] = load_param(entry.path().string());
|
||||
}
|
||||
set++;
|
||||
}
|
||||
@@ -211,6 +294,12 @@ int APS5_VABI sceSaveDataDirNameSearch(const SaveDataDirNameSearchCond* cond, Sa
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataDirNameSearch(const SaveDataDirNameSearchCond* cond, SaveDataDirNameSearchResult* result) {
|
||||
const int rc = dirNameSearch(cond, result);
|
||||
SAVEDATA_TRACE("dirNameSearch user=%d pattern=%s hit=%u set=%u -> 0x%08x", cond != nullptr ? cond->user_id : -1, cond != nullptr && cond->dir_name != nullptr ? cond->dir_name->data : "(all)", result != nullptr ? result->hit_num : 0u, result != nullptr ? result->set_num : 0u, static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataGetEventResult(const void* event_param, SaveDataEvent* event) {
|
||||
(void)event_param;
|
||||
if (event == nullptr) {
|
||||
@@ -225,7 +314,7 @@ int APS5_VABI sceSaveDataGetEventResult(const void* event_param, SaveDataEvent*
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataGetMountInfo(const SaveDataMountPoint* mount_point, SaveDataMountInfo* info) {
|
||||
static int getMountInfo(const SaveDataMountPoint* mount_point, SaveDataMountInfo* info) {
|
||||
if (mount_point == nullptr || info == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataGetMountInfo: null argument");
|
||||
}
|
||||
@@ -238,22 +327,39 @@ int APS5_VABI sceSaveDataGetMountInfo(const SaveDataMountPoint* mount_point, Sav
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataGetParam(const SaveDataMountPoint* mount_point, uint32_t param_type, void* param_buf, size_t param_buf_size, size_t* got_size) {
|
||||
(void)param_type;
|
||||
int APS5_VABI sceSaveDataGetMountInfo(const SaveDataMountPoint* mount_point, SaveDataMountInfo* info) {
|
||||
const int rc = getMountInfo(mount_point, info);
|
||||
SAVEDATA_TRACE("getMountInfo point=%s -> 0x%08x", mount_point != nullptr ? mount_point->data : "(null)", static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int getParam(const SaveDataMountPoint* mount_point, uint32_t param_type, void* param_buf, size_t param_buf_size, size_t* got_size) {
|
||||
if (mount_point == nullptr || param_buf == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataGetParam: null argument");
|
||||
}
|
||||
if (find_slot_by_mount_point(mount_point->data) == -1) {
|
||||
const int slot = find_slot_by_mount_point(mount_point->data);
|
||||
if (slot == -1) {
|
||||
return SAVE_DATA_ERROR_NOT_MOUNTED;
|
||||
}
|
||||
std::memset(param_buf, 0, param_buf_size);
|
||||
ParamField field{};
|
||||
if (!param_field(param_type, &field) || param_buf_size < field.size) {
|
||||
return SAVE_DATA_ERROR_PARAMETER;
|
||||
}
|
||||
const SaveDataParam param = load_param(g_slots[slot].real_path);
|
||||
std::memcpy(param_buf, reinterpret_cast<const char*>(¶m) + field.offset, field.size);
|
||||
if (got_size != nullptr) {
|
||||
*got_size = param_buf_size;
|
||||
*got_size = field.size;
|
||||
}
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataGetSaveDataMemory2(SaveDataMemoryGet2* get_param) {
|
||||
int APS5_VABI sceSaveDataGetParam(const SaveDataMountPoint* mount_point, uint32_t param_type, void* param_buf, size_t param_buf_size, size_t* got_size) {
|
||||
const int rc = getParam(mount_point, param_type, param_buf, param_buf_size, got_size);
|
||||
SAVEDATA_TRACE("getParam point=%s type=%u size=%zu -> 0x%08x got=%zu", mount_point != nullptr ? mount_point->data : "(null)", param_type, param_buf_size, static_cast<unsigned>(rc), got_size != nullptr ? *got_size : static_cast<size_t>(0));
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int getSaveDataMemory2(SaveDataMemoryGet2* get_param) {
|
||||
if (get_param == nullptr) {
|
||||
return SAVE_DATA_ERROR_PARAMETER;
|
||||
}
|
||||
@@ -283,10 +389,7 @@ int APS5_VABI sceSaveDataGetSaveDataMemory2(SaveDataMemoryGet2* get_param) {
|
||||
}
|
||||
if (get_param->param != nullptr) {
|
||||
std::memset(get_param->param, 0, sizeof(SaveDataParam));
|
||||
std::vector<char> pd;
|
||||
if (read_file_all(mem_path(get_param->user_id, get_param->slot_id, "param"), pd)) {
|
||||
std::memcpy(get_param->param, pd.data(), std::min(pd.size(), sizeof(SaveDataParam)));
|
||||
}
|
||||
read_param_file(mem_path(get_param->user_id, get_param->slot_id, "param"), get_param->param);
|
||||
}
|
||||
if (get_param->icon != nullptr) {
|
||||
get_param->icon->data_size = 0;
|
||||
@@ -294,6 +397,12 @@ int APS5_VABI sceSaveDataGetSaveDataMemory2(SaveDataMemoryGet2* get_param) {
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataGetSaveDataMemory2(SaveDataMemoryGet2* get_param) {
|
||||
const int rc = getSaveDataMemory2(get_param);
|
||||
SAVEDATA_TRACE("getMemory2 user=%d slot=%u -> 0x%08x", get_param != nullptr ? get_param->user_id : -1, get_param != nullptr ? get_param->slot_id : 0u, static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataInitialize3(const void* init) {
|
||||
(void)init;
|
||||
if (g_initialized) {
|
||||
@@ -317,7 +426,7 @@ int APS5_VABI sceSaveDataLoadIcon(const SaveDataMountPoint* mount_point, SaveDat
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataMount3(const SaveDataMount3* mount, SaveDataMountResult* mount_result) {
|
||||
static int mount3(const SaveDataMount3* mount, SaveDataMountResult* mount_result) {
|
||||
if (mount == nullptr || mount_result == nullptr || mount->dir_name == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataMount3: null argument");
|
||||
}
|
||||
@@ -360,7 +469,7 @@ int APS5_VABI sceSaveDataMount3(const SaveDataMount3* mount, SaveDataMountResult
|
||||
}
|
||||
// The title gets a short mount point (16 bytes on the PS5) and opens files under it; the
|
||||
// path resolver maps it to the save directory, whose name may be far longer.
|
||||
const std::string mountPoint = "/_sm/" + std::to_string(slot);
|
||||
const std::string mountPoint = "/savedata" + std::to_string(slot);
|
||||
AddPathAlias_nid_no_patch(mountPoint.c_str(), std::filesystem::absolute(real_path).string().c_str());
|
||||
g_slots[slot].used = true;
|
||||
g_slots[slot].mount_point = mountPoint;
|
||||
@@ -371,6 +480,12 @@ int APS5_VABI sceSaveDataMount3(const SaveDataMount3* mount, SaveDataMountResult
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataMount3(const SaveDataMount3* mount, SaveDataMountResult* mount_result) {
|
||||
const int rc = mount3(mount, mount_result);
|
||||
SAVEDATA_TRACE("mount3 user=%d dir=%s mode=0x%x blocks=%llu -> 0x%08x point=%s status=%u", mount != nullptr ? mount->user_id : -1, mount != nullptr && mount->dir_name != nullptr ? mount->dir_name->data : "(null)", mount != nullptr ? mount->mount_mode : 0u, mount != nullptr ? static_cast<unsigned long long>(mount->blocks) : 0ull, static_cast<unsigned>(rc), mount_result != nullptr ? mount_result->mount_point.data : "", mount_result != nullptr ? mount_result->mount_status : 0u);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataPrepare(const SaveDataMountPoint* mount_point, const SaveDataPrepareParam* param) {
|
||||
(void)mount_point;
|
||||
(void)param;
|
||||
@@ -394,20 +509,42 @@ int APS5_VABI sceSaveDataSaveIconByPath(const SaveDataMountPoint* mount_point, c
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataSetParam(const SaveDataMountPoint* mount_point, uint32_t param_type, const void* param_buf, size_t param_buf_size) {
|
||||
(void)param_type;
|
||||
(void)param_buf;
|
||||
(void)param_buf_size;
|
||||
if (mount_point == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataSetParam: null mount_point");
|
||||
static int setParam(const SaveDataMountPoint* mount_point, uint32_t param_type, const void* param_buf, size_t param_buf_size) {
|
||||
if (mount_point == nullptr || param_buf == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataSetParam: null argument");
|
||||
}
|
||||
if (find_slot_by_mount_point(mount_point->data) == -1) {
|
||||
const int slot = find_slot_by_mount_point(mount_point->data);
|
||||
if (slot == -1) {
|
||||
return SAVE_DATA_ERROR_NOT_MOUNTED;
|
||||
}
|
||||
return SAVE_DATA_OK;
|
||||
ParamField field{};
|
||||
if (!param_field(param_type, &field) || param_buf_size == 0 || (!field.text && param_buf_size < field.size)) {
|
||||
return SAVE_DATA_ERROR_PARAMETER;
|
||||
}
|
||||
SaveDataParam param = load_param(g_slots[slot].real_path);
|
||||
char* destination = reinterpret_cast<char*>(¶m) + field.offset;
|
||||
if (field.text) {
|
||||
const std::size_t length = std::min(param_buf_size, field.size - 1);
|
||||
const char* text = static_cast<const char*>(param_buf);
|
||||
const char* end = static_cast<const char*>(std::memchr(text, '\0', length));
|
||||
std::memset(destination, 0, field.size);
|
||||
std::memcpy(destination, text, end != nullptr ? static_cast<std::size_t>(end - text) : length);
|
||||
} else {
|
||||
std::memcpy(destination, param_buf, field.size);
|
||||
}
|
||||
if (param_type != SAVE_DATA_PARAM_TYPE_MTIME) {
|
||||
param.mtime = static_cast<std::int64_t>(std::time(nullptr));
|
||||
}
|
||||
return store_param(g_slots[slot].real_path, param) ? SAVE_DATA_OK : SAVE_DATA_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataSetSaveDataMemory2(const SaveDataMemorySet2* set_param) {
|
||||
int APS5_VABI sceSaveDataSetParam(const SaveDataMountPoint* mount_point, uint32_t param_type, const void* param_buf, size_t param_buf_size) {
|
||||
const int rc = setParam(mount_point, param_type, param_buf, param_buf_size);
|
||||
SAVEDATA_TRACE("setParam point=%s type=%u size=%zu -> 0x%08x", mount_point != nullptr ? mount_point->data : "(null)", param_type, param_buf_size, static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int setSaveDataMemory2(const SaveDataMemorySet2* set_param) {
|
||||
if (set_param == nullptr) {
|
||||
return SAVE_DATA_ERROR_PARAMETER;
|
||||
}
|
||||
@@ -457,7 +594,13 @@ int APS5_VABI sceSaveDataSetSaveDataMemory2(const SaveDataMemorySet2* set_param)
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataSetupSaveDataMemory2(const SaveDataMemorySetup2* setup_param, SaveDataMemorySetupResult* result) {
|
||||
int APS5_VABI sceSaveDataSetSaveDataMemory2(const SaveDataMemorySet2* set_param) {
|
||||
const int rc = setSaveDataMemory2(set_param);
|
||||
SAVEDATA_TRACE("setMemory2 user=%d slot=%u num=%u -> 0x%08x", set_param != nullptr ? set_param->user_id : -1, set_param != nullptr ? set_param->slot_id : 0u, set_param != nullptr ? set_param->data_num : 0u, static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int setupSaveDataMemory2(const SaveDataMemorySetup2* setup_param, SaveDataMemorySetupResult* result) {
|
||||
if (setup_param == nullptr) {
|
||||
return SAVE_DATA_ERROR_PARAMETER;
|
||||
}
|
||||
@@ -499,6 +642,12 @@ int APS5_VABI sceSaveDataSetupSaveDataMemory2(const SaveDataMemorySetup2* setup_
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataSetupSaveDataMemory2(const SaveDataMemorySetup2* setup_param, SaveDataMemorySetupResult* result) {
|
||||
const int rc = setupSaveDataMemory2(setup_param, result);
|
||||
SAVEDATA_TRACE("setupMemory2 user=%d slot=%u size=%zu -> 0x%08x existed=%zu", setup_param != nullptr ? setup_param->user_id : -1, setup_param != nullptr ? setup_param->slot_id : 0u, setup_param != nullptr ? setup_param->memory_size : static_cast<size_t>(0), static_cast<unsigned>(rc), result != nullptr ? result->existed_memory_size : static_cast<size_t>(0));
|
||||
return rc;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataSyncSaveDataMemory(const void* sync_param) {
|
||||
if (sync_param == nullptr) {
|
||||
return SAVE_DATA_ERROR_PARAMETER;
|
||||
@@ -525,7 +674,7 @@ int APS5_VABI sceSaveDataTerminate(void) {
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataTransferringMount(const SaveDataTransferringMount* mount, SaveDataMountResult* mount_result) {
|
||||
static int transferringMount(const SaveDataTransferringMount* mount, SaveDataMountResult* mount_result) {
|
||||
(void)mount;
|
||||
if (mount_result != nullptr) {
|
||||
std::memset(mount_result, 0, sizeof(*mount_result));
|
||||
@@ -534,7 +683,13 @@ int APS5_VABI sceSaveDataTransferringMount(const SaveDataTransferringMount* moun
|
||||
return SAVE_DATA_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataUmount2(uint32_t mode, const SaveDataMountPoint* mount_point) {
|
||||
int APS5_VABI sceSaveDataTransferringMount(const SaveDataTransferringMount* mount, SaveDataMountResult* mount_result) {
|
||||
const int rc = transferringMount(mount, mount_result);
|
||||
SAVEDATA_TRACE("transferringMount -> 0x%08x", static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int umount2(uint32_t mode, const SaveDataMountPoint* mount_point) {
|
||||
(void)mode;
|
||||
if (mount_point == nullptr) {
|
||||
throw std::runtime_error("sceSaveDataUmount2: null mount_point");
|
||||
@@ -548,4 +703,10 @@ int APS5_VABI sceSaveDataUmount2(uint32_t mode, const SaveDataMountPoint* mount_
|
||||
return SAVE_DATA_OK;
|
||||
}
|
||||
|
||||
int APS5_VABI sceSaveDataUmount2(uint32_t mode, const SaveDataMountPoint* mount_point) {
|
||||
const int rc = umount2(mode, mount_point);
|
||||
SAVEDATA_TRACE("umount2 mode=0x%x point=%s -> 0x%08x", mode, mount_point != nullptr ? mount_point->data : "(null)", static_cast<unsigned>(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ constexpr std::uint32_t SAVE_DATA_MOUNT_MODE_CREATE = 4;
|
||||
constexpr std::uint32_t SAVE_DATA_MOUNT_MODE_CREATE2 = 32;
|
||||
|
||||
constexpr std::uint64_t SAVE_DATA_BLOCKS_MAX = 32768;
|
||||
constexpr std::uint32_t SAVE_DATA_PARAM_TYPE_ALL = 0;
|
||||
constexpr std::uint32_t SAVE_DATA_PARAM_TYPE_TITLE = 1;
|
||||
constexpr std::uint32_t SAVE_DATA_PARAM_TYPE_SUB_TITLE = 2;
|
||||
constexpr std::uint32_t SAVE_DATA_PARAM_TYPE_DETAIL = 3;
|
||||
constexpr std::uint32_t SAVE_DATA_PARAM_TYPE_USER_PARAM = 4;
|
||||
constexpr std::uint32_t SAVE_DATA_PARAM_TYPE_MTIME = 5;
|
||||
|
||||
constexpr std::size_t SAVE_DATA_MOUNT_SLOTS = 16;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ extern "C" void NotImplemented_nid_no_patch(const char* funcName);
|
||||
extern "C" void CxaFinalize_nid_no_patch(void* dsoHandle);
|
||||
|
||||
extern "C" std::filesystem::path ResolvePath_nid_no_patch(const char* path);
|
||||
// Guest path aliases: a guest prefix such as "/_sm/0" (a save-data mount point) resolves to a host
|
||||
// Guest path aliases: a guest prefix such as "/savedata0" (a save-data mount point) resolves to a host
|
||||
// directory instead of the run directory; the prefix matches whole path components only.
|
||||
extern "C" void AddPathAlias_nid_no_patch(const char* guestPrefix, const char* hostPath);
|
||||
extern "C" void RemovePathAlias_nid_no_patch(const char* guestPrefix);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace {
|
||||
// Guest prefixes (without leading slashes) mapped to host directories, e.g. save-data mount points:
|
||||
// the PS5 hands the title a short mount point ("/_sm/0") whose files live under _sd/<dir name>.
|
||||
// the PS5 hands the title a short mount point ("/savedata0") whose files live under _sd/<dir name>.
|
||||
struct PathAliases {
|
||||
std::mutex mutex;
|
||||
std::vector<std::pair<std::string, std::string>> entries;
|
||||
|
||||
Reference in New Issue
Block a user