diff --git a/Common/Arm64Emitter.cpp b/Common/Arm64Emitter.cpp index 56ebb11baf..f33f7452a1 100644 --- a/Common/Arm64Emitter.cpp +++ b/Common/Arm64Emitter.cpp @@ -934,7 +934,7 @@ void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch) FixupBranch ARM64XEmitter::CBZ(ARM64Reg Rt) { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 0; branch.reg = Rt; @@ -943,7 +943,7 @@ FixupBranch ARM64XEmitter::CBZ(ARM64Reg Rt) } FixupBranch ARM64XEmitter::CBNZ(ARM64Reg Rt) { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 1; branch.reg = Rt; @@ -952,7 +952,7 @@ FixupBranch ARM64XEmitter::CBNZ(ARM64Reg Rt) } FixupBranch ARM64XEmitter::B(CCFlags cond) { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 2; branch.cond = cond; @@ -961,7 +961,7 @@ FixupBranch ARM64XEmitter::B(CCFlags cond) } FixupBranch ARM64XEmitter::TBZ(ARM64Reg Rt, u8 bit) { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 3; branch.reg = Rt; @@ -971,7 +971,7 @@ FixupBranch ARM64XEmitter::TBZ(ARM64Reg Rt, u8 bit) } FixupBranch ARM64XEmitter::TBNZ(ARM64Reg Rt, u8 bit) { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 4; branch.reg = Rt; @@ -981,7 +981,7 @@ FixupBranch ARM64XEmitter::TBNZ(ARM64Reg Rt, u8 bit) } FixupBranch ARM64XEmitter::B() { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 5; HINT(HINT_NOP); @@ -989,7 +989,7 @@ FixupBranch ARM64XEmitter::B() } FixupBranch ARM64XEmitter::BL() { - FixupBranch branch; + FixupBranch branch{}; branch.ptr = m_code; branch.type = 6; HINT(HINT_NOP); diff --git a/Common/Buffer.cpp b/Common/Buffer.cpp index 4b05d99e51..4cc3c3c08c 100644 --- a/Common/Buffer.cpp +++ b/Common/Buffer.cpp @@ -7,9 +7,6 @@ #include "Common/File/Path.h" #include "Common/Log.h" -Buffer::Buffer() { } -Buffer::~Buffer() { } - char *Buffer::Append(size_t length) { if (length > 0) { size_t old_size = data_.size(); @@ -125,7 +122,7 @@ bool Buffer::FlushToFile(const Path &filename) { FILE *f = File::OpenCFile(filename, "wb"); if (!f) return false; - if (data_.size()) { + if (!data_.empty()) { fwrite(&data_[0], 1, data_.size(), f); } fclose(f); diff --git a/Common/Buffer.h b/Common/Buffer.h index aec1727383..4fb089fe56 100644 --- a/Common/Buffer.h +++ b/Common/Buffer.h @@ -11,9 +11,8 @@ class Path; // Does not do synchronization, must use external mutexes. class Buffer { public: - Buffer(); + Buffer() = default; Buffer(Buffer &&) = default; - ~Buffer(); static Buffer Void() { Buffer buf; diff --git a/Common/CodeBlock.h b/Common/CodeBlock.h index bb017c31f1..04642f16b4 100644 --- a/Common/CodeBlock.h +++ b/Common/CodeBlock.h @@ -128,7 +128,7 @@ public: const uint8_t *pos = GetCodePtr(); if (pos + sizeEstimate - region > (ptrdiff_t)region_size) sizeEstimate = region_size - (pos - region); - writeEstimated_ = pos - writeStart_ + sizeEstimate; + writeEstimated_ = (pos - writeStart_) + sizeEstimate; ProtectMemoryPages(pos, sizeEstimate, MEM_PROT_READ | MEM_PROT_WRITE); } } diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index c3c7c29a87..0bdb88354e 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -54,10 +54,9 @@ struct D3D11DepthStencilKey { } }; - class D3D11DepthStencilState : public DepthStencilState { public: - ~D3D11DepthStencilState() {} + ~D3D11DepthStencilState() = default; DepthStencilStateDesc desc; }; @@ -116,7 +115,7 @@ public: void SetScissorRect(int left, int top, int width, int height) override; void SetViewport(const Viewport &viewport) override; void SetBlendFactor(float color[4]) override { - if (memcmp(blendFactor_, color, sizeof(float) * 4)) { + if (0 != memcmp(blendFactor_, color, sizeof(float) * 4)) { memcpy(blendFactor_, color, sizeof(float) * 4); blendFactorDirty_ = true; } @@ -130,7 +129,7 @@ public: void Draw(int vertexCount, int offset) override; - void DrawIndexed(int vertexCount, int offset) override; + void DrawIndexed(int indexCount, int offset) override; void DrawUP(const void *vdata, int vertexCount) override; void Clear(int mask, uint32_t colorval, float depthVal, int stencilVal) override; @@ -251,7 +250,7 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de context1_(deviceContext1), featureLevel_(featureLevel), swapChain_(swapChain), - deviceList_(deviceList) { + deviceList_(std::move(deviceList)) { // We no longer support Windows Phone. _assert_(featureLevel_ >= D3D_FEATURE_LEVEL_9_3); @@ -351,7 +350,7 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de const size_t UP_MAX_BYTES = 65536 * 24; - upBuffer_ = CreateBuffer(UP_MAX_BYTES, BufferUsageFlag::DYNAMIC | BufferUsageFlag::VERTEXDATA); + upBuffer_ = D3D11DrawContext::CreateBuffer(UP_MAX_BYTES, BufferUsageFlag::DYNAMIC | BufferUsageFlag::VERTEXDATA); IDXGIDevice1 *dxgiDevice1 = nullptr; hr = device_->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast(&dxgiDevice1)); @@ -634,7 +633,7 @@ ID3D11DepthStencilState *D3D11DrawContext::GetCachedDepthStencilState(const D3D1 DepthStencilState *D3D11DrawContext::CreateDepthStencilState(const DepthStencilStateDesc &desc) { D3D11DepthStencilState *dss = new D3D11DepthStencilState(); dss->desc = desc; - return dynamic_cast(dss); + return static_cast(dss); } BlendState *D3D11DrawContext::CreateBlendState(const BlendStateDesc &desc) { diff --git a/Common/GPU/OpenGL/GLQueueRunner.h b/Common/GPU/OpenGL/GLQueueRunner.h index d7832a9b52..a0a058c335 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.h +++ b/Common/GPU/OpenGL/GLQueueRunner.h @@ -385,7 +385,7 @@ private: void PerformReadback(const GLRStep &pass); void PerformReadbackImage(const GLRStep &pass); - void fbo_ext_create(const GLRInitStep &step); + void fbo_ext_create(const GLRInitStep &step); // Unused on some platforms void fbo_bind_fb_target(bool read, GLuint name); GLenum fbo_get_fb_target(bool read, GLuint **cached); void fbo_unbind(); diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index 423187a9e9..169f49b9bb 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -245,10 +245,10 @@ private: }; bool OpenGLShaderModule::Compile(GLRenderManager *render, ShaderLanguage language, const uint8_t *data, size_t dataSize) { - source_ = std::string((const char *)data); + source_ = std::string((const char *)data, dataSize); // Add the prelude on automatically. if (glstage_ == GL_FRAGMENT_SHADER || glstage_ == GL_VERTEX_SHADER) { - if (source_.find("#version") == source_.npos) { + if (source_.find("#version") == std::string::npos) { source_ = ApplyGLSLPrelude(source_, glstage_); } } else { @@ -646,7 +646,7 @@ OpenGLContext::OpenGLContext(bool canChangeSwapInterval) : renderManager_(frameT // Note: this is for Intel drivers with GL3+. // Also on Intel, see https://github.com/hrydgard/ppsspp/issues/10117 // TODO: Remove entirely sometime reasonably far in driver years after 2015. - const std::string ver = GetInfoString(Draw::InfoField::APIVERSION); + const std::string ver = OpenGLContext::GetInfoString(Draw::InfoField::APIVERSION); int versions[4]{}; if (sscanf(ver.c_str(), "Build %d.%d.%d.%d", &versions[0], &versions[1], &versions[2], &versions[3]) == 4) { if (HasIntelDualSrcBug(versions)) { @@ -962,7 +962,7 @@ void OpenGLTexture::SetImageData(int x, int y, int z, int width, int height, int depth_ = depth; } - if (stride == 0) + if (!stride) stride = width; size_t alignment = DataFormatSizeInBytes(format_); diff --git a/Common/GPU/ShaderWriter.cpp b/Common/GPU/ShaderWriter.cpp index ed7a3612f9..6ea3de07ab 100644 --- a/Common/GPU/ShaderWriter.cpp +++ b/Common/GPU/ShaderWriter.cpp @@ -575,8 +575,6 @@ ShaderWriter &ShaderWriter::LoadTexture2D(const char *sampName, const char *uv, ShaderWriter &ShaderWriter::GetTextureSize(const char *szVariable, const char *texName) { switch (lang_.shaderLanguage) { case HLSL_D3D11: - F(" float2 %s; %s.GetDimensions(%s.x, %s.y);", szVariable, texName, szVariable, szVariable); - break; case HLSL_D3D9: F(" float2 %s; %s.GetDimensions(%s.x, %s.y);", szVariable, texName, szVariable, szVariable); break; diff --git a/Common/GPU/Vulkan/VulkanDebug.cpp b/Common/GPU/Vulkan/VulkanDebug.cpp index bae1ad0540..64b77416d3 100644 --- a/Common/GPU/Vulkan/VulkanDebug.cpp +++ b/Common/GPU/Vulkan/VulkanDebug.cpp @@ -42,7 +42,6 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback( VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *pUserData) { - const VulkanLogOptions *options = (const VulkanLogOptions *)pUserData; std::ostringstream message; const char *pMessage = pCallbackData->pMessage; @@ -149,6 +148,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback( std::string msg = message.str(); #ifdef _WIN32 + const VulkanLogOptions *options = (const VulkanLogOptions *)pUserData; OutputDebugStringA(msg.c_str()); if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { if (options->breakOnError && System_GetPropertyBool(SYSPROP_DEBUGGER_PRESENT)) { diff --git a/Common/GPU/Vulkan/VulkanFrameData.h b/Common/GPU/Vulkan/VulkanFrameData.h index 3a6e9d879f..e81287308e 100644 --- a/Common/GPU/Vulkan/VulkanFrameData.h +++ b/Common/GPU/Vulkan/VulkanFrameData.h @@ -55,8 +55,8 @@ struct CachedReadback { struct FrameDataShared { // For synchronous readbacks. VkFence readbackFence = VK_NULL_HANDLE; - bool useMultiThreading; - bool measurePresentTime; + bool useMultiThreading = false; + bool measurePresentTime = false; void Init(VulkanContext *vulkan, bool useMultiThreading, bool measurePresentTime); void Destroy(VulkanContext *vulkan); diff --git a/Common/GPU/Vulkan/VulkanFramebuffer.cpp b/Common/GPU/Vulkan/VulkanFramebuffer.cpp index 5e6d7a61a1..7bc0bff93e 100644 --- a/Common/GPU/Vulkan/VulkanFramebuffer.cpp +++ b/Common/GPU/Vulkan/VulkanFramebuffer.cpp @@ -56,23 +56,23 @@ void VKRImage::Delete(VulkanContext *vulkan) { } } -VKRFramebuffer::VKRFramebuffer(VulkanContext *vk, VulkanBarrierBatch *barriers, VkCommandBuffer initCmd, VKRRenderPass *compatibleRenderPass, int _width, int _height, int _numLayers, int _multiSampleLevel, bool createDepthStencilBuffer, const char *tag) - : vulkan_(vk), tag_(tag), width(_width), height(_height), numLayers(_numLayers) { +VKRFramebuffer::VKRFramebuffer(VulkanContext *vk, VulkanBarrierBatch *barriers, int _width, int _height, int _numLayers, int _multiSampleLevel, bool createDepthStencilBuffer, const char *tag) + : vulkan_(vk), width(_width), height(_height), numLayers(_numLayers) { _dbg_assert_(tag); - CreateImage(vulkan_, barriers, initCmd, color, width, height, numLayers, VK_SAMPLE_COUNT_1_BIT, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true, tag); + CreateImage(vulkan_, barriers, color, width, height, numLayers, VK_SAMPLE_COUNT_1_BIT, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true, tag); if (createDepthStencilBuffer) { - CreateImage(vulkan_, barriers, initCmd, depth, width, height, numLayers, VK_SAMPLE_COUNT_1_BIT, vulkan_->GetDeviceInfo().preferredDepthStencilFormat, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, false, tag); + CreateImage(vulkan_, barriers, depth, width, height, numLayers, VK_SAMPLE_COUNT_1_BIT, vulkan_->GetDeviceInfo().preferredDepthStencilFormat, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, false, tag); } if (_multiSampleLevel > 0) { sampleCount = MultiSampleLevelToFlagBits(_multiSampleLevel); // TODO: Create a different tag for these? - CreateImage(vulkan_, barriers, initCmd, msaaColor, width, height, numLayers, sampleCount, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true, tag); + CreateImage(vulkan_, barriers, msaaColor, width, height, numLayers, sampleCount, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true, tag); if (createDepthStencilBuffer) { - CreateImage(vulkan_, barriers, initCmd, msaaDepth, width, height, numLayers, sampleCount, vulkan_->GetDeviceInfo().preferredDepthStencilFormat, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, false, tag); + CreateImage(vulkan_, barriers, msaaDepth, width, height, numLayers, sampleCount, vulkan_->GetDeviceInfo().preferredDepthStencilFormat, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, false, tag); } } else { sampleCount = VK_SAMPLE_COUNT_1_BIT; @@ -85,6 +85,7 @@ VKRFramebuffer::VKRFramebuffer(VulkanContext *vk, VulkanBarrierBatch *barriers, } void VKRFramebuffer::UpdateTag(const char *newTag) { + tag_ = newTag; char name[128]; snprintf(name, sizeof(name), "fb_color_%s", tag_.c_str()); vulkan_->SetDebugName(color.image, VK_OBJECT_TYPE_IMAGE, name); @@ -161,7 +162,7 @@ VKRFramebuffer::~VKRFramebuffer() { // NOTE: If numLayers > 1, it will create an array texture, rather than a normal 2D texture. // This requires a different sampling path! -void VKRFramebuffer::CreateImage(VulkanContext *vulkan, VulkanBarrierBatch *barriers, VkCommandBuffer cmd, VKRImage &img, int width, int height, int numLayers, VkSampleCountFlagBits sampleCount, VkFormat format, VkImageLayout initialLayout, bool color, const char *tag) { +void VKRFramebuffer::CreateImage(VulkanContext *vulkan, VulkanBarrierBatch *barriers, VKRImage &img, int width, int height, int numLayers, VkSampleCountFlagBits sampleCount, VkFormat format, VkImageLayout initialLayout, bool color, const char *tag) { // We don't support more exotic layer setups for now. Mono or stereo. _dbg_assert_(numLayers == 1 || numLayers == 2); @@ -216,6 +217,7 @@ void VKRFramebuffer::CreateImage(VulkanContext *vulkan, VulkanBarrierBatch *barr ivci.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY; // layered for consistency, even if single image. res = vkCreateImageView(vulkan->GetDevice(), &ivci, nullptr, &img.texAllLayersView); + _dbg_assert_(res == VK_SUCCESS); vulkan->SetDebugName(img.texAllLayersView, VK_OBJECT_TYPE_IMAGE_VIEW, tag); // Create 2D views for both layers. @@ -493,6 +495,8 @@ VkRenderPass CreateRenderPass(VulkanContext *vulkan, const RPKey &key, RenderPas } subpass2.pipelineBindPoint = subpass.pipelineBindPoint; subpass2.viewMask = multiview ? viewMask : 0; + + // We check for multisample again, we want this path to also support non-multisample. if (multisample) { colorResolveReference2.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; colorResolveReference2.attachment = colorResolveReference.attachment; // the non-msaa color buffer. @@ -504,6 +508,7 @@ VkRenderPass CreateRenderPass(VulkanContext *vulkan, const RPKey &key, RenderPas VkAttachmentReference2KHR depthResolveReference2{ VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR }; VkSubpassDescriptionDepthStencilResolveKHR depthStencilResolve{ VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR }; + // We check for multisample again, we want this path to also support non-multisample. if (hasDepth && multisample) { ChainStruct(subpass2, &depthStencilResolve); depthResolveReference2.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; diff --git a/Common/GPU/Vulkan/VulkanFramebuffer.h b/Common/GPU/Vulkan/VulkanFramebuffer.h index 7f968833cf..a21cfbc37e 100644 --- a/Common/GPU/Vulkan/VulkanFramebuffer.h +++ b/Common/GPU/Vulkan/VulkanFramebuffer.h @@ -58,7 +58,7 @@ struct VKRImage { class VKRFramebuffer { public: - VKRFramebuffer(VulkanContext *vk, VulkanBarrierBatch *barriers, VkCommandBuffer initCmd, VKRRenderPass *compatibleRenderPass, int _width, int _height, int _numLayers, int _multiSampleLevel, bool createDepthStencilBuffer, const char *tag); + VKRFramebuffer(VulkanContext *vk, VulkanBarrierBatch *barriers, int _width, int _height, int _numLayers, int _multiSampleLevel, bool createDepthStencilBuffer, const char *tag); ~VKRFramebuffer(); VkFramebuffer Get(VKRRenderPass *compatibleRenderPass, RenderPassType rpType); @@ -95,7 +95,7 @@ public: VulkanContext *Vulkan() const { return vulkan_; } private: - static void CreateImage(VulkanContext *vulkan, VulkanBarrierBatch *barriers, VkCommandBuffer cmd, VKRImage &img, int width, int height, int numLayers, VkSampleCountFlagBits sampleCount, VkFormat format, VkImageLayout initialLayout, bool color, const char *tag); + static void CreateImage(VulkanContext *vulkan, VulkanBarrierBatch *barriers, VKRImage &img, int width, int height, int numLayers, VkSampleCountFlagBits sampleCount, VkFormat format, VkImageLayout initialLayout, bool color, const char *tag); VkFramebuffer framebuf[(size_t)RenderPassType::TYPE_COUNT]{}; @@ -141,7 +141,7 @@ struct RPKey { class VKRRenderPass { public: - VKRRenderPass(const RPKey &key) : key_(key) {} + explicit VKRRenderPass(const RPKey &key) : key_(key) {} VkRenderPass Get(VulkanContext *vulkan, RenderPassType rpType, VkSampleCountFlagBits sampleCount); void Destroy(VulkanContext *vulkan) { diff --git a/Common/GPU/Vulkan/VulkanImage.cpp b/Common/GPU/Vulkan/VulkanImage.cpp index 6b5e724aa6..b44300f53a 100644 --- a/Common/GPU/Vulkan/VulkanImage.cpp +++ b/Common/GPU/Vulkan/VulkanImage.cpp @@ -51,10 +51,10 @@ bool VulkanTexture::CreateDirect(int w, int h, int depth, int numMips, VkFormat Wipe(); - width_ = w; - height_ = h; - depth_ = depth; - numMips_ = numMips; + width_ = (int16_t)w; + height_ = (int16_t)h; + depth_ = (int16_t)depth; + numMips_ = (int16_t)numMips; format_ = format; VkImageAspectFlags aspect = IsDepthStencilFormat(format) ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT; @@ -86,6 +86,14 @@ bool VulkanTexture::CreateDirect(int w, int h, int depth, int numMips, VkFormat allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; VmaAllocationInfo allocInfo{}; VkResult res = vmaCreateImage(vulkan_->Allocator(), &image_create_info, &allocCreateInfo, &image_, &allocation_, &allocInfo); + if (res != VK_SUCCESS) { + ERROR_LOG(Log::G3D, "vmaCreateImage failed: %s. Destroying image.", VulkanResultToString(res)); + _dbg_assert_msg_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS, "%d", (int)res); + view_ = VK_NULL_HANDLE; + image_ = VK_NULL_HANDLE; + allocation_ = VK_NULL_HANDLE; + return false; + } // Apply the tag vulkan_->SetDebugName(image_, VK_OBJECT_TYPE_IMAGE, tag_); diff --git a/Common/GPU/Vulkan/VulkanLoader.cpp b/Common/GPU/Vulkan/VulkanLoader.cpp index 8ec624d5e1..05a09af73e 100644 --- a/Common/GPU/Vulkan/VulkanLoader.cpp +++ b/Common/GPU/Vulkan/VulkanLoader.cpp @@ -373,6 +373,7 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) { (std::string(fileRedirectDir.c_str()) + "/").c_str(), nullptr); if (!lib) { ERROR_LOG(Log::G3D, "Failed to load custom driver with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str()); + *errorString = "Failed to load custom driver"; } else { INFO_LOG(Log::G3D, "Vulkan library loaded with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str()); } @@ -388,6 +389,9 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) { break; } } + if (!lib) { + *errorString = "No vulkan library found"; + } } return lib; #endif @@ -481,7 +485,7 @@ bool VulkanMayBeAvailable() { #elif defined(VK_USE_PLATFORM_METAL_EXT) const char * const platformSurfaceExtension = VK_EXT_METAL_SURFACE_EXTENSION_NAME; #else - const char *platformSurfaceExtension = 0; + const char *platformSurfaceExtension = nullptr; #endif if (!localEnumerateInstanceExtensionProperties || !localCreateInstance || !localEnumerate || !localDestroyInstance || !localGetPhysicalDeviceProperties) { diff --git a/Common/GPU/Vulkan/VulkanProfiler.cpp b/Common/GPU/Vulkan/VulkanProfiler.cpp index 60f9805426..47c03a6be9 100644 --- a/Common/GPU/Vulkan/VulkanProfiler.cpp +++ b/Common/GPU/Vulkan/VulkanProfiler.cpp @@ -1,4 +1,4 @@ -#include +#include #include "VulkanProfiler.h" #include "VulkanContext.h" diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index 8c50403530..69ee85220e 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -73,7 +73,7 @@ void VulkanQueueRunner::DestroyDeviceObjects() { syncReadback_.Destroy(vulkan_); renderPasses_.IterateMut([&](const RPKey &rpkey, VKRRenderPass *rp) { - _assert_(rp); + _dbg_assert_(rp); rp->Destroy(vulkan_); delete rp; }); diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 102595dc93..5c6a6ac58c 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -248,10 +248,10 @@ struct SinglePipelineTask { class CreateMultiPipelinesTask : public Task { public: - CreateMultiPipelinesTask(VulkanContext *vulkan, std::vector tasks) : vulkan_(vulkan), tasks_(tasks) { + CreateMultiPipelinesTask(VulkanContext *vulkan, std::vector tasks) : vulkan_(vulkan), tasks_(std::move(tasks)) { tasksInFlight_.fetch_add(1); } - ~CreateMultiPipelinesTask() {} + ~CreateMultiPipelinesTask() = default; TaskType Type() const override { return TaskType::CPU_COMPUTE; @@ -745,8 +745,8 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling, bool enableLogProfile // unless we want to limit ourselves to only measure the main cmd buffer. // Later versions of Vulkan have support for clearing queries on the CPU timeline, but we don't want to rely on that. // Reserve the first two queries for initCmd. - frameData.profile.timestampDescriptions.push_back("initCmd Begin"); - frameData.profile.timestampDescriptions.push_back("initCmd"); + frameData.profile.timestampDescriptions.emplace_back("initCmd Begin"); + frameData.profile.timestampDescriptions.emplace_back("initCmd"); VkCommandBuffer initCmd = GetInitCmd(); } } diff --git a/Common/GPU/Vulkan/VulkanRenderManager.h b/Common/GPU/Vulkan/VulkanRenderManager.h index ed65c0c4b4..29fda811e7 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.h +++ b/Common/GPU/Vulkan/VulkanRenderManager.h @@ -103,7 +103,7 @@ public: std::string fragmentShaderSource; std::string geometryShaderSource; - VkPrimitiveTopology topology; + VkPrimitiveTopology topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; VkVertexInputAttributeDescription attrs[8]{}; VkVertexInputBindingDescription ibd{}; VkPipelineVertexInputStateCreateInfo vis{ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO }; @@ -390,7 +390,7 @@ public: data.blendColor.color = color; } - void PushConstants(VkPipelineLayout pipelineLayout, VkShaderStageFlags stages, int offset, int size, void *constants) { + void PushConstants(VkShaderStageFlags stages, int offset, int size, void *constants) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER); _dbg_assert_(size + offset < 40); VkRenderData &data = curRenderStep_->commands.push_uninitialized(); @@ -577,7 +577,7 @@ private: bool insideFrame_ = false; // probably doesn't need to be atomic. - std::atomic runCompileThread_; + std::atomic runCompileThread_{}; bool useRenderThread_ = true; bool measurePresentTime_ = false; diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index d785f020f8..8a296cac34 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -148,7 +148,7 @@ public: class VKRasterState : public RasterState { public: - VKRasterState(VulkanContext *vulkan, const RasterStateDesc &desc) { + VKRasterState(const RasterStateDesc &desc) { cullFace = desc.cull; frontFace = desc.frontFace; } @@ -187,7 +187,7 @@ public: VKShaderModule(ShaderStage stage, const std::string &tag) : stage_(stage), tag_(tag) { vkstage_ = StageToVulkan(stage); } - bool Compile(VulkanContext *vulkan, ShaderLanguage language, const uint8_t *data, size_t size); + bool Compile(VulkanContext *vulkan, const uint8_t *data, size_t size); const std::string &GetSource() const { return source_; } ~VKShaderModule() { if (module_) { @@ -214,7 +214,7 @@ private: std::string tag_; }; -bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, const uint8_t *data, size_t size) { +bool VKShaderModule::Compile(VulkanContext *vulkan, const uint8_t *data, size_t size) { // We'll need this to free it later. vulkan_ = vulkan; source_ = (const char *)data; @@ -327,7 +327,7 @@ struct DescriptorSetKey { class VKTexture : public Texture { public: - VKTexture(VulkanContext *vulkan, VkCommandBuffer cmd, VulkanPushPool *pushBuffer, const TextureDesc &desc) + VKTexture(VulkanContext *vulkan, const TextureDesc &desc) : vulkan_(vulkan), mipLevels_(desc.mipLevels) { format_ = desc.format; } @@ -398,7 +398,7 @@ public: std::vector GetDeviceList() const override { std::vector list; for (int i = 0; i < vulkan_->GetNumPhysicalDevices(); i++) { - list.push_back(vulkan_->GetPhysicalDeviceProperties(i).properties.deviceName); + list.emplace_back(vulkan_->GetPhysicalDeviceProperties(i).properties.deviceName); } return list; } @@ -757,7 +757,7 @@ SamplerState *VKContext::CreateSamplerState(const SamplerStateDesc &desc) { } RasterState *VKContext::CreateRasterState(const RasterStateDesc &desc) { - return new VKRasterState(vulkan_, desc); + return new VKRasterState(desc); } void VKContext::BindSamplerStates(int start, int count, SamplerState **state) { @@ -877,8 +877,6 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) : vulkan_(vulkan), renderManager_(vulkan, useRenderThread, frameTimeHistory_) { shaderLanguageDesc_.Init(GLSL_VULKAN); - VkFormat depthStencilFormat = vulkan->GetDeviceInfo().preferredDepthStencilFormat; - INFO_LOG(Log::G3D, "Determining Vulkan device caps"); caps_.setMaxFrameLatencySupported = true; @@ -1160,7 +1158,6 @@ void VKContext::BindDescriptors(VkBuffer buf, PackedDescriptor descriptors[4]) { descriptors[0].buffer.offset = 0; // dynamic descriptors[0].buffer.range = curPipeline_->GetUBOSize(); - int numDescs = 1; for (int i = 0; i < MAX_BOUND_TEXTURES; ++i) { VkImageView view; VkSampler sampler; @@ -1252,7 +1249,6 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char gDesc.pipelineLayout = pipelineLayout_; - VkPipelineRasterizationStateCreateInfo rs{ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO }; raster->ToVulkan(&gDesc.rs); if (renderManager_.GetVulkanContext()->GetDeviceFeatures().enabled.provokingVertex.provokingVertexLast) { @@ -1328,7 +1324,7 @@ Texture *VKContext::CreateTexture(const TextureDesc &desc) { ERROR_LOG(Log::G3D, "Can't create textures before the first frame has started."); return nullptr; } - VKTexture *tex = new VKTexture(vulkan_, initCmd, push_, desc); + VKTexture *tex = new VKTexture(vulkan_, desc); if (tex->Create(initCmd, &renderManager_.PostInitBarrier(), push_, desc)) { return tex; } else { @@ -1396,7 +1392,7 @@ BlendState *VKContext::CreateBlendState(const BlendStateDesc &desc) { // to avoid synchronization issues. class VKBuffer : public Buffer { public: - VKBuffer(size_t size, uint32_t flags) : dataSize_(size) { + VKBuffer(size_t size) : dataSize_(size) { data_ = new uint8_t[size]; } ~VKBuffer() { @@ -1411,7 +1407,7 @@ public: }; Buffer *VKContext::CreateBuffer(size_t size, uint32_t usageFlags) { - return new VKBuffer(size, usageFlags); + return new VKBuffer(size); } void VKContext::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offset, size_t size, UpdateBufferFlags flags) { @@ -1451,7 +1447,7 @@ void VKContext::BindNativeTexture(int sampler, void *nativeTexture) { ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t size, const char *tag) { VKShaderModule *shader = new VKShaderModule(stage, tag); - if (shader->Compile(vulkan_, language, data, size)) { + if (shader->Compile(vulkan_, data, size)) { return shader; } else { ERROR_LOG(Log::G3D, "Failed to compile shader %s:\n%s", tag, (const char *)LineNumberString((const char *)data).c_str()); @@ -1666,8 +1662,7 @@ Framebuffer *VKContext::CreateFramebuffer(const FramebufferDesc &desc) { _assert_(desc.width > 0); _assert_(desc.height > 0); - VkCommandBuffer cmd = renderManager_.GetInitCmd(); - VKRFramebuffer *vkrfb = new VKRFramebuffer(vulkan_, &renderManager_.PostInitBarrier(), cmd, renderManager_.GetQueueRunner()->GetCompatibleRenderPass(), desc.width, desc.height, desc.numLayers, desc.multiSampleLevel, desc.z_stencil, desc.tag); + VKRFramebuffer *vkrfb = new VKRFramebuffer(vulkan_, &renderManager_.PostInitBarrier(), desc.width, desc.height, desc.numLayers, desc.multiSampleLevel, desc.z_stencil, desc.tag); return new VKFramebuffer(vkrfb, desc.multiSampleLevel); } diff --git a/Common/GPU/thin3d.cpp b/Common/GPU/thin3d.cpp index bd93cd133c..de8db83fb3 100644 --- a/Common/GPU/thin3d.cpp +++ b/Common/GPU/thin3d.cpp @@ -548,10 +548,6 @@ void DrawContext::DestroyPresets() { } } -DrawContext::~DrawContext() { - // TODO: Can't call DestroyPresets here, too late. -} - void ConvertFromRGBA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, uint32_t srcStride, uint32_t width, uint32_t height, DataFormat format) { // Must skip stride in the cases below. Some games pack data into the cracks, like MotoGP. const uint32_t *src32 = (const uint32_t *)src; diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index c893b1f36c..f4377cdd06 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -89,7 +89,7 @@ enum class BlendFactor : uint8_t { ONE_MINUS_SRC1_ALPHA, }; -enum class StencilOp { +enum class StencilOp : uint8_t { KEEP = 0, ZERO = 1, REPLACE = 2, @@ -334,7 +334,7 @@ public: uint32_t MaxBugIndex() const { return (uint32_t)MAX_BUG; } - const char *GetBugName(uint32_t bug); + static const char *GetBugName(uint32_t bug); enum : uint32_t { NO_DEPTH_CANNOT_DISCARD_STENCIL_ADRENO = 0, @@ -454,7 +454,7 @@ public: int Width() const { return width_; } int Height() const { return height_; } int Layers() const { return layers_; } - int MultiSampleLevel() { return multiSampleLevel_; } + int MultiSampleLevel() const { return multiSampleLevel_; } virtual void UpdateTag(const char *tag) {} protected: @@ -695,7 +695,7 @@ struct BackendState { class DrawContext { public: - virtual ~DrawContext(); + virtual ~DrawContext() = default; bool CreatePresets(); void DestroyPresets(); diff --git a/Common/GraphicsContext.h b/Common/GraphicsContext.h index 91319d72e8..a0ea7356c6 100644 --- a/Common/GraphicsContext.h +++ b/Common/GraphicsContext.h @@ -8,7 +8,7 @@ // expected to be implemented by subclasses. class GraphicsContext { public: - virtual ~GraphicsContext() {} + virtual ~GraphicsContext() = default; virtual bool InitFromRenderThread(std::string *errorMessage) { return true; } virtual void ShutdownFromRenderThread() {} diff --git a/Common/Log/LogManager.cpp b/Common/Log/LogManager.cpp index b3eedf9f19..3ed417466a 100644 --- a/Common/Log/LogManager.cpp +++ b/Common/Log/LogManager.cpp @@ -80,7 +80,7 @@ bool GenericLogEnabled(LogLevel level, Log type) { return false; } -LogManager *LogManager::logManager_ = NULL; +LogManager *LogManager::logManager_ = nullptr; // NOTE: Needs to be kept in sync with the Log enum. static const char * const g_logTypeNames[] = { @@ -215,8 +215,8 @@ void LogManager::ChangeFileLog(const char *filename) { void LogManager::SaveConfig(Section *section) { for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) { - section->Set((std::string(log_[i].m_shortName) + "Enabled").c_str(), log_[i].enabled); - section->Set((std::string(log_[i].m_shortName) + "Level").c_str(), (int)log_[i].level); + section->Set((std::string(log_[i].m_shortName) + "Enabled"), log_[i].enabled); + section->Set((std::string(log_[i].m_shortName) + "Level"), (int)log_[i].level); } } @@ -224,8 +224,8 @@ void LogManager::LoadConfig(const Section *section, bool debugDefaults) { for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) { bool enabled = false; int level = 0; - section->Get((std::string(log_[i].m_shortName) + "Enabled").c_str(), &enabled, true); - section->Get((std::string(log_[i].m_shortName) + "Level").c_str(), &level, (int)(debugDefaults ? LogLevel::LDEBUG : LogLevel::LERROR)); + section->Get((std::string(log_[i].m_shortName) + "Enabled"), &enabled, true); + section->Get((std::string(log_[i].m_shortName) + "Level"), &level, (int)(debugDefaults ? LogLevel::LDEBUG : LogLevel::LERROR)); log_[i].enabled = enabled; log_[i].level = (LogLevel)level; } @@ -246,7 +246,7 @@ void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, c static const char sep = '/'; #endif const char *fileshort = strrchr(file, sep); - if (fileshort != NULL) { + if (fileshort) { do --fileshort; while (fileshort > file && *fileshort != sep); @@ -302,7 +302,7 @@ void LogManager::Init(bool *enabledSetting) { void LogManager::Shutdown() { delete logManager_; - logManager_ = NULL; + logManager_ = nullptr; } void LogManager::AddListener(LogListener *listener) { diff --git a/Common/Log/LogManager.h b/Common/Log/LogManager.h index 1bceb3433e..ba458b3af6 100644 --- a/Common/Log/LogManager.h +++ b/Common/Log/LogManager.h @@ -45,7 +45,7 @@ struct LogMessage { // pure virtual interface class LogListener { public: - virtual ~LogListener() {} + virtual ~LogListener() = default; virtual void Log(const LogMessage &msg) = 0; }; diff --git a/Common/Log/StdioListener.cpp b/Common/Log/StdioListener.cpp index ce0efd5203..b8617691e9 100644 --- a/Common/Log/StdioListener.cpp +++ b/Common/Log/StdioListener.cpp @@ -19,8 +19,8 @@ #include // min #include #include // System: To be able to add strings with "+" -#include -#include +#include +#include #ifndef _MSC_VER #include #endif diff --git a/Common/MachineContext.h b/Common/MachineContext.h index 282a63c237..8ff7f59832 100644 --- a/Common/MachineContext.h +++ b/Common/MachineContext.h @@ -106,7 +106,7 @@ typedef x86_thread_state64_t SContext; #elif defined(__linux__) -#include +#include #if PPSSPP_ARCH(AMD64) diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 9c7130e8dd..246d6e11cd 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -31,8 +31,8 @@ #ifdef _WIN32 #include "Common/CommonWindows.h" #else -#include -#include +#include +#include #endif #ifdef __APPLE__ diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index 13be8e4998..2cbadaec17 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -38,9 +38,6 @@ namespace net { -Connection::Connection() { -} - Connection::~Connection() { Disconnect(); if (resolved_ != nullptr) @@ -173,7 +170,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { int selectResult = 0; long timeoutHalfSeconds = floor(2 * timeout); while (timeoutHalfSeconds >= 0 && selectResult == 0) { - struct timeval tv; + struct timeval tv{}; tv.tv_sec = 0; if (timeoutHalfSeconds > 0) { // Wait up to 0.5 seconds between cancel checks. @@ -512,13 +509,13 @@ HTTPRequest::HTTPRequest(RequestMethod method, const std::string &url, const std } HTTPRequest::~HTTPRequest() { - g_OSD.RemoveProgressBar(url_, Failed() ? false : true, 0.5f); + g_OSD.RemoveProgressBar(url_, !failed_, 0.5f); _assert_msg_(joined_, "Download destructed without join"); } void HTTPRequest::Start() { - thread_ = std::thread(std::bind(&HTTPRequest::Do, this)); + thread_ = std::thread([this] { Do(); }); } void HTTPRequest::Join() { diff --git a/Common/Net/HTTPClient.h b/Common/Net/HTTPClient.h index 92a56686be..8608006bac 100644 --- a/Common/Net/HTTPClient.h +++ b/Common/Net/HTTPClient.h @@ -14,7 +14,6 @@ namespace net { class Connection { public: - Connection(); virtual ~Connection(); // Inits the sockaddr_in. diff --git a/Common/Net/HTTPNaettRequest.cpp b/Common/Net/HTTPNaettRequest.cpp index 6c39f0a4df..9c14c6a49b 100644 --- a/Common/Net/HTTPNaettRequest.cpp +++ b/Common/Net/HTTPNaettRequest.cpp @@ -17,7 +17,7 @@ HTTPSRequest::HTTPSRequest(RequestMethod method, const std::string &url, const s } HTTPSRequest::~HTTPSRequest() { - Join(); + HTTPSRequest::Join(); } void HTTPSRequest::Start() { @@ -53,7 +53,7 @@ void HTTPSRequest::Join() { if (!res_ || !req_) return; // No pending operation. // Tear down. - if (completed_ && res_) { + if (completed_) { _dbg_assert_(req_); naettClose(res_); naettFree(req_); diff --git a/Common/Net/Resolve.cpp b/Common/Net/Resolve.cpp index f7219d4ef8..bcdd1ad567 100644 --- a/Common/Net/Resolve.cpp +++ b/Common/Net/Resolve.cpp @@ -1,9 +1,9 @@ #include "ppsspp_config.h" #include "Common/Net/Resolve.h" -#include -#include -#include +#include +#include +#include #include #include @@ -98,7 +98,7 @@ bool DNSResolve(const std::string &host, const std::string &service, addrinfo ** else if (type == DNSType::IPV6) hints.ai_family = AF_INET6; - const char *servicep = service.length() == 0 ? nullptr : service.c_str(); + const char *servicep = service.empty() ? nullptr : service.c_str(); *res = nullptr; int result = getaddrinfo(host.c_str(), servicep, &hints, res); @@ -125,7 +125,7 @@ bool DNSResolve(const std::string &host, const std::string &service, addrinfo ** void DNSResolveFree(addrinfo *res) { - if (res != NULL) + if (res) freeaddrinfo(res); } @@ -163,8 +163,7 @@ bool GetIPList(std::vector &IP4s) { #elif defined(SIOCGIFCONF) // Better detection on Linux/UNIX/MacOS/some Android INFO_LOG(Log::sceNet, "GetIPList from SIOCGIFCONF"); static struct ifreq ifreqs[32]; - struct ifconf ifc; - memset(&ifc, 0, sizeof(ifconf)); + struct ifconf ifc{}; ifc.ifc_req = ifreqs; ifc.ifc_len = sizeof(ifreqs); @@ -198,7 +197,7 @@ bool GetIPList(std::vector &IP4s) { if (ifreqs[i].ifr_addr.sa_family == AF_INET) { // is a valid IP4 Address if (inet_ntop(AF_INET, &((struct sockaddr_in*)addr)->sin_addr, ipstr, sizeof(ipstr)) != 0) { - IP4s.push_back(ipstr); + IP4s.emplace_back(ipstr); } } /*else if (ifreqs[i].ifr_addr.sa_family == AF_INET6) { diff --git a/Common/Render/Text/draw_text_android.cpp b/Common/Render/Text/draw_text_android.cpp index df8da6a8b8..2236cd1cbc 100644 --- a/Common/Render/Text/draw_text_android.cpp +++ b/Common/Render/Text/draw_text_android.cpp @@ -37,7 +37,7 @@ TextDrawerAndroid::~TextDrawerAndroid() { // At worst we leak one ref... // env_->DeleteGlobalRef(cls_textRenderer); ClearCache(); - ClearFonts(); + fontMap_.clear(); // size is precomputed using dpiScale_. } bool TextDrawerAndroid::IsReady() const { @@ -58,8 +58,8 @@ uint32_t TextDrawerAndroid::SetFont(const char *fontName, int size, int flags) { } // Just chose a factor that looks good, don't know what unit size is in anyway. - AndroidFontEntry entry; - entry.size = (float)(size * 1.4f) / dpiScale_; + AndroidFontEntry entry{}; + entry.size = ((float)size * 1.4f) / dpiScale_; fontMap_[fontHash] = entry; fontHash_ = fontHash; return fontHash; diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index 2f797a71dc..2c90f615c8 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -32,11 +32,11 @@ #include -#include +#include #include #include -#include +#include #include #include @@ -235,7 +235,7 @@ void DataToHexString(int indent, uint32_t startAddr, const uint8_t* data, size_t std::string StringFromFormat(const char* format, ...) { va_list args; - std::string temp = ""; + std::string temp; #ifdef _WIN32 int required = 0; @@ -275,7 +275,7 @@ std::string StringFromInt(int value) { // Turns " hej " into "hej". Also handles tabs. std::string StripSpaces(const std::string &str) { const size_t s = str.find_first_not_of(" \t\r\n"); - if (str.npos != s) + if (std::string::npos != s) return str.substr(s, str.find_last_not_of(" \t\r\n") - s + 1); else return ""; @@ -295,7 +295,7 @@ std::string StripQuotes(const std::string& s) // Turns " hej " into "hej". Also handles tabs. std::string_view StripSpaces(std::string_view str) { const size_t s = str.find_first_not_of(" \t\r\n"); - if (str.npos != s) + if (std::string::npos != s) return str.substr(s, str.find_last_not_of(" \t\r\n") - s + 1); else return ""; @@ -398,7 +398,7 @@ std::string ReplaceAll(std::string_view input, std::string_view src, std::string // TODO: Don't mutate the input, just append stuff to the output instead. while (true) { pos = result.find(src, pos); - if (pos == result.npos) + if (pos == std::string_view::npos) break; result.replace(pos, src.size(), dest); pos += dest.size(); diff --git a/Common/StringUtils.h b/Common/StringUtils.h index aa331e0f93..0543466a8e 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -115,7 +115,6 @@ const char* safe_string(const char* s); long parseHexLong(const std::string &s); long parseLong(std::string s); -std::string StringFromFormat(const char* format, ...); // Cheap! bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args); diff --git a/Common/UI/Context.h b/Common/UI/Context.h index 849de045fb..bc4bd45f1d 100644 --- a/Common/UI/Context.h +++ b/Common/UI/Context.h @@ -22,7 +22,6 @@ namespace Draw { class RasterState; } -class Texture; class DrawBuffer; class TextDrawer; diff --git a/Common/UI/IconCache.cpp b/Common/UI/IconCache.cpp index 125f7cc32c..5af81d6638 100644 --- a/Common/UI/IconCache.cpp +++ b/Common/UI/IconCache.cpp @@ -35,7 +35,7 @@ void IconCache::SaveToFile(FILE *file) { // First, compute the total size. If above a threshold, remove until under. Decimate(MAX_SAVED_CACHE_SIZE); - DiskCacheHeader header; + DiskCacheHeader header{}; header.magic = ICON_CACHE_MAGIC; header.version = ICON_CACHE_VERSION; header.entryCount = (uint32_t)cache_.size(); @@ -43,8 +43,7 @@ void IconCache::SaveToFile(FILE *file) { fwrite(&header, 1, sizeof(header), file); for (auto &iter : cache_) { - DiskCacheEntry entryHeader; - memset(&entryHeader, 0, sizeof(entryHeader)); // valgrind complains about padding bytes + DiskCacheEntry entryHeader{}; entryHeader.keyLen = (uint32_t)iter.first.size(); entryHeader.dataLen = (uint32_t)iter.second.data.size(); entryHeader.format = iter.second.format; @@ -58,7 +57,7 @@ void IconCache::SaveToFile(FILE *file) { bool IconCache::LoadFromFile(FILE *file) { std::unique_lock lock(lock_); - DiskCacheHeader header; + DiskCacheHeader header{}; if (fread(&header, 1, sizeof(header), file) != sizeof(DiskCacheHeader)) { return false; } @@ -69,7 +68,7 @@ bool IconCache::LoadFromFile(FILE *file) { double now = time_now_d(); for (uint32_t i = 0; i < header.entryCount; i++) { - DiskCacheEntry entryHeader; + DiskCacheEntry entryHeader{}; if (fread(&entryHeader, 1, sizeof(entryHeader), file) != sizeof(entryHeader)) { break; } @@ -157,7 +156,7 @@ void IconCache::Decimate(int64_t maxSize) { int64_t totalSize = 0; for (auto &iter : cache_) { - totalSize += iter.second.data.size(); + totalSize += (int64_t)iter.second.data.size(); } if (totalSize <= maxSize) { @@ -173,7 +172,7 @@ void IconCache::Decimate(int64_t maxSize) { std::vector sortEntries; sortEntries.reserve(cache_.size()); - for (auto iter : cache_) { + for (const auto &iter : cache_) { sortEntries.push_back({ iter.first, iter.second.usedTimeStamp, iter.second.data.size() }); } @@ -183,7 +182,7 @@ void IconCache::Decimate(int64_t maxSize) { }); while (totalSize > maxSize && !sortEntries.empty()) { - totalSize -= sortEntries.back().size; + totalSize -= (int64_t)sortEntries.back().size; auto iter = cache_.find(sortEntries.back().key); if (iter != cache_.end()) { if (iter->second.texture) { diff --git a/Common/UI/Root.cpp b/Common/UI/Root.cpp index 41dadf3d16..db8abe99cb 100644 --- a/Common/UI/Root.cpp +++ b/Common/UI/Root.cpp @@ -88,7 +88,7 @@ void EnableFocusMovement(bool enable) { if (focusedView) { focusedView->FocusChanged(FF_LOSTFOCUS); } - focusedView = 0; + focusedView = nullptr; } } diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index 7f88d7648e..41d9d084a1 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -61,7 +61,9 @@ void ScreenManager::switchScreen(Screen *screen) { WARN_LOG(Log::System, "Switching to a zero screen, this can't be good"); } if (stack_.empty() || screen != stack_.back().screen) { - screen->setScreenManager(this); + if (screen) { + screen->setScreenManager(this); + } nextStack_.push_back({ screen, 0 }); } } @@ -77,7 +79,7 @@ void ScreenManager::update() { overlayScreen_->update(); } // The background screen doesn't need updating. - if (stack_.size()) { + if (!stack_.empty()) { stack_.back().screen->update(); } } diff --git a/Common/UI/Screen.h b/Common/UI/Screen.h index 8b015c925a..156fd57c3f 100644 --- a/Common/UI/Screen.h +++ b/Common/UI/Screen.h @@ -118,7 +118,7 @@ private: class Transition { public: - Transition() {} + Transition() = default; }; enum { diff --git a/Common/UI/UI.h b/Common/UI/UI.h index f73ab0a7a6..39d6855f5d 100644 --- a/Common/UI/UI.h +++ b/Common/UI/UI.h @@ -53,7 +53,6 @@ class StringVectorListAdapter : public UIListAdapter { public: StringVectorListAdapter(const std::vector *items) : items_(items) {} size_t getCount() const override { return items_->size(); } - void drawItem(int item, int x, int y, int w, int h, bool active) const override; private: const std::vector *items_; diff --git a/Common/UI/ViewGroup.h b/Common/UI/ViewGroup.h index da2e4e5fd0..01e253ac3c 100644 --- a/Common/UI/ViewGroup.h +++ b/Common/UI/ViewGroup.h @@ -69,7 +69,7 @@ public: virtual void SetBG(const Drawable &bg) { bg_ = bg; } - virtual void Clear(); + void Clear(); void PersistData(PersistStatus status, std::string anonId, PersistMap &storage) override; View *GetViewByIndex(int index) { return views_[index]; } int GetNumSubviews() const { return (int)views_.size(); } diff --git a/Core/Config.cpp b/Core/Config.cpp index fac682fb84..918f1e26a5 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -123,7 +123,7 @@ const char *DefaultLangRegion() { std::vector keys; mapping.GetKeys("LangRegionNames", keys); - for (std::string key : keys) { + for (const std::string &key : keys) { if (startsWithNoCase(key, langRegion)) { // Exact submatch, or different case. Let's use it. defaultLangRegion = key; @@ -718,21 +718,10 @@ static const ConfigSetting soundSettings[] = { }; static bool DefaultShowTouchControls() { - int deviceType = System_GetPropertyInt(SYSPROP_DEVICE_TYPE); - if (deviceType == DEVICE_TYPE_MOBILE) { - std::string name = System_GetProperty(SYSPROP_NAME); - if (KeyMap::HasBuiltinController(name)) { - return false; - } else { - return true; - } - } else if (deviceType == DEVICE_TYPE_TV) { - return false; - } else if (deviceType == DEVICE_TYPE_DESKTOP) { - return false; - } else if (deviceType == DEVICE_TYPE_VR) { - return false; - } else { + switch (System_GetPropertyInt(SYSPROP_DEVICE_TYPE)) { + case DEVICE_TYPE_MOBILE: + return !KeyMap::HasBuiltinController(System_GetProperty(SYSPROP_NAME)); + default: return false; } } @@ -1063,9 +1052,9 @@ void Config::LoadLangValuesMapping() { for (size_t i = 0; i < keys.size(); i++) { std::string langName; - langRegionNames->Get(keys[i].c_str(), &langName, "ERROR"); + langRegionNames->Get(keys[i], &langName, "ERROR"); std::string langCode; - systemLanguage->Get(keys[i].c_str(), &langCode, "ENGLISH"); + systemLanguage->Get(keys[i], &langCode, "ENGLISH"); int iLangCode = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH; if (langCodeMapping.find(langCode) != langCodeMapping.end()) iLangCode = langCodeMapping[langCode]; @@ -1356,7 +1345,7 @@ bool Config::Save(const char *saveReason) { Section *postShaderSetting = iniFile.GetOrCreateSection("PostShaderSetting"); postShaderSetting->Clear(); for (const auto &[k, v] : mPostShaderSetting) { - postShaderSetting->Set(k.c_str(), v); + postShaderSetting->Set(k, v); } Section *postShaderChain = iniFile.GetOrCreateSection("PostShaderList"); postShaderChain->Clear(); @@ -1772,7 +1761,7 @@ bool Config::saveGameConfig(const std::string &pGameId, const std::string &title Section *postShaderSetting = iniFile.GetOrCreateSection("PostShaderSetting"); postShaderSetting->Clear(); for (const auto &[k, v] : mPostShaderSetting) { - postShaderSetting->Set(k.c_str(), v); + postShaderSetting->Set(k, v); } Section *postShaderChain = iniFile.GetOrCreateSection("PostShaderList"); @@ -1987,15 +1976,15 @@ void PlayTimeTracker::Load(const Section *section) { // Parse the string. PlayTime gameTime{}; if (2 == sscanf(value.c_str(), "%d,%llu", &gameTime.totalTimePlayed, (long long *)&gameTime.lastTimePlayed)) { - tracker_[iter.first.c_str()] = gameTime; + tracker_[iter.first] = gameTime; } } } void PlayTimeTracker::Save(Section *section) { - for (auto iter : tracker_) { + for (auto &iter : tracker_) { std::string formatted = StringFromFormat("%d,%llu", iter.second.totalTimePlayed, iter.second.lastTimePlayed); - section->Set(iter.first.c_str(), formatted); + section->Set(iter.first, formatted); } } diff --git a/Core/ConfigSettings.h b/Core/ConfigSettings.h index a643138101..440e22ca26 100644 --- a/Core/ConfigSettings.h +++ b/Core/ConfigSettings.h @@ -74,7 +74,7 @@ struct ConfigSetting { CustomButtonDefaultCallback customButton; }; - ConfigSetting(const char *ini, bool *v, bool def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, bool *v, bool def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_BOOL), flags_(flags) { ptr_.b = v; cb_.b = nullptr; @@ -82,7 +82,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, int *v, int def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, int *v, int def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_INT), flags_(flags) { ptr_.i = v; cb_.i = nullptr; @@ -90,7 +90,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, int *v, int def, std::string(*transTo)(int), int (*transFrom)(const std::string &), CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, int *v, int def, std::string(*transTo)(int), int (*transFrom)(const std::string &), CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_INT), flags_(flags), translateTo_(transTo), translateFrom_(transFrom) { ptr_.i = v; cb_.i = nullptr; @@ -98,7 +98,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, uint32_t *v, uint32_t def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, uint32_t *v, uint32_t def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_UINT32), flags_(flags) { ptr_.u = v; cb_.u = nullptr; @@ -106,7 +106,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, uint64_t *v, uint64_t def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, uint64_t *v, uint64_t def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_UINT64), flags_(flags) { ptr_.lu = v; cb_.lu = nullptr; @@ -114,7 +114,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, float *v, float def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, float *v, float def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_FLOAT), flags_(flags) { ptr_.f = v; cb_.f = nullptr; @@ -122,7 +122,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, std::string *v, const char *def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, std::string *v, const char *def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_STRING), flags_(flags) { ptr_.s = v; cb_.s = nullptr; @@ -130,7 +130,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, Path *v, const char *def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, Path *v, const char *def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_PATH), flags_(flags) { ptr_.p = v; cb_.p = nullptr; @@ -138,7 +138,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *iniX, const char *iniY, const char *iniScale, const char *iniShow, ConfigTouchPos *v, ConfigTouchPos def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *iniX, const char *iniY, const char *iniScale, const char *iniShow, ConfigTouchPos *v, ConfigTouchPos def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(iniX), ini2_(iniY), ini3_(iniScale), ini4_(iniShow), type_(TYPE_TOUCH_POS), flags_(flags) { ptr_.touchPos = v; cb_.touchPos = nullptr; @@ -146,7 +146,7 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *iniKey, const char *iniImage, const char *iniShape, const char *iniToggle, const char *iniRepeat, ConfigCustomButton *v, ConfigCustomButton def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *iniKey, const char *iniImage, const char *iniShape, const char *iniToggle, const char *iniRepeat, ConfigCustomButton *v, ConfigCustomButton def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(iniKey), ini2_(iniImage), ini3_(iniShape), ini4_(iniToggle), ini5_(iniRepeat), type_(TYPE_CUSTOM_BUTTON), flags_(flags) { ptr_.customButton = v; cb_.customButton = nullptr; @@ -154,49 +154,49 @@ struct ConfigSetting { getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, bool *v, BoolDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, bool *v, BoolDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_BOOL), flags_(flags) { ptr_.b = v; cb_.b = def; getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, int *v, IntDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, int *v, IntDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_INT), flags_(flags) { ptr_.i = v; cb_.i = def; getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, int *v, IntDefaultCallback def, std::string(*transTo)(int), int(*transFrom)(const std::string &), CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, int *v, IntDefaultCallback def, std::string(*transTo)(int), int(*transFrom)(const std::string &), CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_INT), flags_(flags), translateTo_(transTo), translateFrom_(transFrom) { ptr_.i = v; cb_.i = def; getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, uint32_t *v, Uint32DefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, uint32_t *v, Uint32DefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_UINT32), flags_(flags) { ptr_.u = v; cb_.u = def; getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, float *v, FloatDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, float *v, FloatDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_FLOAT), flags_(flags) { ptr_.f = v; cb_.f = def; getPtrLUT()[v] = this; } - ConfigSetting(const char *ini, std::string *v, StringDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *ini, std::string *v, StringDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(ini), type_(TYPE_STRING), flags_(flags) { ptr_.s = v; cb_.s = def; getPtrLUT()[v] = this; } - ConfigSetting(const char *iniX, const char *iniY, const char *iniScale, const char *iniShow, ConfigTouchPos *v, TouchPosDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) + ConfigSetting(const char *iniX, const char *iniY, const char *iniScale, const char *iniShow, ConfigTouchPos *v, TouchPosDefaultCallback def, CfgFlag flags = CfgFlag::DEFAULT) noexcept : iniKey_(iniX), ini2_(iniY), ini3_(iniScale), ini4_(iniShow), type_(TYPE_TOUCH_POS), flags_(flags) { ptr_.touchPos = v; cb_.touchPos = def; @@ -232,9 +232,9 @@ struct ConfigSetting { private: CfgFlag flags_; - SettingPtr ptr_; + SettingPtr ptr_{}; DefaultValue default_{}; - DefaultCallback cb_; + DefaultCallback cb_{}; // We only support transform for ints. std::string (*translateTo_)(int) = nullptr; diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 56c5bdc52d..f074251c5d 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -60,7 +60,7 @@ #endif #endif -StereoResampler::StereoResampler() +StereoResampler::StereoResampler() noexcept : m_maxBufsize(MAX_BUFSIZE_DEFAULT) , m_targetBufsize(TARGET_BUFSIZE_DEFAULT) { // Need to have space for the worst case in case it changes. diff --git a/Core/HW/StereoResampler.h b/Core/HW/StereoResampler.h index 071d7337f7..c691cfe35f 100644 --- a/Core/HW/StereoResampler.h +++ b/Core/HW/StereoResampler.h @@ -28,7 +28,7 @@ struct AudioDebugStats; class StereoResampler { public: - StereoResampler(); + StereoResampler() noexcept; ~StereoResampler(); // Called from audio threads diff --git a/Tools/langtool/Cargo.lock b/Tools/langtool/Cargo.lock index da4b681a99..6717cf54fb 100644 --- a/Tools/langtool/Cargo.lock +++ b/Tools/langtool/Cargo.lock @@ -53,9 +53,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -142,9 +142,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index c49941084f..667f30caf0 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -36,7 +36,7 @@ struct WavData { int raw_bytes_per_frame = 0; uint8_t *raw_data = nullptr; int raw_data_size = 0; - u8 at3_extradata[16]; + u8 at3_extradata[16]{}; bool Read(RIFFReader &riff); @@ -45,6 +45,7 @@ struct WavData { raw_data = nullptr; } + [[nodiscard]] bool IsSimpleWAV() const { bool isBad = raw_bytes_per_frame > sizeof(int16_t) * num_channels; return !isBad && num_channels > 0 && sample_rate >= 8000 && codec == 0; @@ -210,7 +211,7 @@ public: decoder_ = nullptr; } - bool IsOK() { return wave_.raw_data != nullptr; } + bool IsOK() const { return wave_.raw_data != nullptr; } bool Read(int *buffer, int len) { if (!wave_.raw_data) @@ -334,11 +335,13 @@ bool BackgroundAudio::Play() { if (at3Reader_) { if (at3Reader_->Read(buffer, sz)) { if (fadingOut_) { + float vol = volume_; for (int i = 0; i < sz*2; i += 2) { - buffer[i] *= volume_; - buffer[i + 1] *= volume_; - volume_ += delta_; + buffer[i] = (int)((float)buffer[i] * vol); + buffer[i + 1] = (int)((float)buffer[i + 1] * vol); + vol += delta_; } + volume_ = vol; } } } else { diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 564fe3da21..d34babde4d 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -69,7 +69,7 @@ private: UI::EventReturn OnReplace(UI::EventParams ¶ms); UI::EventReturn OnReplaceAll(UI::EventParams ¶ms); - void MappedCallback(const MultiInputMapping &key); + void MappedCallback(const MultiInputMapping &kdf); enum Action { NONE, @@ -82,7 +82,7 @@ private: UI::Choice *replaceAllButton_ = nullptr; std::vector rows_; Action action_ = NONE; - int actionIndex_; + int actionIndex_ = 0; int pspKey_; std::string keyName_; ScreenManager *scrm_; @@ -124,7 +124,7 @@ void SingleControlMapper::Refresh() { replaceAllButton_ = new Choice(iter->second, new LinearLayoutParams(leftColumnWidth, itemH)); } else { // No image? Let's translate. - replaceAllButton_ = new Choice(mc->T(keyName_.c_str()), new LinearLayoutParams(leftColumnWidth, itemH)); + replaceAllButton_ = new Choice(mc->T(keyName_), new LinearLayoutParams(leftColumnWidth, itemH)); replaceAllButton_->SetCentered(true); } root->Add(replaceAllButton_)->OnClick.Handle(this, &SingleControlMapper::OnReplaceAll); @@ -157,7 +157,7 @@ void SingleControlMapper::Refresh() { d->OnClick.Handle(this, &SingleControlMapper::OnDelete); } - if (mappings.size() == 0) { + if (mappings.empty()) { // look like an empty line Choice *c = rightColumn->Add(new Choice("", new LinearLayoutParams(FILL_PARENT, itemH))); c->OnClick.Handle(this, &SingleControlMapper::OnAdd); @@ -608,7 +608,7 @@ UI::EventReturn AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) { class Backplate : public UI::InertView { public: - Backplate(float scale, UI::LayoutParams *layoutParams = nullptr) : InertView(layoutParams), scale_(scale) {} + explicit Backplate(float scale, UI::LayoutParams *layoutParams = nullptr) : InertView(layoutParams), scale_(scale) {} void Draw(UIContext &dc) override { for (float dy = 0.0f; dy <= 4.0f; dy += 1.0f) { @@ -682,7 +682,7 @@ protected: class MockScreen : public UI::InertView { public: - MockScreen(UI::LayoutParams *layoutParams = nullptr) : InertView(layoutParams) { + explicit MockScreen(UI::LayoutParams *layoutParams = nullptr) : InertView(layoutParams) { } void Draw(UIContext &dc) override { diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index ea50e3fd68..8b9c82a184 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -211,7 +211,6 @@ public: void FlushBGs(); // Gets rid of all BG textures. Also gets rid of bg sounds. void CancelAll(); - void WaitUntilDone(std::shared_ptr &info); private: void Init(); diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index 2bd609d769..cba3b07c3a 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -40,7 +40,7 @@ void InstallZipScreen::CreateViews() { using namespace UI; File::FileInfo fileInfo; - bool success = File::GetFileInfo(zipPath_, &fileInfo); + File::GetFileInfo(zipPath_, &fileInfo); auto di = GetI18NCategory(I18NCat::DIALOG); auto iz = GetI18NCategory(I18NCat::INSTALLZIP); @@ -227,7 +227,7 @@ void InstallZipScreen::update() { std::string err = g_GameManager.GetInstallError(); if (!err.empty()) { if (doneView_) - doneView_->SetText(iz->T(err.c_str())); + doneView_->SetText(iz->T(err)); } else if (installStarted_) { if (doneView_) doneView_->SetText(iz->T("Installed!")); diff --git a/UI/JitCompareScreen.cpp b/UI/JitCompareScreen.cpp index 326bd55d9f..03044dd729 100644 --- a/UI/JitCompareScreen.cpp +++ b/UI/JitCompareScreen.cpp @@ -344,7 +344,7 @@ void JitCompareScreen::UpdateDisasm() { } else { // viewMode_ == ViewMode::STATS statsContainer_->Clear(); - BlockCacheStats bcStats; + BlockCacheStats bcStats{}; blockCacheDebug->ComputeStats(bcStats); char stats[1024]; diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index fb06e42c27..0ad6eb28ed 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -123,7 +123,7 @@ static bool IsTempPath(const Path &str) { class GameButton : public UI::Clickable { public: - GameButton(const Path &gamePath, bool gridStyle, UI::LayoutParams *layoutParams = 0) + GameButton(const Path &gamePath, bool gridStyle, UI::LayoutParams *layoutParams = nullptr) : UI::Clickable(layoutParams), gridStyle_(gridStyle), gamePath_(gamePath) {} void Draw(UIContext &dc) override; @@ -227,7 +227,7 @@ private: void GameButton::Draw(UIContext &dc) { std::shared_ptr ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath_, GameInfoFlags::PARAM_SFO | GameInfoFlags::ICON); - Draw::Texture *texture = 0; + Draw::Texture *texture = nullptr; u32 color = 0, shadowColor = 0; using namespace UI; @@ -685,7 +685,7 @@ bool GameBrowser::HasSpecialFiles(std::vector &filenames) { if (path_.GetPath().ToString() == "!RECENT") { filenames.clear(); for (auto &str : g_Config.RecentIsos()) { - filenames.push_back(Path(str)); + filenames.emplace_back(str); } return true; } @@ -1326,7 +1326,7 @@ void MainScreen::CreateViews() { root_->SetTag("mainroot"); - upgradeBar_ = 0; + upgradeBar_ = nullptr; if (!g_Config.upgradeMessage.empty()) { auto u = GetI18NCategory(I18NCat::UPGRADE); upgradeBar_ = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); diff --git a/UI/MainScreen.h b/UI/MainScreen.h index 026f967410..db901751e3 100644 --- a/UI/MainScreen.h +++ b/UI/MainScreen.h @@ -170,7 +170,7 @@ protected: float prevHighlightProgress_ = 0.0f; bool backFromStore_ = false; bool lockBackgroundAudio_ = false; - bool lastVertical_; + bool lastVertical_ = false; bool confirmedTemporary_ = false; UI::ScrollView *scrollAllGames_ = nullptr; bool searchKeyModifier_ = false; diff --git a/UI/MemStickScreen.cpp b/UI/MemStickScreen.cpp index 44fb79b097..d7f28bbf57 100644 --- a/UI/MemStickScreen.cpp +++ b/UI/MemStickScreen.cpp @@ -236,7 +236,7 @@ void MemStickScreen::CreateViews() { leftColumn->Add(new Spacer(new LinearLayoutParams(FILL_PARENT, 12.0f, 0.0f))); - std::string_view confirmButtonText = ""; + std::string_view confirmButtonText; ImageID confirmButtonImage = ImageID::invalid(); switch (choice_) { case CHOICE_BROWSE_FOLDER: @@ -310,9 +310,9 @@ UI::EventReturn MemStickScreen::SetFolderManually(UI::EventParams ¶ms) { auto di = GetI18NCategory(I18NCat::DIALOG); std::string newPath = value; - size_t pos = newPath.find_last_not_of("/"); + size_t pos = newPath.find_last_not_of('/'); // Gotta have at least something but a /, and also needs to start with a /. - if (newPath.empty() || pos == newPath.npos || newPath[0] != '/') { + if (newPath.empty() || pos == std::string::npos || newPath[0] != '/') { settingInfo_->Show(sy->T("ChangingMemstickPathInvalid", "That path couldn't be used to save Memory Stick files."), nullptr); return; } @@ -456,7 +456,7 @@ void MemStickScreen::update() { } } -ConfirmMemstickMoveScreen::ConfirmMemstickMoveScreen(Path newMemstickFolder, bool initialSetup) +ConfirmMemstickMoveScreen::ConfirmMemstickMoveScreen(const Path &newMemstickFolder, bool initialSetup) : newMemstickFolder_(newMemstickFolder), initialSetup_(initialSetup), progressReporter_() { existingFilesInNewFolder_ = FolderSeemsToBeUsed(newMemstickFolder); if (initialSetup_) { diff --git a/UI/MemStickScreen.h b/UI/MemStickScreen.h index d705aa72ee..cb10cffe72 100644 --- a/UI/MemStickScreen.h +++ b/UI/MemStickScreen.h @@ -38,7 +38,7 @@ class NoticeView; class MemStickScreen : public UIDialogScreenWithBackground { public: MemStickScreen(bool initialSetup); - ~MemStickScreen() {} + ~MemStickScreen() = default; const char *tag() const override { return "MemStick"; } @@ -95,7 +95,7 @@ private: class ConfirmMemstickMoveScreen : public UIDialogScreenWithBackground { public: - ConfirmMemstickMoveScreen(Path newMemstickFolder, bool initialSetup); + ConfirmMemstickMoveScreen(const Path &newMemstickFolder, bool initialSetup); ~ConfirmMemstickMoveScreen(); const char *tag() const override { return "ConfirmMemstickMove"; } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 900d7ad778..9c3ec15454 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -80,7 +80,7 @@ static Draw::Texture *bgTexture; class Animation { public: - virtual ~Animation() {} + virtual ~Animation() = default; virtual void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) = 0; }; @@ -254,7 +254,7 @@ private: } } - std::shared_ptr GetInfo(UIContext &dc, int index) { + static std::shared_ptr GetInfo(UIContext &dc, int index) { if (index < 0) { return nullptr; } @@ -264,7 +264,7 @@ private: return g_gameInfoCache->GetInfo(dc.GetDrawContext(), Path(recentIsos[index]), GameInfoFlags::BG); } - void DrawTex(UIContext &dc, std::shared_ptr &ginfo, float amount) { + static void DrawTex(UIContext &dc, std::shared_ptr &ginfo, float amount) { if (!ginfo || amount <= 0.0f) return; GameInfoTex *pic = ginfo->GetBGPic(); @@ -520,8 +520,6 @@ void PromptScreen::CreateViews() { // Scrolling action menu to the right. using namespace UI; - Margins actionMenuMargins(0, 100, 15, 0); - root_ = new AnchorLayout(); root_->Add(new TextView(message_, ALIGN_LEFT | FLAG_WRAP_TEXT, false, new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, 15, 15, 330, 10)))->SetClip(false); @@ -570,7 +568,7 @@ void TextureShaderScreen::CreateViews() { for (int i = 0; i < (int)shaders_.size(); i++) { if (shaders_[i].section == g_Config.sTextureShaderName) selected = i; - items.push_back(std::string(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str()))); + items.emplace_back(ps->T(shaders_[i].section, shaders_[i].name)); } adaptor_ = UI::StringVectorListAdaptor(items, selected); @@ -613,7 +611,7 @@ NewLanguageScreen::NewLanguageScreen(std::string_view title) : ListPopupScreen(t } #endif - File::FileInfo lang = tempLangs[i]; + const File::FileInfo &lang = tempLangs[i]; langs_.push_back(lang); std::string code; @@ -797,6 +795,7 @@ void CreditsScreen::CreateViews() { using namespace UI; auto di = GetI18NCategory(I18NCat::DIALOG); auto cr = GetI18NCategory(I18NCat::PSPCREDITS); + auto mm = GetI18NCategory(I18NCat::MAINMENU); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); Button *back = root_->Add(new Button(di->T("Back"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 10, false))); @@ -807,7 +806,7 @@ void CreditsScreen::CreateViews() { int rightYOffset = 0; if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) { - root_->Add(new Button(cr->T("Buy Gold"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnSupport); + root_->Add(new Button(mm->T("Buy PPSSPP Gold"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnSupport); rightYOffset = 74; } root_->Add(new Button(cr->T("PPSSPP Forums"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 158, false)))->OnClick.Handle(this, &CreditsScreen::OnForums); @@ -815,6 +814,7 @@ void CreditsScreen::CreateViews() { root_->Add(new Button("www.ppsspp.org", new AnchorLayoutParams(260, 64, 10, NONE, NONE, 10, false)))->OnClick.Handle(this, &CreditsScreen::OnPPSSPPOrg); root_->Add(new Button(cr->T("Privacy Policy"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnPrivacy); root_->Add(new Button(cr->T("Twitter @PPSSPP_emu"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 84, false)))->OnClick.Handle(this, &CreditsScreen::OnTwitter); + #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) root_->Add(new Button(cr->T("Share PPSSPP"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 158, false)))->OnClick.Handle(this, &CreditsScreen::OnShare); #endif @@ -958,12 +958,12 @@ void CreditsScreen::DrawForeground(UIContext &dc) { "fp64", "", cr->T("specialthanks", "Special thanks to:"), - specialthanksMaxim.c_str(), - specialthanksKeithGalocy.c_str(), - specialthanksOrphis.c_str(), - specialthanksangelxwind.c_str(), - specialthanksW_MS.c_str(), - specialthankssolarmystic.c_str(), + specialthanksMaxim, + specialthanksKeithGalocy, + specialthanksOrphis, + specialthanksangelxwind, + specialthanksW_MS, + specialthankssolarmystic, cr->T("all the forum mods"), "", cr->T("this translation by", ""), // Empty string as this is the original :) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 272ff35e16..d1e67d3516 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -28,7 +28,7 @@ // Background worker threads should be spawned in NativeInit and joined // in NativeShutdown. -#include +#include #include #include #include @@ -529,7 +529,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch LogManager *logman = LogManager::GetInstance(); - const char *fileToLog = 0; + const char *fileToLog = nullptr; Path stateToLoad; bool gotBootFilename = false; diff --git a/UI/OnScreenDisplay.cpp b/UI/OnScreenDisplay.cpp index c02e5bcbe0..b640f18cbc 100644 --- a/UI/OnScreenDisplay.cpp +++ b/UI/OnScreenDisplay.cpp @@ -70,13 +70,13 @@ static NoticeLevel GetNoticeLevel(OSDType type) { // Align only matters here for the ASCII-only flag. static void MeasureNotice(const UIContext &dc, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float *width, float *height, float *height1) { - dc.MeasureText(dc.theme->uiFont, 1.0f, 1.0f, text.c_str(), width, height, align); + dc.MeasureText(dc.theme->uiFont, 1.0f, 1.0f, text, width, height, align); *height1 = *height; float width2 = 0.0f, height2 = 0.0f; if (!details.empty()) { - dc.MeasureText(dc.theme->uiFont, extraTextScale, extraTextScale, details.c_str(), &width2, &height2, align); + dc.MeasureText(dc.theme->uiFont, extraTextScale, extraTextScale, details, &width2, &height2, align); *width = std::max(*width, width2); *height += 5.0f + height2; } @@ -157,7 +157,7 @@ static void RenderNotice(UIContext &dc, Bounds bounds, float height1, NoticeLeve bounds.x += iconW + 5.0f; bounds.w -= iconW + 5.0f; - dc.DrawTextShadowRect(text.c_str(), bounds.Inset(0.0f, 1.0f, 0.0f, 0.0f), foreGround, (align & FLAG_DYNAMIC_ASCII)); + dc.DrawTextShadowRect(text, bounds.Inset(0.0f, 1.0f, 0.0f, 0.0f), foreGround, (align & FLAG_DYNAMIC_ASCII)); if (!details.empty()) { Bounds bottomTextBounds = bounds.Inset(3.0f, height1 + 5.0f, 3.0f, 3.0f); @@ -187,8 +187,6 @@ static void MeasureOSDProgressBar(const UIContext &dc, const OnScreenDisplay::En } static void RenderOSDProgressBar(UIContext &dc, const OnScreenDisplay::Entry &entry, Bounds bounds, int align, float alpha) { - uint32_t foreGround = whiteAlpha(alpha); - dc.DrawRectDropShadow(bounds, 12.0f, 0.7f * alpha); uint32_t backgroundColor = colorAlpha(0x806050, alpha); @@ -222,11 +220,11 @@ static void RenderOSDProgressBar(UIContext &dc, const OnScreenDisplay::Entry &en dc.SetFontStyle(dc.theme->uiFont); dc.SetFontScale(1.0f, 1.0f); - dc.DrawTextShadowRect(entry.text.c_str(), bounds, colorAlpha(0xFFFFFFFF, alpha), (align & FLAG_DYNAMIC_ASCII) | ALIGN_CENTER); + dc.DrawTextShadowRect(entry.text, bounds, colorAlpha(0xFFFFFFFF, alpha), (align & FLAG_DYNAMIC_ASCII) | ALIGN_CENTER); } static void MeasureLeaderboardTracker(UIContext &dc, const std::string &text, float *width, float *height) { - dc.MeasureText(dc.GetFontStyle(), 1.0f, 1.0f, text.c_str(), width, height); + dc.MeasureText(dc.GetFontStyle(), 1.0f, 1.0f, text, width, height); *width += 16.0f; *height += 10.0f; } @@ -239,7 +237,7 @@ static void RenderLeaderboardTracker(UIContext &dc, const Bounds &bounds, const dc.FillRect(background, bounds); dc.SetFontStyle(dc.theme->uiFont); dc.SetFontScale(1.0f, 1.0f); - dc.DrawTextShadowRect(text.c_str(), bounds.Inset(5.0f, 5.0f), colorAlpha(0xFFFFFFFF, alpha), ALIGN_VCENTER | ALIGN_HCENTER); + dc.DrawTextShadowRect(text, bounds.Inset(5.0f, 5.0f), colorAlpha(0xFFFFFFFF, alpha), ALIGN_VCENTER | ALIGN_HCENTER); } void OnScreenMessagesView::Draw(UIContext &dc) { @@ -319,11 +317,11 @@ void OnScreenMessagesView::Draw(UIContext &dc) { measuredEntry.align2 = 0; // If we have newlines, we may be looking at ASCII debug output. But let's verify. if (entry.text.find('\n') != std::string::npos) { - if (!UTF8StringHasNonASCII(entry.text.c_str())) + if (!UTF8StringHasNonASCII(entry.text)) measuredEntry.align |= FLAG_DYNAMIC_ASCII; } if (entry.text2.find('\n') != std::string::npos) { - if (!UTF8StringHasNonASCII(entry.text2.c_str())) + if (!UTF8StringHasNonASCII(entry.text2)) measuredEntry.align2 |= FLAG_DYNAMIC_ASCII; } diff --git a/UI/PauseScreen.h b/UI/PauseScreen.h index 3e039338a2..f177b33f2c 100644 --- a/UI/PauseScreen.h +++ b/UI/PauseScreen.h @@ -26,11 +26,6 @@ #include "UI/MiscScreens.h" #include "UI/Screen.h" -enum class PauseScreenMode { - MAIN, - DISPLAY_SETTINGS, -}; - class GamePauseScreen : public UIDialogScreenWithGameBackground { public: GamePauseScreen(const Path &filename); @@ -67,7 +62,6 @@ private: // hack bool finishNextFrame_ = false; DialogResult finishNextFrameResult_ = DR_CANCEL; - PauseScreenMode mode_ = PauseScreenMode::MAIN; UI::Button *playButton_ = nullptr; }; diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index 8458507c99..6d65a67003 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -77,7 +77,7 @@ RatingChoice::RatingChoice(std::string_view captionKey, int *value, LayoutParams Add(group_); group_->SetSpacing(0.0f); - SetupChoices(); + RatingChoice::SetupChoices(); } void RatingChoice::Update() { @@ -147,7 +147,7 @@ protected: CompatRatingChoice::CompatRatingChoice(const char *captionKey, int *value, LayoutParams *layoutParams) : RatingChoice(captionKey, value, layoutParams) { - SetupChoices(); + CompatRatingChoice::SetupChoices(); } void CompatRatingChoice::SetupChoices() { diff --git a/UI/RetroAchievementScreens.cpp b/UI/RetroAchievementScreens.cpp index d7022ef567..9e5170c44f 100644 --- a/UI/RetroAchievementScreens.cpp +++ b/UI/RetroAchievementScreens.cpp @@ -14,7 +14,7 @@ #include "UI/OnScreenDisplay.h" static inline std::string_view DeNull(const char *ptr) { - return ptr ? std::string_view(ptr) : ""; + return std::string_view(ptr ? ptr : ""); } // Compound view, creating a FileChooserChoice inside. @@ -221,9 +221,9 @@ void RetroAchievementsLeaderboardScreen::CreateTabs() { const rc_client_leaderboard_entry_t &entry = entryList_->entries[i]; char buffer[512]; - rc_client_leaderboard_entry_get_user_image_url(&entryList_->entries[i], buffer, sizeof(buffer)); + rc_client_leaderboard_entry_get_user_image_url(&entry, buffer, sizeof(buffer)); // Can also show entry.submitted, which is a time_t. And maybe highlight recent ones? - layout->Add(new LeaderboardEntryView(&entryList_->entries[i], is_self)); + layout->Add(new LeaderboardEntryView(&entry, is_self)); } } } @@ -244,7 +244,7 @@ void RetroAchievementsLeaderboardScreen::update() { Poll(); } -RetroAchievementsSettingsScreen::~RetroAchievementsSettingsScreen() {} +RetroAchievementsSettingsScreen::~RetroAchievementsSettingsScreen() = default; void RetroAchievementsSettingsScreen::CreateTabs() { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); @@ -417,7 +417,7 @@ static void MeasureGameAchievementSummary(const UIContext &dc, float *w, float * float tw, th; dc.MeasureText(dc.theme->uiFont, 1.0f, 1.0f, "Wg", &tw, &th); - dc.MeasureText(dc.theme->uiFont, 0.66f, 0.66f, description.c_str(), w, h); + dc.MeasureText(dc.theme->uiFont, 0.66f, 0.66f, description, w, h); *h += 8.0f + th; *w += 8.0f; } @@ -654,7 +654,7 @@ static void RenderLeaderboardEntry(UIContext &dc, const rc_client_leaderboard_en dc.SetFontStyle(dc.theme->uiFont); dc.SetFontScale(1.5f, 1.5f); - dc.DrawTextRect(StringFromFormat("%d", entry->rank).c_str(), Bounds(bounds.x + 4.0f, bounds.y + 4.0f, numberSpace - 10.0f, bounds.h - 4.0f * 2.0f), fgColor, ALIGN_TOPRIGHT); + dc.DrawTextRect(StringFromFormat("%d", entry->rank), Bounds(bounds.x + 4.0f, bounds.y + 4.0f, numberSpace - 10.0f, bounds.h - 4.0f * 2.0f), fgColor, ALIGN_TOPRIGHT); dc.SetFontScale(1.0f, 1.0f); dc.DrawTextRect(entry->user, bounds.Inset(iconSpace + 5.0f, 2.0f, 5.0f, 5.0f), fgColor, ALIGN_TOPLEFT); @@ -695,11 +695,11 @@ void AchievementView::Click() { type++; type = type % 5; switch (type) { - case 0: g_OSD.ShowAchievementUnlocked(achievement_->id); break; - case 1: g_OSD.ShowAchievementProgress(achievement_->id, true); break; - case 2: g_OSD.ShowAchievementProgress(achievement_->id, false); break; - case 3: g_OSD.ShowChallengeIndicator(achievement_->id, true); break; - case 4: g_OSD.ShowChallengeIndicator(achievement_->id, false); break; + case 0: g_OSD.ShowAchievementUnlocked((int)achievement_->id); break; + case 1: g_OSD.ShowAchievementProgress((int)achievement_->id, true); break; + case 2: g_OSD.ShowAchievementProgress((int)achievement_->id, false); break; + case 3: g_OSD.ShowChallengeIndicator((int)achievement_->id, true); break; + case 4: g_OSD.ShowChallengeIndicator((int)achievement_->id, false); break; } #endif } diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index 7d193b8b66..d42dd469dd 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -285,7 +285,7 @@ void SavedataButton::UpdateText(const std::shared_ptr &ginfo) { if (subtitle_.empty() && ginfo->gameSizeOnDisk > 0) { std::string date = ginfo->GetMTime(); std::string savedata_title = ginfo->GetParamSFO().GetValueString("SAVEDATA_TITLE"); - subtitle_ = CleanSaveString(savedata_title) + " (" + NiceSizeFormat(ginfo->gameSizeOnDisk) + ", " + date.c_str() + ")"; + subtitle_ = CleanSaveString(savedata_title) + " (" + NiceSizeFormat(ginfo->gameSizeOnDisk) + ", " + date + ")"; } } @@ -375,7 +375,7 @@ void SavedataButton::Draw(UIContext &dc) { dc.PushScissor(bounds_); UpdateText(ginfo); - dc.MeasureText(dc.GetFontStyle(), 1.0f, 1.0f, title_.c_str(), &tw, &th, 0); + dc.MeasureText(dc.GetFontStyle(), 1.0f, 1.0f, title_, &tw, &th, 0); int availableWidth = bounds_.w - 150; float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f; @@ -389,9 +389,9 @@ void SavedataButton::Draw(UIContext &dc) { tb.w = std::max(1.0f, bounds_.w - 150.0f); dc.PushScissor(tb); } - dc.DrawText(title_.c_str(), bounds_.x + tx, bounds_.y + 4, style.fgColor, ALIGN_TOPLEFT); + dc.DrawText(title_, bounds_.x + tx, bounds_.y + 4, style.fgColor, ALIGN_TOPLEFT); dc.SetFontScale(0.6f, 0.6f); - dc.DrawText(subtitle_.c_str(), bounds_.x + tx, bounds_.y2() - 7, style.fgColor, ALIGN_BOTTOM); + dc.DrawText(subtitle_, bounds_.x + tx, bounds_.y2() - 7, style.fgColor, ALIGN_BOTTOM); dc.SetFontScale(1.0f, 1.0f); if (availableWidth < tw) { diff --git a/UI/Store.cpp b/UI/Store.cpp index fcc8540d53..71f39a9903 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -268,10 +268,10 @@ private: UI::EventReturn OnCancel(UI::EventParams &e); UI::EventReturn OnLaunchClick(UI::EventParams &e); - bool IsGameInstalled() { + bool IsGameInstalled() const { return g_GameManager.IsGameInstalled(entry_.file); } - std::string DownloadURL(); + std::string DownloadURL() const; StoreEntry entry_; UI::Button *uninstallButton_ = nullptr; @@ -380,10 +380,10 @@ void ProductView::Update() { } if (launchButton_) launchButton_->SetEnabled(g_GameManager.GetState() == GameManagerState::IDLE); - View::Update(); + ViewGroup::Update(); } -std::string ProductView::DownloadURL() { +std::string ProductView::DownloadURL() const { if (entry_.downloadURL.empty()) { // Construct the URL. return StoreBaseUrl() + "files/" + entry_.file + ".zip"; @@ -446,7 +446,7 @@ void StoreScreen::update() { g_DownloadManager.Update(); - if (listing_.get() != 0 && listing_->Done()) { + if (listing_.get() && listing_->Done()) { resultCode_ = listing_->ResultCode(); if (listing_->ResultCode() == 200) { std::string listingJson; @@ -574,6 +574,9 @@ void StoreScreen::CreateViews() { ProductItemView *StoreScreen::GetSelectedItem() { for (int i = 0; i < scrollItemView_->GetNumSubviews(); ++i) { ProductItemView *item = static_cast(scrollItemView_->GetViewByIndex(i)); + if (!item) { + continue; + } if (item->GetEntry().name == lastSelectedName_) return item; } diff --git a/UI/TiltAnalogSettingsScreen.cpp b/UI/TiltAnalogSettingsScreen.cpp index 991bb95686..5b317a6c8c 100644 --- a/UI/TiltAnalogSettingsScreen.cpp +++ b/UI/TiltAnalogSettingsScreen.cpp @@ -65,7 +65,7 @@ void TiltAnalogSettingsScreen::CreateViews() { switch (g_Config.iTiltInputType) { case TILT_DPAD: { - PSPDpad *pad = rightSide->Add(new PSPDpad(ImageID("I_DIR_LINE"), "D-pad", ImageID("I_DIR_LINE"), ImageID("I_ARROW"), 1.5f, 1.3f, new AnchorLayoutParams(NONE, NONE, NONE, NONE, true))); + rightSide->Add(new PSPDpad(ImageID("I_DIR_LINE"), "D-pad", ImageID("I_DIR_LINE"), ImageID("I_ARROW"), 1.5f, 1.3f, new AnchorLayoutParams(NONE, NONE, NONE, NONE, true))); break; } case TILT_ACTION_BUTTON: diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index 47190891d6..16329dbd9b 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -286,7 +286,6 @@ public: void Draw(UIContext &dc) override { float opacity = GamepadGetOpacity(); uint32_t colorBg = colorAlpha(GetButtonColor(), opacity); - uint32_t downBg = colorAlpha(0x00FFFFFF, opacity * 0.5f); const ImageID stickImage = g_Config.iTouchButtonStyle ? ImageID("I_STICK_LINE") : ImageID("I_STICK"); const ImageID stickBg = g_Config.iTouchButtonStyle ? ImageID("I_STICK_BG_LINE") : ImageID("I_STICK_BG"); @@ -379,7 +378,6 @@ bool ControlLayoutView::Touch(const TouchInput &touch) { if ((touch.flags & TOUCH_MOVE) && pickedControl_ != nullptr) { if (mode_ == 0) { - const Bounds &controlBounds = pickedControl_->GetBounds(); // Allow placing the control halfway outside the play area. Bounds validRange = this->GetBounds(); @@ -387,7 +385,9 @@ bool ControlLayoutView::Touch(const TouchInput &touch) { validRange.x = 0.0f; validRange.y = 0.0f; - // This make cure the controll is all inside the screen (commended out only half) + // TODO: Worth keeping? + // This make sure the control is all inside the screen (commented out only half) + // const Bounds &controlBounds = pickedControl_->GetBounds(); //validRange.x += controlBounds.w * 0.5f; //validRange.w -= controlBounds.w; //validRange.y += controlBounds.h * 0.5f; @@ -478,7 +478,6 @@ void ControlLayoutView::CreateViews() { ImageID shoulderImage = g_Config.iTouchButtonStyle ? ImageID("I_SHOULDER_LINE") : ImageID("I_SHOULDER"); ImageID stickImage = g_Config.iTouchButtonStyle ? ImageID("I_STICK_LINE") : ImageID("I_STICK"); ImageID stickBg = g_Config.iTouchButtonStyle ? ImageID("I_STICK_BG_LINE") : ImageID("I_STICK_BG"); - ImageID roundImage = g_Config.iTouchButtonStyle ? ImageID("I_ROUND_LINE") : ImageID("I_ROUND"); auto addDragDropButton = [&](ConfigTouchPos &pos, const char *key, ImageID bgImg, ImageID img) { DragDropButton *b = nullptr; diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 55ad427a05..11808ec879 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,11 +1,11 @@ + so we don't need to set them manually. --> @@ -39,7 +39,6 @@ android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" /> - @@ -64,41 +62,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/build.gradle b/android/build.gradle index 040a60ba47..bbb8dde198 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -212,6 +212,7 @@ android { 'normalDebug', // for debugging 'normalOptimized', // for testing/user build 'normalRelease', // for Google Play releases + 'goldDebug', 'goldRelease', // for Google Play releases 'vrDebug', // for VR debugging 'vrOptimized', // for VR testing diff --git a/android/gold/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/gold/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09bc5f..0000000000 --- a/android/gold/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/gold/res/mipmap-hdpi/ic_launcher_round.png b/android/gold/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 6623629741..0000000000 Binary files a/android/gold/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/gold/res/mipmap-mdpi/ic_launcher_round.png b/android/gold/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index d2df261bab..0000000000 Binary files a/android/gold/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/gold/res/mipmap-xhdpi/ic_launcher_round.png b/android/gold/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index c8e6e7d3d4..0000000000 Binary files a/android/gold/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/gold/res/mipmap-xxhdpi/ic_launcher_round.png b/android/gold/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index f1d666718c..0000000000 Binary files a/android/gold/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/jni/AndroidAudio.cpp b/android/jni/AndroidAudio.cpp index 4d80779177..b3e0ed8051 100644 --- a/android/jni/AndroidAudio.cpp +++ b/android/jni/AndroidAudio.cpp @@ -104,8 +104,7 @@ bool AndroidAudio_Resume(AndroidAudioState *state) { if (!init_retval) { delete state->ctx; state->ctx = nullptr; - } - if (state->input_enable) { + } else if (state->input_enable) { state->ctx->AudioRecord_Start(state->input_sample_rate); } return init_retval; diff --git a/android/jni/AndroidVulkanContext.cpp b/android/jni/AndroidVulkanContext.cpp index e021194f55..f6002bf490 100644 --- a/android/jni/AndroidVulkanContext.cpp +++ b/android/jni/AndroidVulkanContext.cpp @@ -93,7 +93,7 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB return false; } - bool success = true; + bool success = false; if (g_Vulkan->InitSwapchain()) { bool useMultiThreading = g_Config.bRenderMultiThreading; if (g_Config.iInflightFrames == 1) { @@ -108,8 +108,6 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB VulkanRenderManager *renderManager = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); renderManager->SetInflightFrames(g_Config.iInflightFrames); success = renderManager->HasBackbuffers(); - } else { - success = false; } INFO_LOG(Log::G3D, "AndroidVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); diff --git a/android/jni/Arm64EmitterTest.cpp b/android/jni/Arm64EmitterTest.cpp index e49658cfda..9417bb1468 100644 --- a/android/jni/Arm64EmitterTest.cpp +++ b/android/jni/Arm64EmitterTest.cpp @@ -35,8 +35,6 @@ void TestCode::Generate() { testCodePtr = this->GetCodePtr(); - const u8 *start = AlignCode16(); - uint32_t regs_to_save = Arm64Gen::ALL_CALLEE_SAVED; uint32_t regs_to_save_fp = Arm64Gen::ALL_CALLEE_SAVED_FP; fp.ABI_PushRegisters(regs_to_save, regs_to_save_fp); diff --git a/android/jni/OpenSLContext.cpp b/android/jni/OpenSLContext.cpp index 32d951b854..f90796974f 100644 --- a/android/jni/OpenSLContext.cpp +++ b/android/jni/OpenSLContext.cpp @@ -291,7 +291,7 @@ OpenSLContext::~OpenSLContext() { (*outputMixObject)->Destroy(outputMixObject); outputMixObject = nullptr; } - AudioRecord_Stop(); + OpenSLContext::AudioRecord_Stop(); INFO_LOG(Log::Audio, "OpenSL: Shutdown - deleting engine object"); diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 1011e599c5..b01a116f2a 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -390,7 +390,7 @@ static void EmuThreadJoin() { static void PushCommand(std::string cmd, std::string param) { std::lock_guard guard(frameCommandLock); - frameCommands.push(FrameCommand(cmd, param)); + frameCommands.push(FrameCommand(std::move(cmd), std::move(param))); } // Android implementation of callbacks to the Java part of the app @@ -440,7 +440,7 @@ std::vector System_GetPropertyStringVec(SystemProperty prop) { case SYSPROP_TEMP_DIRS: default: - return std::vector(); + return {}; } } @@ -576,7 +576,7 @@ std::string Android_GetInputDeviceDebugString() { return "(N/A)"; } - const char *charArray = env->GetStringUTFChars(jstr, 0); + const char *charArray = env->GetStringUTFChars(jstr, nullptr); std::string retVal = charArray; env->ReleaseStringUTFChars(jstr, charArray); env->DeleteLocalRef(jstr); @@ -587,7 +587,7 @@ std::string Android_GetInputDeviceDebugString() { std::string GetJavaString(JNIEnv *env, jstring jstr) { if (!jstr) return ""; - const char *str = env->GetStringUTFChars(jstr, 0); + const char *str = env->GetStringUTFChars(jstr, nullptr); std::string cpp_string = std::string(str); env->ReleaseStringUTFChars(jstr, str); return cpp_string; @@ -632,16 +632,16 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioConfig // Easy way for the Java side to ask the C++ side for configuration options, such as // the rotation lock which must be controlled from Java on Android. -static std::string QueryConfig(std::string query) { +static std::string QueryConfig(std::string_view query) { char temp[128]; if (query == "screenRotation") { INFO_LOG(Log::G3D, "g_Config.screenRotation = %d", g_Config.iScreenRotation); snprintf(temp, sizeof(temp), "%d", g_Config.iScreenRotation); - return std::string(temp); + return temp; } else if (query == "immersiveMode") { - return std::string(g_Config.bImmersiveMode ? "1" : "0"); + return g_Config.bImmersiveMode ? "1" : "0"; } else if (query == "sustainedPerformanceMode") { - return std::string(g_Config.bSustainedPerformanceMode ? "1" : "0"); + return g_Config.bSustainedPerformanceMode ? "1" : "0"; } else if (query == "androidJavaGL") { // If we're using Vulkan, we say no... need C++ to use Vulkan. if (GetGPUBackend() == GPUBackend::VULKAN) { @@ -766,7 +766,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init } std::string user_data_path = GetJavaString(env, jdataDir); - if (user_data_path.size() > 0) + if (!user_data_path.empty()) user_data_path += "/"; std::string shortcut_param = GetJavaString(env, jshortcutParam); std::string cacheDir = GetJavaString(env, jcacheDir); @@ -975,7 +975,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { // JavaEGL. This doesn't get called on the Vulkan path. // This gets called from onSurfaceCreated. -extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, jobject obj) { +extern "C" jboolean Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, jobject obj) { _assert_(useCPUThread); INFO_LOG(Log::G3D, "NativeApp.displayInit()"); @@ -994,7 +994,6 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, INFO_LOG(Log::G3D, "BeginAndroidShutdown. Looping until emu thread done..."); // Skipping GL calls here because the old context is lost. while (graphicsContext->ThreadFrame()) { - continue; } INFO_LOG(Log::G3D, "Joining emu thread"); EmuThreadJoin(); @@ -1042,9 +1041,9 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, } static void recalculateDpi() { - g_display.dpi = display_dpi_x; - g_display.dpi_scale_x = 240.0f / display_dpi_x; - g_display.dpi_scale_y = 240.0f / display_dpi_y; + g_display.dpi = (float)display_dpi_x; + g_display.dpi_scale_x = 240.0f / (float)display_dpi_x; + g_display.dpi_scale_y = 240.0f / (float)display_dpi_y; g_display.dpi_scale_real_x = g_display.dpi_scale_x; g_display.dpi_scale_real_y = g_display.dpi_scale_y; @@ -1122,7 +1121,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string case SystemRequestType::INPUT_TEXT_MODAL: { std::string serialized = StringFromFormat("%d:@:%s:@:%s", requestId, param1.c_str(), param2.c_str()); - PushCommand("inputbox", serialized.c_str()); + PushCommand("inputbox", serialized); return true; } case SystemRequestType::BROWSE_FOR_IMAGE: @@ -1229,7 +1228,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_touch (JNIEnv *, jclass, float x, float y, int code, int pointerId) { if (!renderer_inited) return; - TouchInput touch; + TouchInput touch{}; touch.id = pointerId; touch.x = x * g_display.dpi_scale_x; touch.y = y * g_display.dpi_scale_y; @@ -1280,8 +1279,8 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_joystickAxis( AxisInput *axis = new AxisInput[count]; _dbg_assert_(count <= env->GetArrayLength(axisIds)); _dbg_assert_(count <= env->GetArrayLength(values)); - jint *axisIdBuffer = env->GetIntArrayElements(axisIds, NULL); - jfloat *valueBuffer = env->GetFloatArrayElements(values, NULL); + jint *axisIdBuffer = env->GetIntArrayElements(axisIds, nullptr); + jfloat *valueBuffer = env->GetFloatArrayElements(values, nullptr); // These are dirty-filtered on the Java side. for (int i = 0; i < count; i++) { @@ -1294,7 +1293,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_joystickAxis( } extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_mouseWheelEvent( - JNIEnv *env, jclass, jint stick, jfloat x, jfloat y) { + JNIEnv *env, jclass, jfloat x, jfloat y) { if (!renderer_inited) return false; // TODO: Mousewheel should probably be an axis instead. @@ -1474,7 +1473,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JN } } -extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_computeDesiredBackbufferDimensions() { +extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_computeDesiredBackbufferDimensions(JNIEnv *, jclass) { getDesiredBackbufferSize(desiredBackbufferSizeX, desiredBackbufferSizeY); } @@ -1508,7 +1507,7 @@ std::vector System_GetCameraDeviceList() { getEnv()->DeleteLocalRef(dev); continue; } - deviceListVector.push_back(std::string(cdev)); + deviceListVector.emplace_back(cdev); getEnv()->ReleaseStringUTFChars(dev, cdev); getEnv()->DeleteLocalRef(dev); } @@ -1532,9 +1531,9 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setSatInfoAndroid(JNIEn } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_pushCameraImageAndroid(JNIEnv *env, jclass, jbyteArray image) { - if (image != NULL) { + if (image) { jlong size = env->GetArrayLength(image); - jbyte* buffer = env->GetByteArrayElements(image, NULL); + jbyte* buffer = env->GetByteArrayElements(image, nullptr); Camera::pushCameraImage(size, (unsigned char *)buffer); env->ReleaseByteArrayElements(image, buffer, JNI_ABORT); } @@ -1563,7 +1562,7 @@ static void VulkanEmuThread(ANativeWindow *wnd); // This runs in Vulkan mode only. // This handles the entire lifecycle of the Vulkan context, init and exit. -extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runVulkanRenderLoop(JNIEnv * env, jobject obj, jobject _surf) { +extern "C" jboolean JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runVulkanRenderLoop(JNIEnv * env, jobject obj, jobject _surf) { _assert_(!useCPUThread); if (!graphicsContext) { @@ -1693,7 +1692,7 @@ extern "C" jstring Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameName(JNIEnv INFO_LOG(Log::System, "queryGameName(%s)", path.c_str()); - std::string result = ""; + std::string result; GameInfoCache *cache = new GameInfoCache(); std::shared_ptr info = cache->GetInfo(nullptr, path, GameInfoFlags::PARAM_SFO); @@ -1765,8 +1764,8 @@ Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameIcon(JNIEnv * env, jclass clazz if (info->Ready(GameInfoFlags::ICON)) { if (!info->icon.data.empty()) { INFO_LOG(Log::System, "requestIcon: Got icon"); - result = env->NewByteArray(info->icon.data.size()); - env->SetByteArrayRegion(result, 0, info->icon.data.size(), (const jbyte *)info->icon.data.data()); + result = env->NewByteArray((jsize)info->icon.data.size()); + env->SetByteArrayRegion(result, 0, (jsize)info->icon.data.size(), (const jbyte *)info->icon.data.data()); } } else { INFO_LOG(Log::System, "requestIcon: Filetype unknown"); diff --git a/android/legacy/res/mipmap-hdpi/ic_launcher_round.png b/android/legacy/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 99313828b3..0000000000 Binary files a/android/legacy/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/legacy/res/mipmap-mdpi/ic_launcher_round.png b/android/legacy/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index fe5d77dd22..0000000000 Binary files a/android/legacy/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/legacy/res/mipmap-xhdpi/ic_launcher_round.png b/android/legacy/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index a1aef39a73..0000000000 Binary files a/android/legacy/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/legacy/res/mipmap-xxhdpi/ic_launcher_round.png b/android/legacy/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 57ff24d6c9..0000000000 Binary files a/android/legacy/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09bc5f..0000000000 --- a/android/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/res/mipmap-hdpi/ic_launcher_round.png b/android/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 982b0e34bc..0000000000 Binary files a/android/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/res/mipmap-mdpi/ic_launcher_round.png b/android/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index badd38dc06..0000000000 Binary files a/android/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/res/mipmap-xhdpi/ic_launcher_round.png b/android/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 33d7274e9f..0000000000 Binary files a/android/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/res/mipmap-xxhdpi/ic_launcher_round.png b/android/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 79863e3706..0000000000 Binary files a/android/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index 3c5cb89192..4b5c8c2f15 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -1,7 +1,6 @@ - Hello World, PpssppActivity! PPSSPP PPSSPP game diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index b5f4e8cd77..e5394565d3 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -28,6 +28,8 @@ import android.os.Environment; import android.os.PowerManager; import android.os.Vibrator; import android.provider.MediaStore; + +import androidx.annotation.NonNull; import androidx.documentfile.provider.DocumentFile; import android.text.InputType; import android.util.Log; @@ -92,7 +94,6 @@ public abstract class NativeActivity extends Activity { // audioFocusChangeListener to listen to changes in audio state private AudioFocusChangeListener audioFocusChangeListener; private AudioManager audioManager; - private PowerManager powerManager; private Vibrator vibrator; @@ -213,7 +214,7 @@ public abstract class NativeActivity extends Activity { } @Override - public void onRequestPermissionsResult(int requestCode, String [] permissions, int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String [] permissions, @NonNull int[] grantResults) { switch (requestCode) { case REQUEST_CODE_STORAGE_PERMISSION: if (permissionsGranted(permissions, grantResults)) { @@ -259,7 +260,7 @@ public abstract class NativeActivity extends Activity { // Try another method. String removableStoragePath; list = new ArrayList(); - File fileList[] = new File("/storage/").listFiles(); + File[] fileList = new File("/storage/").listFiles(); if (fileList != null) { for (File file : fileList) { if (!file.getAbsolutePath().equalsIgnoreCase(Environment.getExternalStorageDirectory().getAbsolutePath()) && file.isDirectory() && file.canRead()) { @@ -357,7 +358,7 @@ public abstract class NativeActivity extends Activity { // Get the optimal buffer sz detectOptimalAudioSettings(); } - powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); + PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (powerManager != null && powerManager.isSustainedPerformanceModeSupported()) { sustainedPerfSupported = true; @@ -427,7 +428,7 @@ public abstract class NativeActivity extends Activity { } catch (Exception e) { NativeApp.reportException(e, null); - Log.e(TAG, "Failed to get SD storage dirs: " + e.toString()); + Log.e(TAG, "Failed to get SD storage dirs: " + e); } Log.i(TAG, "End of storage paths"); @@ -504,7 +505,6 @@ public abstract class NativeActivity extends Activity { } } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) private void updateScreenRotation(String cause) { // Query the native application on the desired rotation. int rot; @@ -709,7 +709,7 @@ public abstract class NativeActivity extends Activity { } } catch (Exception e) { - Log.e(TAG, "Failed to set framerate: " + e.toString()); + Log.e(TAG, "Failed to set framerate: " + e); } } } @@ -919,7 +919,7 @@ public abstract class NativeActivity extends Activity { } @Override - public void onConfigurationChanged(Configuration newConfig) { + public void onConfigurationChanged(@NonNull Configuration newConfig) { Log.i(TAG, "onConfigurationChanged"); super.onConfigurationChanged(newConfig); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { @@ -954,7 +954,6 @@ public abstract class NativeActivity extends Activity { } } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) private InputDeviceState getInputDeviceState(InputEvent event) { InputDevice device = event.getDevice(); if (device == null) { @@ -1060,6 +1059,11 @@ public abstract class NativeActivity extends Activity { } } + @TargetApi(Build.VERSION_CODES.N) + void sendMouseDelta(float dx, float dy) { + NativeApp.mouseDelta(dx, dy); + } + @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public boolean onGenericMotionEvent(MotionEvent event) { @@ -1078,9 +1082,11 @@ public abstract class NativeActivity extends Activity { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { if ((event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { - float dx = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); - float dy = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); - NativeApp.mouseDelta(dx, dy); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + float dx = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); + float dy = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); + sendMouseDelta(dx, dy); + } } switch (event.getAction()) { @@ -1223,12 +1229,12 @@ public abstract class NativeActivity extends Activity { getContentResolver().takePersistableUriPermission(selectedFile, Intent.FLAG_GRANT_READ_URI_PERMISSION); } } catch (Exception e) { - Log.w(TAG, "Exception getting permissions for document: " + e.toString()); + Log.w(TAG, "Exception getting permissions for document: " + e); NativeApp.sendRequestResult(requestId, false, "", 0); NativeApp.reportException(e, selectedFile.toString()); return; } - Log.i(TAG, "Browse file finished:" + selectedFile.toString()); + Log.i(TAG, "Browse file finished:" + selectedFile); NativeApp.sendRequestResult(requestId, true, selectedFile.toString(), 0); } } else if (requestCode == RESULT_OPEN_DOCUMENT_TREE) { @@ -1241,7 +1247,7 @@ public abstract class NativeActivity extends Activity { getContentResolver().takePersistableUriPermission(selectedDirectoryUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); } } catch (Exception e) { - Log.w(TAG, "Exception getting permissions for document: " + e.toString()); + Log.w(TAG, "Exception getting permissions for document: " + e); NativeApp.reportException(e, selectedDirectoryUri.toString()); // Even if we got an exception getting permissions, continue and try to pass along the file. Maybe this version of Android // doesn't need it. If we can't access it, we'll fail in some other way later. @@ -1515,7 +1521,7 @@ public abstract class NativeActivity extends Activity { return true; } else if (command.equals("vibrate")) { int milliseconds = -1; - if (!params.equals("")) { + if (!params.isEmpty()) { try { milliseconds = Integer.parseInt(params); } catch (NumberFormatException e) { @@ -1571,7 +1577,7 @@ public abstract class NativeActivity extends Activity { recreate(); } else if (command.equals("graphics_restart")) { Log.i(TAG, "graphics_restart"); - if (params != null && !params.equals("")) { + if (params != null && !params.isEmpty()) { overrideShortcutParam = params; } shuttingDown = true; @@ -1594,7 +1600,7 @@ public abstract class NativeActivity extends Activity { if (mInfraredHelper == null) { return false; } - if (params.startsWith("sircs")) { + if (params.startsWith("sircs") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Pattern pattern = Pattern.compile("sircs_(\\d+)_(\\d+)_(\\d+)_(\\d+)"); Matcher matcher = pattern.matcher(params); if (!matcher.matches()) diff --git a/android/src/org/ppsspp/ppsspp/NativeSurfaceView.java b/android/src/org/ppsspp/ppsspp/NativeSurfaceView.java index a9a21d3b2a..3dee26703f 100644 --- a/android/src/org/ppsspp/ppsspp/NativeSurfaceView.java +++ b/android/src/org/ppsspp/ppsspp/NativeSurfaceView.java @@ -61,7 +61,7 @@ public class NativeSurfaceView extends SurfaceView implements SensorEventListene return ev.getToolType(pointer); } - @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) + @TargetApi(Build.VERSION_CODES.N) private void processMouseDelta(final MotionEvent ev) { if ((ev.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { float dx = ev.getAxisValue(MotionEvent.AXIS_RELATIVE_X); @@ -95,7 +95,7 @@ public class NativeSurfaceView extends SurfaceView implements SensorEventListene break; case MotionEvent.ACTION_MOVE: { code = 1; - if (Build.VERSION.SDK_INT >= 12) { + if (Build.VERSION.SDK_INT >= 24) { processMouseDelta(ev); } break; diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index 397731140a..8cb6622363 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -207,19 +207,21 @@ public class PpssppActivity extends NativeActivity { // to handle more than one... ArrayList childDirs = new ArrayList<>(); - while (c.moveToNext()) { - final String mimeType = c.getString(2); - final boolean isDirectory = mimeType.equals(DocumentsContract.Document.MIME_TYPE_DIR); - if (isDirectory) { - final String childDocumentId = c.getString(0); - final Uri childUri = DocumentsContract.buildDocumentUriUsingTree(uri, childDocumentId); - childDirs.add(childUri); - } else { - final long fileSize = c.getLong(1); - sizeSum += fileSize; + if (c != null) { + while (c.moveToNext()) { + final String mimeType = c.getString(2); + final boolean isDirectory = mimeType.equals(DocumentsContract.Document.MIME_TYPE_DIR); + if (isDirectory) { + final String childDocumentId = c.getString(0); + final Uri childUri = DocumentsContract.buildDocumentUriUsingTree(uri, childDocumentId); + childDirs.add(childUri); + } else { + final long fileSize = c.getLong(1); + sizeSum += fileSize; + } } + c.close(); } - c.close(); c = null; for (Uri childUri : childDirs) { diff --git a/assets/lang/ar_AE.ini b/assets/lang/ar_AE.ini index ae5c2d93b4..5317c69e9e 100644 --- a/assets/lang/ar_AE.ini +++ b/assets/lang/ar_AE.ini @@ -1038,7 +1038,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = بناء سيرفر -Buy Gold = ‎إشتري النسخة الذهبية check = ‎تفحص أيضا برنامج Dolphin, أفضل محاكي جهاز الوي ومكعب الألعاب موجود حالياً: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = ‎المساهمون: diff --git a/assets/lang/az_AZ.ini b/assets/lang/az_AZ.ini index ea6e2d121d..3437631a09 100644 --- a/assets/lang/az_AZ.ini +++ b/assets/lang/az_AZ.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Buy Gold check = Also check out Dolphin, the best Wii/GC emu around: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contributors: diff --git a/assets/lang/bg_BG.ini b/assets/lang/bg_BG.ini index 44ab1c1ed2..1c0330c6eb 100644 --- a/assets/lang/bg_BG.ini +++ b/assets/lang/bg_BG.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Купи Gold check = Също погледнете Dolphin, най-добрия Wii/GC емулатор: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Сътрудници: diff --git a/assets/lang/ca_ES.ini b/assets/lang/ca_ES.ini index 30c8f89257..8d509dde16 100644 --- a/assets/lang/ca_ES.ini +++ b/assets/lang/ca_ES.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Buy Gold check = Also check out Dolphin, the best Wii/GC emu around: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contributors: diff --git a/assets/lang/cz_CZ.ini b/assets/lang/cz_CZ.ini index e895e80ff1..bc4d2b7b05 100644 --- a/assets/lang/cz_CZ.ini +++ b/assets/lang/cz_CZ.ini @@ -1030,7 +1030,6 @@ Vignette = Viněta [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Koupit Zlaté PPSSPP check = Vyzkoušejte také Dolphin, nejlepší emulátor Wii/GC vůbec: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Přispěvatelé: diff --git a/assets/lang/da_DK.ini b/assets/lang/da_DK.ini index 9bcbcb7717..a640eec9d9 100644 --- a/assets/lang/da_DK.ini +++ b/assets/lang/da_DK.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Køb PPSSPP guld check = Se også Dolphin, den bedste tilgængelige Wii/GC emulator: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Bidragsydere: diff --git a/assets/lang/de_DE.ini b/assets/lang/de_DE.ini index 27f7cf1455..09c09a9196 100644 --- a/assets/lang/de_DE.ini +++ b/assets/lang/de_DE.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = Alle Forenmoderatoren build server = Build server -Buy Gold = Erwerbe PPSSPP Gold check = Dolphin, der beste erhältliche Wii/GC Emulator: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Mitwirkende: diff --git a/assets/lang/dr_ID.ini b/assets/lang/dr_ID.ini index cc1d320a84..52dca5ca1c 100644 --- a/assets/lang/dr_ID.ini +++ b/assets/lang/dr_ID.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Alli'i Gold check = Kita to'piki' Dolphin, emu Wii/GC paling marege: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Yato bali'i garagai: diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index 0af9442f93..ba52629f13 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -1005,7 +1005,6 @@ MitchellNetravali = Bicubic (Mitchell-Netravali) Upscaler [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Buy Gold check = Also check out Dolphin, the best Wii/GC emu around: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contributors: diff --git a/assets/lang/es_ES.ini b/assets/lang/es_ES.ini index ae6b526f8f..5502070dc6 100644 --- a/assets/lang/es_ES.ini +++ b/assets/lang/es_ES.ini @@ -1031,7 +1031,6 @@ Vignette = Viñeta [PSPCredits] all the forum mods = Todos los foros de Mods build server = Servidor de compilaciones -Buy Gold = Comprar PPSSPP check = También te recomendamos el emulador de GC/Wii Dolphin: CheckOutPPSSPP = Prueba PPSSPP, el mejor emulador de PSP: https://www.ppsspp.org/ contributors = Colaboradores: diff --git a/assets/lang/es_LA.ini b/assets/lang/es_LA.ini index dc7874fb0e..2432a2bae2 100644 --- a/assets/lang/es_LA.ini +++ b/assets/lang/es_LA.ini @@ -1030,7 +1030,6 @@ Vignette = Viñeta [PSPCredits] all the forum mods = Todos los foros de Mods build server = Servidor de build -Buy Gold = Comprar\nPPSSPP Gold check = También te recomendamos el emulador de Wii/GC Dolphin CheckOutPPSSPP = Prueba PPSSPP, el mejor emulador de PSP: https://www.ppsspp.org/ contributors = Colaboradores: diff --git a/assets/lang/fa_IR.ini b/assets/lang/fa_IR.ini index 839c0b36b1..e6df76162b 100644 --- a/assets/lang/fa_IR.ini +++ b/assets/lang/fa_IR.ini @@ -1030,7 +1030,6 @@ Vignette = شکل [PSPCredits] all the forum mods = همهٔ ناظران انجمن build server = build server -Buy Gold = ‎نسخهٔ طلایی نرم‌افزار check = ‎.موجود Wii/GC و سری هم به شبیه ساز دلفین بزنید، بهترین شبیه ساز CheckOutPPSSPP = PPSSPP را بررسی کنید، یک شبیه‌ساز PSP عالی: https://www.ppsspp.org/ contributors = ‎:مشارکت‌کنندگان diff --git a/assets/lang/fi_FI.ini b/assets/lang/fi_FI.ini index 9349c48700..ca4222d4ed 100644 --- a/assets/lang/fi_FI.ini +++ b/assets/lang/fi_FI.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = kaikki foorumin moderaattorit build server = koontipalvelin -Buy Gold = Osta Gold check = Tutustu myös Dolphiniin, parhaaseen Wii/GC-emulaattoriin: CheckOutPPSSPP = Tutustu PPSSPP:ään, mahtavaan PSP-emulaattoriin: https://www.ppsspp.org/ contributors = Osallistujat: diff --git a/assets/lang/fr_FR.ini b/assets/lang/fr_FR.ini index 444b9fcc21..21e2babd7e 100644 --- a/assets/lang/fr_FR.ini +++ b/assets/lang/fr_FR.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = tous les modérateurs du forum build server = serveur de compilation -Buy Gold = Version Gold check = Essayez aussi Dolphin, le meilleur émulateur de Wii/GameCube : CheckOutPPSSPP = Jetez un œil à PPSSPP, l'impressionnant émulateur de PSP : https://www.ppsspp.org/ contributors = Contributeurs : diff --git a/assets/lang/gl_ES.ini b/assets/lang/gl_ES.ini index a044a00bcb..944c851a1d 100644 --- a/assets/lang/gl_ES.ini +++ b/assets/lang/gl_ES.ini @@ -1030,7 +1030,6 @@ Vignette = Viñeta [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Comprar PPSSPP check = También recomendamoste o emulador de GC/Wii Dolphin: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Colaboradores: diff --git a/assets/lang/gr_EL.ini b/assets/lang/gr_EL.ini index 0bec07c86e..05feb9936b 100644 --- a/assets/lang/gr_EL.ini +++ b/assets/lang/gr_EL.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = όλους τους διαχειριστές του forum build server = build server -Buy Gold = Αγορά Gold check = Επίσης δώστε μια ματιά στο Dolphin, ο καλύτερος εξομοιωτής Wii/GC: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Συντελεστές: diff --git a/assets/lang/he_IL.ini b/assets/lang/he_IL.ini index af48c96a86..d36b20e0e4 100644 --- a/assets/lang/he_IL.ini +++ b/assets/lang/he_IL.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Gold קנה גרסאת check = הטוב ביותר Wii/GC אמולטור ה Dolphin, :ראו את CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = :תורמים diff --git a/assets/lang/he_IL_invert.ini b/assets/lang/he_IL_invert.ini index ca6c97f8d3..59a37bef4b 100644 --- a/assets/lang/he_IL_invert.ini +++ b/assets/lang/he_IL_invert.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = תאסרג הנק Gold check = תא ואר: Dolphin, ה רוטלומא Wii/GC רתויב בוטה CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = םימרות: diff --git a/assets/lang/hr_HR.ini b/assets/lang/hr_HR.ini index 7115735ee8..7bfa3ea9ce 100644 --- a/assets/lang/hr_HR.ini +++ b/assets/lang/hr_HR.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = svi forum modovi build server = build server -Buy Gold = Kupi Gold check = Također provjeri Dolphin, najbolji Wii/GC emu around: CheckOutPPSSPP = Baci oko na PPSSPP, odličan PSP emulator: https://www.ppsspp.org/ contributors = Kontributori: diff --git a/assets/lang/hu_HU.ini b/assets/lang/hu_HU.ini index 94c7a0441d..55ae6d0960 100644 --- a/assets/lang/hu_HU.ini +++ b/assets/lang/hu_HU.ini @@ -1030,7 +1030,6 @@ Vignette = Vignetta [PSPCredits] all the forum mods = a fórum összes moderátorának build server = build szerver -Buy Gold = Gold vásárlása check = Nézd meg a Dolphin-t is, a legjobb Wii/GC emulátort: CheckOutPPSSPP = Nézd meg a PPSSPP-t, a lenyűgöző PSP emulatort: https://www.ppsspp.org/ contributors = Közreműködtek: diff --git a/assets/lang/id_ID.ini b/assets/lang/id_ID.ini index 428ffdea30..44d9e9ed2a 100644 --- a/assets/lang/id_ID.ini +++ b/assets/lang/id_ID.ini @@ -1030,7 +1030,6 @@ Vignette = Penggelapan di sisi [PSPCredits] all the forum mods = Semua forum mod build server = Membangun server -Buy Gold = Beli versi Emas check = Lihat pula Dolphin, emulator Wii/GC terbaik: CheckOutPPSSPP = Lihat PPSSPP, emulator PSP yang luar biasa: https://www.ppsspp.org/ contributors = Kontributor: diff --git a/assets/lang/it_IT.ini b/assets/lang/it_IT.ini index 4a9d8ef3d4..a96afef89c 100644 --- a/assets/lang/it_IT.ini +++ b/assets/lang/it_IT.ini @@ -999,7 +999,6 @@ Vignette = Miniatura [PSPCredits] all the forum mods = tutte le mod del forum build server = crea server -Buy Gold = Compra Gold check = Da' anche un'occhiata a Dolphin, il miglior emulatore per Wii/GC sulla piazza: CheckOutPPSSPP = Da' un'occhiata a PPSSPP, il meraviglioso emulatore PSP: http://www.ppsspp.org/ contributors = Collaboratori: diff --git a/assets/lang/ja_JP.ini b/assets/lang/ja_JP.ini index 81014281cd..97109027d9 100644 --- a/assets/lang/ja_JP.ini +++ b/assets/lang/ja_JP.ini @@ -998,7 +998,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = フォーラムのモデレータの皆さん build server = ビルドサーバ -Buy Gold = Gold版を購入 check = Dolphinもチェックしてください。最高のWii/GCエミュレータです: CheckOutPPSSPP = PPSSPPをチェックしてください。素晴らしいPSPエミュレータです: https://www.ppsspp.org/ contributors = 貢献者: diff --git a/assets/lang/jv_ID.ini b/assets/lang/jv_ID.ini index 5f39af525a..557a002d7f 100644 --- a/assets/lang/jv_ID.ini +++ b/assets/lang/jv_ID.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Tuku versi Emas (Gold) check = Ndeleng pula Dolphin, emulator Wii/GC terapik saat iki: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Kontributor: diff --git a/assets/lang/ko_KR.ini b/assets/lang/ko_KR.ini index b88e8c7f54..5fd2aa8d9f 100644 --- a/assets/lang/ko_KR.ini +++ b/assets/lang/ko_KR.ini @@ -981,7 +981,6 @@ MitchellNetravali = 고등차수 (미첼-네트라발리) 업스케일러 [PSPCredits] all the forum mods = 모든 포럼 모드 build server = 빌드 서버 -Buy Gold = 골드 버전 구매 check = 또한 최고의 Wii/GC 에뮤인 돌핀도 확인하세요: CheckOutPPSSPP = 멋진 PSP 에뮬레이터인 PPSSPP를 확인하세요: https://www.ppsspp.org/ contributors = 도움을 주신 분들: diff --git a/assets/lang/ku_SO.ini b/assets/lang/ku_SO.ini index 99d89c6dd2..013869e00f 100644 --- a/assets/lang/ku_SO.ini +++ b/assets/lang/ku_SO.ini @@ -995,7 +995,6 @@ MitchellNetravali = Bicubic (Mitchell-Netravali) Upscaler [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Buy Gold check = Also check out Dolphin, the best Wii/GC emu around: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contributors: diff --git a/assets/lang/lo_LA.ini b/assets/lang/lo_LA.ini index a68b3be5e9..a0f1782aee 100644 --- a/assets/lang/lo_LA.ini +++ b/assets/lang/lo_LA.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = ຊື້ແບບ Gold check = ລວມໄປເຖິງອີມູເລເຕີຣ໌ Dolphin, ດີທີ່ສຸດສຳລັບຫຼິ້ນ Wii/GC ໃນຕອນນີ້: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = ຜູ້ມີສ່ວນຊ່ອຍ: diff --git a/assets/lang/lt-LT.ini b/assets/lang/lt-LT.ini index a0856f9592..8fe1997d2b 100644 --- a/assets/lang/lt-LT.ini +++ b/assets/lang/lt-LT.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Nusipirkti "Gold" check = Be to, pažiūrekite Dolphin, geriausią Wii/GameCube emuliatorių aplink: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Pagalbininkai: diff --git a/assets/lang/ms_MY.ini b/assets/lang/ms_MY.ini index f4cfc314fa..3d5457b0b2 100644 --- a/assets/lang/ms_MY.ini +++ b/assets/lang/ms_MY.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Beli versi Gold check = Juga lihat Dolphin,emu terbaik Wii/GC disekitar: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Para penyumbang: diff --git a/assets/lang/nl_NL.ini b/assets/lang/nl_NL.ini index 0f633e8fb1..308fafca79 100644 --- a/assets/lang/nl_NL.ini +++ b/assets/lang/nl_NL.ini @@ -1030,7 +1030,6 @@ Vignette = Vignet [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Gold kopen check = Probeer ook Dolphin, de beste Wii/GC-emulator van het moment: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Bijdragers: diff --git a/assets/lang/no_NO.ini b/assets/lang/no_NO.ini index 3c6657b759..7d7946c626 100644 --- a/assets/lang/no_NO.ini +++ b/assets/lang/no_NO.ini @@ -1030,7 +1030,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Buy Gold check = Also check out Dolphin, the best Wii/GC emu around: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contributors: diff --git a/assets/lang/pl_PL.ini b/assets/lang/pl_PL.ini index 87ef077a8e..da6efc5afc 100644 --- a/assets/lang/pl_PL.ini +++ b/assets/lang/pl_PL.ini @@ -1035,7 +1035,6 @@ Vignette = Winieta [PSPCredits] all the forum mods = wszystkich moderatorów forum build server = Serwer kompilacji -Buy Gold = Kup PPSSPP Gold check = Wypróbuj również Dolphin, najlepszy emulator Wii/GC: CheckOutPPSSPP = Wypróbuj PPSSPP, świetny emulator PSP: https://www.ppsspp.org/ contributors = Współautorzy: diff --git a/assets/lang/pt_BR.ini b/assets/lang/pt_BR.ini index 6232814f1e..f2bc98159f 100644 --- a/assets/lang/pt_BR.ini +++ b/assets/lang/pt_BR.ini @@ -1005,7 +1005,6 @@ MitchellNetravali = Ampliador bi-cúbico (Mitchell-Netravali) [PSPCredits] all the forum mods = Todos os moderadores do fórum build server = Servidor dos builds -Buy Gold = Comprar Gold check = Verifique também o Dolphin, o melhor emu de Wii/GC: CheckOutPPSSPP = Verifique o PPSSPP, o incrível emulador de PSP: https://www.ppsspp.org/ contributors = Contribuidores: diff --git a/assets/lang/pt_PT.ini b/assets/lang/pt_PT.ini index 590af3f726..8262aa46c9 100644 --- a/assets/lang/pt_PT.ini +++ b/assets/lang/pt_PT.ini @@ -1024,7 +1024,6 @@ MitchellNetravali = Ampliador Bicúbico (Mitchell-Netravali) [PSPCredits] all the forum mods = Todos os moderadores do fórum build server = Servidor das builds -Buy Gold = Comprar Versão Gold check = Experimenta também o Dolphin, o melhor emulador de Wii/GameCube: CheckOutPPSSPP = Experimenta o PPSSPP, o incrível emulador de PSP: https://www.ppsspp.org/ contributors = Contribuidores: diff --git a/assets/lang/ro_RO.ini b/assets/lang/ro_RO.ini index ce20b8fd0c..b5c36f7c3f 100644 --- a/assets/lang/ro_RO.ini +++ b/assets/lang/ro_RO.ini @@ -1031,7 +1031,6 @@ Vignette = Vignette [PSPCredits] all the forum mods = all the forum mods build server = build server -Buy Gold = Cumpară Gold check = Uitați-vă și la Dolphin, cel mai bun emulator Wii/GC CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contribuitori: diff --git a/assets/lang/ru_RU.ini b/assets/lang/ru_RU.ini index 6642b7a632..f14eb70846 100644 --- a/assets/lang/ru_RU.ini +++ b/assets/lang/ru_RU.ini @@ -998,7 +998,6 @@ Vignette = Виньетирование [PSPCredits] all the forum mods = всем модераторам форума build server = сборочный сервер -Buy Gold = Купить Gold check = Также попробуйте Dolphin - лучший эмулятор Wii/GC: CheckOutPPSSPP = Зацените PPSSPP, потрясающий эмулятор PSP: https://www.ppsspp.org/ contributors = При участии: diff --git a/assets/lang/sv_SE.ini b/assets/lang/sv_SE.ini index c99eb71bb5..488472dc28 100644 --- a/assets/lang/sv_SE.ini +++ b/assets/lang/sv_SE.ini @@ -982,7 +982,6 @@ Vignette = Vignett [PSPCredits] all the forum mods = all the forum mods build server = bygg-server -Buy Gold = Köp Guld check = Kolla också in Dolphin, den bästa Wii/GC-emulatorn CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Contributors: diff --git a/assets/lang/tg_PH.ini b/assets/lang/tg_PH.ini index e99d4fa6cc..82b8e31b16 100644 --- a/assets/lang/tg_PH.ini +++ b/assets/lang/tg_PH.ini @@ -1031,7 +1031,6 @@ Vignette = Vignet [PSPCredits] all the forum mods = lahat ng mods ng forum build server = build server -Buy Gold = Bilhin ang PPSSPP Gold check = Tingnan din ang Dolphin, ang Best na Wii/GC emu sa balat ng lupa: CheckOutPPSSPP = Subukan ang PPSSPP, ang kahanga-hangang PSP emulator: https://www.ppsspp.org/ contributors = Mga nag-ambag: diff --git a/assets/lang/th_TH.ini b/assets/lang/th_TH.ini index 354e813530..b4415ee68c 100644 --- a/assets/lang/th_TH.ini +++ b/assets/lang/th_TH.ini @@ -1047,7 +1047,6 @@ Vignette = ภาพเน้นขอบหม่น [PSPCredits] all the forum mods = และเว็บม็อดต่างๆ build server = บิ๊วด์ เซิร์ฟเวอร์ -Buy Gold = ซื้อแบบตัวสีทอง check = รวมไปถึงอีมูเลเตอร์ Dolphin ดีที่สุดในการเล่นเกม Wii/GC ด้วยอีกเช่นเดียวกัน: CheckOutPPSSPP = ตรวจสอบข้อมูลของ PPSSPP, PSP อีมูเลเตอร์ ขั้นเทพ ได้ที่: https://www.ppsspp.org/ contributors = ผู้มีส่วนช่วย: diff --git a/assets/lang/tr_TR.ini b/assets/lang/tr_TR.ini index 67ed2aebd3..e46a5bcd5f 100644 --- a/assets/lang/tr_TR.ini +++ b/assets/lang/tr_TR.ini @@ -1031,7 +1031,6 @@ Vignette = Vinyet [PSPCredits] all the forum mods = Bütün forum moderatörlerine build server = build server -Buy Gold = Gold Sürümü alın check = Ayrıca etraftaki en iyi Wii/GC emülatörü olan Dolphin'e göz atın: CheckOutPPSSPP = PPSSPP'ye göz atın: https://www.ppsspp.org/ contributors = Yardımcılar: diff --git a/assets/lang/uk_UA.ini b/assets/lang/uk_UA.ini index 3e6a748f49..db0b5c0798 100644 --- a/assets/lang/uk_UA.ini +++ b/assets/lang/uk_UA.ini @@ -1030,7 +1030,6 @@ Vignette = Віньєтка [PSPCredits] all the forum mods = всім модераторам форуму build server = сервер білдів -Buy Gold = Купити Gold check = Також спробуйте Dolphin - кращий Wii/GC емулятор : CheckOutPPSSPP = Перевірте PPSSPP, дивовижний емулятор PSP: https://www.ppsspp.org/ contributors = При участі : diff --git a/assets/lang/vi_VN.ini b/assets/lang/vi_VN.ini index 3f65f9388d..3816ba0958 100644 --- a/assets/lang/vi_VN.ini +++ b/assets/lang/vi_VN.ini @@ -1030,7 +1030,6 @@ Vignette = Đen góc [PSPCredits] all the forum mods = tất cả mod trong diễn đàn build server = xây dựng server -Buy Gold = Mua PPSSPP Gold check = Xin cũng xem qua Dolphin, giả lập Wii/GC tốt nhất hiện nay: CheckOutPPSSPP = Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/ contributors = Đóng góp: diff --git a/assets/lang/zh_CN.ini b/assets/lang/zh_CN.ini index 0a7c06f07e..12a8e5ab97 100644 --- a/assets/lang/zh_CN.ini +++ b/assets/lang/zh_CN.ini @@ -1031,7 +1031,6 @@ CatmullRom = Catmull-Rom双三插值缩放 [PSPCredits] all the forum mods = 论坛所有的管理员 build server = 编译服务器 -Buy Gold = 升级黄金版 check = 同时请浏览我们的海豚Dolphin模拟器,最好用的Wii/NGC模拟器 CheckOutPPSSPP = 浏览我们的PPSSPP,一款超级棒的PSP模拟器:https://www.ppsspp.org/ contributors = 贡献者: diff --git a/assets/lang/zh_TW.ini b/assets/lang/zh_TW.ini index ca7961790c..4cb405a2a1 100644 --- a/assets/lang/zh_TW.ini +++ b/assets/lang/zh_TW.ini @@ -998,7 +998,6 @@ MitchellNetravali = 雙立方 (密契爾 - 內拉瓦利) 放大 [PSPCredits] all the forum mods = 所有論壇模組 build server = 組建伺服器 -Buy Gold = 購買黃金版 check = 同樣歡迎使用 Dolphin 模擬器,這是最棒的 Wii/GC 模擬器 CheckOutPPSSPP = 體驗 PPSSPP,一款絕佳的 PSP 模擬器:https://www.ppsspp.org/ contributors = 參與者: diff --git a/build.gradle b/build.gradle index b4e76cbc55..1b8280e0d4 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.6.1' + classpath 'com.android.tools.build:gradle:8.7.0' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1285ff4bb4..33ebd3e1e7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,6 +3,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip android.useAndroidX=true android.enableJetifier=true