Save lib fixes III (#1069)

* SaveDataMemory: increase memory if needed

* SaveDataDialog: fix intention to hide save details
This commit is contained in:
Vinicius Rangel 2024-09-26 01:56:38 -03:00 committed by GitHub
parent 3d5a6203e1
commit ddb82a690b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 46 deletions

View file

@ -79,6 +79,7 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
this->title_id = item->titleId->data.to_string();
}
if (item->dirName != nullptr) {
for (u32 i = 0; i < item->dirNameNum; i++) {
const auto dir_name = item->dirName[i].data.to_view();
@ -119,7 +120,8 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
.dir_name = std::string{dir_name},
.icon = icon,
.title = std::string{param_sfo.GetString(SaveParams::MAINTITLE).value_or("Unknown")},
.title =
std::string{param_sfo.GetString(SaveParams::MAINTITLE).value_or("Unknown")},
.subtitle = std::string{param_sfo.GetString(SaveParams::SUBTITLE).value_or("")},
.details = std::string{param_sfo.GetString(SaveParams::DETAIL).value_or("")},
.date = date_str,
@ -129,6 +131,7 @@ SaveDialogState::SaveDialogState(const OrbisSaveDataDialogParam& param) {
.is_corrupted = is_corrupted,
});
}
}
if (type == DialogType::SAVE && item->newItem != nullptr) {
RefCountedTexture icon;
@ -299,7 +302,7 @@ SaveDialogState::ProgressBarState::ProgressBarState(const SaveDialogState& state
} else {
switch (bar.sysMsgType) {
case ProgressSystemMessageType::INVALID:
this->msg = "INVALID";
this->msg = "";
break;
case ProgressSystemMessageType::PROGRESS:
switch (state.type) {

View file

@ -268,9 +268,6 @@ bool TriggerSave() {
void ReadMemory(void* buf, size_t buf_size, int64_t offset) {
std::scoped_lock lk{g_saving_memory_mutex};
if (offset > g_save_memory.size()) {
UNREACHABLE_MSG("ReadMemory out of bounds");
}
if (offset + buf_size > g_save_memory.size()) {
UNREACHABLE_MSG("ReadMemory out of bounds");
}
@ -279,11 +276,8 @@ void ReadMemory(void* buf, size_t buf_size, int64_t offset) {
void WriteMemory(void* buf, size_t buf_size, int64_t offset) {
std::scoped_lock lk{g_saving_memory_mutex};
if (offset > g_save_memory.size()) {
UNREACHABLE_MSG("WriteMemory out of bounds");
}
if (offset + buf_size > g_save_memory.size()) {
UNREACHABLE_MSG("WriteMemory out of bounds");
g_save_memory.resize(offset + buf_size);
}
std::memcpy(g_save_memory.data() + offset, buf, buf_size);
g_memory_dirty = true;