From 9d8fc6195460d45e8a24dae87afc8d2495322633 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 1 Apr 2024 22:31:25 +0300 Subject: [PATCH] sceSaveDataMount2 just return save data not found for now --- src/core/libraries/libscecommondialog.cpp | 2 +- src/core/libraries/libscesavedata.cpp | 13 +++++++-- src/core/libraries/libscesavedata.h | 34 ++++++++++++++++++++++- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/core/libraries/libscecommondialog.cpp b/src/core/libraries/libscecommondialog.cpp index f940401d..2d1ea97a 100644 --- a/src/core/libraries/libscecommondialog.cpp +++ b/src/core/libraries/libscecommondialog.cpp @@ -84,7 +84,7 @@ int PS4_SYSV_ABI _ZTVN3sce16CommonDialogUtil6ClientE() { } int PS4_SYSV_ABI sceCommonDialogInitialize() { - LOG_ERROR(Lib_CommonDlg, "(STUBBED) called"); + LOG_ERROR(Lib_CommonDlg, "(DUMMY) called"); return ORBIS_OK; } diff --git a/src/core/libraries/libscesavedata.cpp b/src/core/libraries/libscesavedata.cpp index e3ae6e35..89dd1e7d 100644 --- a/src/core/libraries/libscesavedata.cpp +++ b/src/core/libraries/libscesavedata.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Generated By moduleGenerator +#include #include "common/logging/log.h" #include "error_codes.h" #include "libscesavedata.h" @@ -328,9 +329,15 @@ int PS4_SYSV_ABI sceSaveDataMount() { return ORBIS_OK; } -int PS4_SYSV_ABI sceSaveDataMount2() { - LOG_ERROR(Lib_SaveData, "(STUBBED) called"); - return ORBIS_OK; +s32 PS4_SYSV_ABI sceSaveDataMount2(const OrbisSaveDataMount2* mount, + OrbisSaveDataMountResult* mount_result) { + // will return save data not found , breakpoint for others + LOG_ERROR(Lib_SaveData, "(DUMMY) called user_id = {} dir_name = {} blocks = {} mount_mode = {}", + mount->user_id, mount->dir_name->data, mount->blocks, mount->mount_mode); + if (mount->mount_mode == 1) { // open + return 0x809F0008; // save data not found + } + UNREACHABLE(); } int PS4_SYSV_ABI sceSaveDataMount5() { diff --git a/src/core/libraries/libscesavedata.h b/src/core/libraries/libscesavedata.h index 93f902c1..a15e4f84 100644 --- a/src/core/libraries/libscesavedata.h +++ b/src/core/libraries/libscesavedata.h @@ -7,6 +7,37 @@ namespace Libraries::SaveData { +constexpr int ORBIS_SAVE_DATA_DIRNAME_DATA_MAXSIZE = + 32; // Maximum size for a save data directory name +constexpr int ORBIS_SAVE_DATA_MOUNT_POINT_DATA_MAXSIZE = 16; // Maximum size for a mount point name + +struct OrbisSaveDataDirName { + char data[ORBIS_SAVE_DATA_DIRNAME_DATA_MAXSIZE]; +}; + +struct OrbisSaveDataMount2 { + s32 user_id; + s32 unk1; + const OrbisSaveDataDirName* dir_name; + u64 blocks; + u32 mount_mode; + u8 reserved[32]; + s32 unk2; +}; + +struct OrbisSaveDataMountPoint { + char data[ORBIS_SAVE_DATA_MOUNT_POINT_DATA_MAXSIZE]; +}; + +struct OrbisSaveDataMountResult { + OrbisSaveDataMountPoint mount_point; + u64 required_blocks; + u32 unused; + u32 mount_status; + u8 reserved[28]; + s32 unk1; +}; + int PS4_SYSV_ABI sceSaveDataAbort(); int PS4_SYSV_ABI sceSaveDataBackup(); int PS4_SYSV_ABI sceSaveDataBindPsnAccount(); @@ -71,7 +102,8 @@ int PS4_SYSV_ABI sceSaveDataIsDeletingUsbDb(); int PS4_SYSV_ABI sceSaveDataIsMounted(); int PS4_SYSV_ABI sceSaveDataLoadIcon(); int PS4_SYSV_ABI sceSaveDataMount(); -int PS4_SYSV_ABI sceSaveDataMount2(); +s32 PS4_SYSV_ABI sceSaveDataMount2(const OrbisSaveDataMount2* mount, + OrbisSaveDataMountResult* mount_result); int PS4_SYSV_ABI sceSaveDataMount5(); int PS4_SYSV_ABI sceSaveDataMountInternal(); int PS4_SYSV_ABI sceSaveDataMountSys();