mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
cellSaveData: Implement/Fix param error 22 for funcFile, funcDone, funcFixed and funcList
This commit is contained in:
parent
08ab9c4b04
commit
30f7c81cc5
1 changed files with 61 additions and 68 deletions
|
@ -251,19 +251,15 @@ static error_code select_and_delete(ppu_thread& ppu)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Displays a CellSaveDataCBResult error message.
|
// Displays a CellSaveDataCBResult error message.
|
||||||
static error_code display_callback_result_error_message(ppu_thread& ppu, vm::ptr<CellSaveDataCBResult> result, u32 errDialog)
|
static error_code display_callback_result_error_message(ppu_thread& ppu, const CellSaveDataCBResult& result, u32 errDialog)
|
||||||
{
|
{
|
||||||
// TODO: errDialog == CELL_SAVEDATA_ERRDIALOG_NOREPEAT
|
|
||||||
if (!result || errDialog != CELL_SAVEDATA_ERRDIALOG_ALWAYS)
|
|
||||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
|
||||||
|
|
||||||
std::string msg;
|
std::string msg;
|
||||||
bool use_invalid_message = false;
|
bool use_invalid_message = false;
|
||||||
|
|
||||||
switch (result->result)
|
switch (result.result)
|
||||||
{
|
{
|
||||||
case CELL_SAVEDATA_CBRESULT_ERR_NOSPACE:
|
case CELL_SAVEDATA_CBRESULT_ERR_NOSPACE:
|
||||||
msg = fmt::format("Error - Insufficient free space\n\nSpace needed: %d KB", result->errNeedSizeKB);
|
msg = fmt::format("Error - Insufficient free space\n\nSpace needed: %d KB", result.errNeedSizeKB);
|
||||||
break;
|
break;
|
||||||
case CELL_SAVEDATA_CBRESULT_ERR_FAILURE:
|
case CELL_SAVEDATA_CBRESULT_ERR_FAILURE:
|
||||||
msg = "Error - Failed to save or load";
|
msg = "Error - Failed to save or load";
|
||||||
|
@ -275,18 +271,23 @@ static error_code display_callback_result_error_message(ppu_thread& ppu, vm::ptr
|
||||||
msg = "Error - Save data cannot be found";
|
msg = "Error - Save data cannot be found";
|
||||||
break;
|
break;
|
||||||
case CELL_SAVEDATA_CBRESULT_ERR_INVALID:
|
case CELL_SAVEDATA_CBRESULT_ERR_INVALID:
|
||||||
if (result->invalidMsg)
|
if (result.invalidMsg)
|
||||||
use_invalid_message = true;
|
use_invalid_message = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
// ****** sysutil savedata parameter error : 22 ******
|
||||||
|
return {CELL_SAVEDATA_ERROR_PARAM, "22"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: errDialog == CELL_SAVEDATA_ERRDIALOG_NOREPEAT
|
||||||
|
if (errDialog != CELL_SAVEDATA_ERRDIALOG_ALWAYS)
|
||||||
|
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||||
|
|
||||||
// Yield before a blocking dialog is being spawned
|
// Yield before a blocking dialog is being spawned
|
||||||
lv2_obj::sleep(ppu);
|
lv2_obj::sleep(ppu);
|
||||||
|
|
||||||
// Get user confirmation by opening a blocking dialog (return value should be irrelevant here)
|
// Get user confirmation by opening a blocking dialog (return value should be irrelevant here)
|
||||||
error_code res = open_msg_dialog(true, CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK, use_invalid_message ? result->invalidMsg : vm::make_str(msg));
|
error_code res = open_msg_dialog(true, CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK, use_invalid_message ? result.invalidMsg : vm::make_str(msg));
|
||||||
|
|
||||||
// Reschedule after a blocking dialog returns
|
// Reschedule after a blocking dialog returns
|
||||||
if (ppu.check_state())
|
if (ppu.check_state())
|
||||||
|
@ -684,13 +685,10 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
// List Callback
|
// List Callback
|
||||||
funcList(ppu, result, listGet, listSet);
|
funcList(ppu, result, listGet, listSet);
|
||||||
|
|
||||||
if (result->result < 0)
|
if (const s32 res = result->result; res != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
||||||
{
|
{
|
||||||
cellSaveData.warning("savedata_op(): funcList returned result=%d.", result->result);
|
cellSaveData.warning("savedata_op(): funcList returned result=%d.", result->result);
|
||||||
|
|
||||||
return display_callback_result_error_message(ppu, result, errDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the callback has returned ok, lets return OK.
|
// if the callback has returned ok, lets return OK.
|
||||||
// typically used at game launch when no list is actually required.
|
// typically used at game launch when no list is actually required.
|
||||||
// CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM is only valid for funcFile and funcDone
|
// CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM is only valid for funcFile and funcDone
|
||||||
|
@ -699,6 +697,9 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return display_callback_result_error_message(ppu, *result, errDialog);
|
||||||
|
}
|
||||||
|
|
||||||
// Clean save data list
|
// Clean save data list
|
||||||
save_entries.erase(std::remove_if(save_entries.begin(), save_entries.end(), [&listSet](const SaveDataEntry& entry) -> bool
|
save_entries.erase(std::remove_if(save_entries.begin(), save_entries.end(), [&listSet](const SaveDataEntry& entry) -> bool
|
||||||
{
|
{
|
||||||
|
@ -895,18 +896,18 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
{
|
{
|
||||||
delete_save();
|
delete_save();
|
||||||
|
|
||||||
if (result->result < 0)
|
if (const s32 res = result->result; res != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
||||||
{
|
{
|
||||||
cellSaveData.warning("savedata_op(): funcDone returned result=%d.", result->result);
|
cellSaveData.warning("savedata_op(): funcDone returned result=%d.", res);
|
||||||
|
|
||||||
return display_callback_result_error_message(ppu, result, errDialog);
|
if (res == CELL_SAVEDATA_CBRESULT_OK_LAST || res == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM)
|
||||||
}
|
|
||||||
|
|
||||||
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST || result->result == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM)
|
|
||||||
{
|
{
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return display_callback_result_error_message(ppu, *result, errDialog);
|
||||||
|
}
|
||||||
|
|
||||||
// CELL_SAVEDATA_CBRESULT_OK_NEXT expected
|
// CELL_SAVEDATA_CBRESULT_OK_NEXT expected
|
||||||
save_entries.erase(save_entries.cbegin() + selected);
|
save_entries.erase(save_entries.cbegin() + selected);
|
||||||
focused = save_entries.empty() ? -1 : selected;
|
focused = save_entries.empty() ? -1 : selected;
|
||||||
|
@ -924,24 +925,17 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
// Fixed Callback
|
// Fixed Callback
|
||||||
funcFixed(ppu, result, listGet, fixedSet);
|
funcFixed(ppu, result, listGet, fixedSet);
|
||||||
|
|
||||||
// check result for validity - CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM is not a valid result for funcFixed
|
if (const s32 res = result->result; res != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
||||||
if (result->result < CELL_SAVEDATA_CBRESULT_ERR_INVALID || result->result >= CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM)
|
|
||||||
{
|
{
|
||||||
cellSaveData.error("savedata_op(): funcFixed returned result=%d.", result->result);
|
cellSaveData.warning("savedata_op(): funcFixed returned result=%d.", res);
|
||||||
return CELL_SAVEDATA_ERROR_PARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip all following steps if OK_LAST
|
// skip all following steps if OK_LAST (NOCONFIRM is not allowed)
|
||||||
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST)
|
if (res == CELL_SAVEDATA_CBRESULT_OK_LAST)
|
||||||
{
|
{
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->result < 0)
|
return display_callback_result_error_message(ppu, *result, errDialog);
|
||||||
{
|
|
||||||
cellSaveData.warning("savedata_op(): funcFixed returned result=%d.", result->result);
|
|
||||||
|
|
||||||
return display_callback_result_error_message(ppu, result, errDialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fixedSet->dirName)
|
if (!fixedSet->dirName)
|
||||||
|
@ -1008,11 +1002,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
{
|
{
|
||||||
delete_save();
|
delete_save();
|
||||||
|
|
||||||
if (result->result < 0)
|
if (const s32 res = result->result; res != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
||||||
{
|
{
|
||||||
cellSaveData.warning("savedata_op(): funcDone_ returned result=%d.", result->result);
|
cellSaveData.warning("savedata_op(): funcDone returned result=%d.", res);
|
||||||
|
|
||||||
return display_callback_result_error_message(ppu, result, errDialog);
|
return display_callback_result_error_message(ppu, *result, errDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -1178,27 +1172,17 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
// Stat Callback
|
// Stat Callback
|
||||||
funcStat(ppu, result, statGet, statSet);
|
funcStat(ppu, result, statGet, statSet);
|
||||||
|
|
||||||
if (result->result != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
if (const s32 res = result->result; res != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
||||||
{
|
{
|
||||||
cellSaveData.warning("savedata_op(): funcStat returned result=%d.", result->result);
|
cellSaveData.warning("savedata_op(): funcStat returned result=%d.", res);
|
||||||
|
|
||||||
// Skip and error
|
// Skip and return without error on OK_LAST (NOCONFIRM is not allowed)
|
||||||
if (result->result >= CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM || result->result < CELL_SAVEDATA_CBRESULT_ERR_INVALID)
|
if (res == CELL_SAVEDATA_CBRESULT_OK_LAST)
|
||||||
{
|
|
||||||
// ****** sysutil savedata parameter error : 22 ******
|
|
||||||
return {CELL_SAVEDATA_ERROR_PARAM, "22"};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result->result < CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
|
||||||
{
|
|
||||||
return display_callback_result_error_message(ppu, result, errDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip and return without error
|
|
||||||
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST)
|
|
||||||
{
|
{
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return display_callback_result_error_message(ppu, *result, errDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statSet->setParam)
|
if (statSet->setParam)
|
||||||
|
@ -1338,15 +1322,24 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
|
|
||||||
funcFile(ppu, result, fileGet, fileSet);
|
funcFile(ppu, result, fileGet, fileSet);
|
||||||
|
|
||||||
if (result->result < 0)
|
if (const s32 res = result->result; res != CELL_SAVEDATA_CBRESULT_OK_NEXT)
|
||||||
{
|
{
|
||||||
savedata_result = {CELL_SAVEDATA_ERROR_CBRESULT, +result->result};
|
if (res == CELL_SAVEDATA_CBRESULT_OK_LAST || res == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM)
|
||||||
|
{
|
||||||
|
// TODO: display user prompt
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST || result->result == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM)
|
cellSaveData.warning("savedata_op(): funcFile returned result=%d.", res);
|
||||||
|
|
||||||
|
if (res < CELL_SAVEDATA_CBRESULT_ERR_INVALID || res > CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM)
|
||||||
{
|
{
|
||||||
// TODO: display user prompt
|
// ****** sysutil savedata parameter error : 22 ******
|
||||||
|
savedata_result = {CELL_SAVEDATA_ERROR_PARAM, "22"};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
savedata_result = {CELL_SAVEDATA_ERROR_CBRESULT, res};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1592,7 +1585,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
|
|
||||||
if (savedata_result + 0u == CELL_SAVEDATA_ERROR_CBRESULT)
|
if (savedata_result + 0u == CELL_SAVEDATA_ERROR_CBRESULT)
|
||||||
{
|
{
|
||||||
return display_callback_result_error_message(ppu, result, errDialog);
|
return display_callback_result_error_message(ppu, *result, errDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
return savedata_result;
|
return savedata_result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue