mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
Handle a few more cellSaveData errors
* Check directory existence if setParam is NULL (dont create directory) * Fix mask for reCreateMode * Check a few setParam fields including reserved buffers. * Fix sizeKb when the dir is empty except from PARAM.SFO * Fix error checking when CELL_SAVEDATA_RECREATE_YES is specified but setParam is NULL (Doesnt do anything, simply errors)
This commit is contained in:
parent
6f76e34104
commit
9446bd2d3f
@ -767,7 +767,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
}
|
||||
|
||||
statGet->sysSizeKB = 35; // always reported as 35 regardless of actual file sizes
|
||||
statGet->sizeKB = size_kbytes ? size_kbytes + statGet->sysSizeKB : 0;
|
||||
statGet->sizeKB = !save_entry.isNew ? size_kbytes + statGet->sysSizeKB : 0;
|
||||
|
||||
// Stat Callback
|
||||
funcStat(ppu, result, statGet, statSet);
|
||||
@ -797,6 +797,30 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
|
||||
if (statSet->setParam)
|
||||
{
|
||||
if (statSet->setParam->attribute > CELL_SAVEDATA_ATTR_NODUPLICATE)
|
||||
{
|
||||
// ****** sysutil savedata parameter error : 57 ******
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
for (u8 resv : statSet->setParam->reserved2)
|
||||
{
|
||||
if (resv)
|
||||
{
|
||||
// ****** sysutil savedata parameter error : 58 ******
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
for (u8 resv : statSet->setParam->reserved)
|
||||
{
|
||||
if (resv)
|
||||
{
|
||||
// ****** sysutil savedata parameter error : 59 ******
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
// Update PARAM.SFO
|
||||
psf.clear();
|
||||
psf.insert(
|
||||
@ -816,14 +840,13 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
|
||||
has_modified = true;
|
||||
}
|
||||
//else if (psf.empty())
|
||||
//{
|
||||
// // setParam is specified if something required updating.
|
||||
// // Do not exit. Recreate mode will handle the rest
|
||||
// //return CELL_OK;
|
||||
//}
|
||||
else if (save_entry.isNew)
|
||||
{
|
||||
// ****** sysutil savedata parameter error : 50 ******
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
switch (const u32 mode = statSet->reCreateMode & 0xffff)
|
||||
switch (const u32 mode = statSet->reCreateMode & CELL_SAVEDATA_RECREATE_MASK)
|
||||
{
|
||||
case CELL_SAVEDATA_RECREATE_NO:
|
||||
{
|
||||
@ -841,6 +864,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
case CELL_SAVEDATA_RECREATE_YES:
|
||||
case CELL_SAVEDATA_RECREATE_YES_RESET_OWNER:
|
||||
{
|
||||
if (!statSet->setParam)
|
||||
{
|
||||
// ****** sysutil savedata parameter error : 50 ******
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
// TODO: Only delete data, not owner info
|
||||
for (const auto& entry : fs::dir(dir_path))
|
||||
@ -851,15 +879,6 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: probably not deleting owner info
|
||||
if (!statSet->setParam)
|
||||
{
|
||||
// Savedata deleted and setParam is NULL: delete directory and abort operation
|
||||
if (fs::remove_dir(dir_path)) cellSaveData.error("savedata_op(): savedata directory %s deleted", save_entry.dirName);
|
||||
|
||||
//return CELL_OK;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -86,12 +86,16 @@ enum
|
||||
CELL_SAVEDATA_FILETYPE_CONTENT_PIC1 = 4,
|
||||
CELL_SAVEDATA_FILETYPE_CONTENT_SND0 = 5,
|
||||
|
||||
// CellSaveDataSystemFileParam attribute
|
||||
CELL_SAVEDATA_ATTR_NORMAL = 0,
|
||||
CELL_SAVEDATA_ATTR_NODUPLICATE = 1,
|
||||
|
||||
// reCreateMode
|
||||
CELL_SAVEDATA_RECREATE_NO = 0,
|
||||
CELL_SAVEDATA_RECREATE_NO_NOBROKEN = 1,
|
||||
CELL_SAVEDATA_RECREATE_YES = 2,
|
||||
CELL_SAVEDATA_RECREATE_YES_RESET_OWNER = 3,
|
||||
CELL_SAVEDATA_RECREATE_MASK = 0xffff,
|
||||
CELL_SAVEDATA_RECREATE_MASK = 0xfffeffff,
|
||||
|
||||
// Version
|
||||
CELL_SAVEDATA_VERSION_OLD = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user