core: clean up warnings

This commit is contained in:
BreadFish64 2018-07-23 16:08:14 -05:00
parent ba6eee71f5
commit 74cd98ecad
35 changed files with 82 additions and 77 deletions

2
externals/fmt vendored

@ -1 +1 @@
Subproject commit 5859e58ba17073cf1c16536205450528f3530df0 Subproject commit c2ce7e4f07f7b34b2c7bbd0a4d0798b1d7007f4f

View file

@ -45,7 +45,7 @@ void DspInterface::OutputFrame(StereoFrame16& frame) {
return; return;
// Implementation of the hardware volume slider with a dynamic range of 60 dB // 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++) { for (size_t i = 0; i < frame.size(); i++) {
frame[i][0] = static_cast<s16>(frame[i][0] * volume_scale_factor); frame[i][0] = static_cast<s16>(frame[i][0] * volume_scale_factor);
frame[i][1] = static_cast<s16>(frame[i][1] * volume_scale_factor); frame[i][1] = static_cast<s16>(frame[i][1] * volume_scale_factor);

View file

@ -43,7 +43,7 @@ private:
StereoFrame16 GenerateCurrentFrame(); StereoFrame16 GenerateCurrentFrame();
bool Tick(); bool Tick();
void AudioTickCallback(int cycles_late); void AudioTickCallback(s64 cycles_late);
DspState dsp_state = DspState::Off; DspState dsp_state = DspState::Off;
std::array<std::vector<u8>, num_dsp_pipe> pipe_data; std::array<std::vector<u8>, num_dsp_pipe> pipe_data;
@ -66,7 +66,7 @@ DspHle::Impl::Impl(DspHle& parent_) : parent(parent_) {
dsp_memory.raw_memory.fill(0); dsp_memory.raw_memory.fill(0);
tick_event = 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); this->AudioTickCallback(cycles_late);
}); });
CoreTiming::ScheduleEvent(audio_frame_ticks, tick_event); CoreTiming::ScheduleEvent(audio_frame_ticks, tick_event);
@ -304,7 +304,7 @@ bool DspHle::Impl::Tick() {
return true; return true;
} }
void DspHle::Impl::AudioTickCallback(int cycles_late) { void DspHle::Impl::AudioTickCallback(s64 cycles_late) {
if (Tick()) { if (Tick()) {
// TODO(merry): Signal all the other interrupts as appropriate. // TODO(merry): Signal all the other interrupts as appropriate.
Service::DSP::SignalPipeInterrupt(DspPipe::Audio); Service::DSP::SignalPipeInterrupt(DspPipe::Audio);

View file

@ -99,7 +99,7 @@ static void AddTicks(u64 ticks) {
} }
static u64 GetTicksRemaining() { static u64 GetTicksRemaining() {
int ticks = CoreTiming::GetDowncount(); s64 ticks = CoreTiming::GetDowncount();
return static_cast<u64>(ticks <= 0 ? 0 : ticks); return static_cast<u64>(ticks <= 0 ? 0 : ticks);
} }

View file

@ -75,7 +75,7 @@ ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) {
ARM_DynCom::~ARM_DynCom() {} ARM_DynCom::~ARM_DynCom() {}
void ARM_DynCom::Run() { void ARM_DynCom::Run() {
ExecuteInstructions(std::max(CoreTiming::GetDowncount(), 0)); ExecuteInstructions(std::max<s64>(CoreTiming::GetDowncount(), 0));
} }
void ARM_DynCom::Step() { void ARM_DynCom::Step() {
@ -143,7 +143,7 @@ void ARM_DynCom::SetCP15Register(CP15Register reg, u32 value) {
state->CP15[reg] = value; state->CP15[reg] = value;
} }
void ARM_DynCom::ExecuteInstructions(int num_instructions) { void ARM_DynCom::ExecuteInstructions(u64 num_instructions) {
state->NumInstrsToExecute = num_instructions; state->NumInstrsToExecute = num_instructions;
unsigned ticks_executed = InterpreterMainLoop(state.get()); unsigned ticks_executed = InterpreterMainLoop(state.get());
CoreTiming::AddTicks(ticks_executed); CoreTiming::AddTicks(ticks_executed);

View file

@ -42,7 +42,7 @@ public:
void PrepareReschedule() override; void PrepareReschedule() override;
private: private:
void ExecuteInstructions(int num_instructions); void ExecuteInstructions(u64 num_instructions);
std::unique_ptr<ARMul_State> state; std::unique_ptr<ARMul_State> state;
}; };

View file

@ -1,4 +1,8 @@
#pragma once #pragma once
#ifdef _MSC_VER
// nonstandard extension used: zero-sized array in struct/union
#pragma warning(disable : 4200)
#endif
#include <cstddef> #include <cstddef>
#include "common/common_types.h" #include "common/common_types.h"

View file

@ -221,7 +221,7 @@ public:
u32 TFlag; // Thumb state u32 TFlag; // Thumb state
unsigned long long NumInstrs; // The number of instructions executed unsigned long long NumInstrs; // The number of instructions executed
unsigned NumInstrsToExecute; u64 NumInstrsToExecute;
unsigned NresetSig; // Reset the processor unsigned NresetSig; // Reset the processor
unsigned NfiqSig; unsigned NfiqSig;

View file

@ -19,8 +19,8 @@
namespace CoreTiming { namespace CoreTiming {
static s64 global_timer; static s64 global_timer;
static int slice_length; static s64 slice_length;
static int downcount; static s64 downcount;
struct EventType { struct EventType {
TimedCallback callback; TimedCallback callback;
@ -180,10 +180,8 @@ void RemoveNormalAndThreadsafeEvent(const EventType* event_type) {
void ForceExceptionCheck(s64 cycles) { void ForceExceptionCheck(s64 cycles) {
cycles = std::max<s64>(0, cycles); cycles = std::max<s64>(0, cycles);
if (downcount > cycles) { if (downcount > cycles) {
// downcount is always (much) smaller than MAX_INT so we can safely cast cycles to an int slice_length -= downcount - cycles;
// here. Account for cycles already executed by adjusting the g.slice_length downcount = cycles;
slice_length -= downcount - static_cast<int>(cycles);
downcount = static_cast<int>(cycles);
} }
} }
@ -198,7 +196,7 @@ void MoveEvents() {
void Advance() { void Advance() {
MoveEvents(); MoveEvents();
int cycles_executed = slice_length - downcount; s64 cycles_executed = slice_length - downcount;
global_timer += cycles_executed; global_timer += cycles_executed;
slice_length = MAX_SLICE_LENGTH; slice_length = MAX_SLICE_LENGTH;
@ -231,7 +229,7 @@ u64 GetGlobalTimeUs() {
return GetTicks() * 1000000 / BASE_CLOCK_RATE_ARM11; return GetTicks() * 1000000 / BASE_CLOCK_RATE_ARM11;
} }
int GetDowncount() { s64 GetDowncount() {
return downcount; return downcount;
} }

View file

@ -128,7 +128,7 @@ namespace CoreTiming {
void Init(); void Init();
void Shutdown(); void Shutdown();
typedef std::function<void(u64 userdata, int cycles_late)> TimedCallback; typedef std::function<void(u64 userdata, s64 cycles_late)> TimedCallback;
/** /**
* This should only be called from the emu thread, if you are calling it any other thread, you are * 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(); u64 GetGlobalTimeUs();
int GetDowncount(); s64 GetDowncount();
} // namespace CoreTiming } // namespace CoreTiming

View file

@ -73,7 +73,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, size_t
memcpy(&tmd_body, &file_data[offset + body_start], sizeof(TitleMetadata::Body)); memcpy(&tmd_body, &file_data[offset + body_start], sizeof(TitleMetadata::Body));
size_t expected_size = size_t expected_size =
body_start + sizeof(Body) + tmd_body.content_count * sizeof(ContentChunk); body_start + sizeof(Body) + static_cast<u16>(tmd_body.content_count) * sizeof(ContentChunk);
if (total_size < expected_size) { if (total_size < expected_size) {
LOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size, LOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size,
total_size); total_size);

View file

@ -79,7 +79,7 @@ std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) {
} }
/// Handles updating the current Applet every time it's called. /// 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<Service::APT::AppletId>(applet_id); Service::APT::AppletId id = static_cast<Service::APT::AppletId>(applet_id);
std::shared_ptr<Applet> applet = Applet::Get(id); std::shared_ptr<Applet> applet = Applet::Get(id);
ASSERT_MSG(applet != nullptr, "Applet doesn't exist! applet_id={:08X}", static_cast<u32>(id)); ASSERT_MSG(applet != nullptr, "Applet doesn't exist! applet_id={:08X}", static_cast<u32>(id));

View file

@ -423,7 +423,7 @@ inline const std::vector<u8>& RequestParser::PopStaticBuffer() {
Pop<VAddr>(); Pop<VAddr>();
StaticBufferDescInfo buffer_info{sbuffer_descriptor}; StaticBufferDescInfo buffer_info{sbuffer_descriptor};
return context->GetStaticBuffer(buffer_info.buffer_id); return context->GetStaticBuffer(static_cast<u8>(buffer_info.buffer_id));
} }
inline Kernel::MappedBuffer& RequestParser::PopMappedBuffer() { inline Kernel::MappedBuffer& RequestParser::PopMappedBuffer() {

View file

@ -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) { void MappedBuffer::Read(void* dest_buffer, size_t offset, size_t size) {
ASSERT(perms & IPC::R); ASSERT(perms & IPC::R);
ASSERT(offset + size <= this->size); ASSERT(offset + size <= this->size);
Memory::ReadBlock(*process, address + offset, dest_buffer, size); Memory::ReadBlock(*process, address + static_cast<VAddr>(offset), dest_buffer, size);
} }
void MappedBuffer::Write(const void* src_buffer, size_t offset, size_t size) { void MappedBuffer::Write(const void* src_buffer, size_t offset, size_t size) {
ASSERT(perms & IPC::W); ASSERT(perms & IPC::W);
ASSERT(offset + size <= this->size); ASSERT(offset + size <= this->size);
Memory::WriteBlock(*process, address + offset, src_buffer, size); Memory::WriteBlock(*process, address + static_cast<VAddr>(offset), src_buffer, size);
} }
} // namespace Kernel } // namespace Kernel

View file

@ -120,7 +120,7 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
IPC::MappedBufferDescInfo descInfo{descriptor}; IPC::MappedBufferDescInfo descInfo{descriptor};
VAddr source_address = cmd_buf[i]; VAddr source_address = cmd_buf[i];
size_t size = descInfo.size; u32 size = static_cast<u32>(descInfo.size);
IPC::MappedBufferPermissions permissions = descInfo.perms; IPC::MappedBufferPermissions permissions = descInfo.perms;
VAddr page_start = Common::AlignDown(source_address, Memory::PAGE_SIZE); VAddr page_start = Common::AlignDown(source_address, Memory::PAGE_SIZE);
@ -182,17 +182,18 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
Common::AlignUp(source_address, Memory::PAGE_SIZE) - source_address; Common::AlignUp(source_address, Memory::PAGE_SIZE) - source_address;
// If the data fits in one page we can just copy the required size instead of the // If the data fits in one page we can just copy the required size instead of the
// entire page. // entire page.
size_t read_size = num_pages == 1 ? size : difference_to_page; size_t read_size = num_pages == 1 ? static_cast<size_t>(size) : difference_to_page;
Memory::ReadBlock(*src_process, source_address, buffer->data() + page_offset, Memory::ReadBlock(*src_process, source_address, buffer->data() + page_offset,
read_size); read_size);
// Map the page into the target process' address space. // Map the page into the target process' address space.
target_address = dst_process->vm_manager target_address =
.MapMemoryBlockToBase( dst_process->vm_manager
Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, .MapMemoryBlockToBase(Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE,
buffer, 0, buffer->size(), Kernel::MemoryState::Shared) buffer, 0, static_cast<u32>(buffer->size()),
.Unwrap(); Kernel::MemoryState::Shared)
.Unwrap();
} }
cmd_buf[i++] = target_address + page_offset; cmd_buf[i++] = target_address + page_offset;

View file

@ -188,7 +188,7 @@ void ExitCurrentThread() {
* @param thread_handle The handle of the thread that's been awoken * @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 * @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> thread = wakeup_callback_handle_table.Get<Thread>((Handle)thread_handle); SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>((Handle)thread_handle);
if (thread == nullptr) { if (thread == nullptr) {
LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", (Handle)thread_handle); LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", (Handle)thread_handle);

View file

@ -76,7 +76,7 @@ void Timer::WakeupAllWaitingThreads() {
signaled = false; signaled = false;
} }
void Timer::Signal(int cycles_late) { void Timer::Signal(s64 cycles_late) {
LOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); LOG_TRACE(Kernel, "Timer {} fired", GetObjectId());
signaled = true; signaled = true;
@ -92,7 +92,7 @@ void Timer::Signal(int cycles_late) {
} }
/// The timer callback event, called when a timer is fired /// 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 = SharedPtr<Timer> timer =
timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));

View file

@ -65,7 +65,7 @@ public:
* This method should not be called from outside the timer callback handler, * This method should not be called from outside the timer callback handler,
* lest multiple callback events get scheduled. * lest multiple callback events get scheduled.
*/ */
void Signal(int cycles_late); void Signal(s64 cycles_late);
private: private:
Timer(); Timer();

View file

@ -232,7 +232,7 @@ bool CIAFile::SetSize(u64 size) const {
bool CIAFile::Close() const { bool CIAFile::Close() const {
bool complete = true; bool complete = true;
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) { 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<u16>(i)))
complete = false; complete = false;
} }
@ -294,7 +294,7 @@ InstallStatus InstallCIA(const std::string& path,
Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID())); Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()));
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) { for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
if (container.GetTitleMetadata().GetContentTypeByIndex(i) & if (container.GetTitleMetadata().GetContentTypeByIndex(static_cast<u16>(i)) &
FileSys::TMDContentTypeFlag::Encrypted) { FileSys::TMDContentTypeFlag::Encrypted) {
LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path); LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path);
return InstallStatus::ErrorEncrypted; return InstallStatus::ErrorEncrypted;
@ -493,7 +493,7 @@ void Module::Interface::GetNumPrograms(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(am->am_title_list[media_type].size()); rb.Push<u32>(static_cast<u32>(am->am_title_list[media_type].size()));
} }
void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) { void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
@ -877,7 +877,7 @@ void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
FileSys::TitleMetadata tmd; FileSys::TitleMetadata tmd;
if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) { if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) {
rb.Push<u32>(tmd.GetContentCount()); rb.Push<u32>(static_cast<u32>(tmd.GetContentCount()));
} else { } else {
rb.Push<u32>(1); // Number of content infos plus one rb.Push<u32>(1); // Number of content infos plus one
LOG_WARNING(Service_AM, "(STUBBED) called media_type={}, title_id=0x{:016x}", LOG_WARNING(Service_AM, "(STUBBED) called media_type={}, title_id=0x{:016x}",

View file

@ -74,7 +74,7 @@ void Module::PortConfig::Clear() {
transfer_bytes = 256; transfer_bytes = 256;
} }
void Module::CompletionEventCallBack(u64 port_id, int) { void Module::CompletionEventCallBack(u64 port_id, s64) {
PortConfig& port = ports[port_id]; PortConfig& port = ports[port_id];
const CameraConfig& camera = cameras[port.camera_id]; const CameraConfig& camera = cameras[port.camera_id];
const auto buffer = port.capture_result.get(); const auto buffer = port.capture_result.get();
@ -1028,7 +1028,7 @@ Module::Module() {
} }
completion_event_callback = CoreTiming::RegisterEvent( completion_event_callback = CoreTiming::RegisterEvent(
"CAM::CompletionEventCallBack", "CAM::CompletionEventCallBack",
[this](u64 userdata, int cycles_late) { CompletionEventCallBack(userdata, cycles_late); }); [this](u64 userdata, s64 cycles_late) { CompletionEventCallBack(userdata, cycles_late); });
} }
Module::~Module() { Module::~Module() {

View file

@ -710,7 +710,7 @@ public:
}; };
private: 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 // Starts a receiving process on the specified port. This can only be called when is_busy = true
// and is_receiving = false. // and is_receiving = false.

View file

@ -184,7 +184,7 @@ void Module::Interface::SecureInfoGetRegion(Kernel::HLERequestContext& ctx, u16
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u8>(cfg->GetRegionValue()); rb.Push<u8>(static_cast<u8>(cfg->GetRegionValue()));
} }
void Module::Interface::GenHashConsoleUnique(Kernel::HLERequestContext& ctx) { void Module::Interface::GenHashConsoleUnique(Kernel::HLERequestContext& ctx) {

View file

@ -79,7 +79,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
if (file->subfile && length > file->size) { if (file->subfile && length > file->size) {
LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating"); LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating");
length = file->size; length = static_cast<u32>(file->size);
} }
// This file session might have a specific offset from where to start reading, apply it. // 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 { } else {
buffer.Write(data.data(), 0, *read); buffer.Write(data.data(), 0, *read);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(*read); rb.Push<u32>(static_cast<u32>(*read));
} }
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -142,7 +142,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); rb.Push<u32>(0);
} else { } else {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(*written); rb.Push<u32>(static_cast<u32>(*written));
} }
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }

View file

@ -71,7 +71,7 @@ void Module::LoadInputDevices() {
touch_device = Input::CreateDevice<Input::TouchDevice>(Settings::values.touch_device); touch_device = Input::CreateDevice<Input::TouchDevice>(Settings::values.touch_device);
} }
void Module::UpdatePadCallback(u64 userdata, int cycles_late) { void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer()); SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
if (is_device_reload_pending.exchange(false)) 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); 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<SharedMem*>(shared_mem->GetPointer()); SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
mem->accelerometer.index = next_accelerometer_index; 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); 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<SharedMem*>(shared_mem->GetPointer()); SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
mem->gyroscope.index = next_gyroscope_index; mem->gyroscope.index = next_gyroscope_index;
@ -371,16 +371,16 @@ Module::Module() {
// Register update callbacks // Register update callbacks
pad_update_event = 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); UpdatePadCallback(userdata, cycles_late);
}); });
accelerometer_update_event = CoreTiming::RegisterEvent( 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); UpdateAccelerometerCallback(userdata, cycles_late);
}); });
gyroscope_update_event = CoreTiming::RegisterEvent( gyroscope_update_event = CoreTiming::RegisterEvent(
"HID::UpdateGyroscopeCallback", "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); CoreTiming::ScheduleEvent(pad_update_ticks, pad_update_event);
} }

View file

@ -24,7 +24,7 @@ class SharedMemory;
} // namespace Kernel } // namespace Kernel
namespace CoreTiming { namespace CoreTiming {
class EventType; struct EventType;
}; };
namespace Service { namespace Service {
@ -297,9 +297,9 @@ public:
private: private:
void LoadInputDevices(); void LoadInputDevices();
void UpdatePadCallback(u64 userdata, int cycles_late); void UpdatePadCallback(u64 userdata, s64 cycles_late);
void UpdateAccelerometerCallback(u64 userdata, int cycles_late); void UpdateAccelerometerCallback(u64 userdata, s64 cycles_late);
void UpdateGyroscopeCallback(u64 userdata, int cycles_late); void UpdateGyroscopeCallback(u64 userdata, s64 cycles_late);
// Handle to shared memory region designated to HID_User service // Handle to shared memory region designated to HID_User service
Kernel::SharedPtr<Kernel::SharedMemory> shared_mem; Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;

View file

@ -146,7 +146,7 @@ ExtraHID::ExtraHID(SendFunc send_func) : IRDevice(send_func) {
}}; }};
hid_polling_callback_id = hid_polling_callback_id =
CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, int cycles_late) { CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) {
SendHIDStatus(); SendHIDStatus();
CoreTiming::ScheduleEvent(msToCycles(hid_period) - cycles_late, CoreTiming::ScheduleEvent(msToCycles(hid_period) - cycles_late,
hid_polling_callback_id); hid_polling_callback_id);

View file

@ -48,7 +48,7 @@ void IR_RST::UnloadInputDevices() {
c_stick = nullptr; 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<SharedMem*>(shared_memory->GetPointer()); SharedMem* mem = reinterpret_cast<SharedMem*>(shared_memory->GetPointer());
if (is_device_reload_pending.exchange(false)) 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_event = Event::Create(ResetType::OneShot, "IRRST:UpdateEvent");
update_callback_id = 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); UpdateCallback(userdata, cycles_late);
}); });

View file

@ -19,7 +19,7 @@ class SharedMemory;
} // namespace Kernel } // namespace Kernel
namespace CoreTiming { namespace CoreTiming {
class EventType; struct EventType;
}; };
namespace Service { namespace Service {
@ -76,7 +76,7 @@ private:
void LoadInputDevices(); void LoadInputDevices();
void UnloadInputDevices(); void UnloadInputDevices();
void UpdateCallback(u64 userdata, int cycles_late); void UpdateCallback(u64 userdata, s64 cycles_late);
Kernel::SharedPtr<Kernel::Event> update_event; Kernel::SharedPtr<Kernel::Event> update_event;
Kernel::SharedPtr<Kernel::SharedMemory> shared_memory; Kernel::SharedPtr<Kernel::SharedMemory> shared_memory;

View file

@ -15,7 +15,7 @@ class SharedMemory;
} // namespace Kernel } // namespace Kernel
namespace CoreTiming { namespace CoreTiming {
class EventType; struct EventType;
}; };
namespace Service { namespace Service {

View file

@ -80,7 +80,7 @@ static u8 network_channel = DefaultNetworkChannel;
static NetworkInfo network_info; static NetworkInfo network_info;
// Mapping of mac addresses to their respective node_ids. // Mapping of mac addresses to their respective node_ids.
static std::map<MacAddress, u32> node_map; static std::map<MacAddress, u16> node_map;
// Event that will generate and send the 802.11 beacon frames. // Event that will generate and send the 802.11 beacon frames.
static CoreTiming::EventType* beacon_broadcast_event; static CoreTiming::EventType* beacon_broadcast_event;
@ -179,7 +179,7 @@ static void HandleNodeMapPacket(const Network::WifiPacket& packet) {
node_map.clear(); node_map.clear();
size_t num_entries; size_t num_entries;
Network::MacAddress address; Network::MacAddress address;
u32 id; u16 id;
std::memcpy(&num_entries, packet.data.data(), sizeof(num_entries)); std::memcpy(&num_entries, packet.data.data(), sizeof(num_entries));
size_t offset = sizeof(num_entries); size_t offset = sizeof(num_entries);
for (size_t i = 0; i < num_entries; ++i) { 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. // 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<u32>(cur_buffer_size);
out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader)); out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
@ -1189,7 +1189,7 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
return; return;
} }
network_info.application_data_size = size; network_info.application_data_size = static_cast<u8>(size);
std::memcpy(network_info.application_data.data(), application_data.data(), size); std::memcpy(network_info.application_data.data(), application_data.data(), size);
rb.Push(RESULT_SUCCESS); 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. // 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 // Don't do anything if we're not actually hosting a network
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost)) if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost))
return; return;

View file

@ -77,7 +77,6 @@ void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) {
u32 hours = rp.Pop<u32>(); u32 hours = rp.Pop<u32>();
u64 start_time = rp.Pop<u64>(); u64 start_time = rp.Pop<u64>();
size_t steps_buff_size;
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
ASSERT_MSG(sizeof(u16) * hours == buffer.GetSize(), ASSERT_MSG(sizeof(u16) * hours == buffer.GetSize(),
"Buffer for steps count has incorrect size"); "Buffer for steps count has incorrect size");

View file

@ -796,8 +796,8 @@ void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) {
#endif #endif
} else { } else {
const char* optval_data = reinterpret_cast<const char*>(optval.data()); const char* optval_data = reinterpret_cast<const char*>(optval.data());
err = static_cast<u32>( err = static_cast<u32>(::setsockopt(socket_handle, level, optname, optval_data,
::setsockopt(socket_handle, level, optname, optval_data, optval.size())); static_cast<socklen_t>(optval.size())));
if (err == SOCKET_ERROR_VALUE) { if (err == SOCKET_ERROR_VALUE) {
err = TranslateError(GET_ERRNO); err = TranslateError(GET_ERRNO);
} }

View file

@ -52,7 +52,7 @@ static u64 GetSystemTime() {
return console_time; return console_time;
} }
static void UpdateTimeCallback(u64 userdata, int cycles_late) { static void UpdateTimeCallback(u64 userdata, s64 cycles_late) {
DateTime& date_time = DateTime& date_time =
shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1; shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1;

View file

@ -510,7 +510,7 @@ template void Write<u16>(u32 addr, const u16 data);
template void Write<u8>(u32 addr, const u8 data); template void Write<u8>(u32 addr, const u8 data);
/// Update hardware /// Update hardware
static void VBlankCallback(u64 userdata, int cycles_late) { static void VBlankCallback(u64 userdata, s64 cycles_late) {
VideoCore::g_renderer->SwapBuffers(); VideoCore::g_renderer->SwapBuffers();
// Signal to GSP that GPU interrupt has occurred // Signal to GSP that GPU interrupt has occurred

View file

@ -242,12 +242,15 @@ void Movie::Play(Service::IR::ExtraHIDResponse& extra_hid_response) {
return; return;
} }
extra_hid_response.buttons.battery_level.Assign(s.extra_hid_response.battery_level); extra_hid_response.buttons.battery_level.Assign(
static_cast<u8>(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_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.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.r_not_held.Assign(static_cast<u8>(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.zl_not_held.Assign(
extra_hid_response.buttons.zr_not_held.Assign(s.extra_hid_response.zr_not_held); static_cast<u8>(s.extra_hid_response.zl_not_held));
extra_hid_response.buttons.zr_not_held.Assign(
static_cast<u8>(s.extra_hid_response.zr_not_held));
} }
void Movie::Record(const ControllerState& controller_state) { void Movie::Record(const ControllerState& controller_state) {