From a3961750a7174be7402fc492367f017d845b8e1f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 3 Oct 2018 23:03:13 +1000 Subject: Drop Host_GetRenderSurface and pass display to backend --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Source/Core/DolphinNoGUI/MainNoGUI.cpp') diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 5097b1b8f9..60c037e005 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -71,6 +71,9 @@ public: } virtual void Shutdown() {} virtual ~Platform() {} + + virtual void* GetDisplayHandle() { return nullptr; } + virtual void* GetWindowHandle() { return nullptr; } }; static Platform* platform; @@ -91,12 +94,6 @@ void Host_Message(HostMessageID id) updateMainFrameEvent.Set(); } -static void* s_window_handle = nullptr; -void* Host_GetRenderHandle() -{ - return s_window_handle; -} - void Host_UpdateTitle(const std::string& title) { platform->SetTitle(title); @@ -187,7 +184,6 @@ class PlatformX11 : public Platform } XMapRaised(dpy, win); XFlush(dpy); - s_window_handle = (void*)win; if (SConfig::GetInstance().bDisableScreenSaver) X11Utils::InhibitScreensaver(win, true); @@ -354,6 +350,10 @@ class PlatformX11 : public Platform XCloseDisplay(dpy); } + + void* GetDisplayHandle() override { return static_cast(dpy); } + + void* GetWindowHandle() override { return reinterpret_cast(win); } }; #endif @@ -433,6 +433,9 @@ int main(int argc, char* argv[]) DolphinAnalytics::Instance()->ReportDolphinStart("nogui"); + boot->display_connection = platform->GetDisplayHandle(); + boot->render_surface = platform->GetWindowHandle(); + if (!BootManager::BootCore(std::move(boot))) { fprintf(stderr, "Could not boot the specified file\n"); -- cgit v1.2.3 From 1d827a52234974f308e71e86cdd6f61293e0523f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 3 Oct 2018 23:03:16 +1000 Subject: Renderer: Pull dimensions from GLInterface/Swapchain --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'Source/Core/DolphinNoGUI/MainNoGUI.cpp') diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 60c037e005..6447f6948b 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -209,9 +209,6 @@ class PlatformX11 : public Platform void MainLoop() override { bool fullscreen = SConfig::GetInstance().bFullscreen; - int last_window_width = SConfig::GetInstance().iRenderWindowWidth; - int last_window_height = SConfig::GetInstance().iRenderWindowHeight; - if (fullscreen) { rendererIsFullscreen = X11Utils::ToggleFullscreen(dpy, win); @@ -311,14 +308,8 @@ class PlatformX11 : public Platform break; case ConfigureNotify: { - if (last_window_width != event.xconfigure.width || - last_window_height != event.xconfigure.height) - { - last_window_width = event.xconfigure.width; - last_window_height = event.xconfigure.height; - if (g_renderer) - g_renderer->ResizeSurface(last_window_width, last_window_height); - } + if (g_renderer) + g_renderer->ResizeSurface(); } break; } -- cgit v1.2.3 From eb284b5d661cab6aed770e0e51b790917249ef21 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 3 Oct 2018 23:03:22 +1000 Subject: VideoBackends: Pass window system info from host on creation --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Source/Core/DolphinNoGUI/MainNoGUI.cpp') diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 6447f6948b..6cd71bd353 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -72,8 +72,9 @@ public: virtual void Shutdown() {} virtual ~Platform() {} - virtual void* GetDisplayHandle() { return nullptr; } - virtual void* GetWindowHandle() { return nullptr; } + virtual WindowSystemType GetWindowSystem() const { return WindowSystemType::Headless; } + virtual void* GetDisplayHandle() const { return nullptr; } + virtual void* GetWindowHandle() const { return nullptr; } }; static Platform* platform; @@ -342,9 +343,9 @@ class PlatformX11 : public Platform XCloseDisplay(dpy); } - void* GetDisplayHandle() override { return static_cast(dpy); } - - void* GetWindowHandle() override { return reinterpret_cast(win); } + WindowSystemType GetWindowSystem() const override { return WindowSystemType::X11; } + void* GetDisplayHandle() const override { return static_cast(dpy); } + void* GetWindowHandle() const override { return reinterpret_cast(win); } }; #endif @@ -424,10 +425,10 @@ int main(int argc, char* argv[]) DolphinAnalytics::Instance()->ReportDolphinStart("nogui"); - boot->display_connection = platform->GetDisplayHandle(); - boot->render_surface = platform->GetWindowHandle(); + WindowSystemInfo wsi(platform->GetWindowSystem(), platform->GetDisplayHandle(), + platform->GetWindowHandle()); - if (!BootManager::BootCore(std::move(boot))) + if (!BootManager::BootCore(std::move(boot), wsi)) { fprintf(stderr, "Could not boot the specified file\n"); return 1; -- cgit v1.2.3