diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/partition_filesystem.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.h | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/mutex.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/kernel/server_session.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 47 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 28 | ||||
| -rw-r--r-- | src/core/hle/kernel/wait_object.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audout_u.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 6 | ||||
| -rw-r--r-- | src/core/loader/nca.cpp | 3 | ||||
| -rw-r--r-- | src/core/loader/nro.cpp | 3 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 23 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 36 | ||||
| -rw-r--r-- | src/yuzu/debugger/wait_tree.cpp | 44 |
21 files changed, 138 insertions, 143 deletions
diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index d4097a510..7ccca1089 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp | |||
| @@ -76,7 +76,7 @@ std::vector<std::shared_ptr<VfsFile>> PartitionFilesystem::GetFiles() const { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | std::vector<std::shared_ptr<VfsDirectory>> PartitionFilesystem::GetSubdirectories() const { | 78 | std::vector<std::shared_ptr<VfsDirectory>> PartitionFilesystem::GetSubdirectories() const { |
| 79 | return {}; | 79 | return pfs_dirs; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | std::string PartitionFilesystem::GetName() const { | 82 | std::string PartitionFilesystem::GetName() const { |
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp index 288499cb5..31fdd9aa1 100644 --- a/src/core/file_sys/vfs_offset.cpp +++ b/src/core/file_sys/vfs_offset.cpp | |||
| @@ -2,13 +2,15 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <utility> | ||
| 6 | |||
| 5 | #include "core/file_sys/vfs_offset.h" | 7 | #include "core/file_sys/vfs_offset.h" |
| 6 | 8 | ||
| 7 | namespace FileSys { | 9 | namespace FileSys { |
| 8 | 10 | ||
| 9 | OffsetVfsFile::OffsetVfsFile(std::shared_ptr<VfsFile> file_, size_t size_, size_t offset_, | 11 | OffsetVfsFile::OffsetVfsFile(std::shared_ptr<VfsFile> file_, size_t size_, size_t offset_, |
| 10 | const std::string& name_) | 12 | std::string name_) |
| 11 | : file(file_), offset(offset_), size(size_), name(name_) {} | 13 | : file(std::move(file_)), offset(offset_), size(size_), name(std::move(name_)) {} |
| 12 | 14 | ||
| 13 | std::string OffsetVfsFile::GetName() const { | 15 | std::string OffsetVfsFile::GetName() const { |
| 14 | return name.empty() ? file->GetName() : name; | 16 | return name.empty() ? file->GetName() : name; |
diff --git a/src/core/file_sys/vfs_offset.h b/src/core/file_sys/vfs_offset.h index adc615b38..2e16e47eb 100644 --- a/src/core/file_sys/vfs_offset.h +++ b/src/core/file_sys/vfs_offset.h | |||
| @@ -14,7 +14,7 @@ namespace FileSys { | |||
| 14 | // the size of this wrapper. | 14 | // the size of this wrapper. |
| 15 | struct OffsetVfsFile : public VfsFile { | 15 | struct OffsetVfsFile : public VfsFile { |
| 16 | OffsetVfsFile(std::shared_ptr<VfsFile> file, size_t size, size_t offset = 0, | 16 | OffsetVfsFile(std::shared_ptr<VfsFile> file, size_t size, size_t offset = 0, |
| 17 | const std::string& new_name = ""); | 17 | std::string new_name = ""); |
| 18 | 18 | ||
| 19 | std::string GetName() const override; | 19 | std::string GetName() const override; |
| 20 | size_t GetSize() const override; | 20 | size_t GetSize() const override; |
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index dcc68aabf..233fdab25 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp | |||
| @@ -20,7 +20,7 @@ namespace AddressArbiter { | |||
| 20 | static ResultCode WaitForAddress(VAddr address, s64 timeout) { | 20 | static ResultCode WaitForAddress(VAddr address, s64 timeout) { |
| 21 | SharedPtr<Thread> current_thread = GetCurrentThread(); | 21 | SharedPtr<Thread> current_thread = GetCurrentThread(); |
| 22 | current_thread->arb_wait_address = address; | 22 | current_thread->arb_wait_address = address; |
| 23 | current_thread->status = THREADSTATUS_WAIT_ARB; | 23 | current_thread->status = ThreadStatus::WaitArb; |
| 24 | current_thread->wakeup_callback = nullptr; | 24 | current_thread->wakeup_callback = nullptr; |
| 25 | 25 | ||
| 26 | current_thread->WakeAfterDelay(timeout); | 26 | current_thread->WakeAfterDelay(timeout); |
| @@ -65,7 +65,7 @@ static void WakeThreads(std::vector<SharedPtr<Thread>>& waiting_threads, s32 num | |||
| 65 | 65 | ||
| 66 | // Signal the waiting threads. | 66 | // Signal the waiting threads. |
| 67 | for (size_t i = 0; i < last; i++) { | 67 | for (size_t i = 0; i < last; i++) { |
| 68 | ASSERT(waiting_threads[i]->status == THREADSTATUS_WAIT_ARB); | 68 | ASSERT(waiting_threads[i]->status == ThreadStatus::WaitArb); |
| 69 | waiting_threads[i]->SetWaitSynchronizationResult(RESULT_SUCCESS); | 69 | waiting_threads[i]->SetWaitSynchronizationResult(RESULT_SUCCESS); |
| 70 | waiting_threads[i]->arb_wait_address = 0; | 70 | waiting_threads[i]->arb_wait_address = 0; |
| 71 | waiting_threads[i]->ResumeFromWait(); | 71 | waiting_threads[i]->ResumeFromWait(); |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 8f40bdd5a..f24392520 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -38,7 +38,7 @@ SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread, | |||
| 38 | thread->wakeup_callback = | 38 | thread->wakeup_callback = |
| 39 | [context = *this, callback](ThreadWakeupReason reason, SharedPtr<Thread> thread, | 39 | [context = *this, callback](ThreadWakeupReason reason, SharedPtr<Thread> thread, |
| 40 | SharedPtr<WaitObject> object, size_t index) mutable -> bool { | 40 | SharedPtr<WaitObject> object, size_t index) mutable -> bool { |
| 41 | ASSERT(thread->status == THREADSTATUS_WAIT_HLE_EVENT); | 41 | ASSERT(thread->status == ThreadStatus::WaitHLEEvent); |
| 42 | callback(thread, context, reason); | 42 | callback(thread, context, reason); |
| 43 | context.WriteToOutgoingCommandBuffer(*thread); | 43 | context.WriteToOutgoingCommandBuffer(*thread); |
| 44 | return true; | 44 | return true; |
| @@ -50,7 +50,7 @@ SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread, | |||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | event->Clear(); | 52 | event->Clear(); |
| 53 | thread->status = THREADSTATUS_WAIT_HLE_EVENT; | 53 | thread->status = ThreadStatus::WaitHLEEvent; |
| 54 | thread->wait_objects = {event}; | 54 | thread->wait_objects = {event}; |
| 55 | event->AddWaitingThread(thread); | 55 | event->AddWaitingThread(thread); |
| 56 | 56 | ||
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 65560226d..3f1de3258 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -28,7 +28,7 @@ static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread( | |||
| 28 | if (thread->mutex_wait_address != mutex_addr) | 28 | if (thread->mutex_wait_address != mutex_addr) |
| 29 | continue; | 29 | continue; |
| 30 | 30 | ||
| 31 | ASSERT(thread->status == THREADSTATUS_WAIT_MUTEX); | 31 | ASSERT(thread->status == ThreadStatus::WaitMutex); |
| 32 | 32 | ||
| 33 | ++num_waiters; | 33 | ++num_waiters; |
| 34 | if (highest_priority_thread == nullptr || | 34 | if (highest_priority_thread == nullptr || |
| @@ -83,7 +83,7 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, | |||
| 83 | GetCurrentThread()->mutex_wait_address = address; | 83 | GetCurrentThread()->mutex_wait_address = address; |
| 84 | GetCurrentThread()->wait_handle = requesting_thread_handle; | 84 | GetCurrentThread()->wait_handle = requesting_thread_handle; |
| 85 | 85 | ||
| 86 | GetCurrentThread()->status = THREADSTATUS_WAIT_MUTEX; | 86 | GetCurrentThread()->status = ThreadStatus::WaitMutex; |
| 87 | GetCurrentThread()->wakeup_callback = nullptr; | 87 | GetCurrentThread()->wakeup_callback = nullptr; |
| 88 | 88 | ||
| 89 | // Update the lock holder thread's priority to prevent priority inversion. | 89 | // Update the lock holder thread's priority to prevent priority inversion. |
| @@ -121,7 +121,7 @@ ResultCode Mutex::Release(VAddr address) { | |||
| 121 | // Grant the mutex to the next waiting thread and resume it. | 121 | // Grant the mutex to the next waiting thread and resume it. |
| 122 | Memory::Write32(address, mutex_value); | 122 | Memory::Write32(address, mutex_value); |
| 123 | 123 | ||
| 124 | ASSERT(thread->status == THREADSTATUS_WAIT_MUTEX); | 124 | ASSERT(thread->status == ThreadStatus::WaitMutex); |
| 125 | thread->ResumeFromWait(); | 125 | thread->ResumeFromWait(); |
| 126 | 126 | ||
| 127 | thread->lock_owner = nullptr; | 127 | thread->lock_owner = nullptr; |
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 1f4abfbe8..f7e25cbf5 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -34,7 +34,7 @@ Thread* Scheduler::PopNextReadyThread() { | |||
| 34 | Thread* next = nullptr; | 34 | Thread* next = nullptr; |
| 35 | Thread* thread = GetCurrentThread(); | 35 | Thread* thread = GetCurrentThread(); |
| 36 | 36 | ||
| 37 | if (thread && thread->status == THREADSTATUS_RUNNING) { | 37 | if (thread && thread->status == ThreadStatus::Running) { |
| 38 | // We have to do better than the current thread. | 38 | // We have to do better than the current thread. |
| 39 | // This call returns null when that's not possible. | 39 | // This call returns null when that's not possible. |
| 40 | next = ready_queue.pop_first_better(thread->current_priority); | 40 | next = ready_queue.pop_first_better(thread->current_priority); |
| @@ -57,17 +57,17 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 57 | previous_thread->last_running_ticks = CoreTiming::GetTicks(); | 57 | previous_thread->last_running_ticks = CoreTiming::GetTicks(); |
| 58 | cpu_core->SaveContext(previous_thread->context); | 58 | cpu_core->SaveContext(previous_thread->context); |
| 59 | 59 | ||
| 60 | if (previous_thread->status == THREADSTATUS_RUNNING) { | 60 | if (previous_thread->status == ThreadStatus::Running) { |
| 61 | // This is only the case when a reschedule is triggered without the current thread | 61 | // This is only the case when a reschedule is triggered without the current thread |
| 62 | // yielding execution (i.e. an event triggered, system core time-sliced, etc) | 62 | // yielding execution (i.e. an event triggered, system core time-sliced, etc) |
| 63 | ready_queue.push_front(previous_thread->current_priority, previous_thread); | 63 | ready_queue.push_front(previous_thread->current_priority, previous_thread); |
| 64 | previous_thread->status = THREADSTATUS_READY; | 64 | previous_thread->status = ThreadStatus::Ready; |
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | // Load context of new thread | 68 | // Load context of new thread |
| 69 | if (new_thread) { | 69 | if (new_thread) { |
| 70 | ASSERT_MSG(new_thread->status == THREADSTATUS_READY, | 70 | ASSERT_MSG(new_thread->status == ThreadStatus::Ready, |
| 71 | "Thread must be ready to become running."); | 71 | "Thread must be ready to become running."); |
| 72 | 72 | ||
| 73 | // Cancel any outstanding wakeup events for this thread | 73 | // Cancel any outstanding wakeup events for this thread |
| @@ -78,7 +78,7 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 78 | current_thread = new_thread; | 78 | current_thread = new_thread; |
| 79 | 79 | ||
| 80 | ready_queue.remove(new_thread->current_priority, new_thread); | 80 | ready_queue.remove(new_thread->current_priority, new_thread); |
| 81 | new_thread->status = THREADSTATUS_RUNNING; | 81 | new_thread->status = ThreadStatus::Running; |
| 82 | 82 | ||
| 83 | if (previous_process != current_thread->owner_process) { | 83 | if (previous_process != current_thread->owner_process) { |
| 84 | Core::CurrentProcess() = current_thread->owner_process; | 84 | Core::CurrentProcess() = current_thread->owner_process; |
| @@ -129,14 +129,14 @@ void Scheduler::RemoveThread(Thread* thread) { | |||
| 129 | void Scheduler::ScheduleThread(Thread* thread, u32 priority) { | 129 | void Scheduler::ScheduleThread(Thread* thread, u32 priority) { |
| 130 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 130 | std::lock_guard<std::mutex> lock(scheduler_mutex); |
| 131 | 131 | ||
| 132 | ASSERT(thread->status == THREADSTATUS_READY); | 132 | ASSERT(thread->status == ThreadStatus::Ready); |
| 133 | ready_queue.push_back(priority, thread); | 133 | ready_queue.push_back(priority, thread); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { | 136 | void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { |
| 137 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 137 | std::lock_guard<std::mutex> lock(scheduler_mutex); |
| 138 | 138 | ||
| 139 | ASSERT(thread->status == THREADSTATUS_READY); | 139 | ASSERT(thread->status == ThreadStatus::Ready); |
| 140 | ready_queue.remove(priority, thread); | 140 | ready_queue.remove(priority, thread); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| @@ -144,7 +144,7 @@ void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { | |||
| 144 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 144 | std::lock_guard<std::mutex> lock(scheduler_mutex); |
| 145 | 145 | ||
| 146 | // If thread was ready, adjust queues | 146 | // If thread was ready, adjust queues |
| 147 | if (thread->status == THREADSTATUS_READY) | 147 | if (thread->status == ThreadStatus::Ready) |
| 148 | ready_queue.move(thread, thread->current_priority, priority); | 148 | ready_queue.move(thread, thread->current_priority, priority); |
| 149 | else | 149 | else |
| 150 | ready_queue.prepare(priority); | 150 | ready_queue.prepare(priority); |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 19d17af4f..29b163528 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -110,10 +110,10 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) { | |||
| 110 | result = hle_handler->HandleSyncRequest(context); | 110 | result = hle_handler->HandleSyncRequest(context); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | if (thread->status == THREADSTATUS_RUNNING) { | 113 | if (thread->status == ThreadStatus::Running) { |
| 114 | // Put the thread to sleep until the server replies, it will be awoken in | 114 | // Put the thread to sleep until the server replies, it will be awoken in |
| 115 | // svcReplyAndReceive for LLE servers. | 115 | // svcReplyAndReceive for LLE servers. |
| 116 | thread->status = THREADSTATUS_WAIT_IPC; | 116 | thread->status = ThreadStatus::WaitIPC; |
| 117 | 117 | ||
| 118 | if (hle_handler != nullptr) { | 118 | if (hle_handler != nullptr) { |
| 119 | // For HLE services, we put the request threads to sleep for a short duration to | 119 | // For HLE services, we put the request threads to sleep for a short duration to |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index c6b0bb442..6b2995fe2 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -133,7 +133,7 @@ static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | |||
| 133 | /// Default thread wakeup callback for WaitSynchronization | 133 | /// Default thread wakeup callback for WaitSynchronization |
| 134 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> thread, | 134 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> thread, |
| 135 | SharedPtr<WaitObject> object, size_t index) { | 135 | SharedPtr<WaitObject> object, size_t index) { |
| 136 | ASSERT(thread->status == THREADSTATUS_WAIT_SYNCH_ANY); | 136 | ASSERT(thread->status == ThreadStatus::WaitSynchAny); |
| 137 | 137 | ||
| 138 | if (reason == ThreadWakeupReason::Timeout) { | 138 | if (reason == ThreadWakeupReason::Timeout) { |
| 139 | thread->SetWaitSynchronizationResult(RESULT_TIMEOUT); | 139 | thread->SetWaitSynchronizationResult(RESULT_TIMEOUT); |
| @@ -197,7 +197,7 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 | |||
| 197 | object->AddWaitingThread(thread); | 197 | object->AddWaitingThread(thread); |
| 198 | 198 | ||
| 199 | thread->wait_objects = std::move(objects); | 199 | thread->wait_objects = std::move(objects); |
| 200 | thread->status = THREADSTATUS_WAIT_SYNCH_ANY; | 200 | thread->status = ThreadStatus::WaitSynchAny; |
| 201 | 201 | ||
| 202 | // Create an event to wake the thread up after the specified nanosecond delay has passed | 202 | // Create an event to wake the thread up after the specified nanosecond delay has passed |
| 203 | thread->WakeAfterDelay(nano_seconds); | 203 | thread->WakeAfterDelay(nano_seconds); |
| @@ -217,7 +217,7 @@ static ResultCode CancelSynchronization(Handle thread_handle) { | |||
| 217 | return ERR_INVALID_HANDLE; | 217 | return ERR_INVALID_HANDLE; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | ASSERT(thread->status == THREADSTATUS_WAIT_SYNCH_ANY); | 220 | ASSERT(thread->status == ThreadStatus::WaitSynchAny); |
| 221 | thread->SetWaitSynchronizationResult( | 221 | thread->SetWaitSynchronizationResult( |
| 222 | ResultCode(ErrorModule::Kernel, ErrCodes::SynchronizationCanceled)); | 222 | ResultCode(ErrorModule::Kernel, ErrCodes::SynchronizationCanceled)); |
| 223 | thread->ResumeFromWait(); | 223 | thread->ResumeFromWait(); |
| @@ -468,8 +468,8 @@ static void ExitProcess() { | |||
| 468 | continue; | 468 | continue; |
| 469 | 469 | ||
| 470 | // TODO(Subv): When are the other running/ready threads terminated? | 470 | // TODO(Subv): When are the other running/ready threads terminated? |
| 471 | ASSERT_MSG(thread->status == THREADSTATUS_WAIT_SYNCH_ANY || | 471 | ASSERT_MSG(thread->status == ThreadStatus::WaitSynchAny || |
| 472 | thread->status == THREADSTATUS_WAIT_SYNCH_ALL, | 472 | thread->status == ThreadStatus::WaitSynchAll, |
| 473 | "Exiting processes with non-waiting threads is currently unimplemented"); | 473 | "Exiting processes with non-waiting threads is currently unimplemented"); |
| 474 | 474 | ||
| 475 | thread->Stop(); | 475 | thread->Stop(); |
| @@ -545,7 +545,7 @@ static ResultCode StartThread(Handle thread_handle) { | |||
| 545 | return ERR_INVALID_HANDLE; | 545 | return ERR_INVALID_HANDLE; |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | ASSERT(thread->status == THREADSTATUS_DORMANT); | 548 | ASSERT(thread->status == ThreadStatus::Dormant); |
| 549 | 549 | ||
| 550 | thread->ResumeFromWait(); | 550 | thread->ResumeFromWait(); |
| 551 | Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); | 551 | Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); |
| @@ -596,7 +596,7 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var | |||
| 596 | current_thread->condvar_wait_address = condition_variable_addr; | 596 | current_thread->condvar_wait_address = condition_variable_addr; |
| 597 | current_thread->mutex_wait_address = mutex_addr; | 597 | current_thread->mutex_wait_address = mutex_addr; |
| 598 | current_thread->wait_handle = thread_handle; | 598 | current_thread->wait_handle = thread_handle; |
| 599 | current_thread->status = THREADSTATUS_WAIT_MUTEX; | 599 | current_thread->status = ThreadStatus::WaitMutex; |
| 600 | current_thread->wakeup_callback = nullptr; | 600 | current_thread->wakeup_callback = nullptr; |
| 601 | 601 | ||
| 602 | current_thread->WakeAfterDelay(nano_seconds); | 602 | current_thread->WakeAfterDelay(nano_seconds); |
| @@ -656,7 +656,7 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target | |||
| 656 | if (mutex_val == 0) { | 656 | if (mutex_val == 0) { |
| 657 | // We were able to acquire the mutex, resume this thread. | 657 | // We were able to acquire the mutex, resume this thread. |
| 658 | Memory::Write32(thread->mutex_wait_address, thread->wait_handle); | 658 | Memory::Write32(thread->mutex_wait_address, thread->wait_handle); |
| 659 | ASSERT(thread->status == THREADSTATUS_WAIT_MUTEX); | 659 | ASSERT(thread->status == ThreadStatus::WaitMutex); |
| 660 | thread->ResumeFromWait(); | 660 | thread->ResumeFromWait(); |
| 661 | 661 | ||
| 662 | auto lock_owner = thread->lock_owner; | 662 | auto lock_owner = thread->lock_owner; |
| @@ -672,8 +672,8 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target | |||
| 672 | Handle owner_handle = static_cast<Handle>(mutex_val & Mutex::MutexOwnerMask); | 672 | Handle owner_handle = static_cast<Handle>(mutex_val & Mutex::MutexOwnerMask); |
| 673 | auto owner = g_handle_table.Get<Thread>(owner_handle); | 673 | auto owner = g_handle_table.Get<Thread>(owner_handle); |
| 674 | ASSERT(owner); | 674 | ASSERT(owner); |
| 675 | ASSERT(thread->status != THREADSTATUS_RUNNING); | 675 | ASSERT(thread->status != ThreadStatus::Running); |
| 676 | thread->status = THREADSTATUS_WAIT_MUTEX; | 676 | thread->status = ThreadStatus::WaitMutex; |
| 677 | thread->wakeup_callback = nullptr; | 677 | thread->wakeup_callback = nullptr; |
| 678 | 678 | ||
| 679 | // Signal that the mutex now has a waiting thread. | 679 | // Signal that the mutex now has a waiting thread. |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index e7fd6c842..53f2e861e 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -30,7 +30,7 @@ namespace Kernel { | |||
| 30 | static CoreTiming::EventType* ThreadWakeupEventType = nullptr; | 30 | static CoreTiming::EventType* ThreadWakeupEventType = nullptr; |
| 31 | 31 | ||
| 32 | bool Thread::ShouldWait(Thread* thread) const { | 32 | bool Thread::ShouldWait(Thread* thread) const { |
| 33 | return status != THREADSTATUS_DEAD; | 33 | return status != ThreadStatus::Dead; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void Thread::Acquire(Thread* thread) { | 36 | void Thread::Acquire(Thread* thread) { |
| @@ -63,11 +63,11 @@ void Thread::Stop() { | |||
| 63 | 63 | ||
| 64 | // Clean up thread from ready queue | 64 | // Clean up thread from ready queue |
| 65 | // This is only needed when the thread is termintated forcefully (SVC TerminateProcess) | 65 | // This is only needed when the thread is termintated forcefully (SVC TerminateProcess) |
| 66 | if (status == THREADSTATUS_READY) { | 66 | if (status == ThreadStatus::Ready) { |
| 67 | scheduler->UnscheduleThread(this, current_priority); | 67 | scheduler->UnscheduleThread(this, current_priority); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | status = THREADSTATUS_DEAD; | 70 | status = ThreadStatus::Dead; |
| 71 | 71 | ||
| 72 | WakeupAllWaitingThreads(); | 72 | WakeupAllWaitingThreads(); |
| 73 | 73 | ||
| @@ -86,7 +86,7 @@ void Thread::Stop() { | |||
| 86 | 86 | ||
| 87 | void WaitCurrentThread_Sleep() { | 87 | void WaitCurrentThread_Sleep() { |
| 88 | Thread* thread = GetCurrentThread(); | 88 | Thread* thread = GetCurrentThread(); |
| 89 | thread->status = THREADSTATUS_WAIT_SLEEP; | 89 | thread->status = ThreadStatus::WaitSleep; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | void ExitCurrentThread() { | 92 | void ExitCurrentThread() { |
| @@ -110,10 +110,9 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { | |||
| 110 | 110 | ||
| 111 | bool resume = true; | 111 | bool resume = true; |
| 112 | 112 | ||
| 113 | if (thread->status == THREADSTATUS_WAIT_SYNCH_ANY || | 113 | if (thread->status == ThreadStatus::WaitSynchAny || |
| 114 | thread->status == THREADSTATUS_WAIT_SYNCH_ALL || | 114 | thread->status == ThreadStatus::WaitSynchAll || |
| 115 | thread->status == THREADSTATUS_WAIT_HLE_EVENT) { | 115 | thread->status == ThreadStatus::WaitHLEEvent) { |
| 116 | |||
| 117 | // Remove the thread from each of its waiting objects' waitlists | 116 | // Remove the thread from each of its waiting objects' waitlists |
| 118 | for (auto& object : thread->wait_objects) | 117 | for (auto& object : thread->wait_objects) |
| 119 | object->RemoveWaitingThread(thread.get()); | 118 | object->RemoveWaitingThread(thread.get()); |
| @@ -126,7 +125,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { | |||
| 126 | 125 | ||
| 127 | if (thread->mutex_wait_address != 0 || thread->condvar_wait_address != 0 || | 126 | if (thread->mutex_wait_address != 0 || thread->condvar_wait_address != 0 || |
| 128 | thread->wait_handle) { | 127 | thread->wait_handle) { |
| 129 | ASSERT(thread->status == THREADSTATUS_WAIT_MUTEX); | 128 | ASSERT(thread->status == ThreadStatus::WaitMutex); |
| 130 | thread->mutex_wait_address = 0; | 129 | thread->mutex_wait_address = 0; |
| 131 | thread->condvar_wait_address = 0; | 130 | thread->condvar_wait_address = 0; |
| 132 | thread->wait_handle = 0; | 131 | thread->wait_handle = 0; |
| @@ -141,7 +140,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { | |||
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | if (thread->arb_wait_address != 0) { | 142 | if (thread->arb_wait_address != 0) { |
| 144 | ASSERT(thread->status == THREADSTATUS_WAIT_ARB); | 143 | ASSERT(thread->status == ThreadStatus::WaitArb); |
| 145 | thread->arb_wait_address = 0; | 144 | thread->arb_wait_address = 0; |
| 146 | } | 145 | } |
| 147 | 146 | ||
| @@ -178,28 +177,28 @@ void Thread::ResumeFromWait() { | |||
| 178 | ASSERT_MSG(wait_objects.empty(), "Thread is waking up while waiting for objects"); | 177 | ASSERT_MSG(wait_objects.empty(), "Thread is waking up while waiting for objects"); |
| 179 | 178 | ||
| 180 | switch (status) { | 179 | switch (status) { |
| 181 | case THREADSTATUS_WAIT_SYNCH_ALL: | 180 | case ThreadStatus::WaitSynchAll: |
| 182 | case THREADSTATUS_WAIT_SYNCH_ANY: | 181 | case ThreadStatus::WaitSynchAny: |
| 183 | case THREADSTATUS_WAIT_HLE_EVENT: | 182 | case ThreadStatus::WaitHLEEvent: |
| 184 | case THREADSTATUS_WAIT_SLEEP: | 183 | case ThreadStatus::WaitSleep: |
| 185 | case THREADSTATUS_WAIT_IPC: | 184 | case ThreadStatus::WaitIPC: |
| 186 | case THREADSTATUS_WAIT_MUTEX: | 185 | case ThreadStatus::WaitMutex: |
| 187 | case THREADSTATUS_WAIT_ARB: | 186 | case ThreadStatus::WaitArb: |
| 188 | break; | 187 | break; |
| 189 | 188 | ||
| 190 | case THREADSTATUS_READY: | 189 | case ThreadStatus::Ready: |
| 191 | // The thread's wakeup callback must have already been cleared when the thread was first | 190 | // The thread's wakeup callback must have already been cleared when the thread was first |
| 192 | // awoken. | 191 | // awoken. |
| 193 | ASSERT(wakeup_callback == nullptr); | 192 | ASSERT(wakeup_callback == nullptr); |
| 194 | // If the thread is waiting on multiple wait objects, it might be awoken more than once | 193 | // If the thread is waiting on multiple wait objects, it might be awoken more than once |
| 195 | // before actually resuming. We can ignore subsequent wakeups if the thread status has | 194 | // before actually resuming. We can ignore subsequent wakeups if the thread status has |
| 196 | // already been set to THREADSTATUS_READY. | 195 | // already been set to ThreadStatus::Ready. |
| 197 | return; | 196 | return; |
| 198 | 197 | ||
| 199 | case THREADSTATUS_RUNNING: | 198 | case ThreadStatus::Running: |
| 200 | DEBUG_ASSERT_MSG(false, "Thread with object id {} has already resumed.", GetObjectId()); | 199 | DEBUG_ASSERT_MSG(false, "Thread with object id {} has already resumed.", GetObjectId()); |
| 201 | return; | 200 | return; |
| 202 | case THREADSTATUS_DEAD: | 201 | case ThreadStatus::Dead: |
| 203 | // This should never happen, as threads must complete before being stopped. | 202 | // This should never happen, as threads must complete before being stopped. |
| 204 | DEBUG_ASSERT_MSG(false, "Thread with object id {} cannot be resumed because it's DEAD.", | 203 | DEBUG_ASSERT_MSG(false, "Thread with object id {} cannot be resumed because it's DEAD.", |
| 205 | GetObjectId()); | 204 | GetObjectId()); |
| @@ -208,7 +207,7 @@ void Thread::ResumeFromWait() { | |||
| 208 | 207 | ||
| 209 | wakeup_callback = nullptr; | 208 | wakeup_callback = nullptr; |
| 210 | 209 | ||
| 211 | status = THREADSTATUS_READY; | 210 | status = ThreadStatus::Ready; |
| 212 | 211 | ||
| 213 | boost::optional<s32> new_processor_id = GetNextProcessorId(affinity_mask); | 212 | boost::optional<s32> new_processor_id = GetNextProcessorId(affinity_mask); |
| 214 | if (!new_processor_id) { | 213 | if (!new_processor_id) { |
| @@ -310,7 +309,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 310 | SharedPtr<Thread> thread(new Thread); | 309 | SharedPtr<Thread> thread(new Thread); |
| 311 | 310 | ||
| 312 | thread->thread_id = NewThreadId(); | 311 | thread->thread_id = NewThreadId(); |
| 313 | thread->status = THREADSTATUS_DORMANT; | 312 | thread->status = ThreadStatus::Dormant; |
| 314 | thread->entry_point = entry_point; | 313 | thread->entry_point = entry_point; |
| 315 | thread->stack_top = stack_top; | 314 | thread->stack_top = stack_top; |
| 316 | thread->nominal_priority = thread->current_priority = priority; | 315 | thread->nominal_priority = thread->current_priority = priority; |
| @@ -471,7 +470,7 @@ void Thread::ChangeCore(u32 core, u64 mask) { | |||
| 471 | ideal_core = core; | 470 | ideal_core = core; |
| 472 | affinity_mask = mask; | 471 | affinity_mask = mask; |
| 473 | 472 | ||
| 474 | if (status != THREADSTATUS_READY) { | 473 | if (status != ThreadStatus::Ready) { |
| 475 | return; | 474 | return; |
| 476 | } | 475 | } |
| 477 | 476 | ||
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index f1e759802..47881ec20 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -36,18 +36,18 @@ enum ThreadProcessorId : s32 { | |||
| 36 | (1 << THREADPROCESSORID_2) | (1 << THREADPROCESSORID_3) | 36 | (1 << THREADPROCESSORID_2) | (1 << THREADPROCESSORID_3) |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | enum ThreadStatus { | 39 | enum class ThreadStatus { |
| 40 | THREADSTATUS_RUNNING, ///< Currently running | 40 | Running, ///< Currently running |
| 41 | THREADSTATUS_READY, ///< Ready to run | 41 | Ready, ///< Ready to run |
| 42 | THREADSTATUS_WAIT_HLE_EVENT, ///< Waiting for hle event to finish | 42 | WaitHLEEvent, ///< Waiting for hle event to finish |
| 43 | THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC | 43 | WaitSleep, ///< Waiting due to a SleepThread SVC |
| 44 | THREADSTATUS_WAIT_IPC, ///< Waiting for the reply from an IPC request | 44 | WaitIPC, ///< Waiting for the reply from an IPC request |
| 45 | THREADSTATUS_WAIT_SYNCH_ANY, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false | 45 | WaitSynchAny, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false |
| 46 | THREADSTATUS_WAIT_SYNCH_ALL, ///< Waiting due to WaitSynchronizationN with wait_all = true | 46 | WaitSynchAll, ///< Waiting due to WaitSynchronizationN with wait_all = true |
| 47 | THREADSTATUS_WAIT_MUTEX, ///< Waiting due to an ArbitrateLock/WaitProcessWideKey svc | 47 | WaitMutex, ///< Waiting due to an ArbitrateLock/WaitProcessWideKey svc |
| 48 | THREADSTATUS_WAIT_ARB, ///< Waiting due to a SignalToAddress/WaitForAddress svc | 48 | WaitArb, ///< Waiting due to a SignalToAddress/WaitForAddress svc |
| 49 | THREADSTATUS_DORMANT, ///< Created but not yet made ready | 49 | Dormant, ///< Created but not yet made ready |
| 50 | THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated | 50 | Dead ///< Run to completion, or forcefully terminated |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | enum class ThreadWakeupReason { | 53 | enum class ThreadWakeupReason { |
| @@ -194,14 +194,14 @@ public: | |||
| 194 | * with wait_all = true. | 194 | * with wait_all = true. |
| 195 | */ | 195 | */ |
| 196 | bool IsSleepingOnWaitAll() const { | 196 | bool IsSleepingOnWaitAll() const { |
| 197 | return status == THREADSTATUS_WAIT_SYNCH_ALL; | 197 | return status == ThreadStatus::WaitSynchAll; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | ARM_Interface::ThreadContext context; | 200 | ARM_Interface::ThreadContext context; |
| 201 | 201 | ||
| 202 | u32 thread_id; | 202 | u32 thread_id; |
| 203 | 203 | ||
| 204 | u32 status; | 204 | ThreadStatus status; |
| 205 | VAddr entry_point; | 205 | VAddr entry_point; |
| 206 | VAddr stack_top; | 206 | VAddr stack_top; |
| 207 | 207 | ||
diff --git a/src/core/hle/kernel/wait_object.cpp b/src/core/hle/kernel/wait_object.cpp index b08ac72c1..eb3c92e66 100644 --- a/src/core/hle/kernel/wait_object.cpp +++ b/src/core/hle/kernel/wait_object.cpp | |||
| @@ -38,9 +38,9 @@ SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { | |||
| 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. |
| 41 | ASSERT_MSG(thread->status == THREADSTATUS_WAIT_SYNCH_ANY || | 41 | ASSERT_MSG(thread->status == ThreadStatus::WaitSynchAny || |
| 42 | thread->status == THREADSTATUS_WAIT_SYNCH_ALL || | 42 | thread->status == ThreadStatus::WaitSynchAll || |
| 43 | thread->status == THREADSTATUS_WAIT_HLE_EVENT, | 43 | thread->status == ThreadStatus::WaitHLEEvent, |
| 44 | "Inconsistent thread statuses in waiting_threads"); | 44 | "Inconsistent thread statuses in waiting_threads"); |
| 45 | 45 | ||
| 46 | if (thread->current_priority >= candidate_priority) | 46 | if (thread->current_priority >= candidate_priority) |
| @@ -49,10 +49,10 @@ SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { | |||
| 49 | if (ShouldWait(thread.get())) | 49 | if (ShouldWait(thread.get())) |
| 50 | continue; | 50 | continue; |
| 51 | 51 | ||
| 52 | // A thread is ready to run if it's either in THREADSTATUS_WAIT_SYNCH_ANY or | 52 | // A thread is ready to run if it's either in ThreadStatus::WaitSynchAny or |
| 53 | // in THREADSTATUS_WAIT_SYNCH_ALL and the rest of the objects it is waiting on are ready. | 53 | // in ThreadStatus::WaitSynchAll and the rest of the objects it is waiting on are ready. |
| 54 | bool ready_to_run = true; | 54 | bool ready_to_run = true; |
| 55 | if (thread->status == THREADSTATUS_WAIT_SYNCH_ALL) { | 55 | if (thread->status == ThreadStatus::WaitSynchAll) { |
| 56 | ready_to_run = std::none_of(thread->wait_objects.begin(), thread->wait_objects.end(), | 56 | ready_to_run = std::none_of(thread->wait_objects.begin(), thread->wait_objects.end(), |
| 57 | [&thread](const SharedPtr<WaitObject>& object) { | 57 | [&thread](const SharedPtr<WaitObject>& object) { |
| 58 | return object->ShouldWait(thread.get()); | 58 | return object->ShouldWait(thread.get()); |
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 4217ea4fb..154bc12da 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | ||
| 5 | #include <vector> | 6 | #include <vector> |
| 6 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 7 | #include "core/core_timing.h" | 8 | #include "core/core_timing.h" |
| @@ -167,7 +168,7 @@ void AudOutU::ListAudioOutsImpl(Kernel::HLERequestContext& ctx) { | |||
| 167 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | 168 | LOG_WARNING(Service_Audio, "(STUBBED) called"); |
| 168 | IPC::RequestParser rp{ctx}; | 169 | IPC::RequestParser rp{ctx}; |
| 169 | 170 | ||
| 170 | const std::string audio_interface = "AudioInterface"; | 171 | constexpr std::array<char, 15> audio_interface{{"AudioInterface"}}; |
| 171 | ctx.WriteBuffer(audio_interface); | 172 | ctx.WriteBuffer(audio_interface); |
| 172 | 173 | ||
| 173 | IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); | 174 | IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); |
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 6903f52d6..e623f4f8e 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | ||
| 6 | |||
| 5 | #include "common/alignment.h" | 7 | #include "common/alignment.h" |
| 6 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 7 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| @@ -298,7 +300,7 @@ private: | |||
| 298 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | 300 | LOG_WARNING(Service_Audio, "(STUBBED) called"); |
| 299 | IPC::RequestParser rp{ctx}; | 301 | IPC::RequestParser rp{ctx}; |
| 300 | 302 | ||
| 301 | const std::string audio_interface = "AudioInterface"; | 303 | constexpr std::array<char, 15> audio_interface{{"AudioInterface"}}; |
| 302 | ctx.WriteBuffer(audio_interface); | 304 | ctx.WriteBuffer(audio_interface); |
| 303 | 305 | ||
| 304 | IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); | 306 | IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); |
| @@ -323,7 +325,7 @@ private: | |||
| 323 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | 325 | LOG_WARNING(Service_Audio, "(STUBBED) called"); |
| 324 | IPC::RequestParser rp{ctx}; | 326 | IPC::RequestParser rp{ctx}; |
| 325 | 327 | ||
| 326 | const std::string audio_interface = "AudioDevice"; | 328 | constexpr std::array<char, 12> audio_interface{{"AudioDevice"}}; |
| 327 | ctx.WriteBuffer(audio_interface); | 329 | ctx.WriteBuffer(audio_interface); |
| 328 | 330 | ||
| 329 | IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); | 331 | IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); |
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index e73b253b2..c80df23be 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <utility> | ||
| 5 | #include <vector> | 6 | #include <vector> |
| 6 | 7 | ||
| 7 | #include "common/file_util.h" | 8 | #include "common/file_util.h" |
| @@ -21,7 +22,7 @@ | |||
| 21 | 22 | ||
| 22 | namespace Loader { | 23 | namespace Loader { |
| 23 | 24 | ||
| 24 | AppLoader_NCA::AppLoader_NCA(FileSys::VirtualFile file) : AppLoader(file) {} | 25 | AppLoader_NCA::AppLoader_NCA(FileSys::VirtualFile file) : AppLoader(std::move(file)) {} |
| 25 | 26 | ||
| 26 | FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& file) { | 27 | FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& file) { |
| 27 | // TODO(DarkLordZach): Assuming everything is decrypted. Add crypto support. | 28 | // TODO(DarkLordZach): Assuming everything is decrypted. Add crypto support. |
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 465b827bb..c020399f2 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <utility> | ||
| 5 | #include <vector> | 6 | #include <vector> |
| 6 | 7 | ||
| 7 | #include "common/common_funcs.h" | 8 | #include "common/common_funcs.h" |
| @@ -48,7 +49,7 @@ struct ModHeader { | |||
| 48 | }; | 49 | }; |
| 49 | static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size."); | 50 | static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size."); |
| 50 | 51 | ||
| 51 | AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(file) {} | 52 | AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(std::move(file)) {} |
| 52 | 53 | ||
| 53 | FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { | 54 | FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { |
| 54 | // Read NSO header | 55 | // Read NSO header |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index c66561bf4..06b1b33f4 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -69,29 +69,18 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { | |||
| 69 | static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | 69 | static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, |
| 70 | const NsoSegmentHeader& header) { | 70 | const NsoSegmentHeader& header) { |
| 71 | std::vector<u8> uncompressed_data(header.size); | 71 | std::vector<u8> uncompressed_data(header.size); |
| 72 | const int bytes_uncompressed = LZ4_decompress_safe( | 72 | const int bytes_uncompressed = |
| 73 | reinterpret_cast<const char*>(compressed_data.data()), | 73 | LZ4_decompress_safe(reinterpret_cast<const char*>(compressed_data.data()), |
| 74 | reinterpret_cast<char*>(uncompressed_data.data()), compressed_data.size(), header.size); | 74 | reinterpret_cast<char*>(uncompressed_data.data()), |
| 75 | static_cast<int>(compressed_data.size()), header.size); | ||
| 75 | 76 | ||
| 76 | ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(), | 77 | ASSERT_MSG(bytes_uncompressed == static_cast<int>(header.size) && |
| 78 | bytes_uncompressed == static_cast<int>(uncompressed_data.size()), | ||
| 77 | "{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size()); | 79 | "{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size()); |
| 78 | 80 | ||
| 79 | return uncompressed_data; | 81 | return uncompressed_data; |
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header, | ||
| 83 | size_t compressed_size) { | ||
| 84 | std::vector<u8> compressed_data(compressed_size); | ||
| 85 | |||
| 86 | file.Seek(header.offset, SEEK_SET); | ||
| 87 | if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) { | ||
| 88 | LOG_CRITICAL(Loader, "Failed to read {} NSO LZ4 compressed bytes", compressed_size); | ||
| 89 | return {}; | ||
| 90 | } | ||
| 91 | |||
| 92 | return DecompressSegment(compressed_data, header); | ||
| 93 | } | ||
| 94 | |||
| 95 | static constexpr u32 PageAlignSize(u32 size) { | 84 | static constexpr u32 PageAlignSize(u32 size) { |
| 96 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | 85 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; |
| 97 | } | 86 | } |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index dfbf80abd..d7328ff39 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -317,8 +317,6 @@ std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderSt | |||
| 317 | auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index]; | 317 | auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index]; |
| 318 | ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); | 318 | ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); |
| 319 | 319 | ||
| 320 | GPUVAddr tic_base_address = regs.tic.TICAddress(); | ||
| 321 | |||
| 322 | GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size; | 320 | GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size; |
| 323 | 321 | ||
| 324 | // Offset into the texture constbuffer where the texture info begins. | 322 | // Offset into the texture constbuffer where the texture info begins. |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 9b308b923..a1ac18a71 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -1405,7 +1405,7 @@ private: | |||
| 1405 | 1405 | ||
| 1406 | // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA | 1406 | // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA |
| 1407 | // goes into gpr28+0 and gpr28+1 | 1407 | // goes into gpr28+0 and gpr28+1 |
| 1408 | size_t offset{}; | 1408 | size_t texs_offset{}; |
| 1409 | 1409 | ||
| 1410 | for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) { | 1410 | for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) { |
| 1411 | for (unsigned elem = 0; elem < 2; ++elem) { | 1411 | for (unsigned elem = 0; elem < 2; ++elem) { |
| @@ -1413,7 +1413,8 @@ private: | |||
| 1413 | // Skip disabled components | 1413 | // Skip disabled components |
| 1414 | continue; | 1414 | continue; |
| 1415 | } | 1415 | } |
| 1416 | regs.SetRegisterToFloat(dest, elem + offset, texture, 1, 4, false, elem); | 1416 | regs.SetRegisterToFloat(dest, elem + texs_offset, texture, 1, 4, false, |
| 1417 | elem); | ||
| 1417 | } | 1418 | } |
| 1418 | 1419 | ||
| 1419 | if (!instr.texs.HasTwoDestinations()) { | 1420 | if (!instr.texs.HasTwoDestinations()) { |
| @@ -1421,7 +1422,7 @@ private: | |||
| 1421 | break; | 1422 | break; |
| 1422 | } | 1423 | } |
| 1423 | 1424 | ||
| 1424 | offset += 2; | 1425 | texs_offset += 2; |
| 1425 | } | 1426 | } |
| 1426 | --shader.scope; | 1427 | --shader.scope; |
| 1427 | shader.AddLine("}"); | 1428 | shader.AddLine("}"); |
| @@ -1463,7 +1464,6 @@ private: | |||
| 1463 | op_b = "abs(" + op_b + ')'; | 1464 | op_b = "abs(" + op_b + ')'; |
| 1464 | } | 1465 | } |
| 1465 | 1466 | ||
| 1466 | using Tegra::Shader::Pred; | ||
| 1467 | // We can't use the constant predicate as destination. | 1467 | // We can't use the constant predicate as destination. |
| 1468 | ASSERT(instr.fsetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); | 1468 | ASSERT(instr.fsetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); |
| 1469 | 1469 | ||
| @@ -1500,7 +1500,6 @@ private: | |||
| 1500 | } | 1500 | } |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
| 1503 | using Tegra::Shader::Pred; | ||
| 1504 | // We can't use the constant predicate as destination. | 1503 | // We can't use the constant predicate as destination. |
| 1505 | ASSERT(instr.isetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); | 1504 | ASSERT(instr.isetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); |
| 1506 | 1505 | ||
| @@ -1528,7 +1527,6 @@ private: | |||
| 1528 | std::string op_b = | 1527 | std::string op_b = |
| 1529 | GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); | 1528 | GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); |
| 1530 | 1529 | ||
| 1531 | using Tegra::Shader::Pred; | ||
| 1532 | // We can't use the constant predicate as destination. | 1530 | // We can't use the constant predicate as destination. |
| 1533 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); | 1531 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); |
| 1534 | 1532 | ||
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 2e8a422a8..68bacd4c5 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -181,30 +181,34 @@ void OpenGLState::Apply() const { | |||
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | // Textures | 183 | // Textures |
| 184 | for (int i = 0; i < std::size(texture_units); ++i) { | 184 | for (std::size_t i = 0; i < std::size(texture_units); ++i) { |
| 185 | if (texture_units[i].texture_2d != cur_state.texture_units[i].texture_2d) { | 185 | const auto& texture_unit = texture_units[i]; |
| 186 | glActiveTexture(TextureUnits::MaxwellTexture(i).Enum()); | 186 | const auto& cur_state_texture_unit = cur_state.texture_units[i]; |
| 187 | glBindTexture(GL_TEXTURE_2D, texture_units[i].texture_2d); | 187 | |
| 188 | if (texture_unit.texture_2d != cur_state_texture_unit.texture_2d) { | ||
| 189 | glActiveTexture(TextureUnits::MaxwellTexture(static_cast<int>(i)).Enum()); | ||
| 190 | glBindTexture(GL_TEXTURE_2D, texture_unit.texture_2d); | ||
| 188 | } | 191 | } |
| 189 | if (texture_units[i].sampler != cur_state.texture_units[i].sampler) { | 192 | if (texture_unit.sampler != cur_state_texture_unit.sampler) { |
| 190 | glBindSampler(static_cast<GLuint>(i), texture_units[i].sampler); | 193 | glBindSampler(static_cast<GLuint>(i), texture_unit.sampler); |
| 191 | } | 194 | } |
| 192 | // Update the texture swizzle | 195 | // Update the texture swizzle |
| 193 | if (texture_units[i].swizzle.r != cur_state.texture_units[i].swizzle.r || | 196 | if (texture_unit.swizzle.r != cur_state_texture_unit.swizzle.r || |
| 194 | texture_units[i].swizzle.g != cur_state.texture_units[i].swizzle.g || | 197 | texture_unit.swizzle.g != cur_state_texture_unit.swizzle.g || |
| 195 | texture_units[i].swizzle.b != cur_state.texture_units[i].swizzle.b || | 198 | texture_unit.swizzle.b != cur_state_texture_unit.swizzle.b || |
| 196 | texture_units[i].swizzle.a != cur_state.texture_units[i].swizzle.a) { | 199 | texture_unit.swizzle.a != cur_state_texture_unit.swizzle.a) { |
| 197 | std::array<GLint, 4> mask = {texture_units[i].swizzle.r, texture_units[i].swizzle.g, | 200 | std::array<GLint, 4> mask = {texture_unit.swizzle.r, texture_unit.swizzle.g, |
| 198 | texture_units[i].swizzle.b, texture_units[i].swizzle.a}; | 201 | texture_unit.swizzle.b, texture_unit.swizzle.a}; |
| 199 | glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask.data()); | 202 | glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask.data()); |
| 200 | } | 203 | } |
| 201 | } | 204 | } |
| 202 | 205 | ||
| 203 | // Constbuffers | 206 | // Constbuffers |
| 204 | for (u32 stage = 0; stage < draw.const_buffers.size(); ++stage) { | 207 | for (std::size_t stage = 0; stage < draw.const_buffers.size(); ++stage) { |
| 205 | for (u32 buffer_id = 0; buffer_id < draw.const_buffers[stage].size(); ++buffer_id) { | 208 | for (std::size_t buffer_id = 0; buffer_id < draw.const_buffers[stage].size(); ++buffer_id) { |
| 206 | auto& current = cur_state.draw.const_buffers[stage][buffer_id]; | 209 | const auto& current = cur_state.draw.const_buffers[stage][buffer_id]; |
| 207 | auto& new_state = draw.const_buffers[stage][buffer_id]; | 210 | const auto& new_state = draw.const_buffers[stage][buffer_id]; |
| 211 | |||
| 208 | if (current.enabled != new_state.enabled || current.bindpoint != new_state.bindpoint || | 212 | if (current.enabled != new_state.enabled || current.bindpoint != new_state.bindpoint || |
| 209 | current.ssbo != new_state.ssbo) { | 213 | current.ssbo != new_state.ssbo) { |
| 210 | if (new_state.enabled) { | 214 | if (new_state.enabled) { |
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp index 7101b381e..8f24586ce 100644 --- a/src/yuzu/debugger/wait_tree.cpp +++ b/src/yuzu/debugger/wait_tree.cpp | |||
| @@ -194,32 +194,32 @@ QString WaitTreeThread::GetText() const { | |||
| 194 | const auto& thread = static_cast<const Kernel::Thread&>(object); | 194 | const auto& thread = static_cast<const Kernel::Thread&>(object); |
| 195 | QString status; | 195 | QString status; |
| 196 | switch (thread.status) { | 196 | switch (thread.status) { |
| 197 | case THREADSTATUS_RUNNING: | 197 | case ThreadStatus::Running: |
| 198 | status = tr("running"); | 198 | status = tr("running"); |
| 199 | break; | 199 | break; |
| 200 | case THREADSTATUS_READY: | 200 | case ThreadStatus::Ready: |
| 201 | status = tr("ready"); | 201 | status = tr("ready"); |
| 202 | break; | 202 | break; |
| 203 | case THREADSTATUS_WAIT_HLE_EVENT: | 203 | case ThreadStatus::WaitHLEEvent: |
| 204 | status = tr("waiting for HLE return"); | 204 | status = tr("waiting for HLE return"); |
| 205 | break; | 205 | break; |
| 206 | case THREADSTATUS_WAIT_SLEEP: | 206 | case ThreadStatus::WaitSleep: |
| 207 | status = tr("sleeping"); | 207 | status = tr("sleeping"); |
| 208 | break; | 208 | break; |
| 209 | case THREADSTATUS_WAIT_SYNCH_ALL: | 209 | case ThreadStatus::WaitSynchAll: |
| 210 | case THREADSTATUS_WAIT_SYNCH_ANY: | 210 | case ThreadStatus::WaitSynchAny: |
| 211 | status = tr("waiting for objects"); | 211 | status = tr("waiting for objects"); |
| 212 | break; | 212 | break; |
| 213 | case THREADSTATUS_WAIT_MUTEX: | 213 | case ThreadStatus::WaitMutex: |
| 214 | status = tr("waiting for mutex"); | 214 | status = tr("waiting for mutex"); |
| 215 | break; | 215 | break; |
| 216 | case THREADSTATUS_WAIT_ARB: | 216 | case ThreadStatus::WaitArb: |
| 217 | status = tr("waiting for address arbiter"); | 217 | status = tr("waiting for address arbiter"); |
| 218 | break; | 218 | break; |
| 219 | case THREADSTATUS_DORMANT: | 219 | case ThreadStatus::Dormant: |
| 220 | status = tr("dormant"); | 220 | status = tr("dormant"); |
| 221 | break; | 221 | break; |
| 222 | case THREADSTATUS_DEAD: | 222 | case ThreadStatus::Dead: |
| 223 | status = tr("dead"); | 223 | status = tr("dead"); |
| 224 | break; | 224 | break; |
| 225 | } | 225 | } |
| @@ -232,22 +232,22 @@ QString WaitTreeThread::GetText() const { | |||
| 232 | QColor WaitTreeThread::GetColor() const { | 232 | QColor WaitTreeThread::GetColor() const { |
| 233 | const auto& thread = static_cast<const Kernel::Thread&>(object); | 233 | const auto& thread = static_cast<const Kernel::Thread&>(object); |
| 234 | switch (thread.status) { | 234 | switch (thread.status) { |
| 235 | case THREADSTATUS_RUNNING: | 235 | case ThreadStatus::Running: |
| 236 | return QColor(Qt::GlobalColor::darkGreen); | 236 | return QColor(Qt::GlobalColor::darkGreen); |
| 237 | case THREADSTATUS_READY: | 237 | case ThreadStatus::Ready: |
| 238 | return QColor(Qt::GlobalColor::darkBlue); | 238 | return QColor(Qt::GlobalColor::darkBlue); |
| 239 | case THREADSTATUS_WAIT_HLE_EVENT: | 239 | case ThreadStatus::WaitHLEEvent: |
| 240 | return QColor(Qt::GlobalColor::darkRed); | 240 | return QColor(Qt::GlobalColor::darkRed); |
| 241 | case THREADSTATUS_WAIT_SLEEP: | 241 | case ThreadStatus::WaitSleep: |
| 242 | return QColor(Qt::GlobalColor::darkYellow); | 242 | return QColor(Qt::GlobalColor::darkYellow); |
| 243 | case THREADSTATUS_WAIT_SYNCH_ALL: | 243 | case ThreadStatus::WaitSynchAll: |
| 244 | case THREADSTATUS_WAIT_SYNCH_ANY: | 244 | case ThreadStatus::WaitSynchAny: |
| 245 | case THREADSTATUS_WAIT_MUTEX: | 245 | case ThreadStatus::WaitMutex: |
| 246 | case THREADSTATUS_WAIT_ARB: | 246 | case ThreadStatus::WaitArb: |
| 247 | return QColor(Qt::GlobalColor::red); | 247 | return QColor(Qt::GlobalColor::red); |
| 248 | case THREADSTATUS_DORMANT: | 248 | case ThreadStatus::Dormant: |
| 249 | return QColor(Qt::GlobalColor::darkCyan); | 249 | return QColor(Qt::GlobalColor::darkCyan); |
| 250 | case THREADSTATUS_DEAD: | 250 | case ThreadStatus::Dead: |
| 251 | return QColor(Qt::GlobalColor::gray); | 251 | return QColor(Qt::GlobalColor::gray); |
| 252 | default: | 252 | default: |
| 253 | return WaitTreeItem::GetColor(); | 253 | return WaitTreeItem::GetColor(); |
| @@ -291,8 +291,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { | |||
| 291 | else | 291 | else |
| 292 | list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex"))); | 292 | list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex"))); |
| 293 | 293 | ||
| 294 | if (thread.status == THREADSTATUS_WAIT_SYNCH_ANY || | 294 | if (thread.status == ThreadStatus::WaitSynchAny || |
| 295 | thread.status == THREADSTATUS_WAIT_SYNCH_ALL) { | 295 | thread.status == ThreadStatus::WaitSynchAll) { |
| 296 | list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects, | 296 | list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects, |
| 297 | thread.IsSleepingOnWaitAll())); | 297 | thread.IsSleepingOnWaitAll())); |
| 298 | } | 298 | } |