Skip to content

Commit 6e27b8a

Browse files
committed
FullscreenUI: Add option to start/open to game list
1 parent 3d0f038 commit 6e27b8a

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

‎src/core/fullscreen_ui.cpp‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ static void DestroyResources();
253253
//////////////////////////////////////////////////////////////////////////
254254
// Landing
255255
//////////////////////////////////////////////////////////////////////////
256+
static bool ShouldOpenToGameList();
256257
static void SwitchToLanding();
257258
static ImGuiFullscreen::FileSelectorFilters GetDiscImageFilters();
258259
static ImGuiFullscreen::FileSelectorFilters GetImageFilters();
@@ -678,11 +679,8 @@ bool FullscreenUI::Initialize()
678679
s_state.initialized = true;
679680
s_state.hotkey_list_cache = InputManager::GetHotkeyList();
680681

681-
if (s_state.current_main_window == MainWindowType::None && !GPUThread::HasGPUBackend() &&
682-
!GPUThread::IsGPUBackendRequested())
683-
{
684-
SwitchToLanding();
685-
}
682+
const bool open_main_window = (s_state.current_main_window == MainWindowType::None && !GPUThread::HasGPUBackend() &&
683+
!GPUThread::IsGPUBackendRequested());
686684

687685
// in case we open the pause menu while the game is running
688686
if (GPUThread::HasGPUBackend())
@@ -697,7 +695,10 @@ bool FullscreenUI::Initialize()
697695
}
698696

699697
LoadBackground();
700-
UpdateRunIdleState();
698+
699+
if (open_main_window)
700+
ReturnToMainWindow();
701+
701702
ForceKeyNavEnabled();
702703
return true;
703704
}
@@ -778,8 +779,7 @@ void FullscreenUI::OnSystemDestroyed()
778779
s_state.pause_menu_was_open = false;
779780
s_state.was_paused_on_quick_menu_open = false;
780781
s_state.current_pause_submenu = PauseSubMenu::None;
781-
SwitchToLanding();
782-
UpdateRunIdleState();
782+
ReturnToMainWindow();
783783
});
784784
}
785785

@@ -1079,7 +1079,9 @@ void FullscreenUI::ReturnToPreviousWindow()
10791079
void FullscreenUI::ReturnToMainWindow()
10801080
{
10811081
ClosePauseMenu();
1082-
s_state.current_main_window = GPUThread::HasGPUBackend() ? MainWindowType::None : MainWindowType::Landing;
1082+
s_state.current_main_window = GPUThread::HasGPUBackend() ?
1083+
MainWindowType::None :
1084+
(ShouldOpenToGameList() ? MainWindowType::GameList : MainWindowType::Landing);
10831085
UpdateRunIdleState();
10841086
FixStateIfPaused();
10851087
}
@@ -1743,6 +1745,11 @@ void FullscreenUI::DrawBackground()
17431745
}
17441746
}
17451747

1748+
bool FullscreenUI::ShouldOpenToGameList()
1749+
{
1750+
return Host::GetBaseBoolSettingValue("Main", "FullscreenUIOpenToGameList", false);
1751+
}
1752+
17461753
void FullscreenUI::SwitchToLanding()
17471754
{
17481755
s_state.current_main_window = MainWindowType::Landing;
@@ -3802,6 +3809,11 @@ void FullscreenUI::DrawInterfaceSettingsPage()
38023809
});
38033810
}
38043811

3812+
DrawToggleSetting(
3813+
bsi, FSUI_ICONSTR(ICON_FA_LIST, "Open To Game List"),
3814+
FSUI_CSTR("When Big Picture mode is started, the game list will be displayed instead of the main menu."), "Main",
3815+
"FullscreenUIOpenToGameList", false);
3816+
38053817
if (DrawToggleSetting(
38063818
bsi, FSUI_ICONSTR(ICON_PF_GAMEPAD, "Use DualShock/DualSense Button Icons"),
38073819
FSUI_CSTR(
@@ -7419,7 +7431,7 @@ void FullscreenUI::DrawGameListWindow()
74197431
BeginNavBar();
74207432

74217433
if (NavButton(ICON_PF_NAVIGATION_BACK, true, true))
7422-
ReturnToPreviousWindow();
7434+
SwitchToLanding();
74237435

74247436
NavTitle(Host::TranslateToCString(TR_CONTEXT, titles[static_cast<u32>(s_state.game_list_view)]));
74257437
RightAlignNavButtons(count, ITEM_WIDTH, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
@@ -7499,7 +7511,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
74997511
}
75007512

75017513
if (!AreAnyDialogsOpen() && WantsToCloseMenu())
7502-
ReturnToPreviousWindow();
7514+
SwitchToLanding();
75037515

75047516
auto game_list_lock = GameList::GetLock();
75057517
const GameList::Entry* selected_entry = nullptr;
@@ -7751,7 +7763,7 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
77517763
}
77527764

77537765
if (ImGui::IsWindowFocused() && WantsToCloseMenu())
7754-
ReturnToPreviousWindow();
7766+
SwitchToLanding();
77557767

77567768
ResetFocusHere();
77577769
BeginMenuButtons();
@@ -9086,6 +9098,7 @@ TRANSLATE_NOOP("FullscreenUI", "OK");
90869098
TRANSLATE_NOOP("FullscreenUI", "OSD Scale");
90879099
TRANSLATE_NOOP("FullscreenUI", "On-Screen Display");
90889100
TRANSLATE_NOOP("FullscreenUI", "Open Containing Directory");
9101+
TRANSLATE_NOOP("FullscreenUI", "Open To Game List");
90899102
TRANSLATE_NOOP("FullscreenUI", "Open in File Browser");
90909103
TRANSLATE_NOOP("FullscreenUI", "Operations");
90919104
TRANSLATE_NOOP("FullscreenUI", "Optimal Frame Pacing");
@@ -9364,6 +9377,7 @@ TRANSLATE_NOOP("FullscreenUI", "Vertical Sync (VSync)");
93649377
TRANSLATE_NOOP("FullscreenUI", "WARNING: Activating cheats can cause unpredictable behavior, crashing, soft-locks, or broken saved games.");
93659378
TRANSLATE_NOOP("FullscreenUI", "WARNING: Activating game patches can cause unpredictable behavior, crashing, soft-locks, or broken saved games.");
93669379
TRANSLATE_NOOP("FullscreenUI", "WARNING: Your game is still saving to the memory card. Continuing to {0} may IRREVERSIBLY DESTROY YOUR MEMORY CARD. We recommend resuming your game and waiting 5 seconds for it to finish saving.\n\nDo you want to {0} anyway?");
9380+
TRANSLATE_NOOP("FullscreenUI", "When Big Picture mode is started, the game list will be displayed instead of the main menu.");
93679381
TRANSLATE_NOOP("FullscreenUI", "When enabled and logged in, DuckStation will scan for achievements on startup.");
93689382
TRANSLATE_NOOP("FullscreenUI", "When enabled, DuckStation will assume all achievements are locked and not send any unlock notifications to the server.");
93699383
TRANSLATE_NOOP("FullscreenUI", "When enabled, DuckStation will list achievements from unofficial sets. These achievements are not tracked by RetroAchievements.");

0 commit comments

Comments
 (0)