Merge pull request #19516 from hrydgard/small-stuff
Apply findings from Android code inspect (lint). Update gradle.
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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<void **>(&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<DepthStencilState *>(dss);
|
||||
return static_cast<DepthStencilState *>(dss);
|
||||
}
|
||||
|
||||
BlendState *D3D11DrawContext::CreateBlendState(const BlendStateDesc &desc) {
|
||||
|
@ -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();
|
||||
|
@ -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_);
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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_);
|
||||
|
@ -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) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <cstdarg>
|
||||
|
||||
#include "VulkanProfiler.h"
|
||||
#include "VulkanContext.h"
|
||||
|
@ -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;
|
||||
});
|
||||
|
@ -248,10 +248,10 @@ struct SinglePipelineTask {
|
||||
|
||||
class CreateMultiPipelinesTask : public Task {
|
||||
public:
|
||||
CreateMultiPipelinesTask(VulkanContext *vulkan, std::vector<SinglePipelineTask> tasks) : vulkan_(vulkan), tasks_(tasks) {
|
||||
CreateMultiPipelinesTask(VulkanContext *vulkan, std::vector<SinglePipelineTask> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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<bool> runCompileThread_;
|
||||
std::atomic<bool> runCompileThread_{};
|
||||
|
||||
bool useRenderThread_ = true;
|
||||
bool measurePresentTime_ = false;
|
||||
|
@ -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<std::string> GetDeviceList() const override {
|
||||
std::vector<std::string> 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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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) {
|
||||
|
@ -45,7 +45,7 @@ struct LogMessage {
|
||||
// pure virtual interface
|
||||
class LogListener {
|
||||
public:
|
||||
virtual ~LogListener() {}
|
||||
virtual ~LogListener() = default;
|
||||
|
||||
virtual void Log(const LogMessage &msg) = 0;
|
||||
};
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <algorithm> // min
|
||||
#include <cstring>
|
||||
#include <string> // System: To be able to add strings with "+"
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -106,7 +106,7 @@ typedef x86_thread_state64_t SContext;
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
#ifdef _WIN32
|
||||
#include "Common/CommonWindows.h"
|
||||
#else
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -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() {
|
||||
|
@ -14,7 +14,6 @@ namespace net {
|
||||
|
||||
class Connection {
|
||||
public:
|
||||
Connection();
|
||||
virtual ~Connection();
|
||||
|
||||
// Inits the sockaddr_in.
|
||||
|
@ -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_);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "ppsspp_config.h"
|
||||
#include "Common/Net/Resolve.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -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<std::string> &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<std::string> &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) {
|
||||
|
@ -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;
|
||||
|
@ -32,11 +32,11 @@
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
#include <errno.h>
|
||||
#include <cerrno>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <limits.h>
|
||||
#include <climits>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -22,7 +22,6 @@ namespace Draw {
|
||||
class RasterState;
|
||||
}
|
||||
|
||||
class Texture;
|
||||
class DrawBuffer;
|
||||
class TextDrawer;
|
||||
|
||||
|
@ -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<std::mutex> 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<SortEntry> 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) {
|
||||
|
@ -88,7 +88,7 @@ void EnableFocusMovement(bool enable) {
|
||||
if (focusedView) {
|
||||
focusedView->FocusChanged(FF_LOSTFOCUS);
|
||||
}
|
||||
focusedView = 0;
|
||||
focusedView = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ private:
|
||||
|
||||
class Transition {
|
||||
public:
|
||||
Transition() {}
|
||||
Transition() = default;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -53,7 +53,6 @@ class StringVectorListAdapter : public UIListAdapter {
|
||||
public:
|
||||
StringVectorListAdapter(const std::vector<std::string> *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<std::string> *items_;
|
||||
|
@ -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(); }
|
||||
|
@ -123,7 +123,7 @@ const char *DefaultLangRegion() {
|
||||
std::vector<std::string> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -28,7 +28,7 @@ struct AudioDebugStats;
|
||||
|
||||
class StereoResampler {
|
||||
public:
|
||||
StereoResampler();
|
||||
StereoResampler() noexcept;
|
||||
~StereoResampler();
|
||||
|
||||
// Called from audio threads
|
||||
|
16
Tools/langtool/Cargo.lock
generated
@ -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",
|
||||
|
@ -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 {
|
||||
|
@ -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<UI::View *> 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 {
|
||||
|
@ -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<GameInfo> &info);
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
@ -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!"));
|
||||
|
@ -344,7 +344,7 @@ void JitCompareScreen::UpdateDisasm() {
|
||||
} else { // viewMode_ == ViewMode::STATS
|
||||
statsContainer_->Clear();
|
||||
|
||||
BlockCacheStats bcStats;
|
||||
BlockCacheStats bcStats{};
|
||||
blockCacheDebug->ComputeStats(bcStats);
|
||||
|
||||
char stats[1024];
|
||||
|
@ -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<GameInfo> 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<Path> &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));
|
||||
|
@ -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;
|
||||
|
@ -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_) {
|
||||
|
@ -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"; }
|
||||
|
@ -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<GameInfo> GetInfo(UIContext &dc, int index) {
|
||||
static std::shared_ptr<GameInfo> 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<GameInfo> &ginfo, float amount) {
|
||||
static void DrawTex(UIContext &dc, std::shared_ptr<GameInfo> &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 :)
|
||||
|
@ -28,7 +28,7 @@
|
||||
// Background worker threads should be spawned in NativeInit and joined
|
||||
// in NativeShutdown.
|
||||
|
||||
#include <locale.h>
|
||||
#include <clocale>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void SavedataButton::UpdateText(const std::shared_ptr<GameInfo> &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) {
|
||||
|
13
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<ProductItemView *>(scrollItemView_->GetViewByIndex(i));
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
if (item->GetEntry().name == lastSelectedName_)
|
||||
return item;
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:installLocation="auto">
|
||||
<!-- We use version codes in the format xyyzzrrrr. Example: 110030000
|
||||
In this same case, versionName should be 1.10.3.0
|
||||
Also note that we are overriding these values automatically from a gradle plugin,
|
||||
so we don't need to set them manually. -->
|
||||
so we don't need to set them manually. -->
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
<uses-feature android:name="android.hardware.screen.landscape" android:required="false" />
|
||||
@ -39,7 +39,6 @@
|
||||
android:normalScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:xlargeScreens="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@ -52,7 +51,6 @@
|
||||
<activity
|
||||
android:name=".PpssppActivity"
|
||||
android:configChanges="locale|keyboard|keyboardHidden|navigation|uiMode"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/ppsspp_style"
|
||||
android:exported="true">
|
||||
<!-- android:screenOrientation="landscape" -->
|
||||
@ -64,41 +62,40 @@
|
||||
<category android:name="tv.ouya.intent.category.GAME"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="file" />
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:host="*" />
|
||||
<data android:pathPattern=".*\\.iso" />
|
||||
<data android:pathPattern=".*\\..*\\.iso" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.iso" />
|
||||
<data android:pathPattern=".*\\.cso" />
|
||||
<data android:pathPattern=".*\\..*\\.cso" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.cso" />
|
||||
<data android:pathPattern=".*\\.chd" />
|
||||
<data android:pathPattern=".*\\..*\\.chd" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.chd" />
|
||||
<data android:pathPattern=".*\\.elf" />
|
||||
<data android:pathPattern=".*\\..*\\.elf" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.elf" />
|
||||
<data android:pathPattern=".*\\.ISO" />
|
||||
<data android:pathPattern=".*\\..*\\.ISO" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.ISO" />
|
||||
<data android:pathPattern=".*\\.CSO" />
|
||||
<data android:pathPattern=".*\\..*\\.CSO" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.CSO" />
|
||||
<data android:pathPattern=".*\\.ELF" />
|
||||
<data android:pathPattern=".*\\..*\\.ELF" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.ELF" />
|
||||
<data android:pathPattern=".*\\.CHD" />
|
||||
<data android:pathPattern=".*\\..*\\.CHD" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.CHD" />
|
||||
<data android:pathPattern=".*\\.ppdmp" />
|
||||
</intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="file" />
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:host="*" />
|
||||
<data android:pathPattern=".*\\.iso" />
|
||||
<data android:pathPattern=".*\\..*\\.iso" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.iso" />
|
||||
<data android:pathPattern=".*\\.cso" />
|
||||
<data android:pathPattern=".*\\..*\\.cso" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.cso" />
|
||||
<data android:pathPattern=".*\\.chd" />
|
||||
<data android:pathPattern=".*\\..*\\.chd" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.chd" />
|
||||
<data android:pathPattern=".*\\.elf" />
|
||||
<data android:pathPattern=".*\\..*\\.elf" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.elf" />
|
||||
<data android:pathPattern=".*\\.ISO" />
|
||||
<data android:pathPattern=".*\\..*\\.ISO" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.ISO" />
|
||||
<data android:pathPattern=".*\\.CSO" />
|
||||
<data android:pathPattern=".*\\..*\\.CSO" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.CSO" />
|
||||
<data android:pathPattern=".*\\.ELF" />
|
||||
<data android:pathPattern=".*\\..*\\.ELF" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.ELF" />
|
||||
<data android:pathPattern=".*\\.CHD" />
|
||||
<data android:pathPattern=".*\\..*\\.CHD" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.CHD" />
|
||||
<data android:pathPattern=".*\\.ppdmp" />
|
||||
<data android:pathPattern=".*\\.pbp" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<meta-data android:name="isGame" android:value="true" />
|
||||
<activity
|
||||
@ -115,6 +112,8 @@
|
||||
<meta-data
|
||||
android:name="xperiaplayoptimized_content"
|
||||
android:resource="@drawable/ic_launcher" />
|
||||
|
||||
<profileable android:shell="true" android:enabled="true" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
@ -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
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 11 KiB |
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
||||
|
@ -390,7 +390,7 @@ static void EmuThreadJoin() {
|
||||
|
||||
static void PushCommand(std::string cmd, std::string param) {
|
||||
std::lock_guard<std::mutex> 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<std::string> System_GetPropertyStringVec(SystemProperty prop) {
|
||||
|
||||
case SYSPROP_TEMP_DIRS:
|
||||
default:
|
||||
return std::vector<std::string>();
|
||||
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<std::string> 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<GameInfo> 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");
|
||||
|
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 11 KiB |
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="hello">Hello World, PpssppActivity!</string>
|
||||
<string name="app_name">PPSSPP</string>
|
||||
<string name="shortcut_name">PPSSPP game</string>
|
||||
|
||||
|
@ -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<String>();
|
||||
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())
|
||||
|
@ -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;
|
||||
|
@ -207,19 +207,21 @@ public class PpssppActivity extends NativeActivity {
|
||||
// to handle more than one...
|
||||
ArrayList<Uri> 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) {
|
||||
|
@ -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 = المساهمون:
|
||||
|
@ -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:
|
||||
|
@ -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 = Сътрудници:
|
||||
|
@ -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:
|
||||
|
@ -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é:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|