-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cellSaveData: Add autosave indicator #15720
Open
NicknineTheEagle
wants to merge
3
commits into
RPCS3:master
Choose a base branch
from
NicknineTheEagle:nn/auto-indicator
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+113
−13
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing default |
||
|
||
// 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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,12 +117,12 @@ namespace rsx | |
return compiled_resources; | ||
} | ||
|
||
void message_item::update(usz index, u64 timestamp_us, s16 y_offset) | ||
void message_item::update(usz index, u64 timestamp_us, s16 x_offset, s16 y_offset) | ||
{ | ||
if (m_cur_pos != index) | ||
{ | ||
m_cur_pos = index; | ||
set_pos(10, y_offset); | ||
set_pos(x_offset, y_offset); | ||
} | ||
|
||
if (!m_processed) | ||
|
@@ -198,18 +198,29 @@ namespace rsx | |
// Render reversed list. Oldest entries are furthest from the border | ||
constexpr u16 spacing = 4; | ||
s16 y_offset = 8; | ||
s16 x_offset = 10; | ||
usz index = 0; | ||
for (auto it = vis_set.rbegin(); it != vis_set.rend(); ++it, ++index) | ||
{ | ||
if (origin == message_pin_location::top) [[ likely ]] | ||
{ | ||
it->update(index, cur_time, y_offset); | ||
it->update(index, cur_time, x_offset, y_offset); | ||
y_offset += (spacing + it->h); | ||
} | ||
else | ||
else if (origin == message_pin_location::bottom) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a switch |
||
{ | ||
y_offset += (spacing + it->h); | ||
it->update(index, cur_time, x_offset, virtual_height - y_offset); | ||
} | ||
else if (origin == message_pin_location::top_right) | ||
{ | ||
it->update(index, cur_time, virtual_width - x_offset - it->w, y_offset); | ||
y_offset += (spacing + it->h); | ||
it->update(index, cur_time, virtual_height - y_offset); | ||
} | ||
else if (origin == message_pin_location::bottom_right) | ||
{ | ||
y_offset += (spacing + it->h); | ||
it->update(index, cur_time, virtual_width - x_offset - it->w, virtual_height - y_offset); | ||
} | ||
} | ||
} | ||
|
@@ -225,8 +236,11 @@ namespace rsx | |
|
||
update_queue(m_visible_items_top, m_ready_queue_top, message_pin_location::top); | ||
update_queue(m_visible_items_bottom, m_ready_queue_bottom, message_pin_location::bottom); | ||
update_queue(m_visible_items_top_right, m_ready_queue_top_right, message_pin_location::top_right); | ||
update_queue(m_visible_items_bottom_right, m_ready_queue_bottom_right, message_pin_location::bottom_right); | ||
|
||
visible = !m_visible_items_top.empty() || !m_visible_items_bottom.empty(); | ||
visible = !m_visible_items_top.empty() || !m_visible_items_bottom.empty() || | ||
!m_visible_items_top_right.empty() || !m_visible_items_bottom_right.empty(); | ||
} | ||
|
||
compiled_resource message::get_compiled() | ||
|
@@ -250,6 +264,16 @@ namespace rsx | |
cr.add(item.get_compiled()); | ||
} | ||
|
||
for (auto& item : m_visible_items_top_right) | ||
{ | ||
cr.add(item.get_compiled()); | ||
} | ||
|
||
for (auto& item : m_visible_items_bottom_right) | ||
{ | ||
cr.add(item.get_compiled()); | ||
} | ||
|
||
return cr; | ||
} | ||
|
||
|
@@ -287,6 +311,10 @@ namespace rsx | |
return check_list(m_ready_queue_top) || check_list(m_visible_items_top); | ||
case message_pin_location::bottom: | ||
return check_list(m_ready_queue_bottom) || check_list(m_visible_items_bottom); | ||
case message_pin_location::top_right: | ||
return check_list(m_ready_queue_top_right) || check_list(m_visible_items_top_right); | ||
case message_pin_location::bottom_right: | ||
return check_list(m_ready_queue_bottom_right) || check_list(m_visible_items_bottom_right); | ||
} | ||
|
||
return false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.