mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-22 04:24:44 +00:00
SaveData: Fix issue with old firmwares
This commit is contained in:
parent
a73efdad30
commit
0ee1d37f0f
3 changed files with 18 additions and 10 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <magic_enum.hpp>
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/save_data/save_instance.h"
|
||||
#include "imgui/imgui_std.h"
|
||||
|
@ -46,11 +47,13 @@ void SaveDialogResult::CopyTo(OrbisSaveDataDialogResult& result) const {
|
|||
result.mode = this->mode;
|
||||
result.result = this->result;
|
||||
result.buttonId = this->button_id;
|
||||
if (result.dirName != nullptr) {
|
||||
result.dirName->data.FromString(this->dir_name);
|
||||
}
|
||||
if (result.param != nullptr && this->param.GetString(SaveParams::MAINTITLE).has_value()) {
|
||||
result.param->FromSFO(this->param);
|
||||
if (has_item) {
|
||||
if (result.dirName != nullptr) {
|
||||
result.dirName->data.FromString(this->dir_name);
|
||||
}
|
||||
if (result.param != nullptr && this->param.GetString(SaveParams::MAINTITLE).has_value()) {
|
||||
result.param->FromSFO(this->param);
|
||||
}
|
||||
}
|
||||
result.userData = this->user_data;
|
||||
}
|
||||
|
@ -127,12 +130,12 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
|
|||
});
|
||||
}
|
||||
|
||||
if (type == DialogType::SAVE) {
|
||||
if (type == DialogType::SAVE && item->newItem != nullptr) {
|
||||
RefCountedTexture icon;
|
||||
std::string title{"New Save"};
|
||||
|
||||
const auto new_item = item->newItem;
|
||||
if (new_item != nullptr && new_item->iconBuf && new_item->iconSize) {
|
||||
if (new_item->iconBuf && new_item->iconSize) {
|
||||
auto buf = (u8*)new_item->iconBuf;
|
||||
icon = RefCountedTexture::DecodePngTexture({buf, buf + new_item->iconSize});
|
||||
} else {
|
||||
|
@ -141,7 +144,7 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
|
|||
icon = RefCountedTexture::DecodePngFile(src_icon);
|
||||
}
|
||||
}
|
||||
if (new_item != nullptr && new_item->title != nullptr) {
|
||||
if (new_item->title != nullptr) {
|
||||
title = std::string{new_item->title};
|
||||
}
|
||||
|
||||
|
@ -350,8 +353,11 @@ void SaveDialogUi::Finish(ButtonId buttonId, Result r) {
|
|||
result->result = r;
|
||||
result->button_id = buttonId;
|
||||
result->user_data = this->state->user_data;
|
||||
if (state && state->mode != SaveDataDialogMode::LIST && !state->save_list.empty()) {
|
||||
result->dir_name = state->save_list.front().dir_name;
|
||||
if (state) {
|
||||
if (state->mode != SaveDataDialogMode::LIST && !state->save_list.empty()) {
|
||||
result->dir_name = state->save_list.front().dir_name;
|
||||
}
|
||||
result->has_item = state->mode == SaveDataDialogMode::LIST || !state->save_list.empty();
|
||||
}
|
||||
}
|
||||
if (status) {
|
||||
|
|
|
@ -201,6 +201,7 @@ struct SaveDialogResult {
|
|||
std::string dir_name{};
|
||||
PSF param{};
|
||||
void* user_data{};
|
||||
bool has_item{false};
|
||||
|
||||
void CopyTo(OrbisSaveDataDialogResult& result) const;
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue