1
0
mirror of https://github.com/RPCS3/rpcs3 synced 2024-07-03 08:08:42 +00:00

cellSaveData: Add autosave indicator

This commit is contained in:
NicknineTheEagle 2024-06-22 14:40:48 +03:00
parent fb06a7d5d0
commit abf454718f
3 changed files with 52 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/Modules/cellSysutil.h"
#include "Emu/Cell/Modules/cellUserInfo.h"
#include "Emu/RSX/Overlays/overlay_message.h"
#include "cellSaveData.h"
#include "cellMsgDialog.h"
@ -1750,6 +1751,48 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
fileGet->excSize = 0;
// show indicator for automatic save or auto load interactions if the game requests it (statSet->indicator)
const bool show_auto_indicator = operation <= SAVEDATA_OP_LIST_AUTO_LOAD && statSet && statSet->indicator;
if (show_auto_indicator)
{
auto msg_text = localized_string_id::INVALID;
if (operation == SAVEDATA_OP_AUTO_SAVE || operation == SAVEDATA_OP_LIST_AUTO_SAVE)
{
msg_text = localized_string_id::CELL_SAVEDATA_AUTOSAVE;
}
else if (operation == SAVEDATA_OP_AUTO_LOAD || operation == SAVEDATA_OP_LIST_AUTO_LOAD)
{
msg_text = localized_string_id::CELL_SAVEDATA_AUTOLOAD;
}
u32 indicator_pos = (statSet->indicator->dispPosition & 0x0F);
auto msg_location = rsx::overlays::message_pin_location::top;
switch (indicator_pos)
{
case CELL_SAVEDATA_INDICATORPOS_UPPER_LEFT:
msg_location = rsx::overlays::message_pin_location::top;
break;
case CELL_SAVEDATA_INDICATORPOS_LOWER_LEFT:
msg_location = rsx::overlays::message_pin_location::bottom;
break;
case CELL_SAVEDATA_INDICATORPOS_UPPER_RIGHT:
msg_location = rsx::overlays::message_pin_location::top_right;
break;
case CELL_SAVEDATA_INDICATORPOS_LOWER_RIGHT:
msg_location = rsx::overlays::message_pin_location::bottom_right;
break;
}
// TODO: Blinking variants
// RPCS3 saves basically instantaneously so there's not much point in showing auto indicator
// WHILE saving is in progress. Instead we show the indicator for 3 seconds to let the user
// know when the game autosaves.
rsx::overlays::queue_message(msg_text, 3'000'000, {}, msg_location);
}
error_code savedata_result = CELL_OK;
u64 delay_save_until = 0;
@ -2098,6 +2141,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
fs::remove_all(old_path);
}
if (show_auto_indicator)
{
// auto indicator should be hidden here if save/load throttling is added
}
if (savedata_result + 0u == CELL_SAVEDATA_ERROR_CBRESULT)
{
return display_callback_result_error_message(ppu, *result, errDialog);

View File

@ -132,6 +132,8 @@ enum class localized_string_id
CELL_SAVEDATA_SAVE,
CELL_SAVEDATA_LOAD,
CELL_SAVEDATA_OVERWRITE,
CELL_SAVEDATA_AUTOSAVE,
CELL_SAVEDATA_AUTOLOAD,
CELL_CROSS_CONTROLLER_MSG,
CELL_CROSS_CONTROLLER_FW_MSG,

View File

@ -159,6 +159,8 @@ private:
case localized_string_id::CELL_SAVEDATA_DELETE: return tr("Delete this data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_SAVEDATA_LOAD: return tr("Load this data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_SAVEDATA_OVERWRITE: return tr("Do you want to overwrite the saved data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_SAVEDATA_AUTOSAVE: return tr("Saving...");
case localized_string_id::CELL_SAVEDATA_AUTOLOAD: return tr("Loading...");
case localized_string_id::CELL_CROSS_CONTROLLER_MSG: return tr("Start [%0] on the PS Vita system.\nIf you have not installed [%0], go to [Remote Play] on the PS Vita system and start [Cross-Controller] from the LiveArea™ screen.", "Cross-Controller message").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_CROSS_CONTROLLER_FW_MSG: return tr("If your system software version on the PS Vita system is earlier than 1.80, you must update the system software to the latest version.", "Cross-Controller firmware message");
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE: return tr("Select Message", "RECVMESSAGE_DIALOG");