mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 05:30:05 +00:00
core/CMakeLists: Make some warnings errors
Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
This commit is contained in:
parent
d291fc1a51
commit
39c8d18feb
3
externals/CMakeLists.txt
vendored
3
externals/CMakeLists.txt
vendored
@ -90,6 +90,9 @@ if (ENABLE_WEB_SERVICE)
|
||||
target_include_directories(httplib INTERFACE ./httplib)
|
||||
target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
||||
if (WIN32)
|
||||
target_link_libraries(httplib INTERFACE crypt32 cryptui ws2_32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Opus
|
||||
|
4189
externals/httplib/httplib.h
vendored
4189
externals/httplib/httplib.h
vendored
File diff suppressed because it is too large
Load Diff
@ -16,14 +16,14 @@ namespace Common {
|
||||
|
||||
[[nodiscard]] constexpr u8 ToHexNibble(char c) {
|
||||
if (c >= 65 && c <= 70) {
|
||||
return c - 55;
|
||||
return static_cast<u8>(c - 55);
|
||||
}
|
||||
|
||||
if (c >= 97 && c <= 102) {
|
||||
return c - 87;
|
||||
return static_cast<u8>(c - 87);
|
||||
}
|
||||
|
||||
return c - 48;
|
||||
return static_cast<u8>(c - 48);
|
||||
}
|
||||
|
||||
[[nodiscard]] std::vector<u8> HexStringToVector(std::string_view str, bool little_endian);
|
||||
@ -33,11 +33,11 @@ template <std::size_t Size, bool le = false>
|
||||
std::array<u8, Size> out{};
|
||||
if constexpr (le) {
|
||||
for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) {
|
||||
out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]);
|
||||
out[i / 2] = static_cast<u8>((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]));
|
||||
}
|
||||
} else {
|
||||
for (std::size_t i = 0; i < 2 * Size; i += 2) {
|
||||
out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]);
|
||||
out[i / 2] = static_cast<u8>((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
@ -623,6 +623,17 @@ if (MSVC)
|
||||
# 'context' : truncation from 'type1' to 'type2'
|
||||
/we4305
|
||||
)
|
||||
else()
|
||||
target_compile_options(core PRIVATE
|
||||
-Werror=conversion
|
||||
-Werror=ignored-qualifiers
|
||||
-Werror=implicit-fallthrough
|
||||
-Werror=reorder
|
||||
-Werror=sign-compare
|
||||
-Werror=unused-but-set-parameter
|
||||
-Werror=unused-but-set-variable
|
||||
-Werror=unused-variable
|
||||
)
|
||||
endif()
|
||||
|
||||
create_target_directory_groups(core)
|
||||
|
@ -411,7 +411,7 @@ Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& ke
|
||||
// Combine sources and seed
|
||||
for (auto& source : sd_key_sources) {
|
||||
for (std::size_t i = 0; i < source.size(); ++i) {
|
||||
source[i] ^= sd_seed[i & 0xF];
|
||||
source[i] = static_cast<u8>(source[i] ^ sd_seed[i & 0xF]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,9 @@ std::multimap<u64, VirtualFile> RomFSBuildContext::Build() {
|
||||
cur_file->offset = file_partition_size;
|
||||
file_partition_size += cur_file->size;
|
||||
cur_file->entry_offset = entry_offset;
|
||||
entry_offset += sizeof(RomFSFileEntry) +
|
||||
Common::AlignUp(cur_file->path_len - cur_file->cur_path_ofs, 4);
|
||||
entry_offset +=
|
||||
static_cast<u32>(sizeof(RomFSFileEntry) +
|
||||
Common::AlignUp(cur_file->path_len - cur_file->cur_path_ofs, 4));
|
||||
prev_file = cur_file;
|
||||
}
|
||||
// Assign deferred parent/sibling ownership.
|
||||
@ -284,8 +285,9 @@ std::multimap<u64, VirtualFile> RomFSBuildContext::Build() {
|
||||
for (const auto& it : directories) {
|
||||
cur_dir = it.second;
|
||||
cur_dir->entry_offset = entry_offset;
|
||||
entry_offset += sizeof(RomFSDirectoryEntry) +
|
||||
Common::AlignUp(cur_dir->path_len - cur_dir->cur_path_ofs, 4);
|
||||
entry_offset +=
|
||||
static_cast<u32>(sizeof(RomFSDirectoryEntry) +
|
||||
Common::AlignUp(cur_dir->path_len - cur_dir->cur_path_ofs, 4));
|
||||
}
|
||||
// Assign deferred parent/sibling ownership.
|
||||
for (auto it = directories.rbegin(); it->second != root; ++it) {
|
||||
|
@ -299,7 +299,7 @@ void IPSwitchCompiler::Parse() {
|
||||
patch_text->GetName(), offset, Common::HexToString(replace));
|
||||
}
|
||||
|
||||
patch.records.insert_or_assign(offset, std::move(replace));
|
||||
patch.records.insert_or_assign(static_cast<u32>(offset), std::move(replace));
|
||||
}
|
||||
|
||||
patches.push_back(std::move(patch));
|
||||
|
@ -108,7 +108,7 @@ std::vector<u8> CNMT::Serialize() const {
|
||||
memcpy(out.data() + sizeof(CNMTHeader), &opt_header, sizeof(OptionalHeader));
|
||||
}
|
||||
|
||||
auto offset = header.table_offset;
|
||||
u64_le offset = header.table_offset;
|
||||
|
||||
for (const auto& rec : content_records) {
|
||||
memcpy(out.data() + offset + sizeof(CNMTHeader), &rec, sizeof(ContentRecord));
|
||||
|
@ -29,7 +29,7 @@
|
||||
namespace FileSys {
|
||||
namespace {
|
||||
|
||||
constexpr u64 SINGLE_BYTE_MODULUS = 0x100;
|
||||
constexpr u32 SINGLE_BYTE_MODULUS = 0x100;
|
||||
constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000;
|
||||
|
||||
constexpr std::array<const char*, 14> EXEFS_FILE_NAMES{
|
||||
|
@ -84,10 +84,12 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
|
||||
return;
|
||||
|
||||
std::lock_guard guard{touch_state->mutex};
|
||||
touch_state->touch_x = static_cast<float>(framebuffer_x - framebuffer_layout.screen.left) /
|
||||
(framebuffer_layout.screen.right - framebuffer_layout.screen.left);
|
||||
touch_state->touch_y = static_cast<float>(framebuffer_y - framebuffer_layout.screen.top) /
|
||||
(framebuffer_layout.screen.bottom - framebuffer_layout.screen.top);
|
||||
touch_state->touch_x =
|
||||
static_cast<float>(framebuffer_x - framebuffer_layout.screen.left) /
|
||||
static_cast<float>(framebuffer_layout.screen.right - framebuffer_layout.screen.left);
|
||||
touch_state->touch_y =
|
||||
static_cast<float>(framebuffer_y - framebuffer_layout.screen.top) /
|
||||
static_cast<float>(framebuffer_layout.screen.bottom - framebuffer_layout.screen.top);
|
||||
|
||||
touch_state->touch_pressed = true;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ namespace Layout {
|
||||
template <class T>
|
||||
static Common::Rectangle<T> MaxRectangle(Common::Rectangle<T> window_area,
|
||||
float screen_aspect_ratio) {
|
||||
float scale = std::min(static_cast<float>(window_area.GetWidth()),
|
||||
window_area.GetHeight() / screen_aspect_ratio);
|
||||
const float scale = std::min(static_cast<float>(window_area.GetWidth()),
|
||||
static_cast<float>(window_area.GetHeight()) / screen_aspect_ratio);
|
||||
return Common::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)),
|
||||
static_cast<T>(std::round(scale * screen_aspect_ratio))};
|
||||
}
|
||||
@ -27,7 +27,7 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) {
|
||||
// so just calculate them both even if the other isn't showing.
|
||||
FramebufferLayout res{width, height, false, {}};
|
||||
|
||||
const float window_aspect_ratio = static_cast<float>(height) / width;
|
||||
const float window_aspect_ratio = static_cast<float>(height) / static_cast<float>(width);
|
||||
const float emulation_aspect_ratio = EmulationAspectRatio(
|
||||
static_cast<AspectRatio>(Settings::values.aspect_ratio.GetValue()), window_aspect_ratio);
|
||||
|
||||
|
@ -291,11 +291,11 @@ static void FpuWrite(std::size_t id, u128 val, Kernel::Thread* thread = nullptr)
|
||||
*/
|
||||
static u8 HexCharToValue(u8 hex) {
|
||||
if (hex >= '0' && hex <= '9') {
|
||||
return hex - '0';
|
||||
return static_cast<u8>(hex - '0');
|
||||
} else if (hex >= 'a' && hex <= 'f') {
|
||||
return hex - 'a' + 0xA;
|
||||
return static_cast<u8>(hex - 'a' + 0xA);
|
||||
} else if (hex >= 'A' && hex <= 'F') {
|
||||
return hex - 'A' + 0xA;
|
||||
return static_cast<u8>(hex - 'A' + 0xA);
|
||||
}
|
||||
|
||||
LOG_ERROR(Debug_GDBStub, "Invalid nibble: {} ({:02X})", hex, hex);
|
||||
@ -310,9 +310,9 @@ static u8 HexCharToValue(u8 hex) {
|
||||
static u8 NibbleToHex(u8 n) {
|
||||
n &= 0xF;
|
||||
if (n < 0xA) {
|
||||
return '0' + n;
|
||||
return static_cast<u8>('0' + n);
|
||||
} else {
|
||||
return 'a' + n - 0xA;
|
||||
return static_cast<u8>('a' + n - 0xA);
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,8 +355,8 @@ static u64 HexToLong(const u8* src, std::size_t len) {
|
||||
*/
|
||||
static void MemToGdbHex(u8* dest, const u8* src, std::size_t len) {
|
||||
while (len-- > 0) {
|
||||
u8 tmp = *src++;
|
||||
*dest++ = NibbleToHex(tmp >> 4);
|
||||
const u8 tmp = *src++;
|
||||
*dest++ = NibbleToHex(static_cast<u8>(tmp >> 4));
|
||||
*dest++ = NibbleToHex(tmp);
|
||||
}
|
||||
}
|
||||
@ -370,7 +370,7 @@ static void MemToGdbHex(u8* dest, const u8* src, std::size_t len) {
|
||||
*/
|
||||
static void GdbHexToMem(u8* dest, const u8* src, std::size_t len) {
|
||||
while (len-- > 0) {
|
||||
*dest++ = (HexCharToValue(src[0]) << 4) | HexCharToValue(src[1]);
|
||||
*dest++ = static_cast<u8>((HexCharToValue(src[0]) << 4) | HexCharToValue(src[1]));
|
||||
src += 2;
|
||||
}
|
||||
}
|
||||
@ -602,22 +602,22 @@ static void SendReply(const char* reply) {
|
||||
|
||||
memcpy(command_buffer + 1, reply, command_length);
|
||||
|
||||
u8 checksum = CalculateChecksum(command_buffer, command_length + 1);
|
||||
const u8 checksum = CalculateChecksum(command_buffer, command_length + 1);
|
||||
command_buffer[0] = GDB_STUB_START;
|
||||
command_buffer[command_length + 1] = GDB_STUB_END;
|
||||
command_buffer[command_length + 2] = NibbleToHex(checksum >> 4);
|
||||
command_buffer[command_length + 2] = NibbleToHex(static_cast<u8>(checksum >> 4));
|
||||
command_buffer[command_length + 3] = NibbleToHex(checksum);
|
||||
|
||||
u8* ptr = command_buffer;
|
||||
u32 left = command_length + 4;
|
||||
while (left > 0) {
|
||||
int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0);
|
||||
const auto sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0);
|
||||
if (sent_size < 0) {
|
||||
LOG_ERROR(Debug_GDBStub, "gdb: send failed");
|
||||
return Shutdown();
|
||||
}
|
||||
|
||||
left -= sent_size;
|
||||
left -= static_cast<u32>(sent_size);
|
||||
ptr += sent_size;
|
||||
}
|
||||
}
|
||||
@ -777,10 +777,10 @@ static void ReadCommand() {
|
||||
command_buffer[command_length++] = c;
|
||||
}
|
||||
|
||||
u8 checksum_received = HexCharToValue(ReadByte()) << 4;
|
||||
checksum_received |= HexCharToValue(ReadByte());
|
||||
auto checksum_received = static_cast<u32>(HexCharToValue(ReadByte()) << 4);
|
||||
checksum_received |= static_cast<u32>(HexCharToValue(ReadByte()));
|
||||
|
||||
u8 checksum_calculated = CalculateChecksum(command_buffer, command_length);
|
||||
const u32 checksum_calculated = CalculateChecksum(command_buffer, command_length);
|
||||
|
||||
if (checksum_received != checksum_calculated) {
|
||||
LOG_ERROR(Debug_GDBStub,
|
||||
|
@ -38,10 +38,11 @@ public:
|
||||
explicit RequestHelperBase(Kernel::HLERequestContext& context)
|
||||
: context(&context), cmdbuf(context.CommandBuffer()) {}
|
||||
|
||||
void Skip(unsigned size_in_words, bool set_to_null) {
|
||||
if (set_to_null)
|
||||
void Skip(u32 size_in_words, bool set_to_null) {
|
||||
if (set_to_null) {
|
||||
memset(cmdbuf + index, 0, size_in_words * sizeof(u32));
|
||||
index += size_in_words;
|
||||
}
|
||||
index += static_cast<ptrdiff_t>(size_in_words);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,15 +50,15 @@ public:
|
||||
*/
|
||||
void AlignWithPadding() {
|
||||
if (index & 3) {
|
||||
Skip(4 - (index & 3), true);
|
||||
Skip(static_cast<u32>(4 - (index & 3)), true);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned GetCurrentOffset() const {
|
||||
return static_cast<unsigned>(index);
|
||||
u32 GetCurrentOffset() const {
|
||||
return static_cast<u32>(index);
|
||||
}
|
||||
|
||||
void SetCurrentOffset(unsigned offset) {
|
||||
void SetCurrentOffset(u32 offset) {
|
||||
index = static_cast<ptrdiff_t>(offset);
|
||||
}
|
||||
};
|
||||
@ -89,7 +90,7 @@ public:
|
||||
|
||||
// The entire size of the raw data section in u32 units, including the 16 bytes of mandatory
|
||||
// padding.
|
||||
u32 raw_data_size = sizeof(IPC::DataPayloadHeader) / 4 + 4 + normal_params_size;
|
||||
u64 raw_data_size = sizeof(IPC::DataPayloadHeader) / 4 + 4 + normal_params_size;
|
||||
|
||||
u32 num_handles_to_move{};
|
||||
u32 num_domain_objects{};
|
||||
@ -105,7 +106,7 @@ public:
|
||||
raw_data_size += sizeof(DomainMessageHeader) / 4 + num_domain_objects;
|
||||
}
|
||||
|
||||
header.data_size.Assign(raw_data_size);
|
||||
header.data_size.Assign(static_cast<u32>(raw_data_size));
|
||||
if (num_handles_to_copy || num_handles_to_move) {
|
||||
header.enable_handle_descriptor.Assign(1);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ std::shared_ptr<Object> HandleTable::GetGeneric(Handle handle) const {
|
||||
|
||||
void HandleTable::Clear() {
|
||||
for (u16 i = 0; i < table_size; ++i) {
|
||||
generations[i] = i + 1;
|
||||
generations[i] = static_cast<u16>(i + 1);
|
||||
objects[i] = nullptr;
|
||||
}
|
||||
next_free_slot = 0;
|
||||
|
@ -72,7 +72,7 @@ u32 GlobalScheduler::SelectThreads() {
|
||||
if (top_thread != nullptr) {
|
||||
// TODO(Blinkhawk): Implement Thread Pinning
|
||||
} else {
|
||||
idle_cores |= (1ul << core);
|
||||
idle_cores |= (1U << core);
|
||||
}
|
||||
top_threads[core] = top_thread;
|
||||
}
|
||||
@ -126,7 +126,7 @@ u32 GlobalScheduler::SelectThreads() {
|
||||
top_threads[core_id] = suggested;
|
||||
}
|
||||
|
||||
idle_cores &= ~(1ul << core_id);
|
||||
idle_cores &= ~(1U << core_id);
|
||||
}
|
||||
u32 cores_needing_context_switch{};
|
||||
for (u32 core = 0; core < Core::Hardware::NUM_CPU_CORES; core++) {
|
||||
@ -134,7 +134,7 @@ u32 GlobalScheduler::SelectThreads() {
|
||||
ASSERT(top_threads[core] == nullptr ||
|
||||
static_cast<u32>(top_threads[core]->GetProcessorID()) == core);
|
||||
if (update_thread(top_threads[core], sched)) {
|
||||
cores_needing_context_switch |= (1ul << core);
|
||||
cores_needing_context_switch |= (1U << core);
|
||||
}
|
||||
}
|
||||
return cores_needing_context_switch;
|
||||
@ -364,7 +364,7 @@ void GlobalScheduler::EnableInterruptAndSchedule(u32 cores_pending_reschedule,
|
||||
} else {
|
||||
must_context_switch = true;
|
||||
}
|
||||
cores_pending_reschedule &= ~(1ul << core);
|
||||
cores_pending_reschedule &= ~(1U << core);
|
||||
}
|
||||
if (must_context_switch) {
|
||||
auto& core_scheduler = kernel.CurrentScheduler();
|
||||
@ -767,7 +767,7 @@ void Scheduler::SwitchToCurrent() {
|
||||
current_thread->context_guard.unlock();
|
||||
break;
|
||||
}
|
||||
if (current_thread->GetProcessorID() != core_id) {
|
||||
if (static_cast<u32>(current_thread->GetProcessorID()) != core_id) {
|
||||
current_thread->context_guard.unlock();
|
||||
break;
|
||||
}
|
||||
|
@ -196,7 +196,9 @@ private:
|
||||
const std::string& content_type_name) {
|
||||
if (client == nullptr) {
|
||||
client = std::make_unique<httplib::SSLClient>(BOXCAT_HOSTNAME, PORT);
|
||||
client->set_timeout_sec(timeout_seconds);
|
||||
client->set_connection_timeout(timeout_seconds);
|
||||
client->set_read_timeout(timeout_seconds);
|
||||
client->set_write_timeout(timeout_seconds);
|
||||
}
|
||||
|
||||
httplib::Headers headers{
|
||||
@ -255,7 +257,7 @@ private:
|
||||
return out;
|
||||
}
|
||||
|
||||
std::unique_ptr<httplib::Client> client;
|
||||
std::unique_ptr<httplib::SSLClient> client;
|
||||
std::string path;
|
||||
u64 title_id;
|
||||
u64 build_id;
|
||||
@ -443,7 +445,9 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
|
||||
Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global,
|
||||
std::map<std::string, EventStatus>& games) {
|
||||
httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast<int>(PORT)};
|
||||
client.set_timeout_sec(static_cast<int>(TIMEOUT_SECONDS));
|
||||
client.set_connection_timeout(static_cast<int>(TIMEOUT_SECONDS));
|
||||
client.set_read_timeout(static_cast<int>(TIMEOUT_SECONDS));
|
||||
client.set_write_timeout(static_cast<int>(TIMEOUT_SECONDS));
|
||||
|
||||
httplib::Headers headers{
|
||||
{std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)},
|
||||
|
@ -42,8 +42,8 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing,
|
||||
cur_entry.modifier = 0;
|
||||
if (Settings::values.keyboard_enabled) {
|
||||
for (std::size_t i = 0; i < keyboard_keys.size(); ++i) {
|
||||
cur_entry.key[i / KEYS_PER_BYTE] |=
|
||||
(keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE));
|
||||
auto& entry = cur_entry.key[i / KEYS_PER_BYTE];
|
||||
entry = static_cast<u8>(entry | (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE)));
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < keyboard_mods.size(); ++i) {
|
||||
|
@ -269,7 +269,6 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
|
||||
auto& rstick_entry = npad_pad_states[controller_idx].r_stick;
|
||||
const auto& button_state = buttons[controller_idx];
|
||||
const auto& analog_state = sticks[controller_idx];
|
||||
const auto& motion_state = motions[controller_idx];
|
||||
const auto [stick_l_x_f, stick_l_y_f] =
|
||||
analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus();
|
||||
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*
|
||||
|
||||
libnx_entry.connection_status.raw = 0;
|
||||
libnx_entry.connection_status.IsConnected.Assign(1);
|
||||
auto& full_sixaxis_entry =
|
||||
npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index];
|
||||
auto& handheld_sixaxis_entry =
|
||||
npad.sixaxis_handheld.sixaxis[npad.sixaxis_handheld.common.last_entry_index];
|
||||
auto& dual_left_sixaxis_entry =
|
||||
npad.sixaxis_dual_left.sixaxis[npad.sixaxis_dual_left.common.last_entry_index];
|
||||
auto& dual_right_sixaxis_entry =
|
||||
npad.sixaxis_dual_right.sixaxis[npad.sixaxis_dual_right.common.last_entry_index];
|
||||
auto& left_sixaxis_entry =
|
||||
npad.sixaxis_left.sixaxis[npad.sixaxis_left.common.last_entry_index];
|
||||
auto& right_sixaxis_entry =
|
||||
npad.sixaxis_right.sixaxis[npad.sixaxis_right.common.last_entry_index];
|
||||
|
||||
switch (controller_type) {
|
||||
case NPadControllerType::None:
|
||||
@ -541,18 +528,6 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
||||
}
|
||||
}
|
||||
|
||||
auto& main_controller =
|
||||
npad.main_controller_states.npad[npad.main_controller_states.common.last_entry_index];
|
||||
auto& handheld_entry =
|
||||
npad.handheld_states.npad[npad.handheld_states.common.last_entry_index];
|
||||
auto& dual_entry = npad.dual_states.npad[npad.dual_states.common.last_entry_index];
|
||||
auto& left_entry = npad.left_joy_states.npad[npad.left_joy_states.common.last_entry_index];
|
||||
auto& right_entry =
|
||||
npad.right_joy_states.npad[npad.right_joy_states.common.last_entry_index];
|
||||
auto& pokeball_entry =
|
||||
npad.pokeball_states.npad[npad.pokeball_states.common.last_entry_index];
|
||||
auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index];
|
||||
|
||||
auto& full_sixaxis_entry =
|
||||
npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index];
|
||||
auto& handheld_sixaxis_entry =
|
||||
|
@ -475,7 +475,7 @@ void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto enable{rp.Pop<bool>()};
|
||||
[[maybe_unused]] const auto enable{rp.Pop<bool>()};
|
||||
const auto handle{rp.Pop<u32>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
|
@ -428,7 +428,7 @@ bool MiiManager::IsFullDatabase() const {
|
||||
}
|
||||
|
||||
u32 MiiManager::GetCount(SourceFlag source_flag) const {
|
||||
u32 count{};
|
||||
std::size_t count{};
|
||||
if ((source_flag & SourceFlag::Database) != SourceFlag::None) {
|
||||
// TODO(bunnei): We don't implement the Mii database, but when we do, update this
|
||||
count += 0;
|
||||
@ -436,7 +436,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const {
|
||||
if ((source_flag & SourceFlag::Default) != SourceFlag::None) {
|
||||
count += DefaultMiiCount;
|
||||
}
|
||||
return count;
|
||||
return static_cast<u32>(count);
|
||||
}
|
||||
|
||||
ResultVal<MiiInfo> MiiManager::UpdateLatest([[maybe_unused]] const MiiInfo& info,
|
||||
|
@ -89,9 +89,9 @@ Network::Protocol Translate(Type type, Protocol protocol) {
|
||||
}
|
||||
}
|
||||
|
||||
u16 TranslatePollEventsToHost(u16 flags) {
|
||||
u16 result = 0;
|
||||
const auto translate = [&result, &flags](u16 from, u16 to) {
|
||||
u16 TranslatePollEventsToHost(u32 flags) {
|
||||
u32 result = 0;
|
||||
const auto translate = [&result, &flags](u32 from, u32 to) {
|
||||
if ((flags & from) != 0) {
|
||||
flags &= ~from;
|
||||
result |= to;
|
||||
@ -105,12 +105,12 @@ u16 TranslatePollEventsToHost(u16 flags) {
|
||||
translate(POLL_NVAL, Network::POLL_NVAL);
|
||||
|
||||
UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags);
|
||||
return result;
|
||||
return static_cast<u16>(result);
|
||||
}
|
||||
|
||||
u16 TranslatePollEventsToGuest(u16 flags) {
|
||||
u16 result = 0;
|
||||
const auto translate = [&result, &flags](u16 from, u16 to) {
|
||||
u16 TranslatePollEventsToGuest(u32 flags) {
|
||||
u32 result = 0;
|
||||
const auto translate = [&result, &flags](u32 from, u32 to) {
|
||||
if ((flags & from) != 0) {
|
||||
flags &= ~from;
|
||||
result |= to;
|
||||
@ -125,7 +125,7 @@ u16 TranslatePollEventsToGuest(u16 flags) {
|
||||
translate(Network::POLL_NVAL, POLL_NVAL);
|
||||
|
||||
UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags);
|
||||
return result;
|
||||
return static_cast<u16>(result);
|
||||
}
|
||||
|
||||
Network::SockAddrIn Translate(SockAddrIn value) {
|
||||
|
@ -31,10 +31,10 @@ Network::Type Translate(Type type);
|
||||
Network::Protocol Translate(Type type, Protocol protocol);
|
||||
|
||||
/// Translate abstract poll event flags to guest poll event flags
|
||||
u16 TranslatePollEventsToHost(u16 flags);
|
||||
u16 TranslatePollEventsToHost(u32 flags);
|
||||
|
||||
/// Translate guest poll event flags to abstract poll event flags
|
||||
u16 TranslatePollEventsToGuest(u16 flags);
|
||||
u16 TranslatePollEventsToGuest(u32 flags);
|
||||
|
||||
/// Translate guest socket address structure to abstract socket address structure
|
||||
Network::SockAddrIn Translate(SockAddrIn value);
|
||||
|
@ -820,7 +820,10 @@ static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, Calend
|
||||
const ResultCode result{
|
||||
ToCalendarTimeInternal(rules, time, calendar_time, calendar.additiona_info)};
|
||||
calendar.time.year = static_cast<s16>(calendar_time.year);
|
||||
calendar.time.month = calendar_time.month + 1; // Internal impl. uses 0-indexed month
|
||||
|
||||
// Internal impl. uses 0-indexed month
|
||||
calendar.time.month = static_cast<s8>(calendar_time.month + 1);
|
||||
|
||||
calendar.time.day = calendar_time.day;
|
||||
calendar.time.hour = calendar_time.hour;
|
||||
calendar.time.minute = calendar_time.minute;
|
||||
@ -872,13 +875,15 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules,
|
||||
const CalendarTime& calendar_time, s64& posix_time) const {
|
||||
posix_time = 0;
|
||||
|
||||
CalendarTimeInternal internal_time{};
|
||||
internal_time.year = calendar_time.year;
|
||||
internal_time.month = calendar_time.month - 1; // Internal impl. uses 0-indexed month
|
||||
internal_time.day = calendar_time.day;
|
||||
internal_time.hour = calendar_time.hour;
|
||||
internal_time.minute = calendar_time.minute;
|
||||
internal_time.second = calendar_time.second;
|
||||
CalendarTimeInternal internal_time{
|
||||
.year = calendar_time.year,
|
||||
// Internal impl. uses 0-indexed month
|
||||
.month = static_cast<s8>(calendar_time.month - 1),
|
||||
.day = calendar_time.day,
|
||||
.hour = calendar_time.hour,
|
||||
.minute = calendar_time.minute,
|
||||
.second = calendar_time.second,
|
||||
};
|
||||
|
||||
s32 hour{internal_time.hour};
|
||||
s32 minute{internal_time.minute};
|
||||
|
@ -159,7 +159,7 @@ public:
|
||||
header.data_size = static_cast<u32_le>(write_index - sizeof(Header));
|
||||
header.data_offset = sizeof(Header);
|
||||
header.objects_size = 4;
|
||||
header.objects_offset = sizeof(Header) + header.data_size;
|
||||
header.objects_offset = static_cast<u32>(sizeof(Header) + header.data_size);
|
||||
std::memcpy(buffer.data(), &header, sizeof(Header));
|
||||
|
||||
return buffer;
|
||||
|
@ -16,7 +16,7 @@ namespace Loader {
|
||||
|
||||
namespace {
|
||||
constexpr u32 PageAlignSize(u32 size) {
|
||||
return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK;
|
||||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
@ -127,7 +127,7 @@ FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) {
|
||||
}
|
||||
|
||||
static constexpr u32 PageAlignSize(u32 size) {
|
||||
return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK;
|
||||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
|
||||
static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data,
|
||||
|
@ -47,7 +47,7 @@ std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
||||
}
|
||||
|
||||
constexpr u32 PageAlignSize(u32 size) {
|
||||
return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK;
|
||||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
@ -59,7 +59,7 @@ struct NSOHeader {
|
||||
static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size.");
|
||||
static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable.");
|
||||
|
||||
constexpr u64 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000;
|
||||
constexpr u32 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000;
|
||||
|
||||
struct NSOArgumentHeader {
|
||||
u32_le allocated_size;
|
||||
|
@ -120,9 +120,9 @@ struct Memory::Impl {
|
||||
if ((addr & 1) == 0) {
|
||||
return Read<u16_le>(addr);
|
||||
} else {
|
||||
const u8 a{Read<u8>(addr)};
|
||||
const u8 b{Read<u8>(addr + sizeof(u8))};
|
||||
return (static_cast<u16>(b) << 8) | a;
|
||||
const u32 a{Read<u8>(addr)};
|
||||
const u32 b{Read<u8>(addr + sizeof(u8))};
|
||||
return static_cast<u16>((b << 8) | a);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,9 +130,9 @@ struct Memory::Impl {
|
||||
if ((addr & 3) == 0) {
|
||||
return Read<u32_le>(addr);
|
||||
} else {
|
||||
const u16 a{Read16(addr)};
|
||||
const u16 b{Read16(addr + sizeof(u16))};
|
||||
return (static_cast<u32>(b) << 16) | a;
|
||||
const u32 a{Read16(addr)};
|
||||
const u32 b{Read16(addr + sizeof(u16))};
|
||||
return (b << 16) | a;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,8 +153,9 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto value = static_cast<u32>(std::stoul(hex, nullptr, 0x10));
|
||||
out[*current_entry].definition.opcodes[out[*current_entry].definition.num_opcodes++] =
|
||||
std::stoul(hex, nullptr, 0x10);
|
||||
value;
|
||||
|
||||
i += 8;
|
||||
} else {
|
||||
|
@ -238,14 +238,14 @@ SockAddrIn TranslateToSockAddrIn(sockaddr input_) {
|
||||
return result;
|
||||
}
|
||||
|
||||
u16 TranslatePollEvents(u16 events) {
|
||||
u16 result = 0;
|
||||
u16 TranslatePollEvents(u32 events) {
|
||||
u32 result = 0;
|
||||
|
||||
if (events & POLL_IN) {
|
||||
if ((events & POLL_IN) != 0) {
|
||||
events &= ~POLL_IN;
|
||||
result |= POLLIN;
|
||||
}
|
||||
if (events & POLL_PRI) {
|
||||
if ((events & POLL_PRI) != 0) {
|
||||
events &= ~POLL_PRI;
|
||||
#ifdef _WIN32
|
||||
LOG_WARNING(Service, "Winsock doesn't support POLLPRI");
|
||||
@ -253,20 +253,20 @@ u16 TranslatePollEvents(u16 events) {
|
||||
result |= POLL_PRI;
|
||||
#endif
|
||||
}
|
||||
if (events & POLL_OUT) {
|
||||
if ((events & POLL_OUT) != 0) {
|
||||
events &= ~POLL_OUT;
|
||||
result |= POLLOUT;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED_IF_MSG(events != 0, "Unhandled guest events=0x{:x}", events);
|
||||
|
||||
return result;
|
||||
return static_cast<u16>(result);
|
||||
}
|
||||
|
||||
u16 TranslatePollRevents(u16 revents) {
|
||||
u16 result = 0;
|
||||
const auto translate = [&result, &revents](int host, unsigned guest) {
|
||||
if (revents & host) {
|
||||
u16 TranslatePollRevents(u32 revents) {
|
||||
u32 result = 0;
|
||||
const auto translate = [&result, &revents](u32 host, u32 guest) {
|
||||
if ((revents & host) != 0) {
|
||||
revents &= ~host;
|
||||
result |= guest;
|
||||
}
|
||||
@ -280,7 +280,7 @@ u16 TranslatePollRevents(u16 revents) {
|
||||
|
||||
UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents);
|
||||
|
||||
return result;
|
||||
return static_cast<u16>(result);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -350,7 +350,7 @@ std::pair<s32, Errno> Poll(std::vector<PollFD>& pollfds, s32 timeout) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num; ++i) {
|
||||
pollfds[i].revents = TranslatePollRevents(host_pollfds[i].revents);
|
||||
pollfds[i].revents = TranslatePollRevents(static_cast<u32>(host_pollfds[i].revents));
|
||||
}
|
||||
|
||||
if (result > 0) {
|
||||
@ -408,7 +408,7 @@ std::pair<Socket::AcceptResult, Errno> Socket::Accept() {
|
||||
|
||||
Errno Socket::Connect(SockAddrIn addr_in) {
|
||||
const sockaddr host_addr_in = TranslateFromSockAddrIn(addr_in);
|
||||
if (connect(fd, &host_addr_in, sizeof(host_addr_in)) != INVALID_SOCKET) {
|
||||
if (connect(fd, &host_addr_in, sizeof(host_addr_in)) != SOCKET_ERROR) {
|
||||
return Errno::SUCCESS;
|
||||
}
|
||||
|
||||
@ -503,10 +503,10 @@ std::pair<s32, Errno> Socket::Recv(int flags, std::vector<u8>& message) {
|
||||
ASSERT(flags == 0);
|
||||
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
|
||||
|
||||
const int result =
|
||||
const auto result =
|
||||
recv(fd, reinterpret_cast<char*>(message.data()), static_cast<int>(message.size()), 0);
|
||||
if (result != SOCKET_ERROR) {
|
||||
return {result, Errno::SUCCESS};
|
||||
return {static_cast<s32>(result), Errno::SUCCESS};
|
||||
}
|
||||
|
||||
switch (const int ec = LastError()) {
|
||||
@ -531,14 +531,14 @@ std::pair<s32, Errno> Socket::RecvFrom(int flags, std::vector<u8>& message, Sock
|
||||
socklen_t* const p_addrlen = addr ? &addrlen : nullptr;
|
||||
sockaddr* const p_addr_in = addr ? &addr_in : nullptr;
|
||||
|
||||
const int result = recvfrom(fd, reinterpret_cast<char*>(message.data()),
|
||||
const auto result = recvfrom(fd, reinterpret_cast<char*>(message.data()),
|
||||
static_cast<int>(message.size()), 0, p_addr_in, p_addrlen);
|
||||
if (result != SOCKET_ERROR) {
|
||||
if (addr) {
|
||||
ASSERT(addrlen == sizeof(addr_in));
|
||||
*addr = TranslateToSockAddrIn(addr_in);
|
||||
}
|
||||
return {result, Errno::SUCCESS};
|
||||
return {static_cast<s32>(result), Errno::SUCCESS};
|
||||
}
|
||||
|
||||
switch (const int ec = LastError()) {
|
||||
@ -558,10 +558,10 @@ std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) {
|
||||
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
|
||||
ASSERT(flags == 0);
|
||||
|
||||
const int result = send(fd, reinterpret_cast<const char*>(message.data()),
|
||||
const auto result = send(fd, reinterpret_cast<const char*>(message.data()),
|
||||
static_cast<int>(message.size()), 0);
|
||||
if (result != SOCKET_ERROR) {
|
||||
return {result, Errno::SUCCESS};
|
||||
return {static_cast<s32>(result), Errno::SUCCESS};
|
||||
}
|
||||
|
||||
const int ec = LastError();
|
||||
@ -591,10 +591,10 @@ std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message,
|
||||
to = &host_addr_in;
|
||||
}
|
||||
|
||||
const int result = sendto(fd, reinterpret_cast<const char*>(message.data()),
|
||||
const auto result = sendto(fd, reinterpret_cast<const char*>(message.data()),
|
||||
static_cast<int>(message.size()), 0, to, tolen);
|
||||
if (result != SOCKET_ERROR) {
|
||||
return {result, Errno::SUCCESS};
|
||||
return {static_cast<s32>(result), Errno::SUCCESS};
|
||||
}
|
||||
|
||||
const int ec = LastError();
|
||||
|
@ -67,28 +67,25 @@ struct Client::Impl {
|
||||
const std::string& jwt = "", const std::string& username = "",
|
||||
const std::string& token = "") {
|
||||
if (cli == nullptr) {
|
||||
auto parsedUrl = LUrlParser::clParseURL::ParseURL(host);
|
||||
int port;
|
||||
const auto parsedUrl = LUrlParser::clParseURL::ParseURL(host);
|
||||
int port{};
|
||||
if (parsedUrl.m_Scheme == "http") {
|
||||
if (!parsedUrl.GetPort(&port)) {
|
||||
port = HTTP_PORT;
|
||||
}
|
||||
cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port);
|
||||
} else if (parsedUrl.m_Scheme == "https") {
|
||||
if (!parsedUrl.GetPort(&port)) {
|
||||
port = HTTPS_PORT;
|
||||
}
|
||||
cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), port);
|
||||
} else {
|
||||
LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme);
|
||||
return WebResult{WebResult::Code::InvalidURL, "Bad URL scheme", ""};
|
||||
}
|
||||
cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port);
|
||||
}
|
||||
if (cli == nullptr) {
|
||||
LOG_ERROR(WebService, "Invalid URL {}", host + path);
|
||||
return WebResult{WebResult::Code::InvalidURL, "Invalid URL", ""};
|
||||
}
|
||||
cli->set_timeout_sec(TIMEOUT_SECONDS);
|
||||
cli->set_connection_timeout(TIMEOUT_SECONDS);
|
||||
cli->set_read_timeout(TIMEOUT_SECONDS);
|
||||
cli->set_write_timeout(TIMEOUT_SECONDS);
|
||||
|
||||
httplib::Headers params;
|
||||
if (!jwt.empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user