From ac9f7426bc9100a2ead3cfe937bd0d164db48fe3 Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Tue, 19 Jul 2022 11:15:39 -0600 Subject: [PATCH] update gui --- mupen64plus-gui/interface/core_commands.cpp | 1 + mupen64plus-gui/interface/core_commands.h | 1 + mupen64plus-gui/mainwindow.cpp | 1 + mupen64plus-gui/vkwindow.cpp | 18 ++++++++++++++++-- mupen64plus-gui/vkwindow.h | 3 +++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mupen64plus-gui/interface/core_commands.cpp b/mupen64plus-gui/interface/core_commands.cpp index ddd0138..1a48646 100644 --- a/mupen64plus-gui/interface/core_commands.cpp +++ b/mupen64plus-gui/interface/core_commands.cpp @@ -17,5 +17,6 @@ ptr_ConfigGetParamString ConfigGetParamString = nullptr; ptr_ConfigSetParameter ConfigSetParameter = nullptr; ptr_ConfigDeleteSection ConfigDeleteSection = nullptr; ptr_ConfigOpenSection ConfigOpenSection = nullptr; +ptr_ConfigSaveSection ConfigSaveSection = nullptr; ptr_ConfigListParameters ConfigListParameters = nullptr; ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = nullptr; diff --git a/mupen64plus-gui/interface/core_commands.h b/mupen64plus-gui/interface/core_commands.h index b592eb0..e151857 100644 --- a/mupen64plus-gui/interface/core_commands.h +++ b/mupen64plus-gui/interface/core_commands.h @@ -21,6 +21,7 @@ extern ptr_ConfigGetParamString ConfigGetParamString; extern ptr_ConfigSetParameter ConfigSetParameter; extern ptr_ConfigDeleteSection ConfigDeleteSection; extern ptr_ConfigOpenSection ConfigOpenSection; +extern ptr_ConfigSaveSection ConfigSaveSection; extern ptr_ConfigListParameters ConfigListParameters; extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath; #endif diff --git a/mupen64plus-gui/mainwindow.cpp b/mupen64plus-gui/mainwindow.cpp index 07bf717..b7c6284 100644 --- a/mupen64plus-gui/mainwindow.cpp +++ b/mupen64plus-gui/mainwindow.cpp @@ -980,6 +980,7 @@ void MainWindow::loadCoreLib() ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(coreLib, "ConfigSetParameter"); ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(coreLib, "ConfigDeleteSection"); ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(coreLib, "ConfigOpenSection"); + ConfigSaveSection = (ptr_ConfigSaveSection) osal_dynlib_getproc(coreLib, "ConfigSaveSection"); ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(coreLib, "ConfigListParameters"); ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) osal_dynlib_getproc(coreLib, "ConfigGetSharedDataFilepath"); diff --git a/mupen64plus-gui/vkwindow.cpp b/mupen64plus-gui/vkwindow.cpp index 4cd9216..2b55117 100644 --- a/mupen64plus-gui/vkwindow.cpp +++ b/mupen64plus-gui/vkwindow.cpp @@ -9,6 +9,18 @@ VkWindow::VkWindow(QWindow *parent) setSurfaceType(QWindow::VulkanSurface); } +VkWindow::~VkWindow() +{ + if (w->getCoreLib()) + { + m64p_handle configVideoParallel = NULL; + (*ConfigOpenSection)("Video-Parallel", &configVideoParallel); + (*ConfigSetParameter)(configVideoParallel, "ScreenWidth", M64TYPE_INT, &orig_width); + (*ConfigSetParameter)(configVideoParallel, "ScreenHeight", M64TYPE_INT, &orig_height); + (*ConfigSaveSection)("Video-Parallel"); + } +} + void VkWindow::resizeEvent(QResizeEvent *event) { QWindow::resizeEvent(event); if (timerId) { @@ -16,8 +28,10 @@ void VkWindow::resizeEvent(QResizeEvent *event) { timerId = 0; } timerId = startTimer(500); - m_width = event->size().width() * devicePixelRatio(); - m_height = event->size().height() * devicePixelRatio(); + orig_width = event->size().width(); + orig_height = event->size().height(); + m_width = orig_width * devicePixelRatio(); + m_height = orig_height * devicePixelRatio(); } void VkWindow::timerEvent(QTimerEvent *te) { diff --git a/mupen64plus-gui/vkwindow.h b/mupen64plus-gui/vkwindow.h index 80f9c64..5cbc47b 100644 --- a/mupen64plus-gui/vkwindow.h +++ b/mupen64plus-gui/vkwindow.h @@ -10,6 +10,7 @@ class VkWindow : public QWindow Q_OBJECT public: explicit VkWindow(QWindow *parent = nullptr); + ~VkWindow(); protected: void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; @@ -17,6 +18,8 @@ protected: private: int m_width; int m_height; + int orig_width; + int orig_height; int timerId = 0; }; #endif // VKWINDOW_H