mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 22:28:45 +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 <magic_enum.hpp>
|
||||||
|
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
|
#include "common/string_util.h"
|
||||||
#include "core/file_sys/fs.h"
|
#include "core/file_sys/fs.h"
|
||||||
#include "core/libraries/save_data/save_instance.h"
|
#include "core/libraries/save_data/save_instance.h"
|
||||||
#include "imgui/imgui_std.h"
|
#include "imgui/imgui_std.h"
|
||||||
|
@ -46,11 +47,13 @@ void SaveDialogResult::CopyTo(OrbisSaveDataDialogResult& result) const {
|
||||||
result.mode = this->mode;
|
result.mode = this->mode;
|
||||||
result.result = this->result;
|
result.result = this->result;
|
||||||
result.buttonId = this->button_id;
|
result.buttonId = this->button_id;
|
||||||
if (result.dirName != nullptr) {
|
if (has_item) {
|
||||||
result.dirName->data.FromString(this->dir_name);
|
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 (result.param != nullptr && this->param.GetString(SaveParams::MAINTITLE).has_value()) {
|
||||||
|
result.param->FromSFO(this->param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result.userData = this->user_data;
|
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;
|
RefCountedTexture icon;
|
||||||
std::string title{"New Save"};
|
std::string title{"New Save"};
|
||||||
|
|
||||||
const auto new_item = item->newItem;
|
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;
|
auto buf = (u8*)new_item->iconBuf;
|
||||||
icon = RefCountedTexture::DecodePngTexture({buf, buf + new_item->iconSize});
|
icon = RefCountedTexture::DecodePngTexture({buf, buf + new_item->iconSize});
|
||||||
} else {
|
} else {
|
||||||
|
@ -141,7 +144,7 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
|
||||||
icon = RefCountedTexture::DecodePngFile(src_icon);
|
icon = RefCountedTexture::DecodePngFile(src_icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (new_item != nullptr && new_item->title != nullptr) {
|
if (new_item->title != nullptr) {
|
||||||
title = std::string{new_item->title};
|
title = std::string{new_item->title};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,8 +353,11 @@ void SaveDialogUi::Finish(ButtonId buttonId, Result r) {
|
||||||
result->result = r;
|
result->result = r;
|
||||||
result->button_id = buttonId;
|
result->button_id = buttonId;
|
||||||
result->user_data = this->state->user_data;
|
result->user_data = this->state->user_data;
|
||||||
if (state && state->mode != SaveDataDialogMode::LIST && !state->save_list.empty()) {
|
if (state) {
|
||||||
result->dir_name = state->save_list.front().dir_name;
|
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) {
|
if (status) {
|
||||||
|
|
|
@ -201,6 +201,7 @@ struct SaveDialogResult {
|
||||||
std::string dir_name{};
|
std::string dir_name{};
|
||||||
PSF param{};
|
PSF param{};
|
||||||
void* user_data{};
|
void* user_data{};
|
||||||
|
bool has_item{false};
|
||||||
|
|
||||||
void CopyTo(OrbisSaveDataDialogResult& result) const;
|
void CopyTo(OrbisSaveDataDialogResult& result) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue