mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-02 00:33:16 +00:00
core/libraries/save_data: Fix inaccurate behaviour on sceSaveDataSetupSaveDataMemory
(#913)
This commit is contained in:
parent
5c5c02cb04
commit
febc1a9e17
1 changed files with 11 additions and 3 deletions
|
@ -769,13 +769,21 @@ int PS4_SYSV_ABI sceSaveDataSetupSaveDataMemory(u32 userId, size_t memorySize,
|
||||||
|
|
||||||
LOG_INFO(Lib_SaveData, "called:userId = {}, memorySize = {}", userId, memorySize);
|
LOG_INFO(Lib_SaveData, "called:userId = {}, memorySize = {}", userId, memorySize);
|
||||||
|
|
||||||
|
if (param == nullptr) {
|
||||||
|
return ORBIS_SAVE_DATA_ERROR_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) /
|
const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) /
|
||||||
std::to_string(userId) / game_serial / "sdmemory";
|
std::to_string(userId) / game_serial / "sdmemory";
|
||||||
|
|
||||||
if (std::filesystem::exists(mount_dir)) {
|
if (!std::filesystem::exists(mount_dir)) {
|
||||||
return ORBIS_SAVE_DATA_ERROR_EXISTS;
|
std::filesystem::create_directories(mount_dir);
|
||||||
}
|
}
|
||||||
std::filesystem::create_directories(mount_dir);
|
|
||||||
|
// NOTE: Reminder that games can pass params:
|
||||||
|
// memset(param, 0, sizeof(param_t));
|
||||||
|
// strncpy(param->title, "Beach Buggy Racing", 127);
|
||||||
|
|
||||||
std::vector<u8> buf(memorySize);
|
std::vector<u8> buf(memorySize);
|
||||||
Common::FS::IOFile::WriteBytes(mount_dir / "save_mem1.sav", buf);
|
Common::FS::IOFile::WriteBytes(mount_dir / "save_mem1.sav", buf);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue