Fix some bugs and mistakes found by Nemoumbra through static analysis

This commit is contained in:
Henrik Rydgård 2023-11-26 13:43:11 +01:00
parent aec0606ba4
commit dae758e5f4
3 changed files with 5 additions and 7 deletions

View File

@ -109,8 +109,8 @@ static bool ovrFramebuffer_CreateGLES(XrSession session, ovrFramebuffer* frameBu
swapChainCreateInfo.arraySize = multiview ? 2 : 1;
#ifdef ANDROID
XrSwapchainCreateInfoFoveationFB swapChainFoveationCreateInfo;
if (VR_GetPlatformFlag(VR_PLATFORM_EXTENSION_FOVEATION)) {
XrSwapchainCreateInfoFoveationFB swapChainFoveationCreateInfo;
memset(&swapChainFoveationCreateInfo, 0, sizeof(swapChainFoveationCreateInfo));
swapChainFoveationCreateInfo.type = XR_TYPE_SWAPCHAIN_CREATE_INFO_FOVEATION_FB;
swapChainCreateInfo.next = &swapChainFoveationCreateInfo;
@ -203,8 +203,8 @@ static bool ovrFramebuffer_CreateVK(XrSession session, ovrFramebuffer* frameBuff
swapChainCreateInfo.arraySize = multiview ? 2 : 1;
#ifdef ANDROID
XrSwapchainCreateInfoFoveationFB swapChainFoveationCreateInfo;
if (VR_GetPlatformFlag(VR_PLATFORM_EXTENSION_FOVEATION)) {
XrSwapchainCreateInfoFoveationFB swapChainFoveationCreateInfo;
memset(&swapChainFoveationCreateInfo, 0, sizeof(swapChainFoveationCreateInfo));
swapChainFoveationCreateInfo.type = XR_TYPE_SWAPCHAIN_CREATE_INFO_FOVEATION_FB;
swapChainCreateInfo.next = &swapChainFoveationCreateInfo;

View File

@ -1593,10 +1593,8 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) {
if (!vfb) {
if (Memory::IsValidAddress(fbaddr)) {
// The game is displaying something directly from RAM. In GTA, it's decoded video.
if (!vfb) {
DrawFramebufferToOutput(Memory::GetPointerUnchecked(fbaddr), displayStride_, displayFormat_);
return;
}
DrawFramebufferToOutput(Memory::GetPointerUnchecked(fbaddr), displayStride_, displayFormat_);
return;
} else {
DEBUG_LOG(FRAMEBUF, "Found no FBO to display! displayFBPtr = %08x", fbaddr);
// No framebuffer to display! Clear to black.

View File

@ -660,7 +660,7 @@ namespace MainWindow
double now = time_now_d();
if ((now - lastMouseDown) < 0.001 * GetDoubleClickTime()) {
float dx = lastMouseDownX - x;
float dy = lastMouseDownX - x;
float dy = lastMouseDownY - y;
float distSq = dx * dx + dy * dy;
if (distSq < 3.0f*3.0f && !g_Config.bShowTouchControls && !g_Config.bMouseControl && GetUIState() == UISTATE_INGAME && g_Config.bFullscreenOnDoubleclick) {
SendToggleFullscreen(!g_Config.UseFullScreen());