diff options
Diffstat (limited to 'src')
30 files changed, 144 insertions, 146 deletions
diff --git a/src/common/hex_util.h b/src/common/hex_util.h index 120f1a5e6..a8d414fb8 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h | |||
| @@ -16,14 +16,14 @@ namespace Common { | |||
| 16 | 16 | ||
| 17 | [[nodiscard]] constexpr u8 ToHexNibble(char c) { | 17 | [[nodiscard]] constexpr u8 ToHexNibble(char c) { |
| 18 | if (c >= 65 && c <= 70) { | 18 | if (c >= 65 && c <= 70) { |
| 19 | return c - 55; | 19 | return static_cast<u8>(c - 55); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | if (c >= 97 && c <= 102) { | 22 | if (c >= 97 && c <= 102) { |
| 23 | return c - 87; | 23 | return static_cast<u8>(c - 87); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | return c - 48; | 26 | return static_cast<u8>(c - 48); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | [[nodiscard]] std::vector<u8> HexStringToVector(std::string_view str, bool little_endian); | 29 | [[nodiscard]] std::vector<u8> HexStringToVector(std::string_view str, bool little_endian); |
| @@ -33,11 +33,11 @@ template <std::size_t Size, bool le = false> | |||
| 33 | std::array<u8, Size> out{}; | 33 | std::array<u8, Size> out{}; |
| 34 | if constexpr (le) { | 34 | if constexpr (le) { |
| 35 | for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { | 35 | for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { |
| 36 | out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]); | 36 | out[i / 2] = static_cast<u8>((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1])); |
| 37 | } | 37 | } |
| 38 | } else { | 38 | } else { |
| 39 | for (std::size_t i = 0; i < 2 * Size; i += 2) { | 39 | for (std::size_t i = 0; i < 2 * Size; i += 2) { |
| 40 | out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]); | 40 | out[i / 2] = static_cast<u8>((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1])); |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | return out; | 43 | return out; |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d0c405ec7..9760be4e4 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -623,6 +623,17 @@ if (MSVC) | |||
| 623 | # 'context' : truncation from 'type1' to 'type2' | 623 | # 'context' : truncation from 'type1' to 'type2' |
| 624 | /we4305 | 624 | /we4305 |
| 625 | ) | 625 | ) |
| 626 | else() | ||
| 627 | target_compile_options(core PRIVATE | ||
| 628 | -Werror=conversion | ||
| 629 | -Werror=ignored-qualifiers | ||
| 630 | -Werror=implicit-fallthrough | ||
| 631 | -Werror=reorder | ||
| 632 | -Werror=sign-compare | ||
| 633 | -Werror=unused-but-set-parameter | ||
| 634 | -Werror=unused-but-set-variable | ||
| 635 | -Werror=unused-variable | ||
| 636 | ) | ||
| 626 | endif() | 637 | endif() |
| 627 | 638 | ||
| 628 | create_target_directory_groups(core) | 639 | create_target_directory_groups(core) |
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 65d246050..da15f764a 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -411,7 +411,7 @@ Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& ke | |||
| 411 | // Combine sources and seed | 411 | // Combine sources and seed |
| 412 | for (auto& source : sd_key_sources) { | 412 | for (auto& source : sd_key_sources) { |
| 413 | for (std::size_t i = 0; i < source.size(); ++i) { | 413 | for (std::size_t i = 0; i < source.size(); ++i) { |
| 414 | source[i] ^= sd_seed[i & 0xF]; | 414 | source[i] = static_cast<u8>(source[i] ^ sd_seed[i & 0xF]); |
| 415 | } | 415 | } |
| 416 | } | 416 | } |
| 417 | 417 | ||
diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp index 2aff2708a..c52fafb6f 100644 --- a/src/core/file_sys/fsmitm_romfsbuild.cpp +++ b/src/core/file_sys/fsmitm_romfsbuild.cpp | |||
| @@ -266,8 +266,9 @@ std::multimap<u64, VirtualFile> RomFSBuildContext::Build() { | |||
| 266 | cur_file->offset = file_partition_size; | 266 | cur_file->offset = file_partition_size; |
| 267 | file_partition_size += cur_file->size; | 267 | file_partition_size += cur_file->size; |
| 268 | cur_file->entry_offset = entry_offset; | 268 | cur_file->entry_offset = entry_offset; |
| 269 | entry_offset += sizeof(RomFSFileEntry) + | 269 | entry_offset += |
| 270 | Common::AlignUp(cur_file->path_len - cur_file->cur_path_ofs, 4); | 270 | static_cast<u32>(sizeof(RomFSFileEntry) + |
| 271 | Common::AlignUp(cur_file->path_len - cur_file->cur_path_ofs, 4)); | ||
| 271 | prev_file = cur_file; | 272 | prev_file = cur_file; |
| 272 | } | 273 | } |
| 273 | // Assign deferred parent/sibling ownership. | 274 | // Assign deferred parent/sibling ownership. |
| @@ -284,8 +285,9 @@ std::multimap<u64, VirtualFile> RomFSBuildContext::Build() { | |||
| 284 | for (const auto& it : directories) { | 285 | for (const auto& it : directories) { |
| 285 | cur_dir = it.second; | 286 | cur_dir = it.second; |
| 286 | cur_dir->entry_offset = entry_offset; | 287 | cur_dir->entry_offset = entry_offset; |
| 287 | entry_offset += sizeof(RomFSDirectoryEntry) + | 288 | entry_offset += |
| 288 | Common::AlignUp(cur_dir->path_len - cur_dir->cur_path_ofs, 4); | 289 | static_cast<u32>(sizeof(RomFSDirectoryEntry) + |
| 290 | Common::AlignUp(cur_dir->path_len - cur_dir->cur_path_ofs, 4)); | ||
| 289 | } | 291 | } |
| 290 | // Assign deferred parent/sibling ownership. | 292 | // Assign deferred parent/sibling ownership. |
| 291 | for (auto it = directories.rbegin(); it->second != root; ++it) { | 293 | for (auto it = directories.rbegin(); it->second != root; ++it) { |
diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp index dd779310f..a6101f1c0 100644 --- a/src/core/file_sys/ips_layer.cpp +++ b/src/core/file_sys/ips_layer.cpp | |||
| @@ -299,7 +299,7 @@ void IPSwitchCompiler::Parse() { | |||
| 299 | patch_text->GetName(), offset, Common::HexToString(replace)); | 299 | patch_text->GetName(), offset, Common::HexToString(replace)); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | patch.records.insert_or_assign(offset, std::move(replace)); | 302 | patch.records.insert_or_assign(static_cast<u32>(offset), std::move(replace)); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | patches.push_back(std::move(patch)); | 305 | patches.push_back(std::move(patch)); |
diff --git a/src/core/file_sys/nca_metadata.cpp b/src/core/file_sys/nca_metadata.cpp index 2d1476e3a..3596541b2 100644 --- a/src/core/file_sys/nca_metadata.cpp +++ b/src/core/file_sys/nca_metadata.cpp | |||
| @@ -108,7 +108,7 @@ std::vector<u8> CNMT::Serialize() const { | |||
| 108 | memcpy(out.data() + sizeof(CNMTHeader), &opt_header, sizeof(OptionalHeader)); | 108 | memcpy(out.data() + sizeof(CNMTHeader), &opt_header, sizeof(OptionalHeader)); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | auto offset = header.table_offset; | 111 | u64_le offset = header.table_offset; |
| 112 | 112 | ||
| 113 | for (const auto& rec : content_records) { | 113 | for (const auto& rec : content_records) { |
| 114 | memcpy(out.data() + offset + sizeof(CNMTHeader), &rec, sizeof(ContentRecord)); | 114 | memcpy(out.data() + offset + sizeof(CNMTHeader), &rec, sizeof(ContentRecord)); |
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index b9c09b456..807b05821 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | namespace FileSys { | 29 | namespace FileSys { |
| 30 | namespace { | 30 | namespace { |
| 31 | 31 | ||
| 32 | constexpr u64 SINGLE_BYTE_MODULUS = 0x100; | 32 | constexpr u32 SINGLE_BYTE_MODULUS = 0x100; |
| 33 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; | 33 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; |
| 34 | 34 | ||
| 35 | constexpr std::array<const char*, 14> EXEFS_FILE_NAMES{ | 35 | constexpr std::array<const char*, 14> EXEFS_FILE_NAMES{ |
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 9a081fbd4..8c1193894 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp | |||
| @@ -84,10 +84,12 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) { | |||
| 84 | return; | 84 | return; |
| 85 | 85 | ||
| 86 | std::lock_guard guard{touch_state->mutex}; | 86 | std::lock_guard guard{touch_state->mutex}; |
| 87 | touch_state->touch_x = static_cast<float>(framebuffer_x - framebuffer_layout.screen.left) / | 87 | touch_state->touch_x = |
| 88 | (framebuffer_layout.screen.right - framebuffer_layout.screen.left); | 88 | static_cast<float>(framebuffer_x - framebuffer_layout.screen.left) / |
| 89 | touch_state->touch_y = static_cast<float>(framebuffer_y - framebuffer_layout.screen.top) / | 89 | static_cast<float>(framebuffer_layout.screen.right - framebuffer_layout.screen.left); |
| 90 | (framebuffer_layout.screen.bottom - framebuffer_layout.screen.top); | 90 | touch_state->touch_y = |
| 91 | static_cast<float>(framebuffer_y - framebuffer_layout.screen.top) / | ||
| 92 | static_cast<float>(framebuffer_layout.screen.bottom - framebuffer_layout.screen.top); | ||
| 91 | 93 | ||
| 92 | touch_state->touch_pressed = true; | 94 | touch_state->touch_pressed = true; |
| 93 | } | 95 | } |
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index c1fbc235b..1acc82497 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -14,8 +14,8 @@ namespace Layout { | |||
| 14 | template <class T> | 14 | template <class T> |
| 15 | static Common::Rectangle<T> MaxRectangle(Common::Rectangle<T> window_area, | 15 | static Common::Rectangle<T> MaxRectangle(Common::Rectangle<T> window_area, |
| 16 | float screen_aspect_ratio) { | 16 | float screen_aspect_ratio) { |
| 17 | float scale = std::min(static_cast<float>(window_area.GetWidth()), | 17 | const float scale = std::min(static_cast<float>(window_area.GetWidth()), |
| 18 | window_area.GetHeight() / screen_aspect_ratio); | 18 | static_cast<float>(window_area.GetHeight()) / screen_aspect_ratio); |
| 19 | return Common::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)), | 19 | return Common::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)), |
| 20 | static_cast<T>(std::round(scale * screen_aspect_ratio))}; | 20 | static_cast<T>(std::round(scale * screen_aspect_ratio))}; |
| 21 | } | 21 | } |
| @@ -27,7 +27,7 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { | |||
| 27 | // so just calculate them both even if the other isn't showing. | 27 | // so just calculate them both even if the other isn't showing. |
| 28 | FramebufferLayout res{width, height, false, {}}; | 28 | FramebufferLayout res{width, height, false, {}}; |
| 29 | 29 | ||
| 30 | const float window_aspect_ratio = static_cast<float>(height) / width; | 30 | const float window_aspect_ratio = static_cast<float>(height) / static_cast<float>(width); |
| 31 | const float emulation_aspect_ratio = EmulationAspectRatio( | 31 | const float emulation_aspect_ratio = EmulationAspectRatio( |
| 32 | static_cast<AspectRatio>(Settings::values.aspect_ratio.GetValue()), window_aspect_ratio); | 32 | static_cast<AspectRatio>(Settings::values.aspect_ratio.GetValue()), window_aspect_ratio); |
| 33 | 33 | ||
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index 79f22a403..97ee65464 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp | |||
| @@ -291,11 +291,11 @@ static void FpuWrite(std::size_t id, u128 val, Kernel::Thread* thread = nullptr) | |||
| 291 | */ | 291 | */ |
| 292 | static u8 HexCharToValue(u8 hex) { | 292 | static u8 HexCharToValue(u8 hex) { |
| 293 | if (hex >= '0' && hex <= '9') { | 293 | if (hex >= '0' && hex <= '9') { |
| 294 | return hex - '0'; | 294 | return static_cast<u8>(hex - '0'); |
| 295 | } else if (hex >= 'a' && hex <= 'f') { | 295 | } else if (hex >= 'a' && hex <= 'f') { |
| 296 | return hex - 'a' + 0xA; | 296 | return static_cast<u8>(hex - 'a' + 0xA); |
| 297 | } else if (hex >= 'A' && hex <= 'F') { | 297 | } else if (hex >= 'A' && hex <= 'F') { |
| 298 | return hex - 'A' + 0xA; | 298 | return static_cast<u8>(hex - 'A' + 0xA); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | LOG_ERROR(Debug_GDBStub, "Invalid nibble: {} ({:02X})", hex, hex); | 301 | LOG_ERROR(Debug_GDBStub, "Invalid nibble: {} ({:02X})", hex, hex); |
| @@ -310,9 +310,9 @@ static u8 HexCharToValue(u8 hex) { | |||
| 310 | static u8 NibbleToHex(u8 n) { | 310 | static u8 NibbleToHex(u8 n) { |
| 311 | n &= 0xF; | 311 | n &= 0xF; |
| 312 | if (n < 0xA) { | 312 | if (n < 0xA) { |
| 313 | return '0' + n; | 313 | return static_cast<u8>('0' + n); |
| 314 | } else { | 314 | } else { |
| 315 | return 'a' + n - 0xA; | 315 | return static_cast<u8>('a' + n - 0xA); |
| 316 | } | 316 | } |
| 317 | } | 317 | } |
| 318 | 318 | ||
| @@ -355,8 +355,8 @@ static u64 HexToLong(const u8* src, std::size_t len) { | |||
| 355 | */ | 355 | */ |
| 356 | static void MemToGdbHex(u8* dest, const u8* src, std::size_t len) { | 356 | static void MemToGdbHex(u8* dest, const u8* src, std::size_t len) { |
| 357 | while (len-- > 0) { | 357 | while (len-- > 0) { |
| 358 | u8 tmp = *src++; | 358 | const u8 tmp = *src++; |
| 359 | *dest++ = NibbleToHex(tmp >> 4); | 359 | *dest++ = NibbleToHex(static_cast<u8>(tmp >> 4)); |
| 360 | *dest++ = NibbleToHex(tmp); | 360 | *dest++ = NibbleToHex(tmp); |
| 361 | } | 361 | } |
| 362 | } | 362 | } |
| @@ -370,7 +370,7 @@ static void MemToGdbHex(u8* dest, const u8* src, std::size_t len) { | |||
| 370 | */ | 370 | */ |
| 371 | static void GdbHexToMem(u8* dest, const u8* src, std::size_t len) { | 371 | static void GdbHexToMem(u8* dest, const u8* src, std::size_t len) { |
| 372 | while (len-- > 0) { | 372 | while (len-- > 0) { |
| 373 | *dest++ = (HexCharToValue(src[0]) << 4) | HexCharToValue(src[1]); | 373 | *dest++ = static_cast<u8>((HexCharToValue(src[0]) << 4) | HexCharToValue(src[1])); |
| 374 | src += 2; | 374 | src += 2; |
| 375 | } | 375 | } |
| 376 | } | 376 | } |
| @@ -602,22 +602,22 @@ static void SendReply(const char* reply) { | |||
| 602 | 602 | ||
| 603 | memcpy(command_buffer + 1, reply, command_length); | 603 | memcpy(command_buffer + 1, reply, command_length); |
| 604 | 604 | ||
| 605 | u8 checksum = CalculateChecksum(command_buffer, command_length + 1); | 605 | const u8 checksum = CalculateChecksum(command_buffer, command_length + 1); |
| 606 | command_buffer[0] = GDB_STUB_START; | 606 | command_buffer[0] = GDB_STUB_START; |
| 607 | command_buffer[command_length + 1] = GDB_STUB_END; | 607 | command_buffer[command_length + 1] = GDB_STUB_END; |
| 608 | command_buffer[command_length + 2] = NibbleToHex(checksum >> 4); | 608 | command_buffer[command_length + 2] = NibbleToHex(static_cast<u8>(checksum >> 4)); |
| 609 | command_buffer[command_length + 3] = NibbleToHex(checksum); | 609 | command_buffer[command_length + 3] = NibbleToHex(checksum); |
| 610 | 610 | ||
| 611 | u8* ptr = command_buffer; | 611 | u8* ptr = command_buffer; |
| 612 | u32 left = command_length + 4; | 612 | u32 left = command_length + 4; |
| 613 | while (left > 0) { | 613 | while (left > 0) { |
| 614 | int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0); | 614 | const auto sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0); |
| 615 | if (sent_size < 0) { | 615 | if (sent_size < 0) { |
| 616 | LOG_ERROR(Debug_GDBStub, "gdb: send failed"); | 616 | LOG_ERROR(Debug_GDBStub, "gdb: send failed"); |
| 617 | return Shutdown(); | 617 | return Shutdown(); |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | left -= sent_size; | 620 | left -= static_cast<u32>(sent_size); |
| 621 | ptr += sent_size; | 621 | ptr += sent_size; |
| 622 | } | 622 | } |
| 623 | } | 623 | } |
| @@ -777,10 +777,10 @@ static void ReadCommand() { | |||
| 777 | command_buffer[command_length++] = c; | 777 | command_buffer[command_length++] = c; |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | u8 checksum_received = HexCharToValue(ReadByte()) << 4; | 780 | auto checksum_received = static_cast<u32>(HexCharToValue(ReadByte()) << 4); |
| 781 | checksum_received |= HexCharToValue(ReadByte()); | 781 | checksum_received |= static_cast<u32>(HexCharToValue(ReadByte())); |
| 782 | 782 | ||
| 783 | u8 checksum_calculated = CalculateChecksum(command_buffer, command_length); | 783 | const u32 checksum_calculated = CalculateChecksum(command_buffer, command_length); |
| 784 | 784 | ||
| 785 | if (checksum_received != checksum_calculated) { | 785 | if (checksum_received != checksum_calculated) { |
| 786 | LOG_ERROR(Debug_GDBStub, | 786 | LOG_ERROR(Debug_GDBStub, |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 1b503331f..1c354037d 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -38,10 +38,11 @@ public: | |||
| 38 | explicit RequestHelperBase(Kernel::HLERequestContext& context) | 38 | explicit RequestHelperBase(Kernel::HLERequestContext& context) |
| 39 | : context(&context), cmdbuf(context.CommandBuffer()) {} | 39 | : context(&context), cmdbuf(context.CommandBuffer()) {} |
| 40 | 40 | ||
| 41 | void Skip(unsigned size_in_words, bool set_to_null) { | 41 | void Skip(u32 size_in_words, bool set_to_null) { |
| 42 | if (set_to_null) | 42 | if (set_to_null) { |
| 43 | memset(cmdbuf + index, 0, size_in_words * sizeof(u32)); | 43 | memset(cmdbuf + index, 0, size_in_words * sizeof(u32)); |
| 44 | index += size_in_words; | 44 | } |
| 45 | index += static_cast<ptrdiff_t>(size_in_words); | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | /** | 48 | /** |
| @@ -49,15 +50,15 @@ public: | |||
| 49 | */ | 50 | */ |
| 50 | void AlignWithPadding() { | 51 | void AlignWithPadding() { |
| 51 | if (index & 3) { | 52 | if (index & 3) { |
| 52 | Skip(4 - (index & 3), true); | 53 | Skip(static_cast<u32>(4 - (index & 3)), true); |
| 53 | } | 54 | } |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | unsigned GetCurrentOffset() const { | 57 | u32 GetCurrentOffset() const { |
| 57 | return static_cast<unsigned>(index); | 58 | return static_cast<u32>(index); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | void SetCurrentOffset(unsigned offset) { | 61 | void SetCurrentOffset(u32 offset) { |
| 61 | index = static_cast<ptrdiff_t>(offset); | 62 | index = static_cast<ptrdiff_t>(offset); |
| 62 | } | 63 | } |
| 63 | }; | 64 | }; |
| @@ -89,7 +90,7 @@ public: | |||
| 89 | 90 | ||
| 90 | // The entire size of the raw data section in u32 units, including the 16 bytes of mandatory | 91 | // The entire size of the raw data section in u32 units, including the 16 bytes of mandatory |
| 91 | // padding. | 92 | // padding. |
| 92 | u32 raw_data_size = sizeof(IPC::DataPayloadHeader) / 4 + 4 + normal_params_size; | 93 | u64 raw_data_size = sizeof(IPC::DataPayloadHeader) / 4 + 4 + normal_params_size; |
| 93 | 94 | ||
| 94 | u32 num_handles_to_move{}; | 95 | u32 num_handles_to_move{}; |
| 95 | u32 num_domain_objects{}; | 96 | u32 num_domain_objects{}; |
| @@ -105,7 +106,7 @@ public: | |||
| 105 | raw_data_size += sizeof(DomainMessageHeader) / 4 + num_domain_objects; | 106 | raw_data_size += sizeof(DomainMessageHeader) / 4 + num_domain_objects; |
| 106 | } | 107 | } |
| 107 | 108 | ||
| 108 | header.data_size.Assign(raw_data_size); | 109 | header.data_size.Assign(static_cast<u32>(raw_data_size)); |
| 109 | if (num_handles_to_copy || num_handles_to_move) { | 110 | if (num_handles_to_copy || num_handles_to_move) { |
| 110 | header.enable_handle_descriptor.Assign(1); | 111 | header.enable_handle_descriptor.Assign(1); |
| 111 | } | 112 | } |
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index fb30b6f8b..3e745c18b 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp | |||
| @@ -118,7 +118,7 @@ std::shared_ptr<Object> HandleTable::GetGeneric(Handle handle) const { | |||
| 118 | 118 | ||
| 119 | void HandleTable::Clear() { | 119 | void HandleTable::Clear() { |
| 120 | for (u16 i = 0; i < table_size; ++i) { | 120 | for (u16 i = 0; i < table_size; ++i) { |
| 121 | generations[i] = i + 1; | 121 | generations[i] = static_cast<u16>(i + 1); |
| 122 | objects[i] = nullptr; | 122 | objects[i] = nullptr; |
| 123 | } | 123 | } |
| 124 | next_free_slot = 0; | 124 | next_free_slot = 0; |
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 5cbd3b912..6b7db5372 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -72,7 +72,7 @@ u32 GlobalScheduler::SelectThreads() { | |||
| 72 | if (top_thread != nullptr) { | 72 | if (top_thread != nullptr) { |
| 73 | // TODO(Blinkhawk): Implement Thread Pinning | 73 | // TODO(Blinkhawk): Implement Thread Pinning |
| 74 | } else { | 74 | } else { |
| 75 | idle_cores |= (1ul << core); | 75 | idle_cores |= (1U << core); |
| 76 | } | 76 | } |
| 77 | top_threads[core] = top_thread; | 77 | top_threads[core] = top_thread; |
| 78 | } | 78 | } |
| @@ -126,7 +126,7 @@ u32 GlobalScheduler::SelectThreads() { | |||
| 126 | top_threads[core_id] = suggested; | 126 | top_threads[core_id] = suggested; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | idle_cores &= ~(1ul << core_id); | 129 | idle_cores &= ~(1U << core_id); |
| 130 | } | 130 | } |
| 131 | u32 cores_needing_context_switch{}; | 131 | u32 cores_needing_context_switch{}; |
| 132 | for (u32 core = 0; core < Core::Hardware::NUM_CPU_CORES; core++) { | 132 | for (u32 core = 0; core < Core::Hardware::NUM_CPU_CORES; core++) { |
| @@ -134,7 +134,7 @@ u32 GlobalScheduler::SelectThreads() { | |||
| 134 | ASSERT(top_threads[core] == nullptr || | 134 | ASSERT(top_threads[core] == nullptr || |
| 135 | static_cast<u32>(top_threads[core]->GetProcessorID()) == core); | 135 | static_cast<u32>(top_threads[core]->GetProcessorID()) == core); |
| 136 | if (update_thread(top_threads[core], sched)) { | 136 | if (update_thread(top_threads[core], sched)) { |
| 137 | cores_needing_context_switch |= (1ul << core); | 137 | cores_needing_context_switch |= (1U << core); |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| 140 | return cores_needing_context_switch; | 140 | return cores_needing_context_switch; |
| @@ -364,7 +364,7 @@ void GlobalScheduler::EnableInterruptAndSchedule(u32 cores_pending_reschedule, | |||
| 364 | } else { | 364 | } else { |
| 365 | must_context_switch = true; | 365 | must_context_switch = true; |
| 366 | } | 366 | } |
| 367 | cores_pending_reschedule &= ~(1ul << core); | 367 | cores_pending_reschedule &= ~(1U << core); |
| 368 | } | 368 | } |
| 369 | if (must_context_switch) { | 369 | if (must_context_switch) { |
| 370 | auto& core_scheduler = kernel.CurrentScheduler(); | 370 | auto& core_scheduler = kernel.CurrentScheduler(); |
| @@ -767,7 +767,7 @@ void Scheduler::SwitchToCurrent() { | |||
| 767 | current_thread->context_guard.unlock(); | 767 | current_thread->context_guard.unlock(); |
| 768 | break; | 768 | break; |
| 769 | } | 769 | } |
| 770 | if (current_thread->GetProcessorID() != core_id) { | 770 | if (static_cast<u32>(current_thread->GetProcessorID()) != core_id) { |
| 771 | current_thread->context_guard.unlock(); | 771 | current_thread->context_guard.unlock(); |
| 772 | break; | 772 | break; |
| 773 | } | 773 | } |
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index ca021a99f..589e288df 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp | |||
| @@ -196,7 +196,9 @@ private: | |||
| 196 | const std::string& content_type_name) { | 196 | const std::string& content_type_name) { |
| 197 | if (client == nullptr) { | 197 | if (client == nullptr) { |
| 198 | client = std::make_unique<httplib::SSLClient>(BOXCAT_HOSTNAME, PORT); | 198 | client = std::make_unique<httplib::SSLClient>(BOXCAT_HOSTNAME, PORT); |
| 199 | client->set_timeout_sec(timeout_seconds); | 199 | client->set_connection_timeout(timeout_seconds); |
| 200 | client->set_read_timeout(timeout_seconds); | ||
| 201 | client->set_write_timeout(timeout_seconds); | ||
| 200 | } | 202 | } |
| 201 | 203 | ||
| 202 | httplib::Headers headers{ | 204 | httplib::Headers headers{ |
| @@ -255,7 +257,7 @@ private: | |||
| 255 | return out; | 257 | return out; |
| 256 | } | 258 | } |
| 257 | 259 | ||
| 258 | std::unique_ptr<httplib::Client> client; | 260 | std::unique_ptr<httplib::SSLClient> client; |
| 259 | std::string path; | 261 | std::string path; |
| 260 | u64 title_id; | 262 | u64 title_id; |
| 261 | u64 build_id; | 263 | u64 build_id; |
| @@ -443,7 +445,9 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title) | |||
| 443 | Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global, | 445 | Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global, |
| 444 | std::map<std::string, EventStatus>& games) { | 446 | std::map<std::string, EventStatus>& games) { |
| 445 | httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast<int>(PORT)}; | 447 | httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast<int>(PORT)}; |
| 446 | client.set_timeout_sec(static_cast<int>(TIMEOUT_SECONDS)); | 448 | client.set_connection_timeout(static_cast<int>(TIMEOUT_SECONDS)); |
| 449 | client.set_read_timeout(static_cast<int>(TIMEOUT_SECONDS)); | ||
| 450 | client.set_write_timeout(static_cast<int>(TIMEOUT_SECONDS)); | ||
| 447 | 451 | ||
| 448 | httplib::Headers headers{ | 452 | httplib::Headers headers{ |
| 449 | {std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)}, | 453 | {std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)}, |
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index 0b896d5ad..59b694cd4 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -42,8 +42,8 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 42 | cur_entry.modifier = 0; | 42 | cur_entry.modifier = 0; |
| 43 | if (Settings::values.keyboard_enabled) { | 43 | if (Settings::values.keyboard_enabled) { |
| 44 | for (std::size_t i = 0; i < keyboard_keys.size(); ++i) { | 44 | for (std::size_t i = 0; i < keyboard_keys.size(); ++i) { |
| 45 | cur_entry.key[i / KEYS_PER_BYTE] |= | 45 | auto& entry = cur_entry.key[i / KEYS_PER_BYTE]; |
| 46 | (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE)); | 46 | entry = static_cast<u8>(entry | (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE))); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | for (std::size_t i = 0; i < keyboard_mods.size(); ++i) { | 49 | for (std::size_t i = 0; i < keyboard_mods.size(); ++i) { |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 2de4ed348..e311bc18c 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -269,7 +269,6 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { | |||
| 269 | auto& rstick_entry = npad_pad_states[controller_idx].r_stick; | 269 | auto& rstick_entry = npad_pad_states[controller_idx].r_stick; |
| 270 | const auto& button_state = buttons[controller_idx]; | 270 | const auto& button_state = buttons[controller_idx]; |
| 271 | const auto& analog_state = sticks[controller_idx]; | 271 | const auto& analog_state = sticks[controller_idx]; |
| 272 | const auto& motion_state = motions[controller_idx]; | ||
| 273 | const auto [stick_l_x_f, stick_l_y_f] = | 272 | const auto [stick_l_x_f, stick_l_y_f] = |
| 274 | analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus(); | 273 | analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus(); |
| 275 | const auto [stick_r_x_f, stick_r_y_f] = | 274 | const auto [stick_r_x_f, stick_r_y_f] = |
| @@ -391,18 +390,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 391 | 390 | ||
| 392 | libnx_entry.connection_status.raw = 0; | 391 | libnx_entry.connection_status.raw = 0; |
| 393 | libnx_entry.connection_status.IsConnected.Assign(1); | 392 | libnx_entry.connection_status.IsConnected.Assign(1); |
| 394 | auto& full_sixaxis_entry = | ||
| 395 | npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; | ||
| 396 | auto& handheld_sixaxis_entry = | ||
| 397 | npad.sixaxis_handheld.sixaxis[npad.sixaxis_handheld.common.last_entry_index]; | ||
| 398 | auto& dual_left_sixaxis_entry = | ||
| 399 | npad.sixaxis_dual_left.sixaxis[npad.sixaxis_dual_left.common.last_entry_index]; | ||
| 400 | auto& dual_right_sixaxis_entry = | ||
| 401 | npad.sixaxis_dual_right.sixaxis[npad.sixaxis_dual_right.common.last_entry_index]; | ||
| 402 | auto& left_sixaxis_entry = | ||
| 403 | npad.sixaxis_left.sixaxis[npad.sixaxis_left.common.last_entry_index]; | ||
| 404 | auto& right_sixaxis_entry = | ||
| 405 | npad.sixaxis_right.sixaxis[npad.sixaxis_right.common.last_entry_index]; | ||
| 406 | 393 | ||
| 407 | switch (controller_type) { | 394 | switch (controller_type) { |
| 408 | case NPadControllerType::None: | 395 | case NPadControllerType::None: |
| @@ -541,18 +528,6 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 541 | } | 528 | } |
| 542 | } | 529 | } |
| 543 | 530 | ||
| 544 | auto& main_controller = | ||
| 545 | npad.main_controller_states.npad[npad.main_controller_states.common.last_entry_index]; | ||
| 546 | auto& handheld_entry = | ||
| 547 | npad.handheld_states.npad[npad.handheld_states.common.last_entry_index]; | ||
| 548 | auto& dual_entry = npad.dual_states.npad[npad.dual_states.common.last_entry_index]; | ||
| 549 | auto& left_entry = npad.left_joy_states.npad[npad.left_joy_states.common.last_entry_index]; | ||
| 550 | auto& right_entry = | ||
| 551 | npad.right_joy_states.npad[npad.right_joy_states.common.last_entry_index]; | ||
| 552 | auto& pokeball_entry = | ||
| 553 | npad.pokeball_states.npad[npad.pokeball_states.common.last_entry_index]; | ||
| 554 | auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; | ||
| 555 | |||
| 556 | auto& full_sixaxis_entry = | 531 | auto& full_sixaxis_entry = |
| 557 | npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; | 532 | npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; |
| 558 | auto& handheld_sixaxis_entry = | 533 | auto& handheld_sixaxis_entry = |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 71dbaba7f..8918946a1 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -475,7 +475,7 @@ void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) { | |||
| 475 | 475 | ||
| 476 | void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { | 476 | void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { |
| 477 | IPC::RequestParser rp{ctx}; | 477 | IPC::RequestParser rp{ctx}; |
| 478 | const auto enable{rp.Pop<bool>()}; | 478 | [[maybe_unused]] const auto enable{rp.Pop<bool>()}; |
| 479 | const auto handle{rp.Pop<u32>()}; | 479 | const auto handle{rp.Pop<u32>()}; |
| 480 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 480 | const auto applet_resource_user_id{rp.Pop<u64>()}; |
| 481 | 481 | ||
diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/manager.cpp index 4730070cb..8e433eb41 100644 --- a/src/core/hle/service/mii/manager.cpp +++ b/src/core/hle/service/mii/manager.cpp | |||
| @@ -428,7 +428,7 @@ bool MiiManager::IsFullDatabase() const { | |||
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | u32 MiiManager::GetCount(SourceFlag source_flag) const { | 430 | u32 MiiManager::GetCount(SourceFlag source_flag) const { |
| 431 | u32 count{}; | 431 | std::size_t count{}; |
| 432 | if ((source_flag & SourceFlag::Database) != SourceFlag::None) { | 432 | if ((source_flag & SourceFlag::Database) != SourceFlag::None) { |
| 433 | // TODO(bunnei): We don't implement the Mii database, but when we do, update this | 433 | // TODO(bunnei): We don't implement the Mii database, but when we do, update this |
| 434 | count += 0; | 434 | count += 0; |
| @@ -436,7 +436,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const { | |||
| 436 | if ((source_flag & SourceFlag::Default) != SourceFlag::None) { | 436 | if ((source_flag & SourceFlag::Default) != SourceFlag::None) { |
| 437 | count += DefaultMiiCount; | 437 | count += DefaultMiiCount; |
| 438 | } | 438 | } |
| 439 | return count; | 439 | return static_cast<u32>(count); |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | ResultVal<MiiInfo> MiiManager::UpdateLatest([[maybe_unused]] const MiiInfo& info, | 442 | ResultVal<MiiInfo> MiiManager::UpdateLatest([[maybe_unused]] const MiiInfo& info, |
diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index 139743e1d..2e626fd86 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp | |||
| @@ -89,9 +89,9 @@ Network::Protocol Translate(Type type, Protocol protocol) { | |||
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | u16 TranslatePollEventsToHost(u16 flags) { | 92 | u16 TranslatePollEventsToHost(u32 flags) { |
| 93 | u16 result = 0; | 93 | u32 result = 0; |
| 94 | const auto translate = [&result, &flags](u16 from, u16 to) { | 94 | const auto translate = [&result, &flags](u32 from, u32 to) { |
| 95 | if ((flags & from) != 0) { | 95 | if ((flags & from) != 0) { |
| 96 | flags &= ~from; | 96 | flags &= ~from; |
| 97 | result |= to; | 97 | result |= to; |
| @@ -105,12 +105,12 @@ u16 TranslatePollEventsToHost(u16 flags) { | |||
| 105 | translate(POLL_NVAL, Network::POLL_NVAL); | 105 | translate(POLL_NVAL, Network::POLL_NVAL); |
| 106 | 106 | ||
| 107 | UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags); | 107 | UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags); |
| 108 | return result; | 108 | return static_cast<u16>(result); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | u16 TranslatePollEventsToGuest(u16 flags) { | 111 | u16 TranslatePollEventsToGuest(u32 flags) { |
| 112 | u16 result = 0; | 112 | u32 result = 0; |
| 113 | const auto translate = [&result, &flags](u16 from, u16 to) { | 113 | const auto translate = [&result, &flags](u32 from, u32 to) { |
| 114 | if ((flags & from) != 0) { | 114 | if ((flags & from) != 0) { |
| 115 | flags &= ~from; | 115 | flags &= ~from; |
| 116 | result |= to; | 116 | result |= to; |
| @@ -125,7 +125,7 @@ u16 TranslatePollEventsToGuest(u16 flags) { | |||
| 125 | translate(Network::POLL_NVAL, POLL_NVAL); | 125 | translate(Network::POLL_NVAL, POLL_NVAL); |
| 126 | 126 | ||
| 127 | UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags); | 127 | UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags); |
| 128 | return result; | 128 | return static_cast<u16>(result); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | Network::SockAddrIn Translate(SockAddrIn value) { | 131 | Network::SockAddrIn Translate(SockAddrIn value) { |
diff --git a/src/core/hle/service/sockets/sockets_translate.h b/src/core/hle/service/sockets/sockets_translate.h index 8ed041e31..e498913d4 100644 --- a/src/core/hle/service/sockets/sockets_translate.h +++ b/src/core/hle/service/sockets/sockets_translate.h | |||
| @@ -31,10 +31,10 @@ Network::Type Translate(Type type); | |||
| 31 | Network::Protocol Translate(Type type, Protocol protocol); | 31 | Network::Protocol Translate(Type type, Protocol protocol); |
| 32 | 32 | ||
| 33 | /// Translate abstract poll event flags to guest poll event flags | 33 | /// Translate abstract poll event flags to guest poll event flags |
| 34 | u16 TranslatePollEventsToHost(u16 flags); | 34 | u16 TranslatePollEventsToHost(u32 flags); |
| 35 | 35 | ||
| 36 | /// Translate guest poll event flags to abstract poll event flags | 36 | /// Translate guest poll event flags to abstract poll event flags |
| 37 | u16 TranslatePollEventsToGuest(u16 flags); | 37 | u16 TranslatePollEventsToGuest(u32 flags); |
| 38 | 38 | ||
| 39 | /// Translate guest socket address structure to abstract socket address structure | 39 | /// Translate guest socket address structure to abstract socket address structure |
| 40 | Network::SockAddrIn Translate(SockAddrIn value); | 40 | Network::SockAddrIn Translate(SockAddrIn value); |
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index 69152d0ac..bdf0439f2 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp | |||
| @@ -820,7 +820,10 @@ static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, Calend | |||
| 820 | const ResultCode result{ | 820 | const ResultCode result{ |
| 821 | ToCalendarTimeInternal(rules, time, calendar_time, calendar.additiona_info)}; | 821 | ToCalendarTimeInternal(rules, time, calendar_time, calendar.additiona_info)}; |
| 822 | calendar.time.year = static_cast<s16>(calendar_time.year); | 822 | calendar.time.year = static_cast<s16>(calendar_time.year); |
| 823 | calendar.time.month = calendar_time.month + 1; // Internal impl. uses 0-indexed month | 823 | |
| 824 | // Internal impl. uses 0-indexed month | ||
| 825 | calendar.time.month = static_cast<s8>(calendar_time.month + 1); | ||
| 826 | |||
| 824 | calendar.time.day = calendar_time.day; | 827 | calendar.time.day = calendar_time.day; |
| 825 | calendar.time.hour = calendar_time.hour; | 828 | calendar.time.hour = calendar_time.hour; |
| 826 | calendar.time.minute = calendar_time.minute; | 829 | calendar.time.minute = calendar_time.minute; |
| @@ -872,13 +875,15 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, | |||
| 872 | const CalendarTime& calendar_time, s64& posix_time) const { | 875 | const CalendarTime& calendar_time, s64& posix_time) const { |
| 873 | posix_time = 0; | 876 | posix_time = 0; |
| 874 | 877 | ||
| 875 | CalendarTimeInternal internal_time{}; | 878 | CalendarTimeInternal internal_time{ |
| 876 | internal_time.year = calendar_time.year; | 879 | .year = calendar_time.year, |
| 877 | internal_time.month = calendar_time.month - 1; // Internal impl. uses 0-indexed month | 880 | // Internal impl. uses 0-indexed month |
| 878 | internal_time.day = calendar_time.day; | 881 | .month = static_cast<s8>(calendar_time.month - 1), |
| 879 | internal_time.hour = calendar_time.hour; | 882 | .day = calendar_time.day, |
| 880 | internal_time.minute = calendar_time.minute; | 883 | .hour = calendar_time.hour, |
| 881 | internal_time.second = calendar_time.second; | 884 | .minute = calendar_time.minute, |
| 885 | .second = calendar_time.second, | ||
| 886 | }; | ||
| 882 | 887 | ||
| 883 | s32 hour{internal_time.hour}; | 888 | s32 hour{internal_time.hour}; |
| 884 | s32 minute{internal_time.minute}; | 889 | s32 minute{internal_time.minute}; |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 480d34725..d380c60fb 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -159,7 +159,7 @@ public: | |||
| 159 | header.data_size = static_cast<u32_le>(write_index - sizeof(Header)); | 159 | header.data_size = static_cast<u32_le>(write_index - sizeof(Header)); |
| 160 | header.data_offset = sizeof(Header); | 160 | header.data_offset = sizeof(Header); |
| 161 | header.objects_size = 4; | 161 | header.objects_size = 4; |
| 162 | header.objects_offset = sizeof(Header) + header.data_size; | 162 | header.objects_offset = static_cast<u32>(sizeof(Header) + header.data_size); |
| 163 | std::memcpy(buffer.data(), &header, sizeof(Header)); | 163 | std::memcpy(buffer.data(), &header, sizeof(Header)); |
| 164 | 164 | ||
| 165 | return buffer; | 165 | return buffer; |
diff --git a/src/core/loader/kip.cpp b/src/core/loader/kip.cpp index 5981bcd21..2a905d3e4 100644 --- a/src/core/loader/kip.cpp +++ b/src/core/loader/kip.cpp | |||
| @@ -16,7 +16,7 @@ namespace Loader { | |||
| 16 | 16 | ||
| 17 | namespace { | 17 | namespace { |
| 18 | constexpr u32 PageAlignSize(u32 size) { | 18 | constexpr u32 PageAlignSize(u32 size) { |
| 19 | return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; | 19 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); |
| 20 | } | 20 | } |
| 21 | } // Anonymous namespace | 21 | } // Anonymous namespace |
| 22 | 22 | ||
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 9fb5eddad..5f4b3104b 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -127,7 +127,7 @@ FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { | |||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | static constexpr u32 PageAlignSize(u32 size) { | 129 | static constexpr u32 PageAlignSize(u32 size) { |
| 130 | return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; | 130 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, | 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 1e70f6e11..497f438a1 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -47,7 +47,7 @@ std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | constexpr u32 PageAlignSize(u32 size) { | 49 | constexpr u32 PageAlignSize(u32 size) { |
| 50 | return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; | 50 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); |
| 51 | } | 51 | } |
| 52 | } // Anonymous namespace | 52 | } // Anonymous namespace |
| 53 | 53 | ||
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 4bd47787d..d331096ae 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h | |||
| @@ -59,7 +59,7 @@ struct NSOHeader { | |||
| 59 | static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size."); | 59 | static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size."); |
| 60 | static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable."); | 60 | static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable."); |
| 61 | 61 | ||
| 62 | constexpr u64 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000; | 62 | constexpr u32 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000; |
| 63 | 63 | ||
| 64 | struct NSOArgumentHeader { | 64 | struct NSOArgumentHeader { |
| 65 | u32_le allocated_size; | 65 | u32_le allocated_size; |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index c3f4829d7..b88aa5c40 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -120,9 +120,9 @@ struct Memory::Impl { | |||
| 120 | if ((addr & 1) == 0) { | 120 | if ((addr & 1) == 0) { |
| 121 | return Read<u16_le>(addr); | 121 | return Read<u16_le>(addr); |
| 122 | } else { | 122 | } else { |
| 123 | const u8 a{Read<u8>(addr)}; | 123 | const u32 a{Read<u8>(addr)}; |
| 124 | const u8 b{Read<u8>(addr + sizeof(u8))}; | 124 | const u32 b{Read<u8>(addr + sizeof(u8))}; |
| 125 | return (static_cast<u16>(b) << 8) | a; | 125 | return static_cast<u16>((b << 8) | a); |
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | 128 | ||
| @@ -130,9 +130,9 @@ struct Memory::Impl { | |||
| 130 | if ((addr & 3) == 0) { | 130 | if ((addr & 3) == 0) { |
| 131 | return Read<u32_le>(addr); | 131 | return Read<u32_le>(addr); |
| 132 | } else { | 132 | } else { |
| 133 | const u16 a{Read16(addr)}; | 133 | const u32 a{Read16(addr)}; |
| 134 | const u16 b{Read16(addr + sizeof(u16))}; | 134 | const u32 b{Read16(addr + sizeof(u16))}; |
| 135 | return (static_cast<u32>(b) << 16) | a; | 135 | return (b << 16) | a; |
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | 138 | ||
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 29284a42d..2dd0eb0f8 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -153,8 +153,9 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const { | |||
| 153 | return {}; | 153 | return {}; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | const auto value = static_cast<u32>(std::stoul(hex, nullptr, 0x10)); | ||
| 156 | out[*current_entry].definition.opcodes[out[*current_entry].definition.num_opcodes++] = | 157 | out[*current_entry].definition.opcodes[out[*current_entry].definition.num_opcodes++] = |
| 157 | std::stoul(hex, nullptr, 0x10); | 158 | value; |
| 158 | 159 | ||
| 159 | i += 8; | 160 | i += 8; |
| 160 | } else { | 161 | } else { |
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp index 56d173b5e..4b3bb4366 100644 --- a/src/core/network/network.cpp +++ b/src/core/network/network.cpp | |||
| @@ -238,14 +238,14 @@ SockAddrIn TranslateToSockAddrIn(sockaddr input_) { | |||
| 238 | return result; | 238 | return result; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | u16 TranslatePollEvents(u16 events) { | 241 | u16 TranslatePollEvents(u32 events) { |
| 242 | u16 result = 0; | 242 | u32 result = 0; |
| 243 | 243 | ||
| 244 | if (events & POLL_IN) { | 244 | if ((events & POLL_IN) != 0) { |
| 245 | events &= ~POLL_IN; | 245 | events &= ~POLL_IN; |
| 246 | result |= POLLIN; | 246 | result |= POLLIN; |
| 247 | } | 247 | } |
| 248 | if (events & POLL_PRI) { | 248 | if ((events & POLL_PRI) != 0) { |
| 249 | events &= ~POLL_PRI; | 249 | events &= ~POLL_PRI; |
| 250 | #ifdef _WIN32 | 250 | #ifdef _WIN32 |
| 251 | LOG_WARNING(Service, "Winsock doesn't support POLLPRI"); | 251 | LOG_WARNING(Service, "Winsock doesn't support POLLPRI"); |
| @@ -253,20 +253,20 @@ u16 TranslatePollEvents(u16 events) { | |||
| 253 | result |= POLL_PRI; | 253 | result |= POLL_PRI; |
| 254 | #endif | 254 | #endif |
| 255 | } | 255 | } |
| 256 | if (events & POLL_OUT) { | 256 | if ((events & POLL_OUT) != 0) { |
| 257 | events &= ~POLL_OUT; | 257 | events &= ~POLL_OUT; |
| 258 | result |= POLLOUT; | 258 | result |= POLLOUT; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | UNIMPLEMENTED_IF_MSG(events != 0, "Unhandled guest events=0x{:x}", events); | 261 | UNIMPLEMENTED_IF_MSG(events != 0, "Unhandled guest events=0x{:x}", events); |
| 262 | 262 | ||
| 263 | return result; | 263 | return static_cast<u16>(result); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | u16 TranslatePollRevents(u16 revents) { | 266 | u16 TranslatePollRevents(u32 revents) { |
| 267 | u16 result = 0; | 267 | u32 result = 0; |
| 268 | const auto translate = [&result, &revents](int host, unsigned guest) { | 268 | const auto translate = [&result, &revents](u32 host, u32 guest) { |
| 269 | if (revents & host) { | 269 | if ((revents & host) != 0) { |
| 270 | revents &= ~host; | 270 | revents &= ~host; |
| 271 | result |= guest; | 271 | result |= guest; |
| 272 | } | 272 | } |
| @@ -280,7 +280,7 @@ u16 TranslatePollRevents(u16 revents) { | |||
| 280 | 280 | ||
| 281 | UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents); | 281 | UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents); |
| 282 | 282 | ||
| 283 | return result; | 283 | return static_cast<u16>(result); |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | template <typename T> | 286 | template <typename T> |
| @@ -350,7 +350,7 @@ std::pair<s32, Errno> Poll(std::vector<PollFD>& pollfds, s32 timeout) { | |||
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | for (size_t i = 0; i < num; ++i) { | 352 | for (size_t i = 0; i < num; ++i) { |
| 353 | pollfds[i].revents = TranslatePollRevents(host_pollfds[i].revents); | 353 | pollfds[i].revents = TranslatePollRevents(static_cast<u32>(host_pollfds[i].revents)); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | if (result > 0) { | 356 | if (result > 0) { |
| @@ -408,7 +408,7 @@ std::pair<Socket::AcceptResult, Errno> Socket::Accept() { | |||
| 408 | 408 | ||
| 409 | Errno Socket::Connect(SockAddrIn addr_in) { | 409 | Errno Socket::Connect(SockAddrIn addr_in) { |
| 410 | const sockaddr host_addr_in = TranslateFromSockAddrIn(addr_in); | 410 | const sockaddr host_addr_in = TranslateFromSockAddrIn(addr_in); |
| 411 | if (connect(fd, &host_addr_in, sizeof(host_addr_in)) != INVALID_SOCKET) { | 411 | if (connect(fd, &host_addr_in, sizeof(host_addr_in)) != SOCKET_ERROR) { |
| 412 | return Errno::SUCCESS; | 412 | return Errno::SUCCESS; |
| 413 | } | 413 | } |
| 414 | 414 | ||
| @@ -503,10 +503,10 @@ std::pair<s32, Errno> Socket::Recv(int flags, std::vector<u8>& message) { | |||
| 503 | ASSERT(flags == 0); | 503 | ASSERT(flags == 0); |
| 504 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); | 504 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); |
| 505 | 505 | ||
| 506 | const int result = | 506 | const auto result = |
| 507 | recv(fd, reinterpret_cast<char*>(message.data()), static_cast<int>(message.size()), 0); | 507 | recv(fd, reinterpret_cast<char*>(message.data()), static_cast<int>(message.size()), 0); |
| 508 | if (result != SOCKET_ERROR) { | 508 | if (result != SOCKET_ERROR) { |
| 509 | return {result, Errno::SUCCESS}; | 509 | return {static_cast<s32>(result), Errno::SUCCESS}; |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | switch (const int ec = LastError()) { | 512 | switch (const int ec = LastError()) { |
| @@ -531,14 +531,14 @@ std::pair<s32, Errno> Socket::RecvFrom(int flags, std::vector<u8>& message, Sock | |||
| 531 | socklen_t* const p_addrlen = addr ? &addrlen : nullptr; | 531 | socklen_t* const p_addrlen = addr ? &addrlen : nullptr; |
| 532 | sockaddr* const p_addr_in = addr ? &addr_in : nullptr; | 532 | sockaddr* const p_addr_in = addr ? &addr_in : nullptr; |
| 533 | 533 | ||
| 534 | const int result = recvfrom(fd, reinterpret_cast<char*>(message.data()), | 534 | const auto result = recvfrom(fd, reinterpret_cast<char*>(message.data()), |
| 535 | static_cast<int>(message.size()), 0, p_addr_in, p_addrlen); | 535 | static_cast<int>(message.size()), 0, p_addr_in, p_addrlen); |
| 536 | if (result != SOCKET_ERROR) { | 536 | if (result != SOCKET_ERROR) { |
| 537 | if (addr) { | 537 | if (addr) { |
| 538 | ASSERT(addrlen == sizeof(addr_in)); | 538 | ASSERT(addrlen == sizeof(addr_in)); |
| 539 | *addr = TranslateToSockAddrIn(addr_in); | 539 | *addr = TranslateToSockAddrIn(addr_in); |
| 540 | } | 540 | } |
| 541 | return {result, Errno::SUCCESS}; | 541 | return {static_cast<s32>(result), Errno::SUCCESS}; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | switch (const int ec = LastError()) { | 544 | switch (const int ec = LastError()) { |
| @@ -558,10 +558,10 @@ std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) { | |||
| 558 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); | 558 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); |
| 559 | ASSERT(flags == 0); | 559 | ASSERT(flags == 0); |
| 560 | 560 | ||
| 561 | const int result = send(fd, reinterpret_cast<const char*>(message.data()), | 561 | const auto result = send(fd, reinterpret_cast<const char*>(message.data()), |
| 562 | static_cast<int>(message.size()), 0); | 562 | static_cast<int>(message.size()), 0); |
| 563 | if (result != SOCKET_ERROR) { | 563 | if (result != SOCKET_ERROR) { |
| 564 | return {result, Errno::SUCCESS}; | 564 | return {static_cast<s32>(result), Errno::SUCCESS}; |
| 565 | } | 565 | } |
| 566 | 566 | ||
| 567 | const int ec = LastError(); | 567 | const int ec = LastError(); |
| @@ -591,10 +591,10 @@ std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message, | |||
| 591 | to = &host_addr_in; | 591 | to = &host_addr_in; |
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | const int result = sendto(fd, reinterpret_cast<const char*>(message.data()), | 594 | const auto result = sendto(fd, reinterpret_cast<const char*>(message.data()), |
| 595 | static_cast<int>(message.size()), 0, to, tolen); | 595 | static_cast<int>(message.size()), 0, to, tolen); |
| 596 | if (result != SOCKET_ERROR) { | 596 | if (result != SOCKET_ERROR) { |
| 597 | return {result, Errno::SUCCESS}; | 597 | return {static_cast<s32>(result), Errno::SUCCESS}; |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | const int ec = LastError(); | 600 | const int ec = LastError(); |
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 74e287045..534960d09 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp | |||
| @@ -67,28 +67,25 @@ struct Client::Impl { | |||
| 67 | const std::string& jwt = "", const std::string& username = "", | 67 | const std::string& jwt = "", const std::string& username = "", |
| 68 | const std::string& token = "") { | 68 | const std::string& token = "") { |
| 69 | if (cli == nullptr) { | 69 | if (cli == nullptr) { |
| 70 | auto parsedUrl = LUrlParser::clParseURL::ParseURL(host); | 70 | const auto parsedUrl = LUrlParser::clParseURL::ParseURL(host); |
| 71 | int port; | 71 | int port{}; |
| 72 | if (parsedUrl.m_Scheme == "http") { | 72 | if (parsedUrl.m_Scheme == "http") { |
| 73 | if (!parsedUrl.GetPort(&port)) { | 73 | if (!parsedUrl.GetPort(&port)) { |
| 74 | port = HTTP_PORT; | 74 | port = HTTP_PORT; |
| 75 | } | 75 | } |
| 76 | cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port); | ||
| 77 | } else if (parsedUrl.m_Scheme == "https") { | 76 | } else if (parsedUrl.m_Scheme == "https") { |
| 78 | if (!parsedUrl.GetPort(&port)) { | 77 | if (!parsedUrl.GetPort(&port)) { |
| 79 | port = HTTPS_PORT; | 78 | port = HTTPS_PORT; |
| 80 | } | 79 | } |
| 81 | cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), port); | ||
| 82 | } else { | 80 | } else { |
| 83 | LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme); | 81 | LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme); |
| 84 | return WebResult{WebResult::Code::InvalidURL, "Bad URL scheme", ""}; | 82 | return WebResult{WebResult::Code::InvalidURL, "Bad URL scheme", ""}; |
| 85 | } | 83 | } |
| 84 | cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port); | ||
| 86 | } | 85 | } |
| 87 | if (cli == nullptr) { | 86 | cli->set_connection_timeout(TIMEOUT_SECONDS); |
| 88 | LOG_ERROR(WebService, "Invalid URL {}", host + path); | 87 | cli->set_read_timeout(TIMEOUT_SECONDS); |
| 89 | return WebResult{WebResult::Code::InvalidURL, "Invalid URL", ""}; | 88 | cli->set_write_timeout(TIMEOUT_SECONDS); |
| 90 | } | ||
| 91 | cli->set_timeout_sec(TIMEOUT_SECONDS); | ||
| 92 | 89 | ||
| 93 | httplib::Headers params; | 90 | httplib::Headers params; |
| 94 | if (!jwt.empty()) { | 91 | if (!jwt.empty()) { |