From fb798cf6b2c086b7bee0790cb71416dda4f72026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 23 Mar 2018 10:26:33 +0100 Subject: [PATCH] Win32 textdrawer: Fix rare crash affecting Patapon 2 in savedata manager. See 10764. --- Common/Vulkan/VulkanContext.h | 3 --- Core/FileSystems/DirectoryFileSystem.cpp | 4 ++-- ext/native/gfx_es2/draw_text_win.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Common/Vulkan/VulkanContext.h b/Common/Vulkan/VulkanContext.h index ac4d98148f..6466f7b390 100644 --- a/Common/Vulkan/VulkanContext.h +++ b/Common/Vulkan/VulkanContext.h @@ -8,9 +8,6 @@ #include "base/logging.h" #include "Common/Vulkan/VulkanLoader.h" -// Amount of time, in nanoseconds, to wait for a command buffer to complete -#define FENCE_TIMEOUT 10000000000 - enum { VULKAN_FLAG_VALIDATE = 1, VULKAN_FLAG_PRESENT_MAILBOX = 2, diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 6e53be5110..f4db57f7ab 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -186,7 +186,7 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil #endif std::string fullName = GetLocalPath(basePath,fileName); - DEBUG_LOG(FILESYS,"Actually opening %s", fullName.c_str()); + VERBOSE_LOG(FILESYS,"Actually opening %s", fullName.c_str()); // On the PSP, truncating doesn't lose data. If you seek later, you'll recover it. // This is abnormal, so we deviate from the PSP's behavior and truncate on write/close. @@ -1002,7 +1002,7 @@ u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char std::string fullName = GetLocalPath(filename); const char *fullNameC = fullName.c_str(); - DEBUG_LOG(FILESYS,"VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str()); + VERBOSE_LOG(FILESYS,"VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str()); size_t size; u8 *data = VFSReadFile(fullNameC, &size); diff --git a/ext/native/gfx_es2/draw_text_win.cpp b/ext/native/gfx_es2/draw_text_win.cpp index 0476bd564e..1cae07f795 100644 --- a/ext/native/gfx_es2/draw_text_win.cpp +++ b/ext/native/gfx_es2/draw_text_win.cpp @@ -231,6 +231,12 @@ void TextDrawerWin32::DrawString(DrawBuffer &target, const char *str, float x, f size.cx = MAX_TEXT_WIDTH; if (size.cy > MAX_TEXT_HEIGHT) size.cy = MAX_TEXT_HEIGHT; + // Prevent zero-sized textures, which can occur. Not worth to avoid + // creating the texture altogether in this case. + if (size.cx == 0) + size.cx = 1; + if (size.cy == 0) + size.cy = 1; entry = new TextStringEntry(); entry->width = size.cx;