cellSaveDataEnableOverlay

This commit is contained in:
Megamouse 2021-03-17 08:48:07 +01:00 committed by Ivan
parent 83fdcff178
commit 43ac33c2b4
6 changed files with 36 additions and 17 deletions

View file

@ -95,9 +95,10 @@ namespace
vm::gvar<savedata_context> g_savedata_context;
struct savedata_mutex
struct savedata_manager
{
semaphore<> mutex;
atomic_t<bool> enable_overlay;
};
static std::vector<SaveDataEntry> get_save_entries(const std::string& base_dir, const std::string& prefix)
@ -163,7 +164,7 @@ static std::vector<SaveDataEntry> get_save_entries(const std::string& base_dir,
static error_code select_and_delete(ppu_thread& ppu)
{
std::unique_lock lock(g_fxo->get<savedata_mutex>().mutex, std::try_to_lock);
std::unique_lock lock(g_fxo->get<savedata_manager>().mutex, std::try_to_lock);
if (!lock)
{
@ -185,7 +186,7 @@ static error_code select_and_delete(ppu_thread& ppu)
// Display a blocking Save Data List asynchronously in the GUI thread.
if (auto save_dialog = Emu.GetCallbacks().get_save_dialog())
{
selected = save_dialog->ShowSaveDataList(save_entries, focused, SAVEDATA_OP_LIST_DELETE, vm::null);
selected = save_dialog->ShowSaveDataList(save_entries, focused, SAVEDATA_OP_LIST_DELETE, vm::null, g_fxo->get<savedata_manager>().enable_overlay);
}
// Reschedule after a blocking dialog returns
@ -558,7 +559,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
return {CELL_SAVEDATA_ERROR_PARAM, std::to_string(ecode)};
}
std::unique_lock lock(g_fxo->get<savedata_mutex>().mutex, std::try_to_lock);
std::unique_lock lock(g_fxo->get<savedata_manager>().mutex, std::try_to_lock);
if (!lock)
{
@ -998,7 +999,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
// Display a blocking Save Data List asynchronously in the GUI thread.
if (auto save_dialog = Emu.GetCallbacks().get_save_dialog())
{
selected = save_dialog->ShowSaveDataList(save_entries, focused, operation, listSet);
selected = save_dialog->ShowSaveDataList(save_entries, focused, operation, listSet, g_fxo->get<savedata_manager>().enable_overlay);
}
else
{
@ -2284,7 +2285,9 @@ error_code cellSaveDataUserFixedDelete(ppu_thread& ppu, u32 userId, PSetList set
void cellSaveDataEnableOverlay(s32 enable)
{
cellSaveData.todo("cellSaveDataEnableOverlay(enable=%d)", enable);
cellSaveData.notice("cellSaveDataEnableOverlay(enable=%d)", enable);
auto& manager = g_fxo->get<savedata_manager>();
manager.enable_overlay = enable != 0;
}