mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
cellSaveData: prevent some potential crashes due to corrupt files
This commit is contained in:
parent
08333e0876
commit
cc21d1b3cf
2 changed files with 33 additions and 33 deletions
|
|
@ -151,11 +151,11 @@ static std::vector<SaveDataEntry> get_save_entries(const std::string& base_dir,
|
|||
}
|
||||
|
||||
SaveDataEntry save_entry;
|
||||
save_entry.dirName = psf.at("SAVEDATA_DIRECTORY").as_string();
|
||||
save_entry.listParam = psf.at("SAVEDATA_LIST_PARAM").as_string();
|
||||
save_entry.title = psf.at("TITLE").as_string();
|
||||
save_entry.subtitle = psf.at("SUB_TITLE").as_string();
|
||||
save_entry.details = psf.at("DETAIL").as_string();
|
||||
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");
|
||||
save_entry.subtitle = psf::get_string(psf, "SUB_TITLE");
|
||||
save_entry.details = psf::get_string(psf, "DETAIL");
|
||||
|
||||
for (const auto& entry2 : fs::dir(base_dir + entry.name))
|
||||
{
|
||||
|
|
@ -678,11 +678,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
|||
}
|
||||
|
||||
SaveDataEntry save_entry2;
|
||||
save_entry2.dirName = psf.at("SAVEDATA_DIRECTORY").as_string();
|
||||
save_entry2.listParam = psf.at("SAVEDATA_LIST_PARAM").as_string();
|
||||
save_entry2.title = psf.at("TITLE").as_string();
|
||||
save_entry2.subtitle = psf.at("SUB_TITLE").as_string();
|
||||
save_entry2.details = psf.at("DETAIL").as_string();
|
||||
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");
|
||||
|
||||
for (const auto& entry2 : fs::dir(base_dir + entry.name))
|
||||
{
|
||||
|
|
@ -1291,8 +1291,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
|||
// This section contains the list of files in the save ordered as they would be in BSD filesystem
|
||||
std::vector<std::string> blist;
|
||||
|
||||
if (psf.count("RPCS3_BLIST"))
|
||||
blist = fmt::split(psf.at("RPCS3_BLIST").as_string(), {"/"}, false);
|
||||
if (const auto it = psf.find("RPCS3_BLIST"); it != psf.cend())
|
||||
blist = fmt::split(it->second.as_string(), {"/"}, false);
|
||||
|
||||
// Get save stats
|
||||
{
|
||||
|
|
@ -1318,12 +1318,12 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
|||
|
||||
if (!psf.empty())
|
||||
{
|
||||
statGet->getParam.parental_level = psf.at("PARENTAL_LEVEL").as_integer();
|
||||
statGet->getParam.attribute = psf.at("ATTRIBUTE").as_integer(); // ???
|
||||
strcpy_trunc(statGet->getParam.title, save_entry.title = psf.at("TITLE").as_string());
|
||||
strcpy_trunc(statGet->getParam.subTitle, save_entry.subtitle = psf.at("SUB_TITLE").as_string());
|
||||
strcpy_trunc(statGet->getParam.detail, save_entry.details = psf.at("DETAIL").as_string());
|
||||
strcpy_trunc(statGet->getParam.listParam, save_entry.listParam = psf.at("SAVEDATA_LIST_PARAM").as_string());
|
||||
statGet->getParam.parental_level = psf::get_integer(psf, "PARENTAL_LEVEL");
|
||||
statGet->getParam.attribute = psf::get_integer(psf, "ATTRIBUTE"); // ???
|
||||
strcpy_trunc(statGet->getParam.title, save_entry.title = psf::get_string(psf, "TITLE"));
|
||||
strcpy_trunc(statGet->getParam.subTitle, save_entry.subtitle = psf::get_string(psf, "SUB_TITLE"));
|
||||
strcpy_trunc(statGet->getParam.detail, save_entry.details = psf::get_string(psf, "DETAIL"));
|
||||
strcpy_trunc(statGet->getParam.listParam, save_entry.listParam = psf::get_string(psf, "SAVEDATA_LIST_PARAM"));
|
||||
}
|
||||
|
||||
statGet->bind = 0;
|
||||
|
|
@ -2056,14 +2056,14 @@ static NEVER_INLINE error_code savedata_get_list_item(vm::cptr<char> dirName, vm
|
|||
return CELL_SAVEDATA_ERROR_NODATA;
|
||||
}
|
||||
|
||||
auto psf = psf::load_object(fs::file(sfo));
|
||||
const psf::registry psf = psf::load_object(fs::file(sfo));
|
||||
|
||||
if (sysFileParam)
|
||||
{
|
||||
strcpy_trunc(sysFileParam->listParam, psf.at("SAVEDATA_LIST_PARAM").as_string());
|
||||
strcpy_trunc(sysFileParam->title, psf.at("TITLE").as_string());
|
||||
strcpy_trunc(sysFileParam->subTitle, psf.at("SUB_TITLE").as_string());
|
||||
strcpy_trunc(sysFileParam->detail, psf.at("DETAIL").as_string());
|
||||
strcpy_trunc(sysFileParam->listParam, psf::get_string(psf, "SAVEDATA_LIST_PARAM"));
|
||||
strcpy_trunc(sysFileParam->title, psf::get_string(psf, "TITLE"));
|
||||
strcpy_trunc(sysFileParam->subTitle, psf::get_string(psf, "SUB_TITLE"));
|
||||
strcpy_trunc(sysFileParam->detail, psf::get_string(psf, "DETAIL"));
|
||||
}
|
||||
|
||||
if (dir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue