mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
NoGUI: Start in fullscreen when option or command line flag is set
This commit is contained in:
parent
23e102b90a
commit
590513350c
|
@ -58,7 +58,7 @@ void DRMHostInterface::FixIncompatibleSettings(bool display_osd_messages)
|
|||
g_settings.confim_power_off = false;
|
||||
}
|
||||
|
||||
bool DRMHostInterface::CreatePlatformWindow()
|
||||
bool DRMHostInterface::CreatePlatformWindow(bool fullscreen)
|
||||
{
|
||||
Assert(!m_drm_display);
|
||||
m_drm_display = std::make_unique<DRMDisplay>();
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
protected:
|
||||
virtual void FixIncompatibleSettings(bool display_osd_messages) override;
|
||||
|
||||
bool CreatePlatformWindow() override;
|
||||
bool CreatePlatformWindow(bool fullscreen) override;
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ bool NoGUIHostInterface::Initialize()
|
|||
|
||||
CreateImGuiContext();
|
||||
|
||||
if (!CreatePlatformWindow())
|
||||
const bool start_fullscreen = m_command_line_flags.start_fullscreen || g_settings.start_fullscreen;
|
||||
if (!CreatePlatformWindow(start_fullscreen))
|
||||
{
|
||||
Log_ErrorPrintf("Failed to create platform window");
|
||||
ImGui::DestroyContext();
|
||||
|
@ -264,12 +265,14 @@ bool NoGUIHostInterface::AcquireHostDisplay()
|
|||
|
||||
if (needs_switch)
|
||||
{
|
||||
const bool was_fullscreen = IsFullscreen();
|
||||
|
||||
ImGui::EndFrame();
|
||||
DestroyDisplay();
|
||||
|
||||
// We need to recreate the window, otherwise bad things happen...
|
||||
DestroyPlatformWindow();
|
||||
if (!CreatePlatformWindow())
|
||||
if (!CreatePlatformWindow(was_fullscreen))
|
||||
Panic("Failed to recreate platform window on GPU renderer switch");
|
||||
|
||||
if (!CreateDisplay())
|
||||
|
|
|
@ -55,7 +55,7 @@ protected:
|
|||
void RequestExit() override;
|
||||
virtual void PollAndUpdate() override;
|
||||
|
||||
virtual bool CreatePlatformWindow() = 0;
|
||||
virtual bool CreatePlatformWindow(bool fullscreen) = 0;
|
||||
virtual void DestroyPlatformWindow() = 0;
|
||||
virtual std::optional<WindowInfo> GetPlatformWindowInfo() = 0;
|
||||
void OnPlatformWindowResized(u32 new_width, u32 new_height, float new_scale);
|
||||
|
|
|
@ -131,7 +131,7 @@ ALWAYS_INLINE static TinyString GetWindowTitle()
|
|||
return TinyString::FromFormat("DuckStation %s (%s)", g_scm_tag_str, g_scm_branch_str);
|
||||
}
|
||||
|
||||
bool SDLHostInterface::CreatePlatformWindow()
|
||||
bool SDLHostInterface::CreatePlatformWindow(bool fullscreen)
|
||||
{
|
||||
// Create window.
|
||||
const u32 window_flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
|
@ -165,8 +165,11 @@ bool SDLHostInterface::CreatePlatformWindow()
|
|||
SDL_FreeSurface(icon_surface);
|
||||
}
|
||||
|
||||
if (m_fullscreen)
|
||||
if (fullscreen || m_fullscreen)
|
||||
{
|
||||
SDL_SetWindowFullscreen(m_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
m_fullscreen = true;
|
||||
}
|
||||
|
||||
ImGui_ImplSDL2_Init(m_window);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
|||
|
||||
std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const override;
|
||||
|
||||
bool CreatePlatformWindow() override;
|
||||
bool CreatePlatformWindow(bool fullscreen) override;
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ bool Win32HostInterface::RegisterWindowClass()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Win32HostInterface::CreatePlatformWindow()
|
||||
bool Win32HostInterface::CreatePlatformWindow(bool fullscreen)
|
||||
{
|
||||
m_hwnd = CreateWindowExW(WS_EX_CLIENTEDGE, WINDOW_CLASS_NAME, _T("DuckStation"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, nullptr, nullptr,
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
static std::unique_ptr<NoGUIHostInterface> Create();
|
||||
|
||||
protected:
|
||||
bool CreatePlatformWindow() override;
|
||||
bool CreatePlatformWindow(bool fullscreen) override;
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
|
||||
|
|
|
@ -304,6 +304,7 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[],
|
|||
else if (CHECK_ARG("-fullscreen"))
|
||||
{
|
||||
Log_InfoPrintf("Going fullscreen after booting.");
|
||||
m_command_line_flags.start_fullscreen = true;
|
||||
force_fullscreen = true;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -405,6 +405,9 @@ protected:
|
|||
|
||||
// disable controller interface (buggy devices with SDL)
|
||||
BitField<u8, bool, 1, 1> disable_controller_interface;
|
||||
|
||||
// starting fullscreen (outside of boot options)
|
||||
BitField<u8, bool, 2, 1> start_fullscreen;
|
||||
} m_command_line_flags = {};
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue