From 7a16cff6de02e27272b2fc7db1fa23fe77efcf4a Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 25 May 2015 12:35:23 +0000 Subject: [PATCH 1/8] Common: implement GetExeDirectory on NetBSD --- Common/FileUtil.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index 92272d2276..09f28676d3 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -42,9 +42,8 @@ #include #endif -#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) #include // KERN_PROC_PATHNAME -#include // getpid #endif #if defined(__APPLE__) @@ -767,9 +766,15 @@ const std::string &GetExeDirectory() #elif defined(KERN_PROC_PATHNAME) int mib[4] = { CTL_KERN, +#if defined(__NetBSD__) + KERN_PROC_ARGS, + -1, + KERN_PROC_PATHNAME, +#else KERN_PROC, KERN_PROC_PATHNAME, - getpid() + -1, +#endif }; size_t sz = program_path_size; From 206d287f53da0c8d31c66762f0a48c2507cba687 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Tue, 26 May 2015 11:27:56 +0000 Subject: [PATCH 2/8] Core: report Debian GNU/kFreeBSD separately --- Core/Reporting.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 34bbad7d4f..8f1fd199a9 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -269,6 +269,8 @@ namespace Reporting return "DragonFly"; #elif defined(__FreeBSD__) return "FreeBSD"; +#elif defined(__FreeBSD_kernel__) && defined(__GLIBC__) + return "GNU/kFreeBSD"; #elif defined(__NetBSD__) return "NetBSD"; #elif defined(__OpenBSD__) From a763fe4b95836425ea58ce5c03de87a2081f9cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Nov 2017 14:49:00 +0100 Subject: [PATCH 3/8] Android: Call setDisplayParameters early with the display w/h in pixels. Without this, was defaulting to 1x rendering on S8 which is silly. --- Core/Config.cpp | 4 +++- .../src/org/ppsspp/ppsspp/NativeActivity.java | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 48aee13246..f4815b8f27 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -433,7 +433,9 @@ static int DefaultInternalResolution() { return 0; #else int longestDisplaySide = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)); - return longestDisplaySide >= 1000 ? 2 : 1; + int scale = longestDisplaySide >= 1000 ? 2 : 1; + ILOG("Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale); + return scale; #endif } diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 0f70d98124..78db54746d 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -288,6 +288,8 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C // All other device types are treated the same. } + + isXperiaPlay = IsXperiaPlay(); String libraryDir = getApplicationLibraryDir(appInfo); @@ -453,17 +455,21 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C shuttingDown = false; registerCallbacks(); - if (!initialized) { - Initialize(); - initialized = true; - } - Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); densityDpi = metrics.densityDpi; refreshRate = display.getRefreshRate(); + // Set early to be able to set defaults when loading config for the first time. Like figuring out + // whether to start at 1x or 2x. + NativeApp.setDisplayParameters(metrics.widthPixels, metrics.heightPixels, (int)densityDpi, refreshRate); + + if (!initialized) { + Initialize(); + initialized = true; + } + // OK, config should be initialized, we can query for screen rotation. updateScreenRotation("onCreate"); updateSustainedPerformanceMode(); From 234f30a3721eece4c5e33af11f6f3da8761866e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Nov 2017 14:52:26 +0100 Subject: [PATCH 4/8] Minor error checking improvement --- android/jni/app-android.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index ddcb32cb09..44c4e7cef7 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -301,6 +301,7 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX, int physicalDevice = g_Vulkan->GetBestPhysicalDevice(); if (physicalDevice < 0) { ELOG("No usable Vulkan device found."); + g_Vulkan->DestroyInstance(); delete g_Vulkan; g_Vulkan = nullptr; return false; @@ -313,6 +314,7 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX, if (g_Vulkan->CreateDevice() != VK_SUCCESS) { ILOG("Failed to create vulkan device: %s", g_Vulkan->InitError().c_str()); System_SendMessage("toast", "No Vulkan driver found. Using OpenGL instead."); + g_Vulkan->DestroyInstance(); delete g_Vulkan; g_Vulkan = nullptr; return false; From b9bad7431a3e7de6f5204c260384caf3b9938679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Nov 2017 16:13:04 +0100 Subject: [PATCH 5/8] Add ability to simulate a few kinds of Vulkan initialization failures, to test the GL fallback. --- Common/Vulkan/VulkanContext.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Common/Vulkan/VulkanContext.cpp b/Common/Vulkan/VulkanContext.cpp index 8ed08ecf39..f8cfdbd37d 100644 --- a/Common/Vulkan/VulkanContext.cpp +++ b/Common/Vulkan/VulkanContext.cpp @@ -10,6 +10,10 @@ #include "GPU/Common/ShaderCommon.h" #include "Common/StringUtils.h" +// Change this to 1, 2, and 3 to fake failures in a few places, so that +// we can test our fallback-to-GL code. +#define SIMULATE_VULKAN_FAILURE 0 + #ifdef USE_CRT_DBG #undef new #endif @@ -76,6 +80,9 @@ const char *PresentModeString(VkPresentModeKHR presentMode) { } VulkanContext::VulkanContext() { +#if SIMULATE_VULKAN_FAILURE == 1 + return; +#endif if (!VulkanLoad()) { init_error_ = "Failed to load Vulkan driver library"; // No DLL? @@ -89,6 +96,11 @@ VulkanContext::VulkanContext() { } VkResult VulkanContext::CreateInstance(const char *app_name, int app_ver, uint32_t flags) { + if (!vkCreateInstance) { + init_error_ = "Vulkan not loaded - can't create instance"; + return VK_ERROR_INITIALIZATION_FAILED; + } + flags_ = flags; // List extensions to try to enable. @@ -123,7 +135,11 @@ VkResult VulkanContext::CreateInstance(const char *app_name, int app_ver, uint32 inst_info.enabledExtensionCount = (uint32_t)instance_extensions_enabled_.size(); inst_info.ppEnabledExtensionNames = instance_extensions_enabled_.size() ? instance_extensions_enabled_.data() : nullptr; +#if SIMULATE_VULKAN_FAILURE == 2 + VkResult res = VK_ERROR_INCOMPATIBLE_DRIVER; +#else VkResult res = vkCreateInstance(&inst_info, nullptr, &instance_); +#endif if (res != VK_SUCCESS) { if (res == VK_ERROR_LAYER_NOT_PRESENT) { WLOG("Validation on but layers not available - dropping layers"); @@ -152,7 +168,11 @@ VkResult VulkanContext::CreateInstance(const char *app_name, int app_ver, uint32 } uint32_t gpu_count = 1; +#if SIMULATE_VULKAN_FAILURE == 3 + gpu_count = 0; +#else res = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr); +#endif if (gpu_count <= 0) { ELOG("Vulkan driver found but no supported GPU is available"); init_error_ = "No Vulkan physical devices found"; From f50dadb2842b878a9139bdf18df39e929dba19dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Nov 2017 21:02:33 +0100 Subject: [PATCH 6/8] Fix the fix for Thrillville. See #7459 --- GPU/GPUCommon.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 23ae269e0d..fa4fdc3899 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1842,6 +1842,8 @@ void GPUCommon::Execute_ImmVertexAlphaPrim(u32 op, u32 diff) { // Instead of finding a proper point to flush, we just emit a full rectangle every time one // is finished. FlushImm(); + // Need to reset immCount_ here. If we do it in FlushImm it could get skipped by gstate_c.skipDrawReason. + immCount_ = 0; } else { ERROR_LOG_REPORT_ONCE(imm_draw_prim, G3D, "Immediate draw: Unexpected primitive %d at count %d", prim, immCount_); } @@ -1878,7 +1880,6 @@ void GPUCommon::FlushImm() { drawEngineCommon_->DispatchFlush(); // TOOD: In the future, make a special path for these. // drawEngineCommon_->DispatchSubmitImm(immBuffer_, immCount_); - immCount_ = 0; } void GPUCommon::ExecuteOp(u32 op, u32 diff) { From 273dab91ca63e17b278701dd15bcf97cc16d541b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Nov 2017 21:02:59 +0100 Subject: [PATCH 7/8] Fix a text overdraw problem on the title screen on very small displays. --- UI/MiscScreens.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 9b0d7a6672..272201c143 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -507,14 +507,13 @@ void LogoScreen::render() { dc.SetFontStyle(dc.theme->uiFont); dc.DrawText(temp, bounds.centerX(), bounds.centerY() + 40, textColor, ALIGN_CENTER); dc.DrawText(cr->T("license", "Free Software under GPL 2.0+"), bounds.centerX(), bounds.centerY() + 70, textColor, ALIGN_CENTER); - dc.DrawText("www.ppsspp.org", bounds.centerX(), yres / 2 + 130, textColor, ALIGN_CENTER); - if (boot_filename.size()) { - dc.DrawTextShadow(boot_filename.c_str(), bounds.centerX(), bounds.centerY() + 180, textColor, ALIGN_CENTER); - } + + int ppsspp_org_y = yres / 2 + 130; + dc.DrawText("www.ppsspp.org", bounds.centerX(), ppsspp_org_y, textColor, ALIGN_CENTER); #if (defined(_WIN32) && !PPSSPP_PLATFORM(UWP)) || PPSSPP_PLATFORM(ANDROID) // Draw the graphics API, except on UWP where it's always D3D11 - dc.DrawText(screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME).c_str(), bounds.centerX(), bounds.y2() - 100, textColor, ALIGN_CENTER); + dc.DrawText(screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME).c_str(), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER); #endif dc.End(); From f8b6a965e74e1ee878cba8b1f764ab2761a30fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 27 Nov 2017 17:00:32 +0100 Subject: [PATCH 8/8] Coldbird's up and running again, restore the proAdhoc default. See issue #9984 --- Core/Config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index f4815b8f27..c088848042 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -741,7 +741,7 @@ static ConfigSetting systemParamSettings[] = { ReportedConfigSetting("PSPModel", &g_Config.iPSPModel, &DefaultPSPModel, true, true), ReportedConfigSetting("PSPFirmwareVersion", &g_Config.iFirmwareVersion, PSP_DEFAULT_FIRMWARE, true, true), ConfigSetting("NickName", &g_Config.sNickName, "PPSSPP", true, true), - ConfigSetting("proAdhocServer", &g_Config.proAdhocServer, "", true, true), + ConfigSetting("proAdhocServer", &g_Config.proAdhocServer, "coldbird.net", true, true), ConfigSetting("MacAddress", &g_Config.sMACAddress, "", true, true), ConfigSetting("PortOffset", &g_Config.iPortOffset, 0, true, true), ReportedConfigSetting("Language", &g_Config.iLanguage, &DefaultSystemParamLanguage, true, true),