diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index fcbf44435..c5b61d2cd 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -167,27 +167,26 @@ std::size_t Strlcpy(char* dst, const std::string_view& src, std::size_t size) std::optional> DecodeHex(const std::string_view& in) { std::vector data; - data.reserve(in.size()/2); + data.reserve(in.size() / 2); - for (int i = 0; i < in.size()/2; i++) { - auto byte = StringUtil::FromChars(in.substr(i*2, 2), 16); - if (byte) { + for (size_t i = 0; i < in.size() / 2; i++) + { + std::optional byte = StringUtil::FromChars(in.substr(i * 2, 2), 16); + if (byte.has_value()) data.push_back(*byte); - } - else { + else return std::nullopt; - } } - return { data }; + return {data}; } std::string EncodeHex(const u8* data, int length) { std::stringstream ss; - for (int i = 0; i < length; i++) { + for (int i = 0; i < length; i++) ss << std::hex << std::setfill('0') << std::setw(2) << static_cast(data[i]); - } + return ss.str(); } diff --git a/src/common/vulkan/swap_chain.cpp b/src/common/vulkan/swap_chain.cpp index ea592e47b..d47d5d616 100644 --- a/src/common/vulkan/swap_chain.cpp +++ b/src/common/vulkan/swap_chain.cpp @@ -133,8 +133,9 @@ static VkSurfaceKHR CreateDisplaySurface(VkInstance instance, VkPhysicalDevice p { Log_DevPrintf(" Mode %ux%u @ %u", mode.parameters.visibleRegion.width, mode.parameters.visibleRegion.height, mode.parameters.refreshRate); - if (!matched_mode && (wi.surface_width == 0 && wi.surface_height == 0) || - (mode.parameters.visibleRegion.width == wi.surface_width && mode.parameters.visibleRegion.height)) + if (!matched_mode && + ((wi.surface_width == 0 && wi.surface_height == 0) || + (mode.parameters.visibleRegion.width == wi.surface_width && mode.parameters.visibleRegion.height))) { matched_mode = &mode; } diff --git a/src/common/vulkan/util.cpp b/src/common/vulkan/util.cpp index a28fdacff..76ea5acfd 100644 --- a/src/common/vulkan/util.cpp +++ b/src/common/vulkan/util.cpp @@ -9,7 +9,6 @@ #include "../string_util.h" #include "context.h" #include "shader_compiler.h" -Log_SetChannel(Vulkan::Util); namespace Vulkan { namespace Util { diff --git a/src/core/bus.cpp b/src/core/bus.cpp index 6757fc0b9..22509a157 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -361,7 +361,7 @@ void UpdateFastmemViews(CPUFastmemMode mode, bool isolate_cache) u8* page_address = map_address + (i * HOST_PAGE_SIZE); if (!m_memory_arena.SetPageProtection(page_address, HOST_PAGE_SIZE, true, false, false)) { - Log_ErrorPrintf("Failed to write-protect code page at %p"); + Log_ErrorPrintf("Failed to write-protect code page at %p", page_address); return; } } @@ -504,7 +504,7 @@ void SetCodePageFastmemProtection(u32 page_index, bool writable) if (!m_memory_arena.SetPageProtection(page_address, HOST_PAGE_SIZE, true, writable, false)) { Log_ErrorPrintf("Failed to %s code page %u (0x%08X) @ %p", writable ? "unprotect" : "protect", page_index, - page_index * HOST_PAGE_SIZE, page_address); + page_index * static_cast(HOST_PAGE_SIZE), page_address); } } @@ -1421,8 +1421,6 @@ ALWAYS_INLINE_RELEASE static void WriteICache(VirtualMemoryAddress address, u32 static void WriteCacheControl(u32 value) { Log_DevPrintf("Cache control <- 0x%08X", value); - - CacheControl changed_bits{g_state.cache_control.bits ^ value}; g_state.cache_control.bits = value; } diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index 8fc178c33..4e119ebf2 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -1213,10 +1213,10 @@ void CheatCode::Apply() const index += 2; } break; - + case InstructionCode::ExtFindAndReplace: { - + if ((index + 4) >= instructions.size()) { Log_ErrorPrintf("Incomplete find/replace instruction"); @@ -1225,82 +1225,98 @@ void CheatCode::Apply() const const Instruction& inst2 = instructions[index + 1]; const Instruction& inst3 = instructions[index + 2]; const Instruction& inst4 = instructions[index + 3]; - const Instruction& inst5 = instructions[index + 4]; - + const Instruction& inst5 = instructions[index + 4]; + const u32 offset = Truncate16(inst.value32 & 0x0000FFFFu) << 1; const u8 wildcard = Truncate8((inst.value32 & 0x00FF0000u) >> 16); const u32 minaddress = inst.address - offset; const u32 maxaddress = inst.address + offset; - const u8 f1 = Truncate8((inst2.first & 0xFF000000u) >> 24); - const u8 f2 = Truncate8((inst2.first & 0x00FF0000u) >> 16); - const u8 f3 = Truncate8((inst2.first & 0x0000FF00u) >> 8); - const u8 f4 = Truncate8 (inst2.first & 0x000000FFu); - const u8 f5 = Truncate8((inst2.value32 & 0xFF000000u) >> 24); - const u8 f6 = Truncate8((inst2.value32 & 0x00FF0000u) >> 16); - const u8 f7 = Truncate8((inst2.value32 & 0x0000FF00u) >> 8); - const u8 f8 = Truncate8 (inst2.value32 & 0x000000FFu); - const u8 f9 = Truncate8((inst3.first & 0xFF000000u) >> 24); + const u8 f1 = Truncate8((inst2.first & 0xFF000000u) >> 24); + const u8 f2 = Truncate8((inst2.first & 0x00FF0000u) >> 16); + const u8 f3 = Truncate8((inst2.first & 0x0000FF00u) >> 8); + const u8 f4 = Truncate8(inst2.first & 0x000000FFu); + const u8 f5 = Truncate8((inst2.value32 & 0xFF000000u) >> 24); + const u8 f6 = Truncate8((inst2.value32 & 0x00FF0000u) >> 16); + const u8 f7 = Truncate8((inst2.value32 & 0x0000FF00u) >> 8); + const u8 f8 = Truncate8(inst2.value32 & 0x000000FFu); + const u8 f9 = Truncate8((inst3.first & 0xFF000000u) >> 24); const u8 f10 = Truncate8((inst3.first & 0x00FF0000u) >> 16); const u8 f11 = Truncate8((inst3.first & 0x0000FF00u) >> 8); - const u8 f12 = Truncate8 (inst3.first & 0x000000FFu); + const u8 f12 = Truncate8(inst3.first & 0x000000FFu); const u8 f13 = Truncate8((inst3.value32 & 0xFF000000u) >> 24); const u8 f14 = Truncate8((inst3.value32 & 0x00FF0000u) >> 16); const u8 f15 = Truncate8((inst3.value32 & 0x0000FF00u) >> 8); - const u8 f16 = Truncate8 (inst3.value32 & 0x000000FFu); - const u8 r1 = Truncate8((inst4.first & 0xFF000000u) >> 24); - const u8 r2 = Truncate8((inst4.first & 0x00FF0000u) >> 16); - const u8 r3 = Truncate8((inst4.first & 0x0000FF00u) >> 8); - const u8 r4 = Truncate8 (inst4.first & 0x000000FFu); - const u8 r5 = Truncate8((inst4.value32 & 0xFF000000u) >> 24); - const u8 r6 = Truncate8((inst4.value32 & 0x00FF0000u) >> 16); - const u8 r7 = Truncate8((inst4.value32 & 0x0000FF00u) >> 8); - const u8 r8 = Truncate8 (inst4.value32 & 0x000000FFu); - const u8 r9 = Truncate8((inst5.first & 0xFF000000u) >> 24); + const u8 f16 = Truncate8(inst3.value32 & 0x000000FFu); + const u8 r1 = Truncate8((inst4.first & 0xFF000000u) >> 24); + const u8 r2 = Truncate8((inst4.first & 0x00FF0000u) >> 16); + const u8 r3 = Truncate8((inst4.first & 0x0000FF00u) >> 8); + const u8 r4 = Truncate8(inst4.first & 0x000000FFu); + const u8 r5 = Truncate8((inst4.value32 & 0xFF000000u) >> 24); + const u8 r6 = Truncate8((inst4.value32 & 0x00FF0000u) >> 16); + const u8 r7 = Truncate8((inst4.value32 & 0x0000FF00u) >> 8); + const u8 r8 = Truncate8(inst4.value32 & 0x000000FFu); + const u8 r9 = Truncate8((inst5.first & 0xFF000000u) >> 24); const u8 r10 = Truncate8((inst5.first & 0x00FF0000u) >> 16); const u8 r11 = Truncate8((inst5.first & 0x0000FF00u) >> 8); - const u8 r12 = Truncate8 (inst5.first & 0x000000FFu); + const u8 r12 = Truncate8(inst5.first & 0x000000FFu); const u8 r13 = Truncate8((inst5.value32 & 0xFF000000u) >> 24); const u8 r14 = Truncate8((inst5.value32 & 0x00FF0000u) >> 16); const u8 r15 = Truncate8((inst5.value32 & 0x0000FF00u) >> 8); - const u8 r16 = Truncate8 (inst5.value32 & 0x000000FFu); - - for (u32 address = minaddress;address<=maxaddress;address+=2) + const u8 r16 = Truncate8(inst5.value32 & 0x000000FFu); + + for (u32 address = minaddress; address <= maxaddress; address += 2) { - if ((DoMemoryRead(address )==f1 || f1 == wildcard) && - (DoMemoryRead(address+1 )==f2 || f2 == wildcard) && - (DoMemoryRead(address+2 )==f3 || f3 == wildcard) && - (DoMemoryRead(address+3 )==f4 || f4 == wildcard) && - (DoMemoryRead(address+4 )==f5 || f5 == wildcard) && - (DoMemoryRead(address+5 )==f6 || f6 == wildcard) && - (DoMemoryRead(address+6 )==f7 || f7 == wildcard) && - (DoMemoryRead(address+7 )==f8 || f8 == wildcard) && - (DoMemoryRead(address+8 )==f9 || f9 == wildcard) && - (DoMemoryRead(address+9 )==f10|| f10 == wildcard) && - (DoMemoryRead(address+10)==f11|| f11 == wildcard) && - (DoMemoryRead(address+11)==f12|| f12 == wildcard) && - (DoMemoryRead(address+12)==f13|| f13 == wildcard) && - (DoMemoryRead(address+13)==f14|| f14 == wildcard) && - (DoMemoryRead(address+14)==f15|| f15 == wildcard) && - (DoMemoryRead(address+15)==f16|| f16 == wildcard)) + if ((DoMemoryRead(address) == f1 || f1 == wildcard) && + (DoMemoryRead(address + 1) == f2 || f2 == wildcard) && + (DoMemoryRead(address + 2) == f3 || f3 == wildcard) && + (DoMemoryRead(address + 3) == f4 || f4 == wildcard) && + (DoMemoryRead(address + 4) == f5 || f5 == wildcard) && + (DoMemoryRead(address + 5) == f6 || f6 == wildcard) && + (DoMemoryRead(address + 6) == f7 || f7 == wildcard) && + (DoMemoryRead(address + 7) == f8 || f8 == wildcard) && + (DoMemoryRead(address + 8) == f9 || f9 == wildcard) && + (DoMemoryRead(address + 9) == f10 || f10 == wildcard) && + (DoMemoryRead(address + 10) == f11 || f11 == wildcard) && + (DoMemoryRead(address + 11) == f12 || f12 == wildcard) && + (DoMemoryRead(address + 12) == f13 || f13 == wildcard) && + (DoMemoryRead(address + 13) == f14 || f14 == wildcard) && + (DoMemoryRead(address + 14) == f15 || f15 == wildcard) && + (DoMemoryRead(address + 15) == f16 || f16 == wildcard)) { - if (r1 != wildcard) DoMemoryWrite(address , r1 ); - if (r2 != wildcard) DoMemoryWrite(address+1 , r2 ); - if (r3 != wildcard) DoMemoryWrite(address+2 , r3 ); - if (r4 != wildcard) DoMemoryWrite(address+3 , r4 ); - if (r5 != wildcard) DoMemoryWrite(address+4 , r5 ); - if (r6 != wildcard) DoMemoryWrite(address+5 , r6 ); - if (r7 != wildcard) DoMemoryWrite(address+6 , r7 ); - if (r8 != wildcard) DoMemoryWrite(address+7 , r8 ); - if (r9 != wildcard) DoMemoryWrite(address+8 , r9 ); - if (r10 != wildcard) DoMemoryWrite(address+9 , r10); - if (r11 != wildcard) DoMemoryWrite(address+10, r11); - if (r12 != wildcard) DoMemoryWrite(address+11, r12); - if (r13 != wildcard) DoMemoryWrite(address+12, r13); - if (r14 != wildcard) DoMemoryWrite(address+13, r14); - if (r15 != wildcard) DoMemoryWrite(address+14, r15); - if (r16 != wildcard) DoMemoryWrite(address+15, r16); - address=address+15; - } + if (r1 != wildcard) + DoMemoryWrite(address, r1); + if (r2 != wildcard) + DoMemoryWrite(address + 1, r2); + if (r3 != wildcard) + DoMemoryWrite(address + 2, r3); + if (r4 != wildcard) + DoMemoryWrite(address + 3, r4); + if (r5 != wildcard) + DoMemoryWrite(address + 4, r5); + if (r6 != wildcard) + DoMemoryWrite(address + 5, r6); + if (r7 != wildcard) + DoMemoryWrite(address + 6, r7); + if (r8 != wildcard) + DoMemoryWrite(address + 7, r8); + if (r9 != wildcard) + DoMemoryWrite(address + 8, r9); + if (r10 != wildcard) + DoMemoryWrite(address + 9, r10); + if (r11 != wildcard) + DoMemoryWrite(address + 10, r11); + if (r12 != wildcard) + DoMemoryWrite(address + 11, r12); + if (r13 != wildcard) + DoMemoryWrite(address + 12, r13); + if (r14 != wildcard) + DoMemoryWrite(address + 13, r14); + if (r15 != wildcard) + DoMemoryWrite(address + 14, r15); + if (r16 != wildcard) + DoMemoryWrite(address + 15, r16); + address = address + 15; + } } index += 5; } @@ -1488,7 +1504,7 @@ void CheatCode::Apply() const } else { - Log_ErrorPrintf("Invalid command in second slide parameter 0x%02hhX", write_type); + Log_ErrorPrintf("Invalid command in second slide parameter 0x%02X", static_cast(write_type)); } index += 2; @@ -1571,8 +1587,8 @@ void CheatCode::ApplyOnDisable() const case InstructionCode::MemoryCopy: index += 2; break; - case InstructionCode::ExtFindAndReplace: - index += 5; + case InstructionCode::ExtFindAndReplace: + index += 5; break; // for conditionals, we don't want to skip over in case it changed at some point case InstructionCode::ExtCompareEqual32: diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index 0b76b6c6e..cb2a23c19 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -788,7 +788,7 @@ void ShutdownFastmem() Common::PageFaultHandler::HandlerResult MMapPageFaultHandler(void* exception_pc, void* fault_address, bool is_write) { if (static_cast(fault_address) < g_state.fastmem_base || - (static_cast(fault_address) - g_state.fastmem_base) >= Bus::FASTMEM_REGION_SIZE) + (static_cast(fault_address) - g_state.fastmem_base) >= static_cast(Bus::FASTMEM_REGION_SIZE)) { return Common::PageFaultHandler::HandlerResult::ExecuteNextHandler; } diff --git a/src/core/cpu_core_private.h b/src/core/cpu_core_private.h index 7e8ecd15f..a6182641d 100644 --- a/src/core/cpu_core_private.h +++ b/src/core/cpu_core_private.h @@ -47,7 +47,6 @@ ALWAYS_INLINE u32 GetICacheFillTagForAddress(VirtualMemoryAddress address) } ALWAYS_INLINE u32 GetICacheTagMaskForAddress(VirtualMemoryAddress address) { - const u32 offset = (address >> 2) & 0x03u; static const u32 mask[4] = {ICACHE_TAG_ADDRESS_MASK | 1, ICACHE_TAG_ADDRESS_MASK | 2, ICACHE_TAG_ADDRESS_MASK | 4, ICACHE_TAG_ADDRESS_MASK | 8}; return mask[(address >> 2) & 0x03u]; diff --git a/src/core/cpu_recompiler_code_generator_aarch64.cpp b/src/core/cpu_recompiler_code_generator_aarch64.cpp index 98fdc0683..5becc679a 100644 --- a/src/core/cpu_recompiler_code_generator_aarch64.cpp +++ b/src/core/cpu_recompiler_code_generator_aarch64.cpp @@ -202,11 +202,13 @@ void CodeGenerator::EmitBeginBlock() // Save the link register, since we'll be calling functions. const bool link_reg_allocated = m_register_cache.AllocateHostReg(30); DebugAssert(link_reg_allocated); + UNREFERENCED_VARIABLE(link_reg_allocated); m_register_cache.AssumeCalleeSavedRegistersAreSaved(); // Store the CPU struct pointer. TODO: make this better. const bool cpu_reg_allocated = m_register_cache.AllocateHostReg(RCPUPTR); DebugAssert(cpu_reg_allocated); + UNREFERENCED_VARIABLE(cpu_reg_allocated); // If there's loadstore instructions, preload the fastmem base. if (m_block->contains_loadstore_instructions) diff --git a/src/core/gdb_protocol.cpp b/src/core/gdb_protocol.cpp index 34713c0c1..309981ee4 100644 --- a/src/core/gdb_protocol.cpp +++ b/src/core/gdb_protocol.cpp @@ -127,7 +127,7 @@ static std::optional Cmd$g(const std::string_view& data) } // Pad with dummy data (FP registers stuff). - for (int i = 0; i < NUM_GDB_REGISTERS - REGISTERS.size(); i++) { + for (int i = 0; i < NUM_GDB_REGISTERS - static_cast(REGISTERS.size()); i++) { ss << "00000000"; } @@ -150,7 +150,7 @@ static std::optional Cmd$G(const std::string_view& data) } } else { - Log_ErrorPrintf("Wrong payload size for 'G' command, expected %d got %d", NUM_GDB_REGISTERS*8, data.size()); + Log_ErrorPrintf("Wrong payload size for 'G' command, expected %d got %zu", NUM_GDB_REGISTERS*8, data.size()); } return { "" }; @@ -291,7 +291,7 @@ std::string ProcessPacket(const std::string_view& data) // Validate packet. auto packet = DeserializePacket(trimmedData); if (!packet) { - Log_ErrorPrintf("Malformed packet '%*s'", trimmedData.size(), trimmedData.data()); + Log_ErrorPrintf("Malformed packet '%*s'", static_cast(trimmedData.size()), trimmedData.data()); return "-"; } @@ -311,7 +311,7 @@ std::string ProcessPacket(const std::string_view& data) } if (!processed) { - Log_WarningPrintf("Failed to process packet '%*s'", trimmedData.size(), trimmedData.data()); + Log_WarningPrintf("Failed to process packet '%*s'", static_cast(trimmedData.size()), trimmedData.data()); } return reply ? "+"+SerializePacket(*reply) : "+"; } diff --git a/src/core/gpu_backend.cpp b/src/core/gpu_backend.cpp index e7a9a7473..6d628715c 100644 --- a/src/core/gpu_backend.cpp +++ b/src/core/gpu_backend.cpp @@ -153,6 +153,7 @@ void GPUBackend::PushCommand(GPUBackendCommand* cmd) { const u32 new_write_ptr = m_command_fifo_write_ptr.fetch_add(cmd->size) + cmd->size; DebugAssert(new_write_ptr <= COMMAND_QUEUE_SIZE); + UNREFERENCED_VARIABLE(new_write_ptr); if (GetPendingCommandSize() >= THRESHOLD_TO_WAKE_GPU) WakeGPUThread(); } diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 367283092..bc7a4443f 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -341,8 +341,8 @@ void GPU_HW_OpenGL::SetCapabilities(HostDisplay* host_display) if (GLAD_GL_VERSION_4_3 || GLAD_GL_ES_VERSION_3_1 || GLAD_GL_ARB_shader_storage_buffer_object) glGetInteger64v(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_ssbo_size); - Log_InfoPrintf("Max shader storage buffer size: %lld", max_ssbo_size); - m_use_ssbo_for_vram_writes = (max_ssbo_size >= (VRAM_WIDTH * VRAM_HEIGHT * sizeof(u16))); + Log_InfoPrintf("Max shader storage buffer size: %" PRId64, max_ssbo_size); + m_use_ssbo_for_vram_writes = (max_ssbo_size >= static_cast(VRAM_WIDTH * VRAM_HEIGHT * sizeof(u16))); if (m_use_ssbo_for_vram_writes) { Log_InfoPrintf("Using shader storage buffers for VRAM writes."); @@ -399,9 +399,8 @@ bool GPU_HW_OpenGL::CreateFramebuffer() !m_vram_encoding_texture.Create(VRAM_WIDTH, VRAM_HEIGHT, 1, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, nullptr, false) || !m_vram_encoding_texture.CreateFramebuffer() || - !m_display_texture.Create(GPU_MAX_DISPLAY_WIDTH * m_resolution_scale, - GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, GL_RGBA8, GL_RGBA, - GL_UNSIGNED_BYTE, nullptr, false) || + !m_display_texture.Create(GPU_MAX_DISPLAY_WIDTH * m_resolution_scale, GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, + 1, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, nullptr, false) || !m_display_texture.CreateFramebuffer()) { return false; diff --git a/src/core/gpu_hw_shadergen.cpp b/src/core/gpu_hw_shadergen.cpp index 3a5983986..7d8787d74 100644 --- a/src/core/gpu_hw_shadergen.cpp +++ b/src/core/gpu_hw_shadergen.cpp @@ -8,7 +8,7 @@ GPU_HW_ShaderGen::GPU_HW_ShaderGen(HostDisplay::RenderAPI render_api, u32 resolu GPUTextureFilter texture_filtering, bool uv_limits, bool pgxp_depth, bool supports_dual_source_blend) : ShaderGen(render_api, supports_dual_source_blend), m_resolution_scale(resolution_scale), - m_multisamples(multisamples), m_true_color(true_color), m_per_sample_shading(per_sample_shading), + m_multisamples(multisamples), m_per_sample_shading(per_sample_shading), m_true_color(true_color), m_scaled_dithering(scaled_dithering), m_texture_filter(texture_filtering), m_uv_limits(uv_limits), m_pgxp_depth(pgxp_depth) { @@ -1343,7 +1343,7 @@ std::string GPU_HW_ShaderGen::GenerateAdaptiveDownsampleMipFragmentShader(bool f WriteHeader(ss); WriteCommonFunctions(ss); DeclareTexture(ss, "samp0", 0, false); - DeclareUniformBuffer(ss, { "float2 u_uv_min", "float2 u_uv_max", "float2 u_rcp_resolution" }, true); + DeclareUniformBuffer(ss, {"float2 u_uv_min", "float2 u_uv_max", "float2 u_rcp_resolution"}, true); DefineMacro(ss, "FIRST_PASS", first_pass); // mipmap_energy.glsl ported from parallel-rsx. @@ -1402,7 +1402,8 @@ std::string GPU_HW_ShaderGen::GenerateAdaptiveDownsampleBlurFragmentShader() WriteHeader(ss); WriteCommonFunctions(ss); DeclareTexture(ss, "samp0", 0, false); - DeclareUniformBuffer(ss, {"float2 u_uv_min", "float2 u_uv_max", "float2 u_rcp_resolution", "float sample_level"}, true); + DeclareUniformBuffer(ss, {"float2 u_uv_min", "float2 u_uv_max", "float2 u_rcp_resolution", "float sample_level"}, + true); // mipmap_blur.glsl ported from parallel-rsx. DeclareFragmentEntryPoint(ss, 0, 1, {}, false, 1, false, false, false, false); diff --git a/src/core/gpu_sw.cpp b/src/core/gpu_sw.cpp index bb72ce213..0242b0cb9 100644 --- a/src/core/gpu_sw.cpp +++ b/src/core/gpu_sw.cpp @@ -582,7 +582,6 @@ void GPU_SW::DispatchRenderCommand() } const GPURenderCommand rc{m_render_command.bits}; - const bool dithering_enable = rc.IsDitheringEnabled() && m_GPUSTAT.dither_enable; switch (rc.primitive) { diff --git a/src/core/gpu_sw_backend.cpp b/src/core/gpu_sw_backend.cpp index aebdc0e94..55e39958c 100644 --- a/src/core/gpu_sw_backend.cpp +++ b/src/core/gpu_sw_backend.cpp @@ -44,7 +44,6 @@ void GPU_SW_Backend::DrawPolygon(const GPUBackendDrawPolygonCommand* cmd) void GPU_SW_Backend::DrawRectangle(const GPUBackendDrawRectangleCommand* cmd) { const GPURenderCommand rc{cmd->rc.bits}; - const bool dithering_enable = rc.IsDitheringEnabled() && cmd->draw_mode.dither_enable; const DrawRectangleFunction DrawFunction = GetDrawRectangleFunction(rc.texture_enable, rc.raw_texture_enable, rc.transparency_enable); @@ -68,9 +67,9 @@ constexpr GPU_SW_Backend::DitherLUT GPU_SW_Backend::ComputeDitherLUT() { for (u32 j = 0; j < DITHER_MATRIX_SIZE; j++) { - for (s32 value = 0; value < DITHER_LUT_SIZE; value++) + for (u32 value = 0; value < DITHER_LUT_SIZE; value++) { - const s32 dithered_value = (value + DITHER_MATRIX[i][j]) >> 3; + const s32 dithered_value = (static_cast(value) + DITHER_MATRIX[i][j]) >> 3; lut[i][j][value] = static_cast((dithered_value < 0) ? 0 : ((dithered_value > 31) ? 31 : dithered_value)); } } diff --git a/src/core/gpu_types.h b/src/core/gpu_types.h index c9ed3b0ca..eb63648f3 100644 --- a/src/core/gpu_types.h +++ b/src/core/gpu_types.h @@ -13,8 +13,6 @@ enum : u32 VRAM_HEIGHT_MASK = VRAM_HEIGHT - 1, TEXTURE_PAGE_WIDTH = 256, TEXTURE_PAGE_HEIGHT = 256, - MAX_PRIMITIVE_WIDTH = 1024, - MAX_PRIMITIVE_HEIGHT = 512, // In interlaced modes, we can exceed the 512 height of VRAM, up to 576 in PAL games. GPU_MAX_DISPLAY_WIDTH = 720, @@ -23,6 +21,12 @@ enum : u32 DITHER_MATRIX_SIZE = 4 }; +enum : s32 +{ + MAX_PRIMITIVE_WIDTH = 1024, + MAX_PRIMITIVE_HEIGHT = 512, +}; + enum class GPUPrimitive : u8 { Reserved = 0, diff --git a/src/core/host_display.cpp b/src/core/host_display.cpp index c534c82d4..9d8758bae 100644 --- a/src/core/host_display.cpp +++ b/src/core/host_display.cpp @@ -183,8 +183,8 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float* { switch (m_display_alignment) { - case Alignment::LeftOrTop: - *out_top_padding = 0.0f; + case Alignment::RightOrBottom: + *out_top_padding = std::max(static_cast(window_height) - (display_height * scale), 0.0f); break; case Alignment::Center: @@ -192,8 +192,9 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float* std::max((static_cast(window_height) - (display_height * scale)) / 2.0f, 0.0f); break; - case Alignment::RightOrBottom: - *out_top_padding = std::max(static_cast(window_height) - (display_height * scale), 0.0f); + case Alignment::LeftOrTop: + default: + *out_top_padding = 0.0f; break; } } @@ -209,8 +210,8 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float* { switch (m_display_alignment) { - case Alignment::LeftOrTop: - *out_left_padding = 0.0f; + case Alignment::RightOrBottom: + *out_left_padding = std::max(static_cast(window_width) - (display_width * scale), 0.0f); break; case Alignment::Center: @@ -218,8 +219,9 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float* std::max((static_cast(window_width) - (display_width * scale)) / 2.0f, 0.0f); break; - case Alignment::RightOrBottom: - *out_left_padding = std::max(static_cast(window_width) - (display_width * scale), 0.0f); + case Alignment::LeftOrTop: + default: + *out_left_padding = 0.0f; break; } } diff --git a/src/core/system.cpp b/src/core/system.cpp index a8c486ab1..a7d83a3ef 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -514,10 +514,6 @@ DiscRegion GetRegionForExe(const char* path) if (!fp) return DiscRegion::Other; - std::fseek(fp.get(), 0, SEEK_END); - const u32 file_size = static_cast(std::ftell(fp.get())); - std::fseek(fp.get(), 0, SEEK_SET); - BIOS::PSEXEHeader header; if (std::fread(&header, sizeof(header), 1, fp.get()) != 1) return DiscRegion::Other; @@ -2086,7 +2082,7 @@ bool SaveRewindState() s_rewind_states.push_back(std::move(mss)); - Log_DevPrintf("Saved rewind state (%llu bytes, took %.4f ms)", s_rewind_states.back().state_stream->GetSize(), + Log_DevPrintf("Saved rewind state (%" PRIu64 " bytes, took %.4f ms)", s_rewind_states.back().state_stream->GetSize(), save_timer.GetTimeMilliseconds()); return true; diff --git a/src/core/timing_event.cpp b/src/core/timing_event.cpp index 93790d22d..8e92e0ce7 100644 --- a/src/core/timing_event.cpp +++ b/src/core/timing_event.cpp @@ -371,8 +371,8 @@ bool DoState(StateWrapper& sw) TimingEvent::TimingEvent(std::string name, TickCount period, TickCount interval, TimingEventCallback callback, void* callback_param) - : m_downcount(interval), m_time_since_last_run(0), m_period(period), m_interval(interval), m_callback(callback), - m_callback_param(callback_param), m_name(std::move(name)), m_active(false) + : m_callback(callback), m_callback_param(callback_param), m_downcount(interval), m_time_since_last_run(0), + m_period(period), m_interval(interval), m_name(std::move(name)) { } diff --git a/src/core/timing_event.h b/src/core/timing_event.h index 780e5aa48..553c30e7d 100644 --- a/src/core/timing_event.h +++ b/src/core/timing_event.h @@ -67,7 +67,7 @@ public: TickCount m_time_since_last_run; TickCount m_period; TickCount m_interval; - bool m_active; + bool m_active = false; std::string m_name; }; diff --git a/src/duckstation-nogui/drm_host_interface.cpp b/src/duckstation-nogui/drm_host_interface.cpp index 098b6d7b5..b2e11a341 100644 --- a/src/duckstation-nogui/drm_host_interface.cpp +++ b/src/duckstation-nogui/drm_host_interface.cpp @@ -150,7 +150,7 @@ void DRMHostInterface::PollEvDevKeyboards() const bool pressed = (ev.value == 1); const HostKeyCode code = static_cast(ev.code); - if (code >= 0 && code < countof(ImGuiIO::KeysDown)) + if (static_cast(code) < countof(ImGuiIO::KeysDown)) ImGui::GetIO().KeysDown[code] = pressed; HandleHostKeyEvent(code, pressed); diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index ce6111958..2d30c8208 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -9,7 +9,6 @@ static void addBooleanTweakOption(QtHostInterface* host_interface, QTableWidget* std::string section, std::string key, bool default_value) { const int row = table->rowCount(); - const bool current_value = host_interface->GetBoolSettingValue(section.c_str(), key.c_str(), default_value); table->insertRow(row); @@ -35,7 +34,6 @@ static void addIntRangeTweakOption(QtHostInterface* host_interface, QTableWidget int default_value) { const int row = table->rowCount(); - const bool current_value = host_interface->GetBoolSettingValue(section.c_str(), key.c_str(), default_value); table->insertRow(row); diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp index 6b450737d..573936159 100644 --- a/src/duckstation-qt/audiosettingswidget.cpp +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -1,10 +1,8 @@ #include "audiosettingswidget.h" #include "common/audio_stream.h" -#include "common/log.h" #include "settingsdialog.h" #include "settingwidgetbinder.h" #include -Log_SetChannel(AudioSettingsWidget); AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog) : QWidget(parent), m_host_interface(host_interface) diff --git a/src/duckstation-qt/cheatcodeeditordialog.cpp b/src/duckstation-qt/cheatcodeeditordialog.cpp index e216cff60..5fe10b9f8 100644 --- a/src/duckstation-qt/cheatcodeeditordialog.cpp +++ b/src/duckstation-qt/cheatcodeeditordialog.cpp @@ -2,7 +2,7 @@ #include CheatCodeEditorDialog::CheatCodeEditorDialog(const QStringList& group_names, CheatCode* code, QWidget* parent) - : m_code(code), QDialog(parent) + : QDialog(parent), m_code(code) { m_ui.setupUi(this); setupAdditionalUi(group_names); diff --git a/src/duckstation-qt/debuggermodels.cpp b/src/duckstation-qt/debuggermodels.cpp index 8113cace1..b842c6952 100644 --- a/src/duckstation-qt/debuggermodels.cpp +++ b/src/duckstation-qt/debuggermodels.cpp @@ -1,5 +1,4 @@ #include "debuggermodels.h" -#include "common/log.h" #include "core/cpu_core.h" #include "core/cpu_core_private.h" #include "core/cpu_disasm.h" @@ -7,7 +6,6 @@ #include #include #include -Log_SetChannel(DebuggerModels); static constexpr int NUM_COLUMNS = 5; static constexpr int STACK_RANGE = 128; diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index f8b83787d..5e3fee410 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -949,7 +949,6 @@ bool CommonHostInterface::EnumerateOSDMessages(std::functionSkipItems) + { + *visible = false; + *hovered = false; return false; + } ImVec2 pos, size; GetMenuButtonFrameBounds(height, &pos, &size); @@ -774,7 +773,8 @@ bool EnumChoiceButtonImpl(const char* title, const char* summary, s32* value_poi ChoiceDialogOptions options; options.reserve(count); for (u32 i = 0; i < count; i++) - options.emplace_back(to_display_name_function(static_cast(i), opaque), *value_pointer == i); + options.emplace_back(to_display_name_function(static_cast(i), opaque), + static_cast(*value_pointer) == i); OpenChoiceDialog(title, false, std::move(options), [](s32 index, const std::string& title, bool checked) { if (index >= 0) s_enum_choice_button_value = index; @@ -1063,7 +1063,6 @@ void DrawChoiceDialog() bool is_open = (ImGui::GetNavInputAmount(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed) < 1.0f); s32 choice = -1; - bool choice_checked = false; if (ImGui::BeginPopupModal(s_choice_dialog_title.c_str(), &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) diff --git a/src/frontend-common/opengl_host_display.cpp b/src/frontend-common/opengl_host_display.cpp index 79638dbdd..a4e313eb1 100644 --- a/src/frontend-common/opengl_host_display.cpp +++ b/src/frontend-common/opengl_host_display.cpp @@ -946,8 +946,6 @@ void OpenGLHostDisplay::ApplyPostProcessingChain(GLuint final_target, s32 final_ s32 texture_height, s32 texture_view_x, s32 texture_view_y, s32 texture_view_width, s32 texture_view_height) { - static constexpr std::array clear_color = {0.0f, 0.0f, 0.0f, 1.0f}; - if (!CheckPostProcessingRenderTargets(GetWindowWidth(), GetWindowHeight())) { RenderDisplay(final_left, GetWindowHeight() - final_top - final_height, final_width, final_height, texture_handle, diff --git a/src/frontend-common/sdl_controller_interface.cpp b/src/frontend-common/sdl_controller_interface.cpp index 5686f2ca0..ad7d25e69 100644 --- a/src/frontend-common/sdl_controller_interface.cpp +++ b/src/frontend-common/sdl_controller_interface.cpp @@ -594,7 +594,7 @@ bool SDLControllerInterface::BindControllerHatToButton(int controller_index, int return false; // We need 4 entries per hat_number - if (it->hat_button_mapping.size() < hat_number + 1) + if (static_cast(it->hat_button_mapping.size()) < hat_number + 1) it->hat_button_mapping.resize(hat_number + 1); it->hat_button_mapping[hat_number][index] = std::move(callback);