From 81fcbc20ce1387575a44e1cfdbd74d4208eb20d2 Mon Sep 17 00:00:00 2001 From: vcrom Date: Sun, 11 Dec 2016 15:48:29 +0000 Subject: [PATCH] Removed compilation warnings, with Release x64. --- externals/microprofile/microprofile.h | 2 +- externals/microprofile/microprofileui.h | 16 +++++------ src/citra_qt/debugger/graphics_surface.cpp | 2 +- src/citra_qt/debugger/wait_tree.cpp | 2 ++ src/common/assert.h | 2 +- src/common/logging/backend.cpp | 2 ++ src/core/arm/dynarmic/arm_dynarmic.cpp | 2 +- .../arm/dyncom/arm_dyncom_interpreter.cpp | 6 ++-- src/core/arm/dyncom/arm_dyncom_trans.h | 2 +- src/core/file_sys/archive_backend.cpp | 2 ++ src/core/gdbstub/gdbstub.cpp | 6 ++-- src/core/hle/applets/erreula.cpp | 2 +- src/core/hle/applets/mii_selector.cpp | 2 +- src/core/hle/applets/swkbd.cpp | 2 +- src/core/hle/kernel/kernel.h | 2 ++ src/core/hle/kernel/shared_memory.cpp | 2 +- src/core/hle/kernel/thread.cpp | 4 +-- src/core/hle/service/apt/apt.cpp | 8 +++--- src/core/hle/service/dsp_dsp.cpp | 2 +- src/core/hle/service/fs/archive.cpp | 2 +- src/core/hle/service/hid/hid.cpp | 2 +- src/core/hle/service/ldr_ro/cro_helper.h | 4 +-- src/core/hle/service/mic_u.cpp | 8 +++--- src/core/memory.cpp | 28 +++++++++---------- src/video_core/rasterizer.cpp | 6 ++++ .../renderer_opengl/gl_rasterizer.cpp | 2 +- .../renderer_opengl/gl_rasterizer.h | 2 +- src/video_core/shader/shader.cpp | 4 +-- src/video_core/shader/shader_interpreter.cpp | 2 ++ src/video_core/shader/shader_jit_x64.cpp | 6 ++-- 30 files changed, 75 insertions(+), 59 deletions(-) diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index f45c9ba82..f93c50138 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h @@ -926,7 +926,7 @@ typedef HANDLE MicroProfileThread; DWORD _stdcall ThreadTrampoline(void* pFunc) { MicroProfileThreadFunc F = (MicroProfileThreadFunc)pFunc; - return (uint32_t)F(0); + return reinterpret_cast(F(0)); } void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) diff --git a/externals/microprofile/microprofileui.h b/externals/microprofile/microprofileui.h index 66a73abc5..15fc72e3e 100644 --- a/externals/microprofile/microprofileui.h +++ b/externals/microprofile/microprofileui.h @@ -1235,7 +1235,7 @@ void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int nBaseY, // nThreadId is 32-bit on Windows int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); #else - int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); + int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s%s", int64_t(nThreadId), cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); #endif uint32_t nThreadColor = -1; if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore) @@ -1853,7 +1853,7 @@ void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeight) { if(nMetaIndex < MICROPROFILE_META_MAX && S.MetaCounters[nMetaIndex].pName) { - uint32_t nStrWidth = strlen(S.MetaCounters[nMetaIndex].pName); + uint32_t nStrWidth = u32(strlen(S.MetaCounters[nMetaIndex].pName)); if(S.nBars & MP_DRAW_TIMERS) nWidth += 6 + (1+MICROPROFILE_TEXT_WIDTH) * (nStrWidth); if(S.nBars & MP_DRAW_AVERAGE) @@ -1907,7 +1907,7 @@ void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeight) { if(0 != (S.nBars & (MP_DRAW_META_FIRST<nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? pTimeMax : pTimeAvg; const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? "Max" : "Avg"; - MicroProfileDrawText(nMaxOffsetX, nOffsetY, (uint32_t)-1, pString, strlen(pString)); + MicroProfileDrawText(nMaxOffsetX, nOffsetY, (uint32_t)-1, pString, (uint32_t)strlen(pString)); int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, (uint32_t)-1, Buffer, nSize); for(uint32_t i = 0; i < nCount; ++i) @@ -2613,7 +2613,7 @@ void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) { nOffsetY += 2*(1+MICROPROFILE_TEXT_HEIGHT); const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? "Max" : "Avg"; - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, (uint32_t)-1, pString, strlen(pString)); + MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, (uint32_t)-1, pString, (uint32_t)strlen(pString)); int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, (uint32_t)-1, Buffer, nSize); nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); diff --git a/src/citra_qt/debugger/graphics_surface.cpp b/src/citra_qt/debugger/graphics_surface.cpp index 906daaa50..548b349e3 100644 --- a/src/citra_qt/debugger/graphics_surface.cpp +++ b/src/citra_qt/debugger/graphics_surface.cpp @@ -271,7 +271,7 @@ void GraphicsSurfaceWidget::Pick(int x, int y) { surface_picker_x_control->setValue(x); surface_picker_y_control->setValue(y); - if (x < 0 || x >= surface_width || y < 0 || y >= surface_height) { + if (x < 0 || x >= int(surface_width) || y < 0 || y >= int(surface_height)) { surface_info_label->setText(tr("Pixel out of bounds")); surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); return; diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp index be5a51e52..d062d2f81 100644 --- a/src/citra_qt/debugger/wait_tree.cpp +++ b/src/citra_qt/debugger/wait_tree.cpp @@ -116,6 +116,8 @@ QString WaitTreeWaitObject::GetResetTypeQString(Kernel::ResetType reset_type) { return tr("sticky"); case Kernel::ResetType::Pulse: return tr("pulse"); + default: + UNREACHABLE(); } } diff --git a/src/common/assert.h b/src/common/assert.h index 04e80c87a..58e940d8b 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -52,5 +52,5 @@ __declspec(noinline, noreturn) #define DEBUG_ASSERT_MSG(_a_, _desc_, ...) #endif -#define UNIMPLEMENTED() DEBUG_ASSERT_MSG(false, "Unimplemented code!") +#define UNIMPLEMENTED() ASSERT_MSG(false, "Unimplemented code!") #define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__) diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 7fd397fe5..4e8e0451a 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -84,6 +84,7 @@ const char* GetLogClassName(Class log_class) { case Class::Count: UNREACHABLE(); } + UNREACHABLE(); } const char* GetLevelName(Level log_level) { @@ -101,6 +102,7 @@ const char* GetLevelName(Level log_level) { UNREACHABLE(); } #undef LVL + UNREACHABLE(); } Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr, diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index fc4254670..04bdf83f8 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -132,7 +132,7 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64)); void ARM_Dynarmic::ExecuteInstructions(int num_instructions) { MICROPROFILE_SCOPE(ARM_Jit); - unsigned ticks_executed = jit->Run(static_cast(num_instructions)); + unsigned ticks_executed = unsigned(jit->Run(static_cast(num_instructions))); AddTicks(ticks_executed); } diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 7b8616702..52632bb3c 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -759,7 +759,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size); if (ret == ThumbDecodeStatus::BRANCH) { int inst_index; - int table_length = arm_instruction_trans_len; + int table_length = int(arm_instruction_trans_len); u32 tinstr = GetThumbInstruction(inst, addr); switch ((tinstr & 0xF800) >> 11) { @@ -849,7 +849,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) ARM_INST_PTR inst_base = nullptr; TransExtData ret = TransExtData::NON_BRANCH; int size = 0; // instruction size of basic block - bb_start = trans_cache_buf_top; + bb_start = (int)trans_cache_buf_top; u32 phys_addr = addr; u32 pc_start = cpu->Reg[15]; @@ -876,7 +876,7 @@ static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr) MICROPROFILE_SCOPE(DynCom_Decode); ARM_INST_PTR inst_base = nullptr; - bb_start = trans_cache_buf_top; + bb_start = int(trans_cache_buf_top); u32 phys_addr = addr; u32 pc_start = cpu->Reg[15]; diff --git a/src/core/arm/dyncom/arm_dyncom_trans.h b/src/core/arm/dyncom/arm_dyncom_trans.h index b1ec90662..078ebb84a 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.h +++ b/src/core/arm/dyncom/arm_dyncom_trans.h @@ -20,7 +20,7 @@ struct arm_inst { unsigned int idx; unsigned int cond; TransExtData br; - char component[0]; + char* component; }; struct generic_arm_inst { diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 1fae0ede0..7dd5daca0 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -89,6 +89,8 @@ std::u16string Path::AsU16Str() const { // TODO(yuriks): Add assert LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); return {}; + default: + UNREACHABLE(); } } diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index aea43e92b..26c021c89 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -947,8 +947,8 @@ static void Init(u16 port) { WSAStartup(MAKEWORD(2, 2), &InitData); #endif - int tmpsock = socket(PF_INET, SOCK_STREAM, 0); - if (tmpsock == -1) { + auto tmpsock = socket(PF_INET, SOCK_STREAM, 0); + if (int(tmpsock) == -1) { LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket"); } @@ -974,7 +974,7 @@ static void Init(u16 port) { sockaddr_in saddr_client; sockaddr* client_addr = reinterpret_cast(&saddr_client); socklen_t client_addrlen = sizeof(saddr_client); - gdbserver_socket = accept(tmpsock, client_addr, &client_addrlen); + gdbserver_socket = static_cast(accept(tmpsock, client_addr, &client_addrlen)); if (gdbserver_socket < 0) { // In the case that we couldn't start the server for whatever reason, just start CPU // execution like normal. diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp index 75d7fd9fc..dda14dc12 100644 --- a/src/core/hle/applets/erreula.cpp +++ b/src/core/hle/applets/erreula.cpp @@ -31,7 +31,7 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, + heap_memory, 0, u32(heap_memory->size()), MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "ErrEula Memory"); // Send the response message with the newly created SharedMemory diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 07c7f5b99..4d64cdb27 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -39,7 +39,7 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, + heap_memory, 0, u32(heap_memory->size()), MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "MiiSelector Memory"); // Send the response message with the newly created SharedMemory diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index 059297fbc..109653748 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -42,7 +42,7 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, + heap_memory, 0, static_cast(heap_memory->size()), MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "SoftwareKeyboard Memory"); // Send the response message with the newly created SharedMemory diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 231cf7b75..b34fda800 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -100,6 +100,8 @@ public: case HandleType::CodeSet: case HandleType::ClientPort: return false; + default: + UNREACHABLE(); } } diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index bc1560d12..8d5554d55 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -35,7 +35,7 @@ SharedPtr SharedMemory::Create(SharedPtr owner_process, u "Not enough space in region to allocate shared memory!"); shared_memory->backing_block = linheap_memory; - shared_memory->backing_block_offset = linheap_memory->size(); + shared_memory->backing_block_offset = u32(linheap_memory->size()); // Allocate some memory from the end of the linear heap for this region. linheap_memory->insert(linheap_memory->end(), size, 0); memory_region->used += size; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 84d6d24c6..2ac31e787 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -523,7 +523,7 @@ ResultVal> Thread::Create(std::string name, VAddr entry_point, ErrorSummary::OutOfResource, ErrorLevel::Permanent); } - u32 offset = linheap_memory->size(); + u32 offset = u32(linheap_memory->size()); // Allocate some memory from the end of the linear heap for this region. linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0); @@ -531,7 +531,7 @@ ResultVal> Thread::Create(std::string name, VAddr entry_point, Kernel::g_current_process->linear_heap_used += Memory::PAGE_SIZE; tls_slots.emplace_back(0); // The page is completely available at the start - available_page = tls_slots.size() - 1; + available_page = u32(tls_slots.size()) - 1; available_slot = 0; // Use the first slot in the new page auto& vm_manager = Kernel::g_current_process->vm_manager; diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 31e5e07b2..94365bbdf 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -211,12 +211,12 @@ void ReceiveParameter(Service::Interface* self) { cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[2] = next_parameter.sender_id; cmd_buff[3] = next_parameter.signal; // Signal type - cmd_buff[4] = next_parameter.buffer.size(); // Parameter buffer size + cmd_buff[4] = u32(next_parameter.buffer.size()); // Parameter buffer size cmd_buff[5] = 0x10; cmd_buff[6] = 0; if (next_parameter.object != nullptr) cmd_buff[6] = Kernel::g_handle_table.Create(next_parameter.object).MoveFrom(); - cmd_buff[7] = (next_parameter.buffer.size() << 14) | 2; + cmd_buff[7] = u32((next_parameter.buffer.size() << 14) | 2); cmd_buff[8] = buffer; Memory::WriteBlock(buffer, next_parameter.buffer.data(), next_parameter.buffer.size()); @@ -233,12 +233,12 @@ void GlanceParameter(Service::Interface* self) { cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[2] = next_parameter.sender_id; cmd_buff[3] = next_parameter.signal; // Signal type - cmd_buff[4] = next_parameter.buffer.size(); // Parameter buffer size + cmd_buff[4] = u32(next_parameter.buffer.size()); // Parameter buffer size cmd_buff[5] = 0x10; cmd_buff[6] = 0; if (next_parameter.object != nullptr) cmd_buff[6] = Kernel::g_handle_table.Create(next_parameter.object).MoveFrom(); - cmd_buff[7] = (next_parameter.buffer.size() << 14) | 2; + cmd_buff[7] = u32((next_parameter.buffer.size() << 14) | 2); cmd_buff[8] = buffer; Memory::WriteBlock(buffer, next_parameter.buffer.data(), diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index fe8a6c2d6..f0af25b72 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp @@ -139,7 +139,7 @@ static void LoadComponent(Service::Interface* self) { Memory::ReadBlock(buffer, component_data.data(), component_data.size()); LOG_INFO(Service_DSP, "Firmware hash: %#" PRIx64, - Common::ComputeHash64(component_data.data(), component_data.size())); + Common::ComputeHash64(component_data.data(), u32(component_data.size()))); // Some versions of the firmware have the location of DSP structures listed here. ASSERT(size > 0x37C); LOG_INFO(Service_DSP, "Structures hash: %#" PRIx64, diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index bef75f5df..4301ca548 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -220,7 +220,7 @@ ResultVal Directory::SyncRequest() { count); // Number of entries actually read - u32 read = backend->Read(entries.size(), entries.data()); + u32 read = backend->Read(u32(entries.size()), entries.data()); cmd_buff[2] = read; Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry)); break; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 99baded11..151e6be8a 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -37,7 +37,7 @@ static int enable_gyroscope_count = 0; // positive means enabled static PadState GetCirclePadDirectionState(s16 circle_pad_x, s16 circle_pad_y) { // 30 degree and 60 degree are angular thresholds for directions - constexpr float TAN30 = 0.577350269, TAN60 = 1 / TAN30; + constexpr float TAN30 = 0.577350269f, TAN60 = 1 / TAN30; // a circle pad radius greater than 40 will trigger circle pad direction constexpr int CIRCLE_PAD_THRESHOLD_SQUARE = 40 * 40; PadState state; diff --git a/src/core/hle/service/ldr_ro/cro_helper.h b/src/core/hle/service/ldr_ro/cro_helper.h index 060d5a55f..45c126615 100644 --- a/src/core/hle/service/ldr_ro/cro_helper.h +++ b/src/core/hle/service/ldr_ro/cro_helper.h @@ -413,7 +413,7 @@ private: */ template void GetEntry(std::size_t index, T& data) const { - Memory::ReadBlock(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T), &data, sizeof(T)); + Memory::ReadBlock(static_cast(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T)), &data, sizeof(T)); } /** @@ -425,7 +425,7 @@ private: */ template void SetEntry(std::size_t index, const T& data) { - Memory::WriteBlock(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T), &data, sizeof(T)); + Memory::WriteBlock(static_cast(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T)), &data, sizeof(T)); } /** diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index 7ced36439..5b8e0f759 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp @@ -92,7 +92,7 @@ static void StartSampling(Interface* self) { sample_rate = static_cast(cmd_buff[2] & 0xFF); audio_buffer_offset = cmd_buff[3]; audio_buffer_size = cmd_buff[4]; - audio_buffer_loop = static_cast(cmd_buff[5] & 0xFF); + audio_buffer_loop = (cmd_buff[5] & 0xFF) > 0; cmd_buff[1] = RESULT_SUCCESS.raw; // No error is_sampling = true; @@ -200,7 +200,7 @@ static void GetGain(Interface* self) { */ static void SetPower(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); - mic_power = static_cast(cmd_buff[1] & 0xFF); + mic_power = (cmd_buff[1] & 0xFF) > 0; cmd_buff[1] = RESULT_SUCCESS.raw; // No error LOG_WARNING(Service_MIC, "(STUBBED) called, mic_power=%u", mic_power); } @@ -250,7 +250,7 @@ static void SetIirFilterMic(Interface* self) { */ static void SetClamp(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); - clamp = static_cast(cmd_buff[1] & 0xFF); + clamp = (cmd_buff[1] & 0xFF) > 0; cmd_buff[1] = RESULT_SUCCESS.raw; // No error LOG_WARNING(Service_MIC, "(STUBBED) called, clamp=%u", clamp); } @@ -280,7 +280,7 @@ static void GetClamp(Interface* self) { */ static void SetAllowShellClosed(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); - allow_shell_closed = static_cast(cmd_buff[1] & 0xFF); + allow_shell_closed = (cmd_buff[1] & 0xFF) > 0; cmd_buff[1] = RESULT_SUCCESS.raw; // No error LOG_WARNING(Service_MIC, "(STUBBED) called, allow_shell_closed=%u", allow_shell_closed); } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 65e4bba85..a788378c5 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -392,7 +392,7 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) { while (remaining_size > 0) { const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); - const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; + const auto current_vaddr = static_cast((page_index << PAGE_BITS) + page_offset); switch (current_page_table->attributes[page_index]) { case PageType::Unmapped: { @@ -415,7 +415,7 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) { break; } case PageType::RasterizerCachedMemory: { - RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), u32(copy_amount)); std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount); break; @@ -423,7 +423,7 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) { case PageType::RasterizerCachedSpecial: { DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); - RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), u32(copy_amount)); GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount); break; @@ -462,7 +462,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size while (remaining_size > 0) { const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); - const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; + const auto current_vaddr = static_cast((page_index << PAGE_BITS) + page_offset); switch (current_page_table->attributes[page_index]) { case PageType::Unmapped: { @@ -486,7 +486,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size } case PageType::RasterizerCachedMemory: { RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), - copy_amount); + u32(copy_amount)); std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount); break; @@ -495,7 +495,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), - copy_amount); + u32(copy_amount)); GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount); break; @@ -520,7 +520,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) { while (remaining_size > 0) { const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); - const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; + const auto current_vaddr = static_cast((page_index << PAGE_BITS) + page_offset); switch (current_page_table->attributes[page_index]) { case PageType::Unmapped: { @@ -543,7 +543,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) { } case PageType::RasterizerCachedMemory: { RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), - copy_amount); + u32(copy_amount)); std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount); break; @@ -552,7 +552,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) { DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), - copy_amount); + u32(copy_amount)); GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount); break; @@ -574,7 +574,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { while (remaining_size > 0) { const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); - const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; + const auto current_vaddr = static_cast((page_index << PAGE_BITS) + page_offset); switch (current_page_table->attributes[page_index]) { case PageType::Unmapped: { @@ -598,7 +598,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { break; } case PageType::RasterizerCachedMemory: { - RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), u32(copy_amount)); WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount); break; @@ -606,7 +606,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { case PageType::RasterizerCachedSpecial: { DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); - RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), u32(copy_amount)); std::vector buffer(copy_amount); GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size()); @@ -619,8 +619,8 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { page_index++; page_offset = 0; - dest_addr += copy_amount; - src_addr += copy_amount; + dest_addr += static_cast(copy_amount); + src_addr += static_cast(copy_amount); remaining_size -= copy_amount; } } diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index b9f5d4533..e70bbcffe 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -681,6 +681,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader case ColorModifier::OneMinusSourceBlue: return (Math::Vec3(255, 255, 255) - values.bbb()).Cast(); + default: + UNREACHABLE(); } }; @@ -710,6 +712,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader case AlphaModifier::OneMinusSourceBlue: return 255 - values.b(); + default: + UNREACHABLE(); } }; @@ -1253,6 +1257,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader case Regs::LogicOp::OrInverted: return ~src | dest; + default: + UNREACHABLE(); } }; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index cc7e782a4..5488e2fe7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -738,7 +738,7 @@ bool RasterizerOpenGL::AccelerateDisplayTransfer(const GPU::Regs::DisplayTransfe // Adjust the source rectangle to take into account parts of the input lines being cropped if (config.input_width > config.output_width) { - src_rect.right -= (config.input_width - config.output_width) * src_surface->res_scale_width; + src_rect.right -= int((config.input_width - config.output_width) * src_surface->res_scale_width); } // Require destination surface to have same resolution scale as source to preserve scaling diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index e1a9cb361..4d34bdad8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -76,7 +76,7 @@ union PicaShaderConfig { } state.fog_mode = regs.fog_mode; - state.fog_flip = regs.fog_flip; + state.fog_flip = regs.fog_flip.ToBool(); state.combiner_buffer_input = regs.tev_combiner_buffer_input.update_mask_rgb.Value() | regs.tev_combiner_buffer_input.update_mask_a.Value() << 4; diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 3febe739c..20c26ec9e 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -121,7 +121,7 @@ void ShaderSetup::Run(UnitState& state, const InputVertex& input, int num // Setup input register table const auto& attribute_register_map = config.input_register_map; - for (unsigned i = 0; i < num_attributes; i++) + for (unsigned i = 0; i < (unsigned)num_attributes; i++) state.registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i]; state.conditional_code[0] = false; @@ -148,7 +148,7 @@ DebugData ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_ // Setup input register table boost::fill(state.registers.input, Math::Vec4::AssignToAll(float24::Zero())); const auto& attribute_register_map = config.input_register_map; - for (unsigned i = 0; i < num_attributes; i++) + for (unsigned i = 0; i < (unsigned)num_attributes; i++) state.registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i]; state.conditional_code[0] = false; diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 6abb6761f..060831934 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -535,6 +535,8 @@ void RunInterpreter(const ShaderSetup& setup, UnitState& state, unsigned case flow_control.JustY: return results[1]; + default: + UNREACHABLE(); } }; diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index c96110bb2..94469c30d 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -338,8 +338,8 @@ void JitShader::Compile_EvaluateCondition(Instruction instr) { } void JitShader::Compile_UniformCondition(Instruction instr) { - int offset = - ShaderSetup::UniformOffset(RegisterType::BoolUniform, instr.flow_control.bool_uniform_id); + const auto offset = + (int)ShaderSetup::UniformOffset(RegisterType::BoolUniform, instr.flow_control.bool_uniform_id); CMP(sizeof(bool) * 8, MDisp(SETUP, offset), Imm8(0)); } @@ -722,7 +722,7 @@ void JitShader::Compile_LOOP(Instruction instr) { // The Y (LOOPCOUNT_REG) and Z (LOOPINC) component are kept multiplied by 16 (Left shifted by // 4 bits) to be used as an offset into the 16-byte vector registers later int offset = - ShaderSetup::UniformOffset(RegisterType::IntUniform, instr.flow_control.int_uniform_id); + (int)ShaderSetup::UniformOffset(RegisterType::IntUniform, instr.flow_control.int_uniform_id); MOV(32, R(LOOPCOUNT), MDisp(SETUP, offset)); MOV(32, R(LOOPCOUNT_REG), R(LOOPCOUNT)); SHR(32, R(LOOPCOUNT_REG), Imm8(4));