Savestate: Make selector dismissible by opening pause menu

This commit is contained in:
KamFretoZ 2024-09-29 20:09:07 +07:00 committed by Ty
parent 58a26dbca4
commit c1eecb3512
3 changed files with 14 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#include "ImGui/FullscreenUI.h"
#include "ImGui/ImGuiFullscreen.h"
#include "ImGui/ImGuiManager.h"
#include "ImGui/ImGuiOverlays.h"
#include "Input/InputManager.h"
#include "MTGS.h"
#include "Patch.h"
@ -716,6 +717,12 @@ void FullscreenUI::OpenPauseMenu()
if (!VMManager::HasValidVM())
return;
if (SaveStateSelectorUI::IsOpen())
{
SaveStateSelectorUI::Close();
return;
}
MTGS::RunOnGSThread([]() {
if (!ImGuiManager::InitializeFullscreenUI() || s_current_main_window != MainWindowType::None)
return;

View File

@ -752,6 +752,7 @@ namespace SaveStateSelectorUI
static void RefreshHotkeyLegend();
static void Draw();
static void ShowSlotOSDMessage();
bool IsOpen();
static constexpr const char* DATE_TIME_FORMAT = TRANSLATE_NOOP("ImGuiOverlays", "Saved at {0:%H:%M} on {0:%a} {0:%Y/%m/%d}.");
@ -800,6 +801,10 @@ void SaveStateSelectorUI::Open(float open_time /* = DEFAULT_OPEN_TIME */)
RefreshHotkeyLegend();
}
bool SaveStateSelectorUI::IsOpen(){
return s_open;
}
void SaveStateSelectorUI::Close()
{
s_open = false;

View File

@ -12,13 +12,14 @@ namespace ImGuiManager
namespace SaveStateSelectorUI
{
static constexpr float DEFAULT_OPEN_TIME = 7.5f;
static constexpr float DEFAULT_OPEN_TIME = 5.0f;
void Open(float open_time = DEFAULT_OPEN_TIME);
void RefreshList(const std::string& serial, u32 crc);
void DestroyTextures();
void Clear();
void Close();
bool IsOpen();
void SelectNextSlot(bool open_selector);
void SelectPreviousSlot(bool open_selector);