Rewrite Save Data & Impl Save Data Dialog (#824)

* core: Rewrite PSF parser & add encoder

add .sfo hex pattern to /scripts

* core/fs: allow to mount path as read-only

* common: Add CString wrapper to handle native null-terminated strings

* SaveData: rewrite to implement full functionality

* mock value for SYSTEM_VER

* SavaData: backup features

* SavaData: SaveDataMemory features

* imgui Ref-counted textures

- has a background thread to decode textures

* imgui: rework gamepad navigation

* PSF: fixed psf not using enum class for PSFEntryFmt (was a standard old ugly enum)

- Add null check to CString when itself is used in a nullable field

* SaveDataDialog implementation

- Fix Mounting/Unmounting check of SaveInstance
This commit is contained in:
Vinicius Rangel
2024-09-20 06:34:19 -03:00
committed by GitHub
parent 077f8981a7
commit 0f4bcd8c83
51 changed files with 4919 additions and 1134 deletions

View File

@@ -90,37 +90,32 @@ int PS4_SYSV_ABI sceAppContentAddcontUnmount() {
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAppContentAppParamGetInt(OrbisAppContentAppParamId paramId, s32* value) {
if (value == nullptr)
int PS4_SYSV_ABI sceAppContentAppParamGetInt(OrbisAppContentAppParamId paramId, s32* out_value) {
if (out_value == nullptr)
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
auto* param_sfo = Common::Singleton<PSF>::Instance();
std::optional<s32> value;
switch (paramId) {
case ORBIS_APP_CONTENT_APPPARAM_ID_SKU_FLAG:
*value = ORBIS_APP_CONTENT_APPPARAM_SKU_FLAG_FULL;
value = ORBIS_APP_CONTENT_APPPARAM_SKU_FLAG_FULL;
break;
case ORBIS_APP_CONTENT_APPPARAM_ID_USER_DEFINED_PARAM_1:
*value = param_sfo->GetInteger("USER_DEFINED_PARAM_1");
value = param_sfo->GetInteger("USER_DEFINED_PARAM_1");
break;
case ORBIS_APP_CONTENT_APPPARAM_ID_USER_DEFINED_PARAM_2:
*value = param_sfo->GetInteger("USER_DEFINED_PARAM_2");
value = param_sfo->GetInteger("USER_DEFINED_PARAM_2");
break;
case ORBIS_APP_CONTENT_APPPARAM_ID_USER_DEFINED_PARAM_3:
*value = param_sfo->GetInteger("USER_DEFINED_PARAM_3");
value = param_sfo->GetInteger("USER_DEFINED_PARAM_3");
break;
case ORBIS_APP_CONTENT_APPPARAM_ID_USER_DEFINED_PARAM_4:
*value = param_sfo->GetInteger("USER_DEFINED_PARAM_4");
value = param_sfo->GetInteger("USER_DEFINED_PARAM_4");
break;
default:
LOG_ERROR(Lib_AppContent, " paramId = {}, value = {} paramId is not valid", paramId,
*value);
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
if (*value == -1) {
LOG_ERROR(Lib_AppContent,
" paramId = {}, value = {} value is not valid can't read param.sfo?", paramId,
*value);
LOG_ERROR(Lib_AppContent, " paramId = {} paramId is not valid", paramId);
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
*out_value = value.value_or(0);
return ORBIS_OK;
}
@@ -251,7 +246,7 @@ int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initPar
auto* param_sfo = Common::Singleton<PSF>::Instance();
const auto addons_dir = Common::FS::GetUserPath(Common::FS::PathType::AddonsDir);
title_id = param_sfo->GetString("TITLE_ID");
title_id = *param_sfo->GetString("TITLE_ID");
auto addon_path = addons_dir / title_id;
if (std::filesystem::exists(addon_path)) {
for (const auto& entry : std::filesystem::directory_iterator(addon_path)) {