mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
Merge pull request #2962 from huwpascoe/static_cast
Fixed type conversion ambiguity
This commit is contained in:
commit
a3de996ae7
@ -264,7 +264,7 @@ void Source::GenerateFrame() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.next_sample_number += frame_position;
|
state.next_sample_number += static_cast<u32>(frame_position);
|
||||||
|
|
||||||
state.filters.ProcessFrame(current_frame);
|
state.filters.ProcessFrame(current_frame);
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
namespace {
|
namespace {
|
||||||
QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) {
|
QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) {
|
||||||
QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
|
QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
|
||||||
for (int y = 0; y < info.height; ++y) {
|
for (u32 y = 0; y < info.height; ++y) {
|
||||||
for (int x = 0; x < info.width; ++x) {
|
for (u32 x = 0; x < info.width; ++x) {
|
||||||
Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true);
|
Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true);
|
||||||
decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
|
decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,8 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
|
|||||||
surface_picker_x_control->setValue(x);
|
surface_picker_x_control->setValue(x);
|
||||||
surface_picker_y_control->setValue(y);
|
surface_picker_y_control->setValue(y);
|
||||||
|
|
||||||
if (x < 0 || x >= surface_width || y < 0 || y >= surface_height) {
|
if (x < 0 || x >= static_cast<int>(surface_width) || y < 0 ||
|
||||||
|
y >= static_cast<int>(surface_height)) {
|
||||||
surface_info_label->setText(tr("Pixel out of bounds"));
|
surface_info_label->setText(tr("Pixel out of bounds"));
|
||||||
surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
return;
|
return;
|
||||||
|
@ -117,7 +117,7 @@ std::string StringFromFormat(const char* format, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For Debugging. Read out an u8 array.
|
// For Debugging. Read out an u8 array.
|
||||||
std::string ArrayToString(const u8* data, u32 size, int line_len, bool spaces) {
|
std::string ArrayToString(const u8* data, size_t size, int line_len, bool spaces) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << std::setfill('0') << std::hex;
|
oss << std::setfill('0') << std::hex;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ inline void CharArrayFromFormat(char (&out)[Count], const char* format, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Good
|
// Good
|
||||||
std::string ArrayToString(const u8* data, u32 size, int line_len = 20, bool spaces = true);
|
std::string ArrayToString(const u8* data, size_t size, int line_len = 20, bool spaces = true);
|
||||||
|
|
||||||
std::string StripSpaces(const std::string& s);
|
std::string StripSpaces(const std::string& s);
|
||||||
std::string StripQuotes(const std::string& s);
|
std::string StripQuotes(const std::string& s);
|
||||||
|
@ -104,8 +104,7 @@ public:
|
|||||||
}
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
void operator*=(const V& f) {
|
void operator*=(const V& f) {
|
||||||
x *= f;
|
*this = *this * f;
|
||||||
y *= f;
|
|
||||||
}
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
Vec2<decltype(T{} / V{})> operator/(const V& f) const {
|
Vec2<decltype(T{} / V{})> operator/(const V& f) const {
|
||||||
@ -262,9 +261,7 @@ public:
|
|||||||
}
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
void operator*=(const V& f) {
|
void operator*=(const V& f) {
|
||||||
x *= f;
|
*this = *this * f;
|
||||||
y *= f;
|
|
||||||
z *= f;
|
|
||||||
}
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
Vec3<decltype(T{} / V{})> operator/(const V& f) const {
|
Vec3<decltype(T{} / V{})> operator/(const V& f) const {
|
||||||
@ -478,10 +475,7 @@ public:
|
|||||||
}
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
void operator*=(const V& f) {
|
void operator*=(const V& f) {
|
||||||
x *= f;
|
*this = *this * f;
|
||||||
y *= f;
|
|
||||||
z *= f;
|
|
||||||
w *= f;
|
|
||||||
}
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
Vec4<decltype(T{} / V{})> operator/(const V& f) const {
|
Vec4<decltype(T{} / V{})> operator/(const V& f) const {
|
||||||
|
@ -946,7 +946,7 @@ static void Init(u16 port) {
|
|||||||
WSAStartup(MAKEWORD(2, 2), &InitData);
|
WSAStartup(MAKEWORD(2, 2), &InitData);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int tmpsock = socket(PF_INET, SOCK_STREAM, 0);
|
int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0));
|
||||||
if (tmpsock == -1) {
|
if (tmpsock == -1) {
|
||||||
LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket");
|
LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket");
|
||||||
}
|
}
|
||||||
@ -973,7 +973,7 @@ static void Init(u16 port) {
|
|||||||
sockaddr_in saddr_client;
|
sockaddr_in saddr_client;
|
||||||
sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client);
|
sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client);
|
||||||
socklen_t client_addrlen = sizeof(saddr_client);
|
socklen_t client_addrlen = sizeof(saddr_client);
|
||||||
gdbserver_socket = accept(tmpsock, client_addr, &client_addrlen);
|
gdbserver_socket = static_cast<int>(accept(tmpsock, client_addr, &client_addrlen));
|
||||||
if (gdbserver_socket < 0) {
|
if (gdbserver_socket < 0) {
|
||||||
// In the case that we couldn't start the server for whatever reason, just start CPU
|
// In the case that we couldn't start the server for whatever reason, just start CPU
|
||||||
// execution like normal.
|
// execution like normal.
|
||||||
|
@ -122,11 +122,11 @@ union StaticBufferDescInfo {
|
|||||||
BitField<14, 18, u32> size;
|
BitField<14, 18, u32> size;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline u32 StaticBufferDesc(u32 size, u8 buffer_id) {
|
inline u32 StaticBufferDesc(size_t size, u8 buffer_id) {
|
||||||
StaticBufferDescInfo info{};
|
StaticBufferDescInfo info{};
|
||||||
info.descriptor_type.Assign(StaticBuffer);
|
info.descriptor_type.Assign(StaticBuffer);
|
||||||
info.buffer_id.Assign(buffer_id);
|
info.buffer_id.Assign(buffer_id);
|
||||||
info.size.Assign(size);
|
info.size.Assign(static_cast<u32>(size));
|
||||||
return info.raw;
|
return info.raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,11 +160,11 @@ union MappedBufferDescInfo {
|
|||||||
BitField<4, 28, u32> size;
|
BitField<4, 28, u32> size;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline u32 MappedBufferDesc(u32 size, MappedBufferPermissions perms) {
|
inline u32 MappedBufferDesc(size_t size, MappedBufferPermissions perms) {
|
||||||
MappedBufferDescInfo info{};
|
MappedBufferDescInfo info{};
|
||||||
info.flags.Assign(MappedBuffer);
|
info.flags.Assign(MappedBuffer);
|
||||||
info.perms.Assign(perms);
|
info.perms.Assign(perms);
|
||||||
info.size.Assign(size);
|
info.size.Assign(static_cast<u32>(size));
|
||||||
return info.raw;
|
return info.raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +117,9 @@ public:
|
|||||||
|
|
||||||
void PushCurrentPIDHandle();
|
void PushCurrentPIDHandle();
|
||||||
|
|
||||||
void PushStaticBuffer(VAddr buffer_vaddr, u32 size, u8 buffer_id);
|
void PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id);
|
||||||
|
|
||||||
void PushMappedBuffer(VAddr buffer_vaddr, u32 size, MappedBufferPermissions perms);
|
void PushMappedBuffer(VAddr buffer_vaddr, size_t size, MappedBufferPermissions perms);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Push ///
|
/// Push ///
|
||||||
@ -190,12 +190,12 @@ inline void RequestBuilder::PushCurrentPIDHandle() {
|
|||||||
Push(u32(0));
|
Push(u32(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RequestBuilder::PushStaticBuffer(VAddr buffer_vaddr, u32 size, u8 buffer_id) {
|
inline void RequestBuilder::PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id) {
|
||||||
Push(StaticBufferDesc(size, buffer_id));
|
Push(StaticBufferDesc(size, buffer_id));
|
||||||
Push(buffer_vaddr);
|
Push(buffer_vaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RequestBuilder::PushMappedBuffer(VAddr buffer_vaddr, u32 size,
|
inline void RequestBuilder::PushMappedBuffer(VAddr buffer_vaddr, size_t size,
|
||||||
MappedBufferPermissions perms) {
|
MappedBufferPermissions perms) {
|
||||||
Push(MappedBufferDesc(size, perms));
|
Push(MappedBufferDesc(size, perms));
|
||||||
Push(buffer_vaddr);
|
Push(buffer_vaddr);
|
||||||
@ -227,8 +227,8 @@ public:
|
|||||||
bool validateHeader = true) {
|
bool validateHeader = true) {
|
||||||
if (validateHeader)
|
if (validateHeader)
|
||||||
ValidateHeader();
|
ValidateHeader();
|
||||||
Header builderHeader{
|
Header builderHeader{MakeHeader(static_cast<u16>(header.command_id), normal_params_size,
|
||||||
MakeHeader(header.command_id, normal_params_size, translate_params_size)};
|
translate_params_size)};
|
||||||
if (context != nullptr)
|
if (context != nullptr)
|
||||||
return {*context, builderHeader};
|
return {*context, builderHeader};
|
||||||
else
|
else
|
||||||
|
@ -37,7 +37,7 @@ SharedPtr<Object> HLERequestContext::GetIncomingHandle(u32 id_from_cmdbuf) const
|
|||||||
|
|
||||||
u32 HLERequestContext::AddOutgoingHandle(SharedPtr<Object> object) {
|
u32 HLERequestContext::AddOutgoingHandle(SharedPtr<Object> object) {
|
||||||
request_handles.push_back(std::move(object));
|
request_handles.push_back(std::move(object));
|
||||||
return request_handles.size() - 1;
|
return static_cast<u32>(request_handles.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HLERequestContext::ClearIncomingObjects() {
|
void HLERequestContext::ClearIncomingObjects() {
|
||||||
|
@ -90,7 +90,7 @@ void Mutex::UpdatePriority() {
|
|||||||
if (!holding_thread)
|
if (!holding_thread)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s32 best_priority = THREADPRIO_LOWEST;
|
u32 best_priority = THREADPRIO_LOWEST;
|
||||||
for (auto& waiter : GetWaitingThreads()) {
|
for (auto& waiter : GetWaitingThreads()) {
|
||||||
if (waiter->current_priority < best_priority)
|
if (waiter->current_priority < best_priority)
|
||||||
best_priority = waiter->current_priority;
|
best_priority = waiter->current_priority;
|
||||||
|
@ -61,7 +61,7 @@ s32 ResourceLimit::GetCurrentResourceValue(u32 resource) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 ResourceLimit::GetMaxResourceValue(u32 resource) const {
|
u32 ResourceLimit::GetMaxResourceValue(u32 resource) const {
|
||||||
switch (resource) {
|
switch (resource) {
|
||||||
case PRIORITY:
|
case PRIORITY:
|
||||||
return max_priority;
|
return max_priority;
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
* @param resource Requested resource type
|
* @param resource Requested resource type
|
||||||
* @returns The max value of the resource type
|
* @returns The max value of the resource type
|
||||||
*/
|
*/
|
||||||
s32 GetMaxResourceValue(u32 resource) const;
|
u32 GetMaxResourceValue(u32 resource) const;
|
||||||
|
|
||||||
/// Name of resource limit object.
|
/// Name of resource limit object.
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -42,7 +42,8 @@ SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u
|
|||||||
memory_region->used += size;
|
memory_region->used += size;
|
||||||
|
|
||||||
shared_memory->linear_heap_phys_address =
|
shared_memory->linear_heap_phys_address =
|
||||||
Memory::FCRAM_PADDR + memory_region->base + shared_memory->backing_block_offset;
|
Memory::FCRAM_PADDR + memory_region->base +
|
||||||
|
static_cast<PAddr>(shared_memory->backing_block_offset);
|
||||||
|
|
||||||
// Increase the amount of used linear heap memory for the owner process.
|
// Increase the amount of used linear heap memory for the owner process.
|
||||||
if (shared_memory->owner_process != nullptr) {
|
if (shared_memory->owner_process != nullptr) {
|
||||||
|
@ -114,7 +114,7 @@ public:
|
|||||||
/// Backing memory for this shared memory block.
|
/// Backing memory for this shared memory block.
|
||||||
std::shared_ptr<std::vector<u8>> backing_block;
|
std::shared_ptr<std::vector<u8>> backing_block;
|
||||||
/// Offset into the backing block for this shared memory.
|
/// Offset into the backing block for this shared memory.
|
||||||
u32 backing_block_offset;
|
size_t backing_block_offset;
|
||||||
/// Size of the memory block. Page-aligned.
|
/// Size of the memory block. Page-aligned.
|
||||||
u32 size;
|
u32 size;
|
||||||
/// Permission restrictions applied to the process which created the block.
|
/// Permission restrictions applied to the process which created the block.
|
||||||
|
@ -111,7 +111,7 @@ void Thread::Stop() {
|
|||||||
|
|
||||||
Thread* ArbitrateHighestPriorityThread(u32 address) {
|
Thread* ArbitrateHighestPriorityThread(u32 address) {
|
||||||
Thread* highest_priority_thread = nullptr;
|
Thread* highest_priority_thread = nullptr;
|
||||||
s32 priority = THREADPRIO_LOWEST;
|
u32 priority = THREADPRIO_LOWEST;
|
||||||
|
|
||||||
// Iterate through threads, find highest priority thread that is waiting to be arbitrated...
|
// Iterate through threads, find highest priority thread that is waiting to be arbitrated...
|
||||||
for (auto& thread : thread_list) {
|
for (auto& thread : thread_list) {
|
||||||
@ -311,7 +311,7 @@ static void DebugThreadQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& t : thread_list) {
|
for (auto& t : thread_list) {
|
||||||
s32 priority = ready_queue.contains(t.get());
|
u32 priority = ready_queue.contains(t.get());
|
||||||
if (priority != -1) {
|
if (priority != -1) {
|
||||||
LOG_DEBUG(Kernel, "0x%02X %u", priority, t->GetObjectId());
|
LOG_DEBUG(Kernel, "0x%02X %u", priority, t->GetObjectId());
|
||||||
}
|
}
|
||||||
@ -422,7 +422,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
|
|||||||
return ERR_OUT_OF_MEMORY;
|
return ERR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 offset = linheap_memory->size();
|
size_t offset = linheap_memory->size();
|
||||||
|
|
||||||
// Allocate some memory from the end of the linear heap for this region.
|
// Allocate some memory from the end of the linear heap for this region.
|
||||||
linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0);
|
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,
|
|||||||
owner_process->linear_heap_used += Memory::PAGE_SIZE;
|
owner_process->linear_heap_used += Memory::PAGE_SIZE;
|
||||||
|
|
||||||
tls_slots.emplace_back(0); // The page is completely available at the start
|
tls_slots.emplace_back(0); // The page is completely available at the start
|
||||||
available_page = tls_slots.size() - 1;
|
available_page = static_cast<u32>(tls_slots.size() - 1);
|
||||||
available_slot = 0; // Use the first slot in the new page
|
available_slot = 0; // Use the first slot in the new page
|
||||||
|
|
||||||
auto& vm_manager = owner_process->vm_manager;
|
auto& vm_manager = owner_process->vm_manager;
|
||||||
@ -457,7 +457,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
|
|||||||
return MakeResult<SharedPtr<Thread>>(std::move(thread));
|
return MakeResult<SharedPtr<Thread>>(std::move(thread));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::SetPriority(s32 priority) {
|
void Thread::SetPriority(u32 priority) {
|
||||||
ASSERT_MSG(priority <= THREADPRIO_LOWEST && priority >= THREADPRIO_HIGHEST,
|
ASSERT_MSG(priority <= THREADPRIO_LOWEST && priority >= THREADPRIO_HIGHEST,
|
||||||
"Invalid priority value.");
|
"Invalid priority value.");
|
||||||
// If thread was ready, adjust queues
|
// If thread was ready, adjust queues
|
||||||
@ -470,7 +470,7 @@ void Thread::SetPriority(s32 priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Thread::UpdatePriority() {
|
void Thread::UpdatePriority() {
|
||||||
s32 best_priority = nominal_priority;
|
u32 best_priority = nominal_priority;
|
||||||
for (auto& mutex : held_mutexes) {
|
for (auto& mutex : held_mutexes) {
|
||||||
if (mutex->priority < best_priority)
|
if (mutex->priority < best_priority)
|
||||||
best_priority = mutex->priority;
|
best_priority = mutex->priority;
|
||||||
@ -478,7 +478,7 @@ void Thread::UpdatePriority() {
|
|||||||
BoostPriority(best_priority);
|
BoostPriority(best_priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::BoostPriority(s32 priority) {
|
void Thread::BoostPriority(u32 priority) {
|
||||||
// If thread was ready, adjust queues
|
// If thread was ready, adjust queues
|
||||||
if (status == THREADSTATUS_READY)
|
if (status == THREADSTATUS_READY)
|
||||||
ready_queue.move(this, current_priority, priority);
|
ready_queue.move(this, current_priority, priority);
|
||||||
@ -487,7 +487,7 @@ void Thread::BoostPriority(s32 priority) {
|
|||||||
current_priority = priority;
|
current_priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPtr<Thread> SetupMainThread(u32 entry_point, s32 priority, SharedPtr<Process> owner_process) {
|
SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process) {
|
||||||
// Initialize new "main" thread
|
// Initialize new "main" thread
|
||||||
auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0,
|
auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0,
|
||||||
Memory::HEAP_VADDR_END, owner_process);
|
Memory::HEAP_VADDR_END, owner_process);
|
||||||
@ -531,7 +531,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) {
|
|||||||
s32 Thread::GetWaitObjectIndex(WaitObject* object) const {
|
s32 Thread::GetWaitObjectIndex(WaitObject* object) const {
|
||||||
ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything");
|
ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything");
|
||||||
auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object);
|
auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object);
|
||||||
return std::distance(match, wait_objects.rend()) - 1;
|
return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "core/hle/kernel/wait_object.h"
|
#include "core/hle/kernel/wait_object.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
enum ThreadPriority : s32 {
|
enum ThreadPriority : u32 {
|
||||||
THREADPRIO_HIGHEST = 0, ///< Highest thread priority
|
THREADPRIO_HIGHEST = 0, ///< Highest thread priority
|
||||||
THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps
|
THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps
|
||||||
THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps
|
THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
* Gets the thread's current priority
|
* Gets the thread's current priority
|
||||||
* @return The current thread's priority
|
* @return The current thread's priority
|
||||||
*/
|
*/
|
||||||
s32 GetPriority() const {
|
u32 GetPriority() const {
|
||||||
return current_priority;
|
return current_priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
* Sets the thread's current priority
|
* Sets the thread's current priority
|
||||||
* @param priority The new priority
|
* @param priority The new priority
|
||||||
*/
|
*/
|
||||||
void SetPriority(s32 priority);
|
void SetPriority(u32 priority);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boost's a thread's priority to the best priority among the thread's held mutexes.
|
* Boost's a thread's priority to the best priority among the thread's held mutexes.
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
* Temporarily boosts the thread's priority until the next time it is scheduled
|
* Temporarily boosts the thread's priority until the next time it is scheduled
|
||||||
* @param priority The new priority
|
* @param priority The new priority
|
||||||
*/
|
*/
|
||||||
void BoostPriority(s32 priority);
|
void BoostPriority(u32 priority);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the thread's thread ID
|
* Gets the thread's thread ID
|
||||||
@ -176,8 +176,8 @@ public:
|
|||||||
u32 entry_point;
|
u32 entry_point;
|
||||||
u32 stack_top;
|
u32 stack_top;
|
||||||
|
|
||||||
s32 nominal_priority; ///< Nominal thread priority, as set by the emulated application
|
u32 nominal_priority; ///< Nominal thread priority, as set by the emulated application
|
||||||
s32 current_priority; ///< Current thread priority, can be temporarily changed
|
u32 current_priority; ///< Current thread priority, can be temporarily changed
|
||||||
|
|
||||||
u64 last_running_ticks; ///< CPU tick when thread was last running
|
u64 last_running_ticks; ///< CPU tick when thread was last running
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ private:
|
|||||||
* @param owner_process The parent process for the main thread
|
* @param owner_process The parent process for the main thread
|
||||||
* @return A shared pointer to the main thread
|
* @return A shared pointer to the main thread
|
||||||
*/
|
*/
|
||||||
SharedPtr<Thread> SetupMainThread(u32 entry_point, s32 priority, SharedPtr<Process> owner_process);
|
SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether there are any threads that are ready to run.
|
* Returns whether there are any threads that are ready to run.
|
||||||
|
@ -34,7 +34,7 @@ void WaitObject::RemoveWaitingThread(Thread* thread) {
|
|||||||
|
|
||||||
SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
|
SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
|
||||||
Thread* candidate = nullptr;
|
Thread* candidate = nullptr;
|
||||||
s32 candidate_priority = THREADPRIO_LOWEST + 1;
|
u32 candidate_priority = THREADPRIO_LOWEST + 1;
|
||||||
|
|
||||||
for (const auto& thread : waiting_threads) {
|
for (const auto& thread : waiting_threads) {
|
||||||
// The list of waiting threads must not contain threads that are not waiting to be awakened.
|
// The list of waiting threads must not contain threads that are not waiting to be awakened.
|
||||||
|
@ -561,7 +561,7 @@ void ReceiveParameter(Service::Interface* self) {
|
|||||||
? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
|
? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
|
||||||
: 0);
|
: 0);
|
||||||
|
|
||||||
rb.PushStaticBuffer(buffer, static_cast<u32>(next_parameter->buffer.size()), 0);
|
rb.PushStaticBuffer(buffer, next_parameter->buffer.size(), 0);
|
||||||
|
|
||||||
Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
|
Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ void GlanceParameter(Service::Interface* self) {
|
|||||||
? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
|
? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
|
||||||
: 0);
|
: 0);
|
||||||
|
|
||||||
rb.PushStaticBuffer(buffer, static_cast<u32>(next_parameter->buffer.size()), 0);
|
rb.PushStaticBuffer(buffer, next_parameter->buffer.size(), 0);
|
||||||
|
|
||||||
Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
|
Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ void CompletionEventCallBack(u64 port_id, int) {
|
|||||||
LOG_ERROR(Service_CAM, "The destination size (%u) doesn't match the source (%zu)!",
|
LOG_ERROR(Service_CAM, "The destination size (%u) doesn't match the source (%zu)!",
|
||||||
port.dest_size, buffer_size);
|
port.dest_size, buffer_size);
|
||||||
}
|
}
|
||||||
Memory::WriteBlock(port.dest, buffer.data(), std::min<u32>(port.dest_size, buffer_size));
|
Memory::WriteBlock(port.dest, buffer.data(), std::min<size_t>(port.dest_size, buffer_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
port.is_receiving = false;
|
port.is_receiving = false;
|
||||||
|
@ -141,7 +141,7 @@ void GetCountryCodeString(Service::Interface* self) {
|
|||||||
|
|
||||||
void GetCountryCodeID(Service::Interface* self) {
|
void GetCountryCodeID(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
u16 country_code = cmd_buff[1];
|
u16 country_code = static_cast<u16>(cmd_buff[1]);
|
||||||
u16 country_code_id = 0;
|
u16 country_code_id = 0;
|
||||||
|
|
||||||
// The following algorithm will fail if the first country code isn't 0.
|
// The following algorithm will fail if the first country code isn't 0.
|
||||||
|
@ -217,7 +217,7 @@ void Directory::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> serve
|
|||||||
LOG_TRACE(Service_FS, "Read %s: count=%d", GetName().c_str(), count);
|
LOG_TRACE(Service_FS, "Read %s: count=%d", GetName().c_str(), count);
|
||||||
|
|
||||||
// Number of entries actually read
|
// Number of entries actually read
|
||||||
u32 read = backend->Read(entries.size(), entries.data());
|
u32 read = backend->Read(static_cast<u32>(entries.size()), entries.data());
|
||||||
cmd_buff[2] = read;
|
cmd_buff[2] = read;
|
||||||
Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry));
|
Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry));
|
||||||
break;
|
break;
|
||||||
|
@ -251,7 +251,7 @@ static void UpdateGyroscopeCallback(u64 userdata, int cycles_late) {
|
|||||||
Math::Vec3<float> gyro;
|
Math::Vec3<float> gyro;
|
||||||
std::tie(std::ignore, gyro) = motion_device->GetStatus();
|
std::tie(std::ignore, gyro) = motion_device->GetStatus();
|
||||||
double stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
|
double stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
|
||||||
gyro *= gyroscope_coef * stretch;
|
gyro *= gyroscope_coef * static_cast<float>(stretch);
|
||||||
gyroscope_entry.x = static_cast<s16>(gyro.x);
|
gyroscope_entry.x = static_cast<s16>(gyro.x);
|
||||||
gyroscope_entry.y = static_cast<s16>(gyro.y);
|
gyroscope_entry.y = static_cast<s16>(gyro.y);
|
||||||
gyroscope_entry.z = static_cast<s16>(gyro.z);
|
gyroscope_entry.z = static_cast<s16>(gyro.z);
|
||||||
|
@ -413,7 +413,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void GetEntry(std::size_t index, T& data) const {
|
void GetEntry(std::size_t index, T& data) const {
|
||||||
Memory::ReadBlock(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T), &data, sizeof(T));
|
Memory::ReadBlock(GetField(T::TABLE_OFFSET_FIELD) + static_cast<u32>(index * sizeof(T)),
|
||||||
|
&data, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,7 +426,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SetEntry(std::size_t index, const T& data) {
|
void SetEntry(std::size_t index, const T& data) {
|
||||||
Memory::WriteBlock(GetField(T::TABLE_OFFSET_FIELD) + index * sizeof(T), &data, sizeof(T));
|
Memory::WriteBlock(GetField(T::TABLE_OFFSET_FIELD) + static_cast<u32>(index * sizeof(T)),
|
||||||
|
&data, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -316,7 +316,7 @@ static void RecvBeaconBroadcastData(Interface* self) {
|
|||||||
auto beacons = GetReceivedBeacons(mac_address);
|
auto beacons = GetReceivedBeacons(mac_address);
|
||||||
|
|
||||||
BeaconDataReplyHeader data_reply_header{};
|
BeaconDataReplyHeader data_reply_header{};
|
||||||
data_reply_header.total_entries = beacons.size();
|
data_reply_header.total_entries = static_cast<u32>(beacons.size());
|
||||||
data_reply_header.max_output_size = out_buffer_size;
|
data_reply_header.max_output_size = out_buffer_size;
|
||||||
|
|
||||||
Memory::WriteBlock(current_buffer_pos, &data_reply_header, sizeof(BeaconDataReplyHeader));
|
Memory::WriteBlock(current_buffer_pos, &data_reply_header, sizeof(BeaconDataReplyHeader));
|
||||||
@ -326,8 +326,8 @@ static void RecvBeaconBroadcastData(Interface* self) {
|
|||||||
for (const auto& beacon : beacons) {
|
for (const auto& beacon : beacons) {
|
||||||
BeaconEntryHeader entry{};
|
BeaconEntryHeader entry{};
|
||||||
// TODO(Subv): Figure out what this size is used for.
|
// TODO(Subv): Figure out what this size is used for.
|
||||||
entry.unk_size = sizeof(BeaconEntryHeader) + beacon.data.size();
|
entry.unk_size = static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
|
||||||
entry.total_size = sizeof(BeaconEntryHeader) + beacon.data.size();
|
entry.total_size = static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
|
||||||
entry.wifi_channel = beacon.channel;
|
entry.wifi_channel = beacon.channel;
|
||||||
entry.header_size = sizeof(BeaconEntryHeader);
|
entry.header_size = sizeof(BeaconEntryHeader);
|
||||||
entry.mac_address = beacon.transmitter_address;
|
entry.mac_address = beacon.transmitter_address;
|
||||||
@ -338,9 +338,9 @@ static void RecvBeaconBroadcastData(Interface* self) {
|
|||||||
current_buffer_pos += sizeof(BeaconEntryHeader);
|
current_buffer_pos += sizeof(BeaconEntryHeader);
|
||||||
|
|
||||||
Memory::WriteBlock(current_buffer_pos, beacon.data.data(), beacon.data.size());
|
Memory::WriteBlock(current_buffer_pos, beacon.data.data(), beacon.data.size());
|
||||||
current_buffer_pos += beacon.data.size();
|
current_buffer_pos += static_cast<VAddr>(beacon.data.size());
|
||||||
|
|
||||||
total_size += sizeof(BeaconEntryHeader) + beacon.data.size();
|
total_size += static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -243,7 +243,7 @@ std::vector<u8> GenerateNintendoFirstEncryptedDataTag(const NetworkInfo& network
|
|||||||
|
|
||||||
EncryptedDataTag tag{};
|
EncryptedDataTag tag{};
|
||||||
tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
|
tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
|
||||||
tag.header.length = sizeof(tag) - sizeof(TagHeader) + payload_size;
|
tag.header.length = static_cast<u8>(sizeof(tag) - sizeof(TagHeader) + payload_size);
|
||||||
tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData0);
|
tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData0);
|
||||||
tag.oui = NintendoOUI;
|
tag.oui = NintendoOUI;
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ std::vector<u8> GenerateNintendoSecondEncryptedDataTag(const NetworkInfo& networ
|
|||||||
|
|
||||||
EncryptedDataTag tag{};
|
EncryptedDataTag tag{};
|
||||||
tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
|
tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
|
||||||
tag.header.length = tag_length;
|
tag.header.length = static_cast<u8>(tag_length);
|
||||||
tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData1);
|
tag.oui_type = static_cast<u8>(NintendoTagId::EncryptedData1);
|
||||||
tag.oui = NintendoOUI;
|
tag.oui = NintendoOUI;
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
|
|||||||
df.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL);
|
df.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL);
|
||||||
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
|
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
|
||||||
|
|
||||||
int size = df.MaxRetrievable();
|
size_t size = df.MaxRetrievable();
|
||||||
|
|
||||||
std::vector<u8> pdata(size);
|
std::vector<u8> pdata(size);
|
||||||
df.Get(pdata.data(), size);
|
df.Get(pdata.data(), size);
|
||||||
@ -251,7 +251,7 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
|
|||||||
|
|
||||||
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
|
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
|
||||||
|
|
||||||
int size = df.MaxRetrievable();
|
size_t size = df.MaxRetrievable();
|
||||||
|
|
||||||
std::vector<u8> cipher(size);
|
std::vector<u8> cipher(size);
|
||||||
df.Get(cipher.data(), size);
|
df.Get(cipher.data(), size);
|
||||||
@ -266,8 +266,8 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
|
|||||||
std::vector<u8> GenerateDataPayload(const std::vector<u8>& data, u8 channel, u16 dest_node,
|
std::vector<u8> GenerateDataPayload(const std::vector<u8>& data, u8 channel, u16 dest_node,
|
||||||
u16 src_node, u16 sequence_number) {
|
u16 src_node, u16 sequence_number) {
|
||||||
std::vector<u8> buffer = GenerateLLCHeader(EtherType::SecureData);
|
std::vector<u8> buffer = GenerateLLCHeader(EtherType::SecureData);
|
||||||
std::vector<u8> securedata_header =
|
std::vector<u8> securedata_header = GenerateSecureDataHeader(
|
||||||
GenerateSecureDataHeader(data.size(), channel, dest_node, src_node, sequence_number);
|
static_cast<u16>(data.size()), channel, dest_node, src_node, sequence_number);
|
||||||
|
|
||||||
buffer.insert(buffer.end(), securedata_header.begin(), securedata_header.end());
|
buffer.insert(buffer.end(), securedata_header.begin(), securedata_header.end());
|
||||||
buffer.insert(buffer.end(), data.begin(), data.end());
|
buffer.insert(buffer.end(), data.begin(), data.end());
|
||||||
|
@ -361,7 +361,7 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
|
|||||||
// We found a ready object, acquire it and set the result value
|
// We found a ready object, acquire it and set the result value
|
||||||
Kernel::WaitObject* object = itr->get();
|
Kernel::WaitObject* object = itr->get();
|
||||||
object->Acquire(thread);
|
object->Acquire(thread);
|
||||||
*out = std::distance(objects.begin(), itr);
|
*out = static_cast<s32>(std::distance(objects.begin(), itr));
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ static ResultCode ReplyAndReceive(s32* index, Kernel::Handle* handles, s32 handl
|
|||||||
// We found a ready object, acquire it and set the result value
|
// We found a ready object, acquire it and set the result value
|
||||||
Kernel::WaitObject* object = itr->get();
|
Kernel::WaitObject* object = itr->get();
|
||||||
object->Acquire(thread);
|
object->Acquire(thread);
|
||||||
*index = std::distance(objects.begin(), itr);
|
*index = static_cast<s32>(std::distance(objects.begin(), itr));
|
||||||
|
|
||||||
if (object->GetHandleType() == Kernel::HandleType::ServerSession) {
|
if (object->GetHandleType() == Kernel::HandleType::ServerSession) {
|
||||||
auto server_session = static_cast<Kernel::ServerSession*>(object);
|
auto server_session = static_cast<Kernel::ServerSession*>(object);
|
||||||
@ -683,7 +683,7 @@ static void ExitThread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the priority for the specified thread
|
/// Gets the priority for the specified thread
|
||||||
static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) {
|
static ResultCode GetThreadPriority(u32* priority, Kernel::Handle handle) {
|
||||||
const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
|
const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
|
||||||
if (thread == nullptr)
|
if (thread == nullptr)
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
@ -693,7 +693,7 @@ static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the priority for the specified thread
|
/// Sets the priority for the specified thread
|
||||||
static ResultCode SetThreadPriority(Kernel::Handle handle, s32 priority) {
|
static ResultCode SetThreadPriority(Kernel::Handle handle, u32 priority) {
|
||||||
if (priority > THREADPRIO_LOWEST) {
|
if (priority > THREADPRIO_LOWEST) {
|
||||||
return Kernel::ERR_OUT_OF_RANGE;
|
return Kernel::ERR_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -500,13 +500,15 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::Flush);
|
||||||
std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount);
|
std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedSpecial: {
|
case PageType::RasterizerCachedSpecial: {
|
||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::Flush);
|
||||||
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount);
|
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -544,7 +546,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -567,13 +569,15 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::FlushAndInvalidate);
|
||||||
std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount);
|
std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedSpecial: {
|
case PageType::RasterizerCachedSpecial: {
|
||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::FlushAndInvalidate);
|
||||||
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount);
|
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -597,7 +601,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -619,13 +623,15 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::FlushAndInvalidate);
|
||||||
std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount);
|
std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedSpecial: {
|
case PageType::RasterizerCachedSpecial: {
|
||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::FlushAndInvalidate);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::FlushAndInvalidate);
|
||||||
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount);
|
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -646,7 +652,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -670,13 +676,15 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::Flush);
|
||||||
WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount);
|
WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedSpecial: {
|
case PageType::RasterizerCachedSpecial: {
|
||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
RasterizerFlushVirtualRegion(current_vaddr, copy_amount, FlushMode::Flush);
|
RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
|
||||||
|
FlushMode::Flush);
|
||||||
|
|
||||||
std::vector<u8> buffer(copy_amount);
|
std::vector<u8> buffer(copy_amount);
|
||||||
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size());
|
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) {
|
|||||||
|
|
||||||
page_index++;
|
page_index++;
|
||||||
page_offset = 0;
|
page_offset = 0;
|
||||||
dest_addr += copy_amount;
|
dest_addr += static_cast<VAddr>(copy_amount);
|
||||||
src_addr += copy_amount;
|
src_addr += static_cast<VAddr>(copy_amount);
|
||||||
remaining_size -= copy_amount;
|
remaining_size -= copy_amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ Packet& Packet::operator<<(double in_data) {
|
|||||||
|
|
||||||
Packet& Packet::operator<<(const char* in_data) {
|
Packet& Packet::operator<<(const char* in_data) {
|
||||||
// First insert string length
|
// First insert string length
|
||||||
u32 length = std::strlen(in_data);
|
u32 length = static_cast<u32>(std::strlen(in_data));
|
||||||
*this << length;
|
*this << length;
|
||||||
|
|
||||||
// Then insert characters
|
// Then insert characters
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
DEBUG_ASSERT(need_index);
|
DEBUG_ASSERT(need_index);
|
||||||
|
|
||||||
// The number of vertex input is put to the uniform register
|
// The number of vertex input is put to the uniform register
|
||||||
float24 vertex_num = float24::FromFloat32(val);
|
float24 vertex_num = float24::FromFloat32(static_cast<float>(val));
|
||||||
setup.uniforms.f[0] = Math::MakeVec(vertex_num, vertex_num, vertex_num, vertex_num);
|
setup.uniforms.f[0] = Math::MakeVec(vertex_num, vertex_num, vertex_num, vertex_num);
|
||||||
|
|
||||||
// The second uniform register and so on are used for receiving input vertices
|
// The second uniform register and so on are used for receiving input vertices
|
||||||
|
@ -267,9 +267,9 @@ void OpenGLState::Apply() const {
|
|||||||
for (size_t i = 0; i < clip_distance.size(); ++i) {
|
for (size_t i = 0; i < clip_distance.size(); ++i) {
|
||||||
if (clip_distance[i] != cur_state.clip_distance[i]) {
|
if (clip_distance[i] != cur_state.clip_distance[i]) {
|
||||||
if (clip_distance[i]) {
|
if (clip_distance[i]) {
|
||||||
glEnable(GL_CLIP_DISTANCE0 + i);
|
glEnable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i));
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_CLIP_DISTANCE0 + i);
|
glDisable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user