From 74cd98ecada3f42875e33f2a90786055a84eb8e9 Mon Sep 17 00:00:00 2001 From: BreadFish64 Date: Mon, 23 Jul 2018 16:08:14 -0500 Subject: [PATCH] core: clean up warnings --- externals/fmt | 2 +- src/audio_core/dsp_interface.cpp | 2 +- src/audio_core/hle/hle.cpp | 6 +++--- src/core/arm/dynarmic/arm_dynarmic.cpp | 2 +- src/core/arm/dyncom/arm_dyncom.cpp | 4 ++-- src/core/arm/dyncom/arm_dyncom.h | 2 +- src/core/arm/dyncom/arm_dyncom_trans.h | 4 ++++ src/core/arm/skyeye_common/armstate.h | 2 +- src/core/core_timing.cpp | 14 ++++++-------- src/core/core_timing.h | 4 ++-- src/core/file_sys/title_metadata.cpp | 2 +- src/core/hle/applets/applet.cpp | 2 +- src/core/hle/ipc_helpers.h | 2 +- src/core/hle/kernel/hle_ipc.cpp | 4 ++-- src/core/hle/kernel/ipc.cpp | 15 ++++++++------- src/core/hle/kernel/thread.cpp | 2 +- src/core/hle/kernel/timer.cpp | 4 ++-- src/core/hle/kernel/timer.h | 2 +- src/core/hle/service/am/am.cpp | 8 ++++---- src/core/hle/service/cam/cam.cpp | 4 ++-- src/core/hle/service/cam/cam.h | 2 +- src/core/hle/service/cfg/cfg.cpp | 2 +- src/core/hle/service/fs/archive.cpp | 6 +++--- src/core/hle/service/hid/hid.cpp | 12 ++++++------ src/core/hle/service/hid/hid.h | 8 ++++---- src/core/hle/service/ir/extra_hid.cpp | 2 +- src/core/hle/service/ir/ir_rst.cpp | 4 ++-- src/core/hle/service/ir/ir_rst.h | 4 ++-- src/core/hle/service/ir/ir_user.h | 2 +- src/core/hle/service/nwm/nwm_uds.cpp | 10 +++++----- src/core/hle/service/ptm/ptm.cpp | 1 - src/core/hle/service/soc_u.cpp | 4 ++-- src/core/hle/shared_page.cpp | 2 +- src/core/hw/gpu.cpp | 2 +- src/core/movie.cpp | 11 +++++++---- 35 files changed, 82 insertions(+), 77 deletions(-) diff --git a/externals/fmt b/externals/fmt index 5859e58ba..c2ce7e4f0 160000 --- a/externals/fmt +++ b/externals/fmt @@ -1 +1 @@ -Subproject commit 5859e58ba17073cf1c16536205450528f3530df0 +Subproject commit c2ce7e4f07f7b34b2c7bbd0a4d0798b1d7007f4f diff --git a/src/audio_core/dsp_interface.cpp b/src/audio_core/dsp_interface.cpp index 626a9d04d..da8319a2e 100644 --- a/src/audio_core/dsp_interface.cpp +++ b/src/audio_core/dsp_interface.cpp @@ -45,7 +45,7 @@ void DspInterface::OutputFrame(StereoFrame16& frame) { return; // Implementation of the hardware volume slider with a dynamic range of 60 dB - float volume_scale_factor = std::exp(6.90775 * Settings::values.volume) * 0.001; + double volume_scale_factor = std::exp(6.90775 * Settings::values.volume) * 0.001; for (size_t i = 0; i < frame.size(); i++) { frame[i][0] = static_cast(frame[i][0] * volume_scale_factor); frame[i][1] = static_cast(frame[i][1] * volume_scale_factor); diff --git a/src/audio_core/hle/hle.cpp b/src/audio_core/hle/hle.cpp index 703112740..04bf66aae 100644 --- a/src/audio_core/hle/hle.cpp +++ b/src/audio_core/hle/hle.cpp @@ -43,7 +43,7 @@ private: StereoFrame16 GenerateCurrentFrame(); bool Tick(); - void AudioTickCallback(int cycles_late); + void AudioTickCallback(s64 cycles_late); DspState dsp_state = DspState::Off; std::array, num_dsp_pipe> pipe_data; @@ -66,7 +66,7 @@ DspHle::Impl::Impl(DspHle& parent_) : parent(parent_) { dsp_memory.raw_memory.fill(0); tick_event = - CoreTiming::RegisterEvent("AudioCore::DspHle::tick_event", [this](u64, int cycles_late) { + CoreTiming::RegisterEvent("AudioCore::DspHle::tick_event", [this](u64, s64 cycles_late) { this->AudioTickCallback(cycles_late); }); CoreTiming::ScheduleEvent(audio_frame_ticks, tick_event); @@ -304,7 +304,7 @@ bool DspHle::Impl::Tick() { return true; } -void DspHle::Impl::AudioTickCallback(int cycles_late) { +void DspHle::Impl::AudioTickCallback(s64 cycles_late) { if (Tick()) { // TODO(merry): Signal all the other interrupts as appropriate. Service::DSP::SignalPipeInterrupt(DspPipe::Audio); diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index ce41bef52..f324b7e09 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -99,7 +99,7 @@ static void AddTicks(u64 ticks) { } static u64 GetTicksRemaining() { - int ticks = CoreTiming::GetDowncount(); + s64 ticks = CoreTiming::GetDowncount(); return static_cast(ticks <= 0 ? 0 : ticks); } diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index 4643a20a7..c06ffc4de 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp @@ -75,7 +75,7 @@ ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { ARM_DynCom::~ARM_DynCom() {} void ARM_DynCom::Run() { - ExecuteInstructions(std::max(CoreTiming::GetDowncount(), 0)); + ExecuteInstructions(std::max(CoreTiming::GetDowncount(), 0)); } void ARM_DynCom::Step() { @@ -143,7 +143,7 @@ void ARM_DynCom::SetCP15Register(CP15Register reg, u32 value) { state->CP15[reg] = value; } -void ARM_DynCom::ExecuteInstructions(int num_instructions) { +void ARM_DynCom::ExecuteInstructions(u64 num_instructions) { state->NumInstrsToExecute = num_instructions; unsigned ticks_executed = InterpreterMainLoop(state.get()); CoreTiming::AddTicks(ticks_executed); diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h index 5547e0cc7..8eb109c9f 100644 --- a/src/core/arm/dyncom/arm_dyncom.h +++ b/src/core/arm/dyncom/arm_dyncom.h @@ -42,7 +42,7 @@ public: void PrepareReschedule() override; private: - void ExecuteInstructions(int num_instructions); + void ExecuteInstructions(u64 num_instructions); std::unique_ptr state; }; diff --git a/src/core/arm/dyncom/arm_dyncom_trans.h b/src/core/arm/dyncom/arm_dyncom_trans.h index 632ff2cd6..2a98e611e 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.h +++ b/src/core/arm/dyncom/arm_dyncom_trans.h @@ -1,4 +1,8 @@ #pragma once +#ifdef _MSC_VER +// nonstandard extension used: zero-sized array in struct/union +#pragma warning(disable : 4200) +#endif #include #include "common/common_types.h" diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h index b2b928d3c..60880caf9 100644 --- a/src/core/arm/skyeye_common/armstate.h +++ b/src/core/arm/skyeye_common/armstate.h @@ -221,7 +221,7 @@ public: u32 TFlag; // Thumb state unsigned long long NumInstrs; // The number of instructions executed - unsigned NumInstrsToExecute; + u64 NumInstrsToExecute; unsigned NresetSig; // Reset the processor unsigned NfiqSig; diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 62c439739..260a8f4d5 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -19,8 +19,8 @@ namespace CoreTiming { static s64 global_timer; -static int slice_length; -static int downcount; +static s64 slice_length; +static s64 downcount; struct EventType { TimedCallback callback; @@ -180,10 +180,8 @@ void RemoveNormalAndThreadsafeEvent(const EventType* event_type) { void ForceExceptionCheck(s64 cycles) { cycles = std::max(0, cycles); if (downcount > cycles) { - // downcount is always (much) smaller than MAX_INT so we can safely cast cycles to an int - // here. Account for cycles already executed by adjusting the g.slice_length - slice_length -= downcount - static_cast(cycles); - downcount = static_cast(cycles); + slice_length -= downcount - cycles; + downcount = cycles; } } @@ -198,7 +196,7 @@ void MoveEvents() { void Advance() { MoveEvents(); - int cycles_executed = slice_length - downcount; + s64 cycles_executed = slice_length - downcount; global_timer += cycles_executed; slice_length = MAX_SLICE_LENGTH; @@ -231,7 +229,7 @@ u64 GetGlobalTimeUs() { return GetTicks() * 1000000 / BASE_CLOCK_RATE_ARM11; } -int GetDowncount() { +s64 GetDowncount() { return downcount; } diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 0510d12a9..ca663a1ed 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -128,7 +128,7 @@ namespace CoreTiming { void Init(); void Shutdown(); -typedef std::function TimedCallback; +typedef std::function TimedCallback; /** * This should only be called from the emu thread, if you are calling it any other thread, you are @@ -186,6 +186,6 @@ void ForceExceptionCheck(s64 cycles); u64 GetGlobalTimeUs(); -int GetDowncount(); +s64 GetDowncount(); } // namespace CoreTiming diff --git a/src/core/file_sys/title_metadata.cpp b/src/core/file_sys/title_metadata.cpp index 8e0b6b30f..ec6b90992 100644 --- a/src/core/file_sys/title_metadata.cpp +++ b/src/core/file_sys/title_metadata.cpp @@ -73,7 +73,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::vector file_data, size_t memcpy(&tmd_body, &file_data[offset + body_start], sizeof(TitleMetadata::Body)); size_t expected_size = - body_start + sizeof(Body) + tmd_body.content_count * sizeof(ContentChunk); + body_start + sizeof(Body) + static_cast(tmd_body.content_count) * sizeof(ContentChunk); if (total_size < expected_size) { LOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size, total_size); diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp index 805bdf8f8..751b85815 100644 --- a/src/core/hle/applets/applet.cpp +++ b/src/core/hle/applets/applet.cpp @@ -79,7 +79,7 @@ std::shared_ptr Applet::Get(Service::APT::AppletId id) { } /// Handles updating the current Applet every time it's called. -static void AppletUpdateEvent(u64 applet_id, int cycles_late) { +static void AppletUpdateEvent(u64 applet_id, s64 cycles_late) { Service::APT::AppletId id = static_cast(applet_id); std::shared_ptr applet = Applet::Get(id); ASSERT_MSG(applet != nullptr, "Applet doesn't exist! applet_id={:08X}", static_cast(id)); diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 52ebacf61..4345540fb 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -423,7 +423,7 @@ inline const std::vector& RequestParser::PopStaticBuffer() { Pop(); StaticBufferDescInfo buffer_info{sbuffer_descriptor}; - return context->GetStaticBuffer(buffer_info.buffer_id); + return context->GetStaticBuffer(static_cast(buffer_info.buffer_id)); } inline Kernel::MappedBuffer& RequestParser::PopMappedBuffer() { diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 6c087dd86..5ab7af552 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -240,13 +240,13 @@ MappedBuffer::MappedBuffer(const Process& process, u32 descriptor, VAddr address void MappedBuffer::Read(void* dest_buffer, size_t offset, size_t size) { ASSERT(perms & IPC::R); ASSERT(offset + size <= this->size); - Memory::ReadBlock(*process, address + offset, dest_buffer, size); + Memory::ReadBlock(*process, address + static_cast(offset), dest_buffer, size); } void MappedBuffer::Write(const void* src_buffer, size_t offset, size_t size) { ASSERT(perms & IPC::W); ASSERT(offset + size <= this->size); - Memory::WriteBlock(*process, address + offset, src_buffer, size); + Memory::WriteBlock(*process, address + static_cast(offset), src_buffer, size); } } // namespace Kernel diff --git a/src/core/hle/kernel/ipc.cpp b/src/core/hle/kernel/ipc.cpp index b390b7fbc..eed6c8c01 100644 --- a/src/core/hle/kernel/ipc.cpp +++ b/src/core/hle/kernel/ipc.cpp @@ -120,7 +120,7 @@ ResultCode TranslateCommandBuffer(SharedPtr src_thread, SharedPtr(descInfo.size); IPC::MappedBufferPermissions permissions = descInfo.perms; VAddr page_start = Common::AlignDown(source_address, Memory::PAGE_SIZE); @@ -182,17 +182,18 @@ ResultCode TranslateCommandBuffer(SharedPtr src_thread, SharedPtr(size) : difference_to_page; Memory::ReadBlock(*src_process, source_address, buffer->data() + page_offset, read_size); // Map the page into the target process' address space. - target_address = dst_process->vm_manager - .MapMemoryBlockToBase( - Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, - buffer, 0, buffer->size(), Kernel::MemoryState::Shared) - .Unwrap(); + target_address = + dst_process->vm_manager + .MapMemoryBlockToBase(Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, + buffer, 0, static_cast(buffer->size()), + Kernel::MemoryState::Shared) + .Unwrap(); } cmd_buf[i++] = target_address + page_offset; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index ebff4d18e..6f30948c7 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -188,7 +188,7 @@ void ExitCurrentThread() { * @param thread_handle The handle of the thread that's been awoken * @param cycles_late The number of CPU cycles that have passed since the desired wakeup time */ -static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { +static void ThreadWakeupCallback(u64 thread_handle, s64 cycles_late) { SharedPtr thread = wakeup_callback_handle_table.Get((Handle)thread_handle); if (thread == nullptr) { LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", (Handle)thread_handle); diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index b31017cb5..1c9b0b6fc 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -76,7 +76,7 @@ void Timer::WakeupAllWaitingThreads() { signaled = false; } -void Timer::Signal(int cycles_late) { +void Timer::Signal(s64 cycles_late) { LOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); signaled = true; @@ -92,7 +92,7 @@ void Timer::Signal(int cycles_late) { } /// The timer callback event, called when a timer is fired -static void TimerCallback(u64 timer_handle, int cycles_late) { +static void TimerCallback(u64 timer_handle, s64 cycles_late) { SharedPtr timer = timer_callback_handle_table.Get(static_cast(timer_handle)); diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h index c63f0ed90..3999c500e 100644 --- a/src/core/hle/kernel/timer.h +++ b/src/core/hle/kernel/timer.h @@ -65,7 +65,7 @@ public: * This method should not be called from outside the timer callback handler, * lest multiple callback events get scheduled. */ - void Signal(int cycles_late); + void Signal(s64 cycles_late); private: Timer(); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 252585e01..534ff1cbb 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -232,7 +232,7 @@ bool CIAFile::SetSize(u64 size) const { bool CIAFile::Close() const { bool complete = true; for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) { - if (content_written[i] < container.GetContentSize(i)) + if (content_written[i] < container.GetContentSize(static_cast(i))) complete = false; } @@ -294,7 +294,7 @@ InstallStatus InstallCIA(const std::string& path, Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID())); for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) { - if (container.GetTitleMetadata().GetContentTypeByIndex(i) & + if (container.GetTitleMetadata().GetContentTypeByIndex(static_cast(i)) & FileSys::TMDContentTypeFlag::Encrypted) { LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path); return InstallStatus::ErrorEncrypted; @@ -493,7 +493,7 @@ void Module::Interface::GetNumPrograms(Kernel::HLERequestContext& ctx) { IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); - rb.Push(am->am_title_list[media_type].size()); + rb.Push(static_cast(am->am_title_list[media_type].size())); } void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) { @@ -877,7 +877,7 @@ void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) { FileSys::TitleMetadata tmd; if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) { - rb.Push(tmd.GetContentCount()); + rb.Push(static_cast(tmd.GetContentCount())); } else { rb.Push(1); // Number of content infos plus one LOG_WARNING(Service_AM, "(STUBBED) called media_type={}, title_id=0x{:016x}", diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index aad4756a3..28abd437a 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp @@ -74,7 +74,7 @@ void Module::PortConfig::Clear() { transfer_bytes = 256; } -void Module::CompletionEventCallBack(u64 port_id, int) { +void Module::CompletionEventCallBack(u64 port_id, s64) { PortConfig& port = ports[port_id]; const CameraConfig& camera = cameras[port.camera_id]; const auto buffer = port.capture_result.get(); @@ -1028,7 +1028,7 @@ Module::Module() { } completion_event_callback = CoreTiming::RegisterEvent( "CAM::CompletionEventCallBack", - [this](u64 userdata, int cycles_late) { CompletionEventCallBack(userdata, cycles_late); }); + [this](u64 userdata, s64 cycles_late) { CompletionEventCallBack(userdata, cycles_late); }); } Module::~Module() { diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index 45361a4ef..324c52023 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -710,7 +710,7 @@ public: }; private: - void CompletionEventCallBack(u64 port_id, int); + void CompletionEventCallBack(u64 port_id, s64); // Starts a receiving process on the specified port. This can only be called when is_busy = true // and is_receiving = false. diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 274c0e424..b7ed429b0 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -184,7 +184,7 @@ void Module::Interface::SecureInfoGetRegion(Kernel::HLERequestContext& ctx, u16 IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); - rb.Push(cfg->GetRegionValue()); + rb.Push(static_cast(cfg->GetRegionValue())); } void Module::Interface::GenHashConsoleUnique(Kernel::HLERequestContext& ctx) { diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 22b338212..e4ed0a40a 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -79,7 +79,7 @@ void File::Read(Kernel::HLERequestContext& ctx) { if (file->subfile && length > file->size) { LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating"); - length = file->size; + length = static_cast(file->size); } // This file session might have a specific offset from where to start reading, apply it. @@ -101,7 +101,7 @@ void File::Read(Kernel::HLERequestContext& ctx) { } else { buffer.Write(data.data(), 0, *read); rb.Push(RESULT_SUCCESS); - rb.Push(*read); + rb.Push(static_cast(*read)); } rb.PushMappedBuffer(buffer); @@ -142,7 +142,7 @@ void File::Write(Kernel::HLERequestContext& ctx) { rb.Push(0); } else { rb.Push(RESULT_SUCCESS); - rb.Push(*written); + rb.Push(static_cast(*written)); } rb.PushMappedBuffer(buffer); } diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 0adbabeeb..6f3719a05 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -71,7 +71,7 @@ void Module::LoadInputDevices() { touch_device = Input::CreateDevice(Settings::values.touch_device); } -void Module::UpdatePadCallback(u64 userdata, int cycles_late) { +void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) { SharedMem* mem = reinterpret_cast(shared_mem->GetPointer()); if (is_device_reload_pending.exchange(false)) @@ -166,7 +166,7 @@ void Module::UpdatePadCallback(u64 userdata, int cycles_late) { CoreTiming::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event); } -void Module::UpdateAccelerometerCallback(u64 userdata, int cycles_late) { +void Module::UpdateAccelerometerCallback(u64 userdata, s64 cycles_late) { SharedMem* mem = reinterpret_cast(shared_mem->GetPointer()); mem->accelerometer.index = next_accelerometer_index; @@ -210,7 +210,7 @@ void Module::UpdateAccelerometerCallback(u64 userdata, int cycles_late) { CoreTiming::ScheduleEvent(accelerometer_update_ticks - cycles_late, accelerometer_update_event); } -void Module::UpdateGyroscopeCallback(u64 userdata, int cycles_late) { +void Module::UpdateGyroscopeCallback(u64 userdata, s64 cycles_late) { SharedMem* mem = reinterpret_cast(shared_mem->GetPointer()); mem->gyroscope.index = next_gyroscope_index; @@ -371,16 +371,16 @@ Module::Module() { // Register update callbacks pad_update_event = - CoreTiming::RegisterEvent("HID::UpdatePadCallback", [this](u64 userdata, int cycles_late) { + CoreTiming::RegisterEvent("HID::UpdatePadCallback", [this](u64 userdata, s64 cycles_late) { UpdatePadCallback(userdata, cycles_late); }); accelerometer_update_event = CoreTiming::RegisterEvent( - "HID::UpdateAccelerometerCallback", [this](u64 userdata, int cycles_late) { + "HID::UpdateAccelerometerCallback", [this](u64 userdata, s64 cycles_late) { UpdateAccelerometerCallback(userdata, cycles_late); }); gyroscope_update_event = CoreTiming::RegisterEvent( "HID::UpdateGyroscopeCallback", - [this](u64 userdata, int cycles_late) { UpdateGyroscopeCallback(userdata, cycles_late); }); + [this](u64 userdata, s64 cycles_late) { UpdateGyroscopeCallback(userdata, cycles_late); }); CoreTiming::ScheduleEvent(pad_update_ticks, pad_update_event); } diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 9689245ed..c367c9e53 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -24,7 +24,7 @@ class SharedMemory; } // namespace Kernel namespace CoreTiming { -class EventType; +struct EventType; }; namespace Service { @@ -297,9 +297,9 @@ public: private: void LoadInputDevices(); - void UpdatePadCallback(u64 userdata, int cycles_late); - void UpdateAccelerometerCallback(u64 userdata, int cycles_late); - void UpdateGyroscopeCallback(u64 userdata, int cycles_late); + void UpdatePadCallback(u64 userdata, s64 cycles_late); + void UpdateAccelerometerCallback(u64 userdata, s64 cycles_late); + void UpdateGyroscopeCallback(u64 userdata, s64 cycles_late); // Handle to shared memory region designated to HID_User service Kernel::SharedPtr shared_mem; diff --git a/src/core/hle/service/ir/extra_hid.cpp b/src/core/hle/service/ir/extra_hid.cpp index f1f0c1043..3dcf9f422 100644 --- a/src/core/hle/service/ir/extra_hid.cpp +++ b/src/core/hle/service/ir/extra_hid.cpp @@ -146,7 +146,7 @@ ExtraHID::ExtraHID(SendFunc send_func) : IRDevice(send_func) { }}; hid_polling_callback_id = - CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, int cycles_late) { + CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) { SendHIDStatus(); CoreTiming::ScheduleEvent(msToCycles(hid_period) - cycles_late, hid_polling_callback_id); diff --git a/src/core/hle/service/ir/ir_rst.cpp b/src/core/hle/service/ir/ir_rst.cpp index c6ed0d3be..587487373 100644 --- a/src/core/hle/service/ir/ir_rst.cpp +++ b/src/core/hle/service/ir/ir_rst.cpp @@ -48,7 +48,7 @@ void IR_RST::UnloadInputDevices() { c_stick = nullptr; } -void IR_RST::UpdateCallback(u64 userdata, int cycles_late) { +void IR_RST::UpdateCallback(u64 userdata, s64 cycles_late) { SharedMem* mem = reinterpret_cast(shared_memory->GetPointer()); if (is_device_reload_pending.exchange(false)) @@ -155,7 +155,7 @@ IR_RST::IR_RST() : ServiceFramework("ir:rst", 1) { update_event = Event::Create(ResetType::OneShot, "IRRST:UpdateEvent"); update_callback_id = - CoreTiming::RegisterEvent("IRRST:UpdateCallBack", [this](u64 userdata, int cycles_late) { + CoreTiming::RegisterEvent("IRRST:UpdateCallBack", [this](u64 userdata, s64 cycles_late) { UpdateCallback(userdata, cycles_late); }); diff --git a/src/core/hle/service/ir/ir_rst.h b/src/core/hle/service/ir/ir_rst.h index 0512cb4cf..7aacb7be2 100644 --- a/src/core/hle/service/ir/ir_rst.h +++ b/src/core/hle/service/ir/ir_rst.h @@ -19,7 +19,7 @@ class SharedMemory; } // namespace Kernel namespace CoreTiming { -class EventType; +struct EventType; }; namespace Service { @@ -76,7 +76,7 @@ private: void LoadInputDevices(); void UnloadInputDevices(); - void UpdateCallback(u64 userdata, int cycles_late); + void UpdateCallback(u64 userdata, s64 cycles_late); Kernel::SharedPtr update_event; Kernel::SharedPtr shared_memory; diff --git a/src/core/hle/service/ir/ir_user.h b/src/core/hle/service/ir/ir_user.h index d94dbbb21..f2f0123dc 100644 --- a/src/core/hle/service/ir/ir_user.h +++ b/src/core/hle/service/ir/ir_user.h @@ -15,7 +15,7 @@ class SharedMemory; } // namespace Kernel namespace CoreTiming { -class EventType; +struct EventType; }; namespace Service { diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index dc8cd42d1..5c6cca142 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -80,7 +80,7 @@ static u8 network_channel = DefaultNetworkChannel; static NetworkInfo network_info; // Mapping of mac addresses to their respective node_ids. -static std::map node_map; +static std::map node_map; // Event that will generate and send the 802.11 beacon frames. static CoreTiming::EventType* beacon_broadcast_event; @@ -179,7 +179,7 @@ static void HandleNodeMapPacket(const Network::WifiPacket& packet) { node_map.clear(); size_t num_entries; Network::MacAddress address; - u32 id; + u16 id; std::memcpy(&num_entries, packet.data.data(), sizeof(num_entries)); size_t offset = sizeof(num_entries); for (size_t i = 0; i < num_entries; ++i) { @@ -612,7 +612,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) { } // Update the total size in the structure and write it to the buffer again. - data_reply_header.total_size = cur_buffer_size; + data_reply_header.total_size = static_cast(cur_buffer_size); out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader)); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); @@ -1189,7 +1189,7 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) { return; } - network_info.application_data_size = size; + network_info.application_data_size = static_cast(size); std::memcpy(network_info.application_data.data(), application_data.data(), size); rb.Push(RESULT_SUCCESS); @@ -1262,7 +1262,7 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx) { } // Sends a 802.11 beacon frame with information about the current network. -static void BeaconBroadcastCallback(u64 userdata, int cycles_late) { +static void BeaconBroadcastCallback(u64 userdata, s64 cycles_late) { // Don't do anything if we're not actually hosting a network if (connection_status.status != static_cast(NetworkStatus::ConnectedAsHost)) return; diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 933cb74db..849e77d6d 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -77,7 +77,6 @@ void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) { u32 hours = rp.Pop(); u64 start_time = rp.Pop(); - size_t steps_buff_size; auto& buffer = rp.PopMappedBuffer(); ASSERT_MSG(sizeof(u16) * hours == buffer.GetSize(), "Buffer for steps count has incorrect size"); diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 204b84f6f..cfb1af110 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -796,8 +796,8 @@ void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) { #endif } else { const char* optval_data = reinterpret_cast(optval.data()); - err = static_cast( - ::setsockopt(socket_handle, level, optname, optval_data, optval.size())); + err = static_cast(::setsockopt(socket_handle, level, optname, optval_data, + static_cast(optval.size()))); if (err == SOCKET_ERROR_VALUE) { err = TranslateError(GET_ERRNO); } diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 730f0271f..066d7390a 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp @@ -52,7 +52,7 @@ static u64 GetSystemTime() { return console_time; } -static void UpdateTimeCallback(u64 userdata, int cycles_late) { +static void UpdateTimeCallback(u64 userdata, s64 cycles_late) { DateTime& date_time = shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1; diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 306c91009..ed94162fa 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -510,7 +510,7 @@ template void Write(u32 addr, const u16 data); template void Write(u32 addr, const u8 data); /// Update hardware -static void VBlankCallback(u64 userdata, int cycles_late) { +static void VBlankCallback(u64 userdata, s64 cycles_late) { VideoCore::g_renderer->SwapBuffers(); // Signal to GSP that GPU interrupt has occurred diff --git a/src/core/movie.cpp b/src/core/movie.cpp index e72016238..16b3da7ca 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -242,12 +242,15 @@ void Movie::Play(Service::IR::ExtraHIDResponse& extra_hid_response) { return; } - extra_hid_response.buttons.battery_level.Assign(s.extra_hid_response.battery_level); + extra_hid_response.buttons.battery_level.Assign( + static_cast(s.extra_hid_response.battery_level)); extra_hid_response.c_stick.c_stick_x.Assign(s.extra_hid_response.c_stick_x); extra_hid_response.c_stick.c_stick_y.Assign(s.extra_hid_response.c_stick_y); - extra_hid_response.buttons.r_not_held.Assign(s.extra_hid_response.r_not_held); - extra_hid_response.buttons.zl_not_held.Assign(s.extra_hid_response.zl_not_held); - extra_hid_response.buttons.zr_not_held.Assign(s.extra_hid_response.zr_not_held); + extra_hid_response.buttons.r_not_held.Assign(static_cast(s.extra_hid_response.r_not_held)); + extra_hid_response.buttons.zl_not_held.Assign( + static_cast(s.extra_hid_response.zl_not_held)); + extra_hid_response.buttons.zr_not_held.Assign( + static_cast(s.extra_hid_response.zr_not_held)); } void Movie::Record(const ControllerState& controller_state) {