From 3de24014b8fb1f52c07d9c68f52c43aea0787a16 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 31 Mar 2025 00:46:08 +0200 Subject: [PATCH] cellSaveData: properly initialize SaveDataEntry --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 15 +++++++-------- rpcs3/rpcs3qt/save_manager_dialog.cpp | 3 +-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index be7583074a..8afee44408 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -244,7 +244,7 @@ static std::vector get_save_entries(const std::string& base_dir, continue; } - SaveDataEntry save_entry; + SaveDataEntry save_entry {}; save_entry.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); save_entry.listParam = psf::get_string(psf, "SAVEDATA_LIST_PARAM"); save_entry.title = psf::get_string(psf, "TITLE"); @@ -326,7 +326,7 @@ static error_code select_and_delete(ppu_thread& ppu) focused = save_entries.empty() ? -1 : selected; // Get information from the selected entry - SaveDataEntry entry = save_entries[selected]; + const SaveDataEntry& entry = ::at32(save_entries, selected); const std::string info = entry.title + "\n" + entry.subtitle + "\n" + entry.details; // Reusable display message string @@ -760,7 +760,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v result->userdata = userdata; // probably should be assigned only once (allows the callback to change it) - SaveDataEntry save_entry; + SaveDataEntry save_entry {}; if (setList) { @@ -820,7 +820,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v break; } - SaveDataEntry save_entry2; + SaveDataEntry save_entry2 {}; save_entry2.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); save_entry2.listParam = psf::get_string(psf, "SAVEDATA_LIST_PARAM"); save_entry2.title = psf::get_string(psf, "TITLE"); @@ -1214,8 +1214,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v else { // Get information from the selected entry - SaveDataEntry entry = save_entries[selected]; - message = get_confirmation_message(operation, entry); + message = get_confirmation_message(operation, ::at32(save_entries, selected)); } // Yield before a blocking dialog is being spawned @@ -1345,14 +1344,14 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v else { // Get information from the selected entry - SaveDataEntry entry = save_entries[selected]; - message = get_confirmation_message(operation, entry); + message = get_confirmation_message(operation, ::at32(save_entries, selected)); } // Yield before a blocking dialog is being spawned lv2_obj::sleep(ppu); // Get user confirmation by opening a blocking dialog + // TODO: show fixedSet->newIcon s32 return_code = CELL_MSGDIALOG_BUTTON_NONE; error_code res = open_msg_dialog(true, CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO, vm::make_str(message), msg_dialog_source::_cellSaveData, vm::null, vm::null, vm::null, &return_code); diff --git a/rpcs3/rpcs3qt/save_manager_dialog.cpp b/rpcs3/rpcs3qt/save_manager_dialog.cpp index 9e3b51b8e2..d3cd03f4ec 100644 --- a/rpcs3/rpcs3qt/save_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/save_manager_dialog.cpp @@ -270,13 +270,12 @@ std::vector save_manager_dialog::GetSaveEntries(const std::string return; } - SaveDataEntry save_entry2; + SaveDataEntry save_entry2 {}; save_entry2.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); save_entry2.listParam = psf::get_string(psf, "SAVEDATA_LIST_PARAM"); save_entry2.title = psf::get_string(psf, "TITLE"); save_entry2.subtitle = psf::get_string(psf, "SUB_TITLE"); save_entry2.details = psf::get_string(psf, "DETAIL"); - save_entry2.size = 0; for (const auto& entry2 : fs::dir(base_dir + entry.name)) {