Displays a CellSaveDataCBResult error message.
| 415 | |
| 416 | // Displays a CellSaveDataCBResult error message. |
| 417 | static 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 |
no test coverage detected