summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Huw Pascoe2017-09-27 00:26:09 +0100
committerGravatar Huw Pascoe2017-09-30 09:34:35 +0100
commita13ab958cbba75bc9abd1ca50f3030a10a75784e (patch)
tree016f6866d15fb9a41a15666f492bed352d95b523 /src
parentMerge pull request #2961 from Subv/load_titles (diff)
downloadyuzu-a13ab958cbba75bc9abd1ca50f3030a10a75784e.tar.gz
yuzu-a13ab958cbba75bc9abd1ca50f3030a10a75784e.tar.xz
yuzu-a13ab958cbba75bc9abd1ca50f3030a10a75784e.zip
Fixed type conversion ambiguity
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/hle/source.cpp2
-rw-r--r--src/citra_qt/debugger/graphics/graphics_cmdlists.cpp4
-rw-r--r--src/citra_qt/debugger/graphics/graphics_surface.cpp3
-rw-r--r--src/common/string_util.cpp2
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/common/vector_math.h12
-rw-r--r--src/core/gdbstub/gdbstub.cpp4
-rw-r--r--src/core/hle/ipc.h8
-rw-r--r--src/core/hle/ipc_helpers.h12
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp2
-rw-r--r--src/core/hle/kernel/mutex.cpp2
-rw-r--r--src/core/hle/kernel/resource_limit.cpp2
-rw-r--r--src/core/hle/kernel/resource_limit.h2
-rw-r--r--src/core/hle/kernel/shared_memory.cpp3
-rw-r--r--src/core/hle/kernel/shared_memory.h2
-rw-r--r--src/core/hle/kernel/thread.cpp18
-rw-r--r--src/core/hle/kernel/thread.h14
-rw-r--r--src/core/hle/kernel/wait_object.cpp2
-rw-r--r--src/core/hle/service/apt/apt.cpp4
-rw-r--r--src/core/hle/service/cam/cam.cpp2
-rw-r--r--src/core/hle/service/cfg/cfg.cpp2
-rw-r--r--src/core/hle/service/fs/archive.cpp2
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/ldr_ro/cro_helper.h6
-rw-r--r--src/core/hle/service/nwm/nwm_uds.cpp10
-rw-r--r--src/core/hle/service/nwm/uds_beacon.cpp4
-rw-r--r--src/core/hle/service/nwm/uds_data.cpp8
-rw-r--r--src/core/hle/svc.cpp8
-rw-r--r--src/core/memory.cpp36
-rw-r--r--src/network/packet.cpp2
-rw-r--r--src/video_core/geometry_pipeline.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp4
32 files changed, 97 insertions, 91 deletions
diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp
index de4e88cae..c12287700 100644
--- a/src/audio_core/hle/source.cpp
+++ b/src/audio_core/hle/source.cpp
@@ -264,7 +264,7 @@ void Source::GenerateFrame() {
264 break; 264 break;
265 } 265 }
266 } 266 }
267 state.next_sample_number += frame_position; 267 state.next_sample_number += static_cast<u32>(frame_position);
268 268
269 state.filters.ProcessFrame(current_frame); 269 state.filters.ProcessFrame(current_frame);
270} 270}
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
index 7d06ec28a..ce2b9fa50 100644
--- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
@@ -26,8 +26,8 @@
26namespace { 26namespace {
27QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) { 27QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) {
28 QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); 28 QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
29 for (int y = 0; y < info.height; ++y) { 29 for (u32 y = 0; y < info.height; ++y) {
30 for (int x = 0; x < info.width; ++x) { 30 for (u32 x = 0; x < info.width; ++x) {
31 Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true); 31 Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true);
32 decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); 32 decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
33 } 33 }
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp
index 47d9924e1..c974545ef 100644
--- a/src/citra_qt/debugger/graphics/graphics_surface.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_surface.cpp
@@ -273,7 +273,8 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
273 surface_picker_x_control->setValue(x); 273 surface_picker_x_control->setValue(x);
274 surface_picker_y_control->setValue(y); 274 surface_picker_y_control->setValue(y);
275 275
276 if (x < 0 || x >= surface_width || y < 0 || y >= surface_height) { 276 if (x < 0 || x >= static_cast<int>(surface_width) || y < 0 ||
277 y >= static_cast<int>(surface_height)) {
277 surface_info_label->setText(tr("Pixel out of bounds")); 278 surface_info_label->setText(tr("Pixel out of bounds"));
278 surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); 279 surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
279 return; 280 return;
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index bad311793..6959915fa 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -117,7 +117,7 @@ std::string StringFromFormat(const char* format, ...) {
117} 117}
118 118
119// For Debugging. Read out an u8 array. 119// For Debugging. Read out an u8 array.
120std::string ArrayToString(const u8* data, u32 size, int line_len, bool spaces) { 120std::string ArrayToString(const u8* data, size_t size, int line_len, bool spaces) {
121 std::ostringstream oss; 121 std::ostringstream oss;
122 oss << std::setfill('0') << std::hex; 122 oss << std::setfill('0') << std::hex;
123 123
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 075bf4ecb..259360aec 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -33,7 +33,7 @@ inline void CharArrayFromFormat(char (&out)[Count], const char* format, ...) {
33} 33}
34 34
35// Good 35// Good
36std::string ArrayToString(const u8* data, u32 size, int line_len = 20, bool spaces = true); 36std::string ArrayToString(const u8* data, size_t size, int line_len = 20, bool spaces = true);
37 37
38std::string StripSpaces(const std::string& s); 38std::string StripSpaces(const std::string& s);
39std::string StripQuotes(const std::string& s); 39std::string StripQuotes(const std::string& s);
diff --git a/src/common/vector_math.h b/src/common/vector_math.h
index 2b05f66ee..3f0057d9e 100644
--- a/src/common/vector_math.h
+++ b/src/common/vector_math.h
@@ -104,8 +104,7 @@ public:
104 } 104 }
105 template <typename V> 105 template <typename V>
106 void operator*=(const V& f) { 106 void operator*=(const V& f) {
107 x *= f; 107 *this = *this * f;
108 y *= f;
109 } 108 }
110 template <typename V> 109 template <typename V>
111 Vec2<decltype(T{} / V{})> operator/(const V& f) const { 110 Vec2<decltype(T{} / V{})> operator/(const V& f) const {
@@ -262,9 +261,7 @@ public:
262 } 261 }
263 template <typename V> 262 template <typename V>
264 void operator*=(const V& f) { 263 void operator*=(const V& f) {
265 x *= f; 264 *this = *this * f;
266 y *= f;
267 z *= f;
268 } 265 }
269 template <typename V> 266 template <typename V>
270 Vec3<decltype(T{} / V{})> operator/(const V& f) const { 267 Vec3<decltype(T{} / V{})> operator/(const V& f) const {
@@ -478,10 +475,7 @@ public:
478 } 475 }
479 template <typename V> 476 template <typename V>
480 void operator*=(const V& f) { 477 void operator*=(const V& f) {
481 x *= f; 478 *this = *this * f;
482 y *= f;
483 z *= f;
484 w *= f;
485 } 479 }
486 template <typename V> 480 template <typename V>
487 Vec4<decltype(T{} / V{})> operator/(const V& f) const { 481 Vec4<decltype(T{} / V{})> operator/(const V& f) const {
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 123fe7cd4..be2b2e25f 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -946,7 +946,7 @@ static void Init(u16 port) {
946 WSAStartup(MAKEWORD(2, 2), &InitData); 946 WSAStartup(MAKEWORD(2, 2), &InitData);
947#endif 947#endif
948 948
949 int tmpsock = socket(PF_INET, SOCK_STREAM, 0); 949 int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0));
950 if (tmpsock == -1) { 950 if (tmpsock == -1) {
951 LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket"); 951 LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket");
952 } 952 }
@@ -973,7 +973,7 @@ static void Init(u16 port) {
973 sockaddr_in saddr_client; 973 sockaddr_in saddr_client;
974 sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client); 974 sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client);
975 socklen_t client_addrlen = sizeof(saddr_client); 975 socklen_t client_addrlen = sizeof(saddr_client);
976 gdbserver_socket = accept(tmpsock, client_addr, &client_addrlen); 976 gdbserver_socket = static_cast<int>(accept(tmpsock, client_addr, &client_addrlen));
977 if (gdbserver_socket < 0) { 977 if (gdbserver_socket < 0) {
978 // In the case that we couldn't start the server for whatever reason, just start CPU 978 // In the case that we couldn't start the server for whatever reason, just start CPU
979 // execution like normal. 979 // execution like normal.
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h
index f7f96125a..87ed85df6 100644
--- a/src/core/hle/ipc.h
+++ b/src/core/hle/ipc.h
@@ -122,11 +122,11 @@ union StaticBufferDescInfo {
122 BitField<14, 18, u32> size; 122 BitField<14, 18, u32> size;
123}; 123};
124 124
125inline u32 StaticBufferDesc(u32 size, u8 buffer_id) { 125inline u32 StaticBufferDesc(size_t size, u8 buffer_id) {
126 StaticBufferDescInfo info{}; 126 StaticBufferDescInfo info{};
127 info.descriptor_type.Assign(StaticBuffer); 127 info.descriptor_type.Assign(StaticBuffer);
128 info.buffer_id.Assign(buffer_id); 128 info.buffer_id.Assign(buffer_id);
129 info.size.Assign(size); 129 info.size.Assign(static_cast<u32>(size));
130 return info.raw; 130 return info.raw;
131} 131}
132 132
@@ -160,11 +160,11 @@ union MappedBufferDescInfo {
160 BitField<4, 28, u32> size; 160 BitField<4, 28, u32> size;
161}; 161};
162 162
163inline u32 MappedBufferDesc(u32 size, MappedBufferPermissions perms) { 163inline u32 MappedBufferDesc(size_t size, MappedBufferPermissions perms) {
164 MappedBufferDescInfo info{}; 164 MappedBufferDescInfo info{};
165 info.flags.Assign(MappedBuffer); 165 info.flags.Assign(MappedBuffer);
166 info.perms.Assign(perms); 166 info.perms.Assign(perms);
167 info.size.Assign(size); 167 info.size.Assign(static_cast<u32>(size));
168 return info.raw; 168 return info.raw;
169} 169}
170 170
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index f0d89cffe..7cb95cbac 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -117,9 +117,9 @@ public:
117 117
118 void PushCurrentPIDHandle(); 118 void PushCurrentPIDHandle();
119 119
120 void PushStaticBuffer(VAddr buffer_vaddr, u32 size, u8 buffer_id); 120 void PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id);
121 121
122 void PushMappedBuffer(VAddr buffer_vaddr, u32 size, MappedBufferPermissions perms); 122 void PushMappedBuffer(VAddr buffer_vaddr, size_t size, MappedBufferPermissions perms);
123}; 123};
124 124
125/// Push /// 125/// Push ///
@@ -190,12 +190,12 @@ inline void RequestBuilder::PushCurrentPIDHandle() {
190 Push(u32(0)); 190 Push(u32(0));
191} 191}
192 192
193inline void RequestBuilder::PushStaticBuffer(VAddr buffer_vaddr, u32 size, u8 buffer_id) { 193inline void RequestBuilder::PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id) {
194 Push(StaticBufferDesc(size, buffer_id)); 194 Push(StaticBufferDesc(size, buffer_id));
195 Push(buffer_vaddr); 195 Push(buffer_vaddr);
196} 196}
197 197
198inline void RequestBuilder::PushMappedBuffer(VAddr buffer_vaddr, u32 size, 198inline void RequestBuilder::PushMappedBuffer(VAddr buffer_vaddr, size_t size,
199 MappedBufferPermissions perms) { 199 MappedBufferPermissions perms) {
200 Push(MappedBufferDesc(size, perms)); 200 Push(MappedBufferDesc(size, perms));
201 Push(buffer_vaddr); 201 Push(buffer_vaddr);
@@ -227,8 +227,8 @@ public:
227 bool validateHeader = true) { 227 bool validateHeader = true) {
228 if (validateHeader) 228 if (validateHeader)
229 ValidateHeader(); 229 ValidateHeader();
230 Header builderHeader{ 230 Header builderHeader{MakeHeader(static_cast<u16>(header.command_id), normal_params_size,
231 MakeHeader(header.command_id, normal_params_size, translate_params_size)}; 231 translate_params_size)};
232 if (context != nullptr) 232 if (context != nullptr)
233 return {*context, builderHeader}; 233 return {*context, builderHeader};
234 else 234 else
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 5ebe2eca4..6020e9764 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -37,7 +37,7 @@ SharedPtr<Object> HLERequestContext::GetIncomingHandle(u32 id_from_cmdbuf) const
37 37
38u32 HLERequestContext::AddOutgoingHandle(SharedPtr<Object> object) { 38u32 HLERequestContext::AddOutgoingHandle(SharedPtr<Object> object) {
39 request_handles.push_back(std::move(object)); 39 request_handles.push_back(std::move(object));
40 return request_handles.size() - 1; 40 return static_cast<u32>(request_handles.size() - 1);
41} 41}
42 42
43void HLERequestContext::ClearIncomingObjects() { 43void HLERequestContext::ClearIncomingObjects() {
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index cef961289..2cbca5e5b 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -90,7 +90,7 @@ void Mutex::UpdatePriority() {
90 if (!holding_thread) 90 if (!holding_thread)
91 return; 91 return;
92 92
93 s32 best_priority = THREADPRIO_LOWEST; 93 u32 best_priority = THREADPRIO_LOWEST;
94 for (auto& waiter : GetWaitingThreads()) { 94 for (auto& waiter : GetWaitingThreads()) {
95 if (waiter->current_priority < best_priority) 95 if (waiter->current_priority < best_priority)
96 best_priority = waiter->current_priority; 96 best_priority = waiter->current_priority;
diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp
index a8f10a3ee..517dc47a8 100644
--- a/src/core/hle/kernel/resource_limit.cpp
+++ b/src/core/hle/kernel/resource_limit.cpp
@@ -61,7 +61,7 @@ s32 ResourceLimit::GetCurrentResourceValue(u32 resource) const {
61 } 61 }
62} 62}
63 63
64s32 ResourceLimit::GetMaxResourceValue(u32 resource) const { 64u32 ResourceLimit::GetMaxResourceValue(u32 resource) const {
65 switch (resource) { 65 switch (resource) {
66 case PRIORITY: 66 case PRIORITY:
67 return max_priority; 67 return max_priority;
diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h
index 6cdfbcf8d..42874eb8d 100644
--- a/src/core/hle/kernel/resource_limit.h
+++ b/src/core/hle/kernel/resource_limit.h
@@ -67,7 +67,7 @@ public:
67 * @param resource Requested resource type 67 * @param resource Requested resource type
68 * @returns The max value of the resource type 68 * @returns The max value of the resource type
69 */ 69 */
70 s32 GetMaxResourceValue(u32 resource) const; 70 u32 GetMaxResourceValue(u32 resource) const;
71 71
72 /// Name of resource limit object. 72 /// Name of resource limit object.
73 std::string name; 73 std::string name;
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index a7b66142f..02d5a7a36 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -42,7 +42,8 @@ SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u
42 memory_region->used += size; 42 memory_region->used += size;
43 43
44 shared_memory->linear_heap_phys_address = 44 shared_memory->linear_heap_phys_address =
45 Memory::FCRAM_PADDR + memory_region->base + shared_memory->backing_block_offset; 45 Memory::FCRAM_PADDR + memory_region->base +
46 static_cast<PAddr>(shared_memory->backing_block_offset);
46 47
47 // Increase the amount of used linear heap memory for the owner process. 48 // Increase the amount of used linear heap memory for the owner process.
48 if (shared_memory->owner_process != nullptr) { 49 if (shared_memory->owner_process != nullptr) {
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index 94b335ed1..93a6f2182 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -114,7 +114,7 @@ public:
114 /// Backing memory for this shared memory block. 114 /// Backing memory for this shared memory block.
115 std::shared_ptr<std::vector<u8>> backing_block; 115 std::shared_ptr<std::vector<u8>> backing_block;
116 /// Offset into the backing block for this shared memory. 116 /// Offset into the backing block for this shared memory.
117 u32 backing_block_offset; 117 size_t backing_block_offset;
118 /// Size of the memory block. Page-aligned. 118 /// Size of the memory block. Page-aligned.
119 u32 size; 119 u32 size;
120 /// Permission restrictions applied to the process which created the block. 120 /// Permission restrictions applied to the process which created the block.
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 1033f8552..11f7d2127 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -111,7 +111,7 @@ void Thread::Stop() {
111 111
112Thread* ArbitrateHighestPriorityThread(u32 address) { 112Thread* ArbitrateHighestPriorityThread(u32 address) {
113 Thread* highest_priority_thread = nullptr; 113 Thread* highest_priority_thread = nullptr;
114 s32 priority = THREADPRIO_LOWEST; 114 u32 priority = THREADPRIO_LOWEST;
115 115
116 // Iterate through threads, find highest priority thread that is waiting to be arbitrated... 116 // Iterate through threads, find highest priority thread that is waiting to be arbitrated...
117 for (auto& thread : thread_list) { 117 for (auto& thread : thread_list) {
@@ -311,7 +311,7 @@ static void DebugThreadQueue() {
311 } 311 }
312 312
313 for (auto& t : thread_list) { 313 for (auto& t : thread_list) {
314 s32 priority = ready_queue.contains(t.get()); 314 u32 priority = ready_queue.contains(t.get());
315 if (priority != -1) { 315 if (priority != -1) {
316 LOG_DEBUG(Kernel, "0x%02X %u", priority, t->GetObjectId()); 316 LOG_DEBUG(Kernel, "0x%02X %u", priority, t->GetObjectId());
317 } 317 }
@@ -422,7 +422,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
422 return ERR_OUT_OF_MEMORY; 422 return ERR_OUT_OF_MEMORY;
423 } 423 }
424 424
425 u32 offset = linheap_memory->size(); 425 size_t offset = linheap_memory->size();
426 426
427 // Allocate some memory from the end of the linear heap for this region. 427 // Allocate some memory from the end of the linear heap for this region.
428 linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0); 428 linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0);
@@ -430,7 +430,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
430 owner_process->linear_heap_used += Memory::PAGE_SIZE; 430 owner_process->linear_heap_used += Memory::PAGE_SIZE;
431 431
432 tls_slots.emplace_back(0); // The page is completely available at the start 432 tls_slots.emplace_back(0); // The page is completely available at the start
433 available_page = tls_slots.size() - 1; 433 available_page = static_cast<u32>(tls_slots.size() - 1);
434 available_slot = 0; // Use the first slot in the new page 434 available_slot = 0; // Use the first slot in the new page
435 435
436 auto& vm_manager = owner_process->vm_manager; 436 auto& vm_manager = owner_process->vm_manager;
@@ -457,7 +457,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
457 return MakeResult<SharedPtr<Thread>>(std::move(thread)); 457 return MakeResult<SharedPtr<Thread>>(std::move(thread));
458} 458}
459 459
460void Thread::SetPriority(s32 priority) { 460void Thread::SetPriority(u32 priority) {
461 ASSERT_MSG(priority <= THREADPRIO_LOWEST && priority >= THREADPRIO_HIGHEST, 461 ASSERT_MSG(priority <= THREADPRIO_LOWEST && priority >= THREADPRIO_HIGHEST,
462 "Invalid priority value."); 462 "Invalid priority value.");
463 // If thread was ready, adjust queues 463 // If thread was ready, adjust queues
@@ -470,7 +470,7 @@ void Thread::SetPriority(s32 priority) {
470} 470}
471 471
472void Thread::UpdatePriority() { 472void Thread::UpdatePriority() {
473 s32 best_priority = nominal_priority; 473 u32 best_priority = nominal_priority;
474 for (auto& mutex : held_mutexes) { 474 for (auto& mutex : held_mutexes) {
475 if (mutex->priority < best_priority) 475 if (mutex->priority < best_priority)
476 best_priority = mutex->priority; 476 best_priority = mutex->priority;
@@ -478,7 +478,7 @@ void Thread::UpdatePriority() {
478 BoostPriority(best_priority); 478 BoostPriority(best_priority);
479} 479}
480 480
481void Thread::BoostPriority(s32 priority) { 481void Thread::BoostPriority(u32 priority) {
482 // If thread was ready, adjust queues 482 // If thread was ready, adjust queues
483 if (status == THREADSTATUS_READY) 483 if (status == THREADSTATUS_READY)
484 ready_queue.move(this, current_priority, priority); 484 ready_queue.move(this, current_priority, priority);
@@ -487,7 +487,7 @@ void Thread::BoostPriority(s32 priority) {
487 current_priority = priority; 487 current_priority = priority;
488} 488}
489 489
490SharedPtr<Thread> SetupMainThread(u32 entry_point, s32 priority, SharedPtr<Process> owner_process) { 490SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process) {
491 // Initialize new "main" thread 491 // Initialize new "main" thread
492 auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0, 492 auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0,
493 Memory::HEAP_VADDR_END, owner_process); 493 Memory::HEAP_VADDR_END, owner_process);
@@ -531,7 +531,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) {
531s32 Thread::GetWaitObjectIndex(WaitObject* object) const { 531s32 Thread::GetWaitObjectIndex(WaitObject* object) const {
532 ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); 532 ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything");
533 auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); 533 auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object);
534 return std::distance(match, wait_objects.rend()) - 1; 534 return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1);
535} 535}
536 536
537//////////////////////////////////////////////////////////////////////////////////////////////////// 537////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index ddc0d15c5..f02e1d43a 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -15,7 +15,7 @@
15#include "core/hle/kernel/wait_object.h" 15#include "core/hle/kernel/wait_object.h"
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17 17
18enum ThreadPriority : s32 { 18enum ThreadPriority : u32 {
19 THREADPRIO_HIGHEST = 0, ///< Highest thread priority 19 THREADPRIO_HIGHEST = 0, ///< Highest thread priority
20 THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps 20 THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps
21 THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps 21 THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps
@@ -82,7 +82,7 @@ public:
82 * Gets the thread's current priority 82 * Gets the thread's current priority
83 * @return The current thread's priority 83 * @return The current thread's priority
84 */ 84 */
85 s32 GetPriority() const { 85 u32 GetPriority() const {
86 return current_priority; 86 return current_priority;
87 } 87 }
88 88
@@ -90,7 +90,7 @@ public:
90 * Sets the thread's current priority 90 * Sets the thread's current priority
91 * @param priority The new priority 91 * @param priority The new priority
92 */ 92 */
93 void SetPriority(s32 priority); 93 void SetPriority(u32 priority);
94 94
95 /** 95 /**
96 * Boost's a thread's priority to the best priority among the thread's held mutexes. 96 * Boost's a thread's priority to the best priority among the thread's held mutexes.
@@ -102,7 +102,7 @@ public:
102 * Temporarily boosts the thread's priority until the next time it is scheduled 102 * Temporarily boosts the thread's priority until the next time it is scheduled
103 * @param priority The new priority 103 * @param priority The new priority
104 */ 104 */
105 void BoostPriority(s32 priority); 105 void BoostPriority(u32 priority);
106 106
107 /** 107 /**
108 * Gets the thread's thread ID 108 * Gets the thread's thread ID
@@ -176,8 +176,8 @@ public:
176 u32 entry_point; 176 u32 entry_point;
177 u32 stack_top; 177 u32 stack_top;
178 178
179 s32 nominal_priority; ///< Nominal thread priority, as set by the emulated application 179 u32 nominal_priority; ///< Nominal thread priority, as set by the emulated application
180 s32 current_priority; ///< Current thread priority, can be temporarily changed 180 u32 current_priority; ///< Current thread priority, can be temporarily changed
181 181
182 u64 last_running_ticks; ///< CPU tick when thread was last running 182 u64 last_running_ticks; ///< CPU tick when thread was last running
183 183
@@ -219,7 +219,7 @@ private:
219 * @param owner_process The parent process for the main thread 219 * @param owner_process The parent process for the main thread
220 * @return A shared pointer to the main thread 220 * @return A shared pointer to the main thread
221 */ 221 */
222SharedPtr<Thread> SetupMainThread(u32 entry_point, s32 priority, SharedPtr<Process> owner_process); 222SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process);
223 223
224/** 224/**
225 * Returns whether there are any threads that are ready to run. 225 * Returns whether there are any threads that are ready to run.
diff --git a/src/core/hle/kernel/wait_object.cpp b/src/core/hle/kernel/wait_object.cpp
index f245eda6c..56fdd977f 100644
--- a/src/core/hle/kernel/wait_object.cpp
+++ b/src/core/hle/kernel/wait_object.cpp
@@ -34,7 +34,7 @@ void WaitObject::RemoveWaitingThread(Thread* thread) {
34 34
35SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { 35SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
36 Thread* candidate = nullptr; 36 Thread* candidate = nullptr;
37 s32 candidate_priority = THREADPRIO_LOWEST + 1; 37 u32 candidate_priority = THREADPRIO_LOWEST + 1;
38 38
39 for (const auto& thread : waiting_threads) { 39 for (const auto& thread : waiting_threads) {
40 // The list of waiting threads must not contain threads that are not waiting to be awakened. 40 // The list of waiting threads must not contain threads that are not waiting to be awakened.
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index 8c0ba73f2..4c6156345 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -561,7 +561,7 @@ void ReceiveParameter(Service::Interface* self) {
561 ? Kernel::g_handle_table.Create(next_parameter->object).Unwrap() 561 ? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
562 : 0); 562 : 0);
563 563
564 rb.PushStaticBuffer(buffer, static_cast<u32>(next_parameter->buffer.size()), 0); 564 rb.PushStaticBuffer(buffer, next_parameter->buffer.size(), 0);
565 565
566 Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size()); 566 Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
567 567
@@ -609,7 +609,7 @@ void GlanceParameter(Service::Interface* self) {
609 ? Kernel::g_handle_table.Create(next_parameter->object).Unwrap() 609 ? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
610 : 0); 610 : 0);
611 611
612 rb.PushStaticBuffer(buffer, static_cast<u32>(next_parameter->buffer.size()), 0); 612 rb.PushStaticBuffer(buffer, next_parameter->buffer.size(), 0);
613 613
614 Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size()); 614 Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
615 615
diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp
index c9f9e9d95..8172edae8 100644
--- a/src/core/hle/service/cam/cam.cpp
+++ b/src/core/hle/service/cam/cam.cpp
@@ -177,7 +177,7 @@ void CompletionEventCallBack(u64 port_id, int) {
177 LOG_ERROR(Service_CAM, "The destination size (%u) doesn't match the source (%zu)!", 177 LOG_ERROR(Service_CAM, "The destination size (%u) doesn't match the source (%zu)!",
178 port.dest_size, buffer_size); 178 port.dest_size, buffer_size);
179 } 179 }
180 Memory::WriteBlock(port.dest, buffer.data(), std::min<u32>(port.dest_size, buffer_size)); 180 Memory::WriteBlock(port.dest, buffer.data(), std::min<size_t>(port.dest_size, buffer_size));
181 } 181 }
182 182
183 port.is_receiving = false; 183 port.is_receiving = false;
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index f26a1f65f..f78c25fb2 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -141,7 +141,7 @@ void GetCountryCodeString(Service::Interface* self) {
141 141
142void GetCountryCodeID(Service::Interface* self) { 142void GetCountryCodeID(Service::Interface* self) {
143 u32* cmd_buff = Kernel::GetCommandBuffer(); 143 u32* cmd_buff = Kernel::GetCommandBuffer();
144 u16 country_code = cmd_buff[1]; 144 u16 country_code = static_cast<u16>(cmd_buff[1]);
145 u16 country_code_id = 0; 145 u16 country_code_id = 0;
146 146
147 // The following algorithm will fail if the first country code isn't 0. 147 // The following algorithm will fail if the first country code isn't 0.
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 4ccb3cd32..4ee7df73c 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -217,7 +217,7 @@ void Directory::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> serve
217 LOG_TRACE(Service_FS, "Read %s: count=%d", GetName().c_str(), count); 217 LOG_TRACE(Service_FS, "Read %s: count=%d", GetName().c_str(), count);
218 218
219 // Number of entries actually read 219 // Number of entries actually read
220 u32 read = backend->Read(entries.size(), entries.data()); 220 u32 read = backend->Read(static_cast<u32>(entries.size()), entries.data());
221 cmd_buff[2] = read; 221 cmd_buff[2] = read;
222 Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry)); 222 Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry));
223 break; 223 break;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index aa5d821f9..379fbd71c 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -251,7 +251,7 @@ static void UpdateGyroscopeCallback(u64 userdata, int cycles_late) {
251 Math::Vec3<float> gyro; 251 Math::Vec3<float> gyro;
252 std::tie(std::ignore, gyro) = motion_device->GetStatus(); 252 std::tie(std::ignore, gyro) = motion_device->GetStatus();
253 double stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale(); 253 double stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
254 gyro *= gyroscope_coef * stretch; 254 gyro *= gyroscope_coef * static_cast<float>(stretch);
255 gyroscope_entry.x = static_cast<s16>(gyro.x); 255 gyroscope_entry.x = static_cast<s16>(gyro.x);
256 gyroscope_entry.y = static_cast<s16>(gyro.y); 256 gyroscope_entry.y = static_cast<s16>(gyro.y);
257 gyroscope_entry.z = static_cast<s16>(gyro.z); 257 gyroscope_entry.z = static_cast<s16>(gyro.z);
diff --git a/src/core/hle/service/ldr_ro/cro_helper.h b/src/core/hle/service/ldr_ro/cro_helper.h
index 3bc10dbdc..57b4fb6df 100644
--- a/src/core/hle/service/ldr_ro/cro_helper.h
+++ b/src/core/hle/service/ldr_ro/cro_helper.h
@@ -413,7 +413,8 @@ private:
413 */ 413 */
414 template <typename T> 414 template <typename T>
415 void GetEntry(std::size_t index, T& data) const { 415 void GetEntry(std::size_t index, T& data) const {
416 Memory::ReadBlock(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T), &data, sizeof(T)); 416 Memory::ReadBlock(GetField(T::TABLE_OFFSET_FIELD) + static_cast<u32>(index * sizeof(T)),
417 &data, sizeof(T));
417 } 418 }
418 419
419 /** 420 /**
@@ -425,7 +426,8 @@ private:
425 */ 426 */
426 template <typename T> 427 template <typename T>
427 void SetEntry(std::size_t index, const T& data) { 428 void SetEntry(std::size_t index, const T& data) {
428 Memory::WriteBlock(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T), &data, sizeof(T)); 429 Memory::WriteBlock(GetField(T::TABLE_OFFSET_FIELD) + static_cast<u32>(index * sizeof(T)),
430 &data, sizeof(T));
429 } 431 }
430 432
431 /** 433 /**
diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp
index 4e2af9ae6..8ef0cda09 100644
--- a/src/core/hle/service/nwm/nwm_uds.cpp
+++ b/src/core/hle/service/nwm/nwm_uds.cpp
@@ -316,7 +316,7 @@ static void RecvBeaconBroadcastData(Interface* self) {
316 auto beacons = GetReceivedBeacons(mac_address); 316 auto beacons = GetReceivedBeacons(mac_address);
317 317
318 BeaconDataReplyHeader data_reply_header{}; 318 BeaconDataReplyHeader data_reply_header{};
319 data_reply_header.total_entries = beacons.size(); 319 data_reply_header.total_entries = static_cast<u32>(beacons.size());
320 data_reply_header.max_output_size = out_buffer_size; 320 data_reply_header.max_output_size = out_buffer_size;
321 321
322 Memory::WriteBlock(current_buffer_pos, &data_reply_header, sizeof(BeaconDataReplyHeader)); 322 Memory::WriteBlock(current_buffer_pos, &data_reply_header, sizeof(BeaconDataReplyHeader));
@@ -326,8 +326,8 @@ static void RecvBeaconBroadcastData(Interface* self) {
326 for (const auto& beacon : beacons) { 326 for (const auto& beacon : beacons) {
327 BeaconEntryHeader entry{}; 327 BeaconEntryHeader entry{};
328 // TODO(Subv): Figure out what this size is used for. 328 // TODO(Subv): Figure out what this size is used for.
329 entry.unk_size = sizeof(BeaconEntryHeader) + beacon.data.size(); 329 entry.unk_size = static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
330 entry.total_size = sizeof(BeaconEntryHeader) + beacon.data.size(); 330 entry.total_size = static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
331 entry.wifi_channel = beacon.channel; 331 entry.wifi_channel = beacon.channel;
332 entry.header_size = sizeof(BeaconEntryHeader); 332 entry.header_size = sizeof(BeaconEntryHeader);
333 entry.mac_address = beacon.transmitter_address; 333 entry.mac_address = beacon.transmitter_address;
@@ -338,9 +338,9 @@ static void RecvBeaconBroadcastData(Interface* self) {
338 current_buffer_pos += sizeof(BeaconEntryHeader); 338 current_buffer_pos += sizeof(BeaconEntryHeader);
339 339
340 Memory::WriteBlock(current_buffer_pos, beacon.data.data(), beacon.data.size()); 340 Memory::WriteBlock(current_buffer_pos, beacon.data.data(), beacon.data.size());
341 current_buffer_pos += beacon.data.size(); 341 current_buffer_pos += static_cast<VAddr>(beacon.data.size());
342 342
343 total_size += sizeof(BeaconEntryHeader) + beacon.data.size(); 343 total_size += static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
344 } 344 }
345 345
346 // Update the total size in the structure and write it to the buffer again. 346 // Update the total size in the structure and write it to the buffer again.
diff --git a/src/core/hle/service/nwm/uds_beacon.cpp b/src/core/hle/service/nwm/uds_beacon.cpp
index 552eaf65e..73a80d940 100644
--- a/src/core/hle/service/nwm/uds_beacon.cpp
+++ b/src/core/hle/service/nwm/uds_beacon.cpp
@@ -243,7 +243,7 @@ std::vector<u8> GenerateNintendoFirstEncryptedDataTag(const NetworkInfo& network
243 243
244 EncryptedDataTag tag{}; 244 EncryptedDataTag tag{};
245 tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific); 245 tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
246 tag.header.length = sizeof(tag) - sizeof(TagHeader) + payload_size; 246 tag.header.length = static_cast<u8>(sizeof(tag) - sizeof(TagHeader) + payload_size);
247 tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData0); 247 tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData0);
248 tag.oui = NintendoOUI; 248 tag.oui = NintendoOUI;
249 249
@@ -279,7 +279,7 @@ std::vector<u8> GenerateNintendoSecondEncryptedDataTag(const NetworkInfo& networ
279 279
280 EncryptedDataTag tag{}; 280 EncryptedDataTag tag{};
281 tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific); 281 tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
282 tag.header.length = tag_length; 282 tag.header.length = static_cast<u8>(tag_length);
283 tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData1); 283 tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData1);
284 tag.oui = NintendoOUI; 284 tag.oui = NintendoOUI;
285 285
diff --git a/src/core/hle/service/nwm/uds_data.cpp b/src/core/hle/service/nwm/uds_data.cpp
index 0fd9b8b8c..3ef2a84b6 100644
--- a/src/core/hle/service/nwm/uds_data.cpp
+++ b/src/core/hle/service/nwm/uds_data.cpp
@@ -197,7 +197,7 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
197 df.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL); 197 df.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL);
198 df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL); 198 df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
199 199
200 int size = df.MaxRetrievable(); 200 size_t size = df.MaxRetrievable();
201 201
202 std::vector<u8> pdata(size); 202 std::vector<u8> pdata(size);
203 df.Get(pdata.data(), size); 203 df.Get(pdata.data(), size);
@@ -251,7 +251,7 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
251 251
252 df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL); 252 df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
253 253
254 int size = df.MaxRetrievable(); 254 size_t size = df.MaxRetrievable();
255 255
256 std::vector<u8> cipher(size); 256 std::vector<u8> cipher(size);
257 df.Get(cipher.data(), size); 257 df.Get(cipher.data(), size);
@@ -266,8 +266,8 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
266std::vector<u8> GenerateDataPayload(const std::vector<u8>& data, u8 channel, u16 dest_node, 266std::vector<u8> GenerateDataPayload(const std::vector<u8>& data, u8 channel, u16 dest_node,
267 u16 src_node, u16 sequence_number) { 267 u16 src_node, u16 sequence_number) {
268 std::vector<u8> buffer = GenerateLLCHeader(EtherType::SecureData); 268 std::vector<u8> buffer = GenerateLLCHeader(EtherType::SecureData);
269 std::vector<u8> securedata_header = 269 std::vector<u8> securedata_header = GenerateSecureDataHeader(
270 GenerateSecureDataHeader(data.size(), channel, dest_node, src_node, sequence_number); 270 static_cast<u16>(data.size()), channel, dest_node, src_node, sequence_number);
271 271
272 buffer.insert(buffer.end(), securedata_header.begin(), securedata_header.end()); 272 buffer.insert(buffer.end(), securedata_header.begin(), securedata_header.end());
273 buffer.insert(buffer.end(), data.begin(), data.end()); 273 buffer.insert(buffer.end(), data.begin(), data.end());
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 05c6897bf..41c82c922 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -361,7 +361,7 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
361 // We found a ready object, acquire it and set the result value 361 // We found a ready object, acquire it and set the result value
362 Kernel::WaitObject* object = itr->get(); 362 Kernel::WaitObject* object = itr->get();
363 object->Acquire(thread); 363 object->Acquire(thread);
364 *out = std::distance(objects.begin(), itr); 364 *out = static_cast<s32>(std::distance(objects.begin(), itr));
365 return RESULT_SUCCESS; 365 return RESULT_SUCCESS;
366 } 366 }
367 367
@@ -469,7 +469,7 @@ static ResultCode ReplyAndReceive(s32* index, Kernel::Handle* handles, s32 handl
469 // We found a ready object, acquire it and set the result value 469 // We found a ready object, acquire it and set the result value
470 Kernel::WaitObject* object = itr->get(); 470 Kernel::WaitObject* object = itr->get();
471 object->Acquire(thread); 471 object->Acquire(thread);
472 *index = std::distance(objects.begin(), itr); 472 *index = static_cast<s32>(std::distance(objects.begin(), itr));
473 473
474 if (object->GetHandleType() == Kernel::HandleType::ServerSession) { 474 if (object->GetHandleType() == Kernel::HandleType::ServerSession) {
475 auto server_session = static_cast<Kernel::ServerSession*>(object); 475 auto server_session = static_cast<Kernel::ServerSession*>(object);
@@ -683,7 +683,7 @@ static void ExitThread() {
683} 683}
684 684
685/// Gets the priority for the specified thread 685/// Gets the priority for the specified thread
686static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) { 686static ResultCode GetThreadPriority(u32* priority, Kernel::Handle handle) {
687 const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); 687 const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
688 if (thread == nullptr) 688 if (thread == nullptr)
689 return ERR_INVALID_HANDLE; 689 return ERR_INVALID_HANDLE;
@@ -693,7 +693,7 @@ static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) {
693} 693}
694 694
695/// Sets the priority for the specified thread 695/// Sets the priority for the specified thread
696static ResultCode SetThreadPriority(Kernel::Handle handle, s32 priority) { 696static ResultCode SetThreadPriority(Kernel::Handle handle, u32 priority) {
697 if (priority > THREADPRIO_LOWEST) { 697 if (priority > THREADPRIO_LOWEST) {
698 return Kernel::ERR_OUT_OF_RANGE; 698 return Kernel::ERR_OUT_OF_RANGE;
699 } 699 }
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 5ea0694a9..847e69710 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -477,7 +477,7 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
477 477
478 while (remaining_size > 0) { 478 while (remaining_size > 0) {
479 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); 479 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
480 const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; 480 const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
481 481
482 switch (current_page_table->attributes[page_index]) { 482 switch (current_page_table->attributes[page_index]) {
483 case PageType::Unmapped: { 483 case PageType::Unmapped: {
@@ -500,13 +500,15 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
500 break; 500 break;
501 } 501 }
502 case PageType::RasterizerCachedMemory: { 502 case PageType::RasterizerCachedMemory: {
503 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush); 503 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
504 FlushMode::Flush);
504 std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount); 505 std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount);
505 break; 506 break;
506 } 507 }
507 case PageType::RasterizerCachedSpecial: { 508 case PageType::RasterizerCachedSpecial: {
508 DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); 509 DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
509 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush); 510 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
511 FlushMode::Flush);
510 GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount); 512 GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount);
511 break; 513 break;
512 } 514 }
@@ -544,7 +546,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
544 546
545 while (remaining_size > 0) { 547 while (remaining_size > 0) {
546 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); 548 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
547 const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; 549 const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
548 550
549 switch (current_page_table->attributes[page_index]) { 551 switch (current_page_table->attributes[page_index]) {
550 case PageType::Unmapped: { 552 case PageType::Unmapped: {
@@ -567,13 +569,15 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
567 break; 569 break;
568 } 570 }
569 case PageType::RasterizerCachedMemory: { 571 case PageType::RasterizerCachedMemory: {
570 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate); 572 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
573 FlushMode::FlushAndInvalidate);
571 std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount); 574 std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount);
572 break; 575 break;
573 } 576 }
574 case PageType::RasterizerCachedSpecial: { 577 case PageType::RasterizerCachedSpecial: {
575 DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); 578 DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
576 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate); 579 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
580 FlushMode::FlushAndInvalidate);
577 GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount); 581 GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount);
578 break; 582 break;
579 } 583 }
@@ -597,7 +601,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
597 601
598 while (remaining_size > 0) { 602 while (remaining_size > 0) {
599 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); 603 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
600 const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; 604 const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
601 605
602 switch (current_page_table->attributes[page_index]) { 606 switch (current_page_table->attributes[page_index]) {
603 case PageType::Unmapped: { 607 case PageType::Unmapped: {
@@ -619,13 +623,15 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
619 break; 623 break;
620 } 624 }
621 case PageType::RasterizerCachedMemory: { 625 case PageType::RasterizerCachedMemory: {
622 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate); 626 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
627 FlushMode::FlushAndInvalidate);
623 std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount); 628 std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount);
624 break; 629 break;
625 } 630 }
626 case PageType::RasterizerCachedSpecial: { 631 case PageType::RasterizerCachedSpecial: {
627 DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); 632 DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
628 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate); 633 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
634 FlushMode::FlushAndInvalidate);
629 GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount); 635 GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount);
630 break; 636 break;
631 } 637 }
@@ -646,7 +652,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
646 652
647 while (remaining_size > 0) { 653 while (remaining_size > 0) {
648 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); 654 const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
649 const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; 655 const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
650 656
651 switch (current_page_table->attributes[page_index]) { 657 switch (current_page_table->attributes[page_index]) {
652 case PageType::Unmapped: { 658 case PageType::Unmapped: {
@@ -670,13 +676,15 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
670 break; 676 break;
671 } 677 }
672 case PageType::RasterizerCachedMemory: { 678 case PageType::RasterizerCachedMemory: {
673 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush); 679 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
680 FlushMode::Flush);
674 WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount); 681 WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount);
675 break; 682 break;
676 } 683 }
677 case PageType::RasterizerCachedSpecial: { 684 case PageType::RasterizerCachedSpecial: {
678 DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); 685 DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
679 RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush); 686 RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
687 FlushMode::Flush);
680 688
681 std::vector<u8> buffer(copy_amount); 689 std::vector<u8> buffer(copy_amount);
682 GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size()); 690 GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size());
@@ -689,8 +697,8 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
689 697
690 page_index++; 698 page_index++;
691 page_offset = 0; 699 page_offset = 0;
692 dest_addr += copy_amount; 700 dest_addr += static_cast<VAddr>(copy_amount);
693 src_addr += copy_amount; 701 src_addr += static_cast<VAddr>(copy_amount);
694 remaining_size -= copy_amount; 702 remaining_size -= copy_amount;
695 } 703 }
696} 704}
diff --git a/src/network/packet.cpp b/src/network/packet.cpp
index cc60f2fbc..7e1a812f3 100644
--- a/src/network/packet.cpp
+++ b/src/network/packet.cpp
@@ -233,7 +233,7 @@ Packet& Packet::operator<<(double in_data) {
233 233
234Packet& Packet::operator<<(const char* in_data) { 234Packet& Packet::operator<<(const char* in_data) {
235 // First insert string length 235 // First insert string length
236 u32 length = std::strlen(in_data); 236 u32 length = static_cast<u32>(std::strlen(in_data));
237 *this << length; 237 *this << length;
238 238
239 // Then insert characters 239 // Then insert characters
diff --git a/src/video_core/geometry_pipeline.cpp b/src/video_core/geometry_pipeline.cpp
index b146e2ecb..98ff2ccd3 100644
--- a/src/video_core/geometry_pipeline.cpp
+++ b/src/video_core/geometry_pipeline.cpp
@@ -105,7 +105,7 @@ public:
105 DEBUG_ASSERT(need_index); 105 DEBUG_ASSERT(need_index);
106 106
107 // The number of vertex input is put to the uniform register 107 // The number of vertex input is put to the uniform register
108 float24 vertex_num = float24::FromFloat32(val); 108 float24 vertex_num = float24::FromFloat32(static_cast<float>(val));
109 setup.uniforms.f[0] = Math::MakeVec(vertex_num, vertex_num, vertex_num, vertex_num); 109 setup.uniforms.f[0] = Math::MakeVec(vertex_num, vertex_num, vertex_num, vertex_num);
110 110
111 // The second uniform register and so on are used for receiving input vertices 111 // The second uniform register and so on are used for receiving input vertices
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 06a905766..5770ae08f 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -267,9 +267,9 @@ void OpenGLState::Apply() const {
267 for (size_t i = 0; i < clip_distance.size(); ++i) { 267 for (size_t i = 0; i < clip_distance.size(); ++i) {
268 if (clip_distance[i] != cur_state.clip_distance[i]) { 268 if (clip_distance[i] != cur_state.clip_distance[i]) {
269 if (clip_distance[i]) { 269 if (clip_distance[i]) {
270 glEnable(GL_CLIP_DISTANCE0 + i); 270 glEnable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i));
271 } else { 271 } else {
272 glDisable(GL_CLIP_DISTANCE0 + i); 272 glDisable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i));
273 } 273 }
274 } 274 }
275 } 275 }