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; 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"; 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__) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index b928319ae0..6e4514965e 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1848,6 +1848,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_); } @@ -1884,7 +1886,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) { 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(); 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; 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();