diff --git a/Source/3rdParty/rt64/src/api/rt64_api_common.cpp b/Source/3rdParty/rt64/src/api/rt64_api_common.cpp index 8fe18586..5583a3c0 100644 --- a/Source/3rdParty/rt64/src/api/rt64_api_common.cpp +++ b/Source/3rdParty/rt64/src/api/rt64_api_common.cpp @@ -55,15 +55,11 @@ DLLEXPORT void CALL UpdateScreen(void) { } DLLEXPORT void CALL ChangeWindow(void) { - CoreVideo_ToggleFullScreen(); -#if 0 // TODO... - RT64::ApplicationWindow *appWindow = RT64::API.app->appWindow.get(); - appWindow->setFullScreen(!appWindow->fullScreen); -#endif + const bool isPJ64 = (RT64::API.apiType == RT64::APIType::Project64); + if (isPJ64) { + CoreVideo_ToggleFullScreen(); + } else { + RT64::ApplicationWindow *appWindow = RT64::API.app->appWindow.get(); + appWindow->setFullScreen(!appWindow->fullScreen); + } } - -DLLEXPORT m64p_error CALL PluginShutdown(void) { - - - return M64ERR_SUCCESS; -} \ No newline at end of file diff --git a/Source/3rdParty/rt64/src/api/rt64_api_common.h b/Source/3rdParty/rt64/src/api/rt64_api_common.h index 37d4a08e..b99cfa5d 100644 --- a/Source/3rdParty/rt64/src/api/rt64_api_common.h +++ b/Source/3rdParty/rt64/src/api/rt64_api_common.h @@ -8,7 +8,7 @@ #include "m64p_types.h" #include "m64p_vidext.h" -// uglyyyyy +// mupen64plus function pointers for the video extension functions extern ptr_VidExt_InitWithRenderMode CoreVideo_InitWithRenderMode; extern ptr_VidExt_Quit CoreVideo_Quit; extern ptr_VidExt_SetCaption CoreVideo_SetCaption; @@ -17,8 +17,8 @@ extern ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow; extern ptr_VidExt_VK_GetSurface CoreVideo_VK_GetSurface; extern ptr_VidExt_VK_GetInstanceExtensions CoreVideo_VK_GetInstanceExtensions; extern ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode; -extern ptr_VidExt_GL_SwapBuffers CoreVideo_SwapCounter; +// TODO: move this to applicationwindow? extern int window_width; extern int window_height; diff --git a/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp b/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp index b78b4e1f..927cd24a 100644 --- a/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp +++ b/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp @@ -22,7 +22,6 @@ ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL; ptr_VidExt_VK_GetSurface CoreVideo_VK_GetSurface = NULL; ptr_VidExt_VK_GetInstanceExtensions CoreVideo_VK_GetInstanceExtensions = NULL; ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL; -ptr_VidExt_GL_SwapBuffers CoreVideo_SwapCounter = NULL; #ifdef _WIN32 #define DLSYM(a, b) GetProcAddress(a, b) @@ -40,7 +39,20 @@ DLLEXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void * CoreVideo_VK_GetSurface = (ptr_VidExt_VK_GetSurface)DLSYM(CoreLibHandle, "VidExt_VK_GetSurface"); CoreVideo_VK_GetInstanceExtensions = (ptr_VidExt_VK_GetInstanceExtensions)DLSYM(CoreLibHandle, "VidExt_VK_GetInstanceExtensions"); CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode)DLSYM(CoreLibHandle, "VidExt_SetVideoMode"); - CoreVideo_SwapCounter = (ptr_VidExt_GL_SwapBuffers)DLSYM(CoreLibHandle, "VidExt_GL_SwapBuffers"); + if (CoreVideo_InitWithRenderMode == NULL || + CoreVideo_Quit == NULL || + CoreVideo_SetCaption == NULL || + CoreVideo_ToggleFullScreen == NULL || + CoreVideo_ResizeWindow == NULL || + CoreVideo_VK_GetSurface == NULL || + CoreVideo_VK_GetInstanceExtensions == NULL || + CoreVideo_SetVideoMode == NULL) { + return M64ERR_SYSTEM_FAIL; + } + return M64ERR_SUCCESS; +} + +DLLEXPORT m64p_error CALL PluginShutdown(void) { return M64ERR_SUCCESS; } @@ -83,18 +95,14 @@ DLLEXPORT void CALL RomClosed(void) { RT64::API.app->end(); RT64::API.app.reset(); } - // Do nothing. } DLLEXPORT int CALL RomOpen(void) { -#if 0 const bool isPJ64 = (RT64::API.apiType == RT64::APIType::Project64); if (isPJ64) { RT64::ApplicationWindow *appWindow = RT64::API.app->appWindow.get(); appWindow->makeResizable(); } -#endif - return 1; } diff --git a/Source/3rdParty/rt64/src/hle/rt64_present_queue.cpp b/Source/3rdParty/rt64/src/hle/rt64_present_queue.cpp index 7e2cce4f..79a0f689 100644 --- a/Source/3rdParty/rt64/src/hle/rt64_present_queue.cpp +++ b/Source/3rdParty/rt64/src/hle/rt64_present_queue.cpp @@ -461,7 +461,7 @@ namespace RT64 { if (needsResize || ext.appWindow->detectWindowMoved()) { ext.appWindow->detectRefreshRate(); - ext.sharedResources->setSwapChainRate(std::min(60u, displayTimingRate)); + ext.sharedResources->setSwapChainRate(std::min(ext.appWindow->getRefreshRate(), displayTimingRate)); } if (displayTiming) { diff --git a/Source/3rdParty/rt64/src/render/rt64_optimus.cpp b/Source/3rdParty/rt64/src/render/rt64_optimus.cpp index 348aa52c..db527060 100644 --- a/Source/3rdParty/rt64/src/render/rt64_optimus.cpp +++ b/Source/3rdParty/rt64/src/render/rt64_optimus.cpp @@ -8,7 +8,7 @@ extern "C" { // Exporting this flag indicates to the NVIDIA driver that it should prefer using the high performance device. - _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; + __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } #endif \ No newline at end of file diff --git a/Source/3rdParty/rt64/src/vulkan/rt64_vulkan.cpp b/Source/3rdParty/rt64/src/vulkan/rt64_vulkan.cpp index 78a488e4..bfa7eac2 100644 --- a/Source/3rdParty/rt64/src/vulkan/rt64_vulkan.cpp +++ b/Source/3rdParty/rt64/src/vulkan/rt64_vulkan.cpp @@ -2216,9 +2216,14 @@ namespace RT64 { } void VulkanSwapChain::getWindowSize(uint32_t &dstWidth, uint32_t &dstHeight) const { - dstWidth = window_width; - dstHeight = window_height; - return; +# if defined(RT64_BUILD_PLUGIN) + const bool isPJ64 = (RT64::API.apiType == RT64::APIType::Project64); + if (!isPJ64) { + dstWidth = window_width; + dstHeight = window_height; + return; + } +# endif # if defined(_WIN64) RECT rect; @@ -2228,7 +2233,7 @@ namespace RT64 { # elif defined(__ANDROID__) dstWidth = ANativeWindow_getWidth(renderWindow); dstHeight = ANativeWindow_getHeight(renderWindow); -# elif defined(__linux__) +# elif defined(__linux__) && !defined(RT64_BUILD_PLUGIN) XWindowAttributes attributes; XGetWindowAttributes(renderWindow.display, renderWindow.window, &attributes); // The attributes width and height members do not include the border.