MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / display_callback_result_error_message

Function display_callback_result_error_message

ps3fw/cellSaveData.cpp:417–476  ·  view source on GitHub ↗

Displays a CellSaveDataCBResult error message.

Source from the content-addressed store, hash-verified

415
416// Displays a CellSaveDataCBResult error message.
417static error_code display_callback_result_error_message(
418 ppu_thread& ppu, const CellSaveDataCBResult& result, u32 errDialog)
419{
420 std::string msg;
421 bool use_invalid_message = false;
422
423 switch (result.result)
424 {
425 case CELL_SAVEDATA_CBRESULT_ERR_NOSPACE:
426 msg = get_localized_string(localized_string_id::CELL_SAVEDATA_CB_NO_SPACE,
427 fmt::format("%d", result.errNeedSizeKB).c_str());
428 break;
429 case CELL_SAVEDATA_CBRESULT_ERR_FAILURE:
430 msg = get_localized_string(localized_string_id::CELL_SAVEDATA_CB_FAILURE);
431 break;
432 case CELL_SAVEDATA_CBRESULT_ERR_BROKEN:
433 msg = get_localized_string(localized_string_id::CELL_SAVEDATA_CB_BROKEN);
434 break;
435 case CELL_SAVEDATA_CBRESULT_ERR_NODATA:
436 msg = get_localized_string(localized_string_id::CELL_SAVEDATA_CB_NO_DATA);
437 break;
438 case CELL_SAVEDATA_CBRESULT_ERR_INVALID:
439 if (result.invalidMsg)
440 use_invalid_message = true;
441 break;
442 default:
443 // ****** sysutil savedata parameter error : 22 ******
444 return {CELL_SAVEDATA_ERROR_PARAM, "22"};
445 }
446
447 if (errDialog == CELL_SAVEDATA_ERRDIALOG_NONE ||
448 (errDialog == CELL_SAVEDATA_ERRDIALOG_NOREPEAT &&
449 result.result ==
450 g_fxo->get<savedata_manager>().last_cbresult_error_dialog.exchange(
451 result.result)))
452 {
453 // TODO: Find out if the "last error" is always tracked or only when
454 // NOREPEAT is set
455 return CELL_SAVEDATA_ERROR_CBRESULT;
456 }
457
458 // Yield before a blocking dialog is being spawned
459 lv2_obj::sleep(ppu);
460
461 // Get user confirmation by opening a blocking dialog (return value should be
462 // irrelevant here)
463 [[maybe_unused]] error_code res = open_msg_dialog(
464 true,
465 CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK,
466 use_invalid_message ? result.invalidMsg : vm::make_str(msg),
467 msg_dialog_source::_cellSaveData);
468
469 // Reschedule after a blocking dialog returns
470 if (ppu.check_state())
471 {
472 return 0;
473 }
474

Callers 1

error_code savedata_opFunction · 0.85

Calls 7

get_localized_stringFunction · 0.85
open_msg_dialogFunction · 0.85
make_strFunction · 0.85
c_strMethod · 0.80
formatEnum · 0.50
exchangeMethod · 0.45
check_stateMethod · 0.45

Tested by

no test coverage detected