diff options
Diffstat (limited to 'src/core')
40 files changed, 412 insertions, 203 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4a1a8bb43..75e0c4f38 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -454,7 +454,6 @@ add_library(core STATIC | |||
| 454 | hle/service/filesystem/fsp_srv.h | 454 | hle/service/filesystem/fsp_srv.h |
| 455 | hle/service/fgm/fgm.cpp | 455 | hle/service/fgm/fgm.cpp |
| 456 | hle/service/fgm/fgm.h | 456 | hle/service/fgm/fgm.h |
| 457 | hle/service/friend/errors.h | ||
| 458 | hle/service/friend/friend.cpp | 457 | hle/service/friend/friend.cpp |
| 459 | hle/service/friend/friend.h | 458 | hle/service/friend/friend.h |
| 460 | hle/service/friend/friend_interface.cpp | 459 | hle/service/friend/friend_interface.cpp |
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 742cfb996..cd4df4522 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -53,7 +53,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) { | |||
| 53 | static constexpr char name[] = "HostTiming"; | 53 | static constexpr char name[] = "HostTiming"; |
| 54 | MicroProfileOnThreadCreate(name); | 54 | MicroProfileOnThreadCreate(name); |
| 55 | Common::SetCurrentThreadName(name); | 55 | Common::SetCurrentThreadName(name); |
| 56 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); | 56 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); |
| 57 | instance.on_thread_init(); | 57 | instance.on_thread_init(); |
| 58 | instance.ThreadLoop(); | 58 | instance.ThreadLoop(); |
| 59 | MicroProfileOnThreadExit(); | 59 | MicroProfileOnThreadExit(); |
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 04a11f444..980bb97f9 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -192,7 +192,7 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) { | |||
| 192 | } | 192 | } |
| 193 | MicroProfileOnThreadCreate(name.c_str()); | 193 | MicroProfileOnThreadCreate(name.c_str()); |
| 194 | Common::SetCurrentThreadName(name.c_str()); | 194 | Common::SetCurrentThreadName(name.c_str()); |
| 195 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); | 195 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); |
| 196 | auto& data = core_data[core]; | 196 | auto& data = core_data[core]; |
| 197 | data.host_context = Common::Fiber::ThreadToFiber(); | 197 | data.host_context = Common::Fiber::ThreadToFiber(); |
| 198 | 198 | ||
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp index 97972ebae..c36eb5dc4 100644 --- a/src/core/hle/kernel/k_address_space_info.cpp +++ b/src/core/hle/kernel/k_address_space_info.cpp | |||
| @@ -44,11 +44,11 @@ const KAddressSpaceInfo& GetAddressSpaceInfo(size_t width, KAddressSpaceInfo::Ty | |||
| 44 | 44 | ||
| 45 | } // namespace | 45 | } // namespace |
| 46 | 46 | ||
| 47 | uintptr_t KAddressSpaceInfo::GetAddressSpaceStart(size_t width, KAddressSpaceInfo::Type type) { | 47 | std::size_t KAddressSpaceInfo::GetAddressSpaceStart(size_t width, KAddressSpaceInfo::Type type) { |
| 48 | return GetAddressSpaceInfo(width, type).address; | 48 | return GetAddressSpaceInfo(width, type).address; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | size_t KAddressSpaceInfo::GetAddressSpaceSize(size_t width, KAddressSpaceInfo::Type type) { | 51 | std::size_t KAddressSpaceInfo::GetAddressSpaceSize(size_t width, KAddressSpaceInfo::Type type) { |
| 52 | return GetAddressSpaceInfo(width, type).size; | 52 | return GetAddressSpaceInfo(width, type).size; |
| 53 | } | 53 | } |
| 54 | 54 | ||
diff --git a/src/core/hle/kernel/k_address_space_info.h b/src/core/hle/kernel/k_address_space_info.h index 69e9d77f2..9a26f6b90 100644 --- a/src/core/hle/kernel/k_address_space_info.h +++ b/src/core/hle/kernel/k_address_space_info.h | |||
| @@ -18,7 +18,7 @@ struct KAddressSpaceInfo final { | |||
| 18 | Count, | 18 | Count, |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | static u64 GetAddressSpaceStart(std::size_t width, Type type); | 21 | static std::size_t GetAddressSpaceStart(std::size_t width, Type type); |
| 22 | static std::size_t GetAddressSpaceSize(std::size_t width, Type type); | 22 | static std::size_t GetAddressSpaceSize(std::size_t width, Type type); |
| 23 | 23 | ||
| 24 | const std::size_t bit_width{}; | 24 | const std::size_t bit_width{}; |
diff --git a/src/core/hle/kernel/k_device_address_space.h b/src/core/hle/kernel/k_device_address_space.h index 4709df995..b4a014c38 100644 --- a/src/core/hle/kernel/k_device_address_space.h +++ b/src/core/hle/kernel/k_device_address_space.h | |||
| @@ -21,9 +21,9 @@ public: | |||
| 21 | ~KDeviceAddressSpace(); | 21 | ~KDeviceAddressSpace(); |
| 22 | 22 | ||
| 23 | Result Initialize(u64 address, u64 size); | 23 | Result Initialize(u64 address, u64 size); |
| 24 | void Finalize(); | 24 | void Finalize() override; |
| 25 | 25 | ||
| 26 | bool IsInitialized() const { | 26 | bool IsInitialized() const override { |
| 27 | return m_is_initialized; | 27 | return m_is_initialized; |
| 28 | } | 28 | } |
| 29 | static void PostDestroy(uintptr_t arg) {} | 29 | static void PostDestroy(uintptr_t arg) {} |
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h index 09bf2f1d0..549809000 100644 --- a/src/core/hle/kernel/k_process.h +++ b/src/core/hle/kernel/k_process.h | |||
| @@ -310,10 +310,10 @@ public: | |||
| 310 | /// Clears the signaled state of the process if and only if it's signaled. | 310 | /// Clears the signaled state of the process if and only if it's signaled. |
| 311 | /// | 311 | /// |
| 312 | /// @pre The process must not be already terminated. If this is called on a | 312 | /// @pre The process must not be already terminated. If this is called on a |
| 313 | /// terminated process, then ERR_INVALID_STATE will be returned. | 313 | /// terminated process, then ResultInvalidState will be returned. |
| 314 | /// | 314 | /// |
| 315 | /// @pre The process must be in a signaled state. If this is called on a | 315 | /// @pre The process must be in a signaled state. If this is called on a |
| 316 | /// process instance that is not signaled, ERR_INVALID_STATE will be | 316 | /// process instance that is not signaled, ResultInvalidState will be |
| 317 | /// returned. | 317 | /// returned. |
| 318 | Result Reset(); | 318 | Result Reset(); |
| 319 | 319 | ||
diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index b9d22b414..626517619 100644 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "common/assert.h" | 4 | #include "common/assert.h" |
| 5 | #include "common/overflow.h" | ||
| 5 | #include "core/core.h" | 6 | #include "core/core.h" |
| 6 | #include "core/core_timing.h" | 7 | #include "core/core_timing.h" |
| 7 | #include "core/hle/kernel/k_resource_limit.h" | 8 | #include "core/hle/kernel/k_resource_limit.h" |
| @@ -104,7 +105,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) { | |||
| 104 | ASSERT(current_hints[index] <= current_values[index]); | 105 | ASSERT(current_hints[index] <= current_values[index]); |
| 105 | 106 | ||
| 106 | // If we would overflow, don't allow to succeed. | 107 | // If we would overflow, don't allow to succeed. |
| 107 | if (current_values[index] + value <= current_values[index]) { | 108 | if (Common::WrappingAdd(current_values[index], value) <= current_values[index]) { |
| 108 | break; | 109 | break; |
| 109 | } | 110 | } |
| 110 | 111 | ||
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 96b90ffef..26e3700e4 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp | |||
| @@ -49,6 +49,7 @@ static void ResetThreadContext32(Core::ARM_Interface::ThreadContext32& context, | |||
| 49 | context.cpu_registers[0] = arg; | 49 | context.cpu_registers[0] = arg; |
| 50 | context.cpu_registers[15] = entry_point; | 50 | context.cpu_registers[15] = entry_point; |
| 51 | context.cpu_registers[13] = stack_top; | 51 | context.cpu_registers[13] = stack_top; |
| 52 | context.fpscr = 0; | ||
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | static void ResetThreadContext64(Core::ARM_Interface::ThreadContext64& context, VAddr stack_top, | 55 | static void ResetThreadContext64(Core::ARM_Interface::ThreadContext64& context, VAddr stack_top, |
| @@ -58,8 +59,8 @@ static void ResetThreadContext64(Core::ARM_Interface::ThreadContext64& context, | |||
| 58 | context.cpu_registers[18] = Kernel::KSystemControl::GenerateRandomU64() | 1; | 59 | context.cpu_registers[18] = Kernel::KSystemControl::GenerateRandomU64() | 1; |
| 59 | context.pc = entry_point; | 60 | context.pc = entry_point; |
| 60 | context.sp = stack_top; | 61 | context.sp = stack_top; |
| 61 | // TODO(merry): Perform a hardware test to determine the below value. | ||
| 62 | context.fpcr = 0; | 62 | context.fpcr = 0; |
| 63 | context.fpsr = 0; | ||
| 63 | } | 64 | } |
| 64 | } // namespace | 65 | } // namespace |
| 65 | 66 | ||
| @@ -815,6 +816,27 @@ void KThread::Continue() { | |||
| 815 | KScheduler::OnThreadStateChanged(kernel, this, old_state); | 816 | KScheduler::OnThreadStateChanged(kernel, this, old_state); |
| 816 | } | 817 | } |
| 817 | 818 | ||
| 819 | void KThread::CloneFpuStatus() { | ||
| 820 | // We shouldn't reach here when starting kernel threads. | ||
| 821 | ASSERT(this->GetOwnerProcess() != nullptr); | ||
| 822 | ASSERT(this->GetOwnerProcess() == GetCurrentProcessPointer(kernel)); | ||
| 823 | |||
| 824 | if (this->GetOwnerProcess()->Is64BitProcess()) { | ||
| 825 | // Clone FPSR and FPCR. | ||
| 826 | ThreadContext64 cur_ctx{}; | ||
| 827 | kernel.System().CurrentArmInterface().SaveContext(cur_ctx); | ||
| 828 | |||
| 829 | this->GetContext64().fpcr = cur_ctx.fpcr; | ||
| 830 | this->GetContext64().fpsr = cur_ctx.fpsr; | ||
| 831 | } else { | ||
| 832 | // Clone FPSCR. | ||
| 833 | ThreadContext32 cur_ctx{}; | ||
| 834 | kernel.System().CurrentArmInterface().SaveContext(cur_ctx); | ||
| 835 | |||
| 836 | this->GetContext32().fpscr = cur_ctx.fpscr; | ||
| 837 | } | ||
| 838 | } | ||
| 839 | |||
| 818 | Result KThread::SetActivity(Svc::ThreadActivity activity) { | 840 | Result KThread::SetActivity(Svc::ThreadActivity activity) { |
| 819 | // Lock ourselves. | 841 | // Lock ourselves. |
| 820 | KScopedLightLock lk(activity_pause_lock); | 842 | KScopedLightLock lk(activity_pause_lock); |
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index bd125f5f1..9423f08ca 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h | |||
| @@ -254,6 +254,8 @@ public: | |||
| 254 | thread_context_32.tpidr = static_cast<u32>(value); | 254 | thread_context_32.tpidr = static_cast<u32>(value); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | void CloneFpuStatus(); | ||
| 258 | |||
| 257 | [[nodiscard]] ThreadContext32& GetContext32() { | 259 | [[nodiscard]] ThreadContext32& GetContext32() { |
| 258 | return thread_context_32; | 260 | return thread_context_32; |
| 259 | } | 261 | } |
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp index 1a8f7e191..9e7bf9530 100644 --- a/src/core/hle/kernel/svc/svc_synchronization.cpp +++ b/src/core/hle/kernel/svc/svc_synchronization.cpp | |||
| @@ -48,19 +48,15 @@ Result ResetSignal(Core::System& system, Handle handle) { | |||
| 48 | return ResultInvalidHandle; | 48 | return ResultInvalidHandle; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | 51 | static Result WaitSynchronization(Core::System& system, int32_t* out_index, const Handle* handles, |
| 52 | Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_address, s32 num_handles, | 52 | int32_t num_handles, int64_t timeout_ns) { |
| 53 | s64 nano_seconds) { | ||
| 54 | LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, num_handles={}, nano_seconds={}", | ||
| 55 | handles_address, num_handles, nano_seconds); | ||
| 56 | |||
| 57 | // Ensure number of handles is valid. | 53 | // Ensure number of handles is valid. |
| 58 | R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange); | 54 | R_UNLESS(0 <= num_handles && num_handles <= Svc::ArgumentHandleCountMax, ResultOutOfRange); |
| 59 | 55 | ||
| 56 | // Get the synchronization context. | ||
| 60 | auto& kernel = system.Kernel(); | 57 | auto& kernel = system.Kernel(); |
| 58 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); | ||
| 61 | std::vector<KSynchronizationObject*> objs(num_handles); | 59 | std::vector<KSynchronizationObject*> objs(num_handles); |
| 62 | const auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); | ||
| 63 | Handle* handles = system.Memory().GetPointer<Handle>(handles_address); | ||
| 64 | 60 | ||
| 65 | // Copy user handles. | 61 | // Copy user handles. |
| 66 | if (num_handles > 0) { | 62 | if (num_handles > 0) { |
| @@ -68,21 +64,38 @@ Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_addre | |||
| 68 | R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(objs.data(), handles, | 64 | R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(objs.data(), handles, |
| 69 | num_handles), | 65 | num_handles), |
| 70 | ResultInvalidHandle); | 66 | ResultInvalidHandle); |
| 71 | for (const auto& obj : objs) { | ||
| 72 | kernel.RegisterInUseObject(obj); | ||
| 73 | } | ||
| 74 | } | 67 | } |
| 75 | 68 | ||
| 76 | // Ensure handles are closed when we're done. | 69 | // Ensure handles are closed when we're done. |
| 77 | SCOPE_EXIT({ | 70 | SCOPE_EXIT({ |
| 78 | for (s32 i = 0; i < num_handles; ++i) { | 71 | for (auto i = 0; i < num_handles; ++i) { |
| 79 | kernel.UnregisterInUseObject(objs[i]); | ||
| 80 | objs[i]->Close(); | 72 | objs[i]->Close(); |
| 81 | } | 73 | } |
| 82 | }); | 74 | }); |
| 83 | 75 | ||
| 84 | return KSynchronizationObject::Wait(kernel, index, objs.data(), static_cast<s32>(objs.size()), | 76 | // Wait on the objects. |
| 85 | nano_seconds); | 77 | Result res = KSynchronizationObject::Wait(kernel, out_index, objs.data(), |
| 78 | static_cast<s32>(objs.size()), timeout_ns); | ||
| 79 | |||
| 80 | R_SUCCEED_IF(res == ResultSessionClosed); | ||
| 81 | R_RETURN(res); | ||
| 82 | } | ||
| 83 | |||
| 84 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | ||
| 85 | Result WaitSynchronization(Core::System& system, int32_t* out_index, VAddr user_handles, | ||
| 86 | int32_t num_handles, int64_t timeout_ns) { | ||
| 87 | LOG_TRACE(Kernel_SVC, "called user_handles={:#x}, num_handles={}, timeout_ns={}", user_handles, | ||
| 88 | num_handles, timeout_ns); | ||
| 89 | |||
| 90 | // Ensure number of handles is valid. | ||
| 91 | R_UNLESS(0 <= num_handles && num_handles <= Svc::ArgumentHandleCountMax, ResultOutOfRange); | ||
| 92 | |||
| 93 | std::vector<Handle> handles(num_handles); | ||
| 94 | if (num_handles > 0) { | ||
| 95 | system.Memory().ReadBlock(user_handles, handles.data(), num_handles * sizeof(Handle)); | ||
| 96 | } | ||
| 97 | |||
| 98 | R_RETURN(WaitSynchronization(system, out_index, handles.data(), num_handles, timeout_ns)); | ||
| 86 | } | 99 | } |
| 87 | 100 | ||
| 88 | /// Resumes a thread waiting on WaitSynchronization | 101 | /// Resumes a thread waiting on WaitSynchronization |
diff --git a/src/core/hle/kernel/svc/svc_thread.cpp b/src/core/hle/kernel/svc/svc_thread.cpp index b39807841..9bc1ebe74 100644 --- a/src/core/hle/kernel/svc/svc_thread.cpp +++ b/src/core/hle/kernel/svc/svc_thread.cpp | |||
| @@ -82,6 +82,9 @@ Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point, | |||
| 82 | // Commit the thread reservation. | 82 | // Commit the thread reservation. |
| 83 | thread_reservation.Commit(); | 83 | thread_reservation.Commit(); |
| 84 | 84 | ||
| 85 | // Clone the current fpu status to the new thread. | ||
| 86 | thread->CloneFpuStatus(); | ||
| 87 | |||
| 85 | // Register the new thread. | 88 | // Register the new thread. |
| 86 | KThread::Register(kernel, thread); | 89 | KThread::Register(kernel, thread); |
| 87 | 90 | ||
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index ddc3a6dbe..120282aa4 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -30,12 +30,6 @@ | |||
| 30 | 30 | ||
| 31 | namespace Service::Account { | 31 | namespace Service::Account { |
| 32 | 32 | ||
| 33 | constexpr Result ERR_INVALID_USER_ID{ErrorModule::Account, 20}; | ||
| 34 | constexpr Result ERR_INVALID_APPLICATION_ID{ErrorModule::Account, 22}; | ||
| 35 | constexpr Result ERR_INVALID_BUFFER{ErrorModule::Account, 30}; | ||
| 36 | constexpr Result ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 31}; | ||
| 37 | constexpr Result ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; | ||
| 38 | |||
| 39 | // Thumbnails are hard coded to be at least this size | 33 | // Thumbnails are hard coded to be at least this size |
| 40 | constexpr std::size_t THUMBNAIL_SIZE = 0x24000; | 34 | constexpr std::size_t THUMBNAIL_SIZE = 0x24000; |
| 41 | 35 | ||
| @@ -384,7 +378,7 @@ protected: | |||
| 384 | if (user_data.size() < sizeof(UserData)) { | 378 | if (user_data.size() < sizeof(UserData)) { |
| 385 | LOG_ERROR(Service_ACC, "UserData buffer too small!"); | 379 | LOG_ERROR(Service_ACC, "UserData buffer too small!"); |
| 386 | IPC::ResponseBuilder rb{ctx, 2}; | 380 | IPC::ResponseBuilder rb{ctx, 2}; |
| 387 | rb.Push(ERR_INVALID_BUFFER); | 381 | rb.Push(Account::ResultInvalidArrayLength); |
| 388 | return; | 382 | return; |
| 389 | } | 383 | } |
| 390 | 384 | ||
| @@ -394,7 +388,7 @@ protected: | |||
| 394 | if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) { | 388 | if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) { |
| 395 | LOG_ERROR(Service_ACC, "Failed to update user data and base!"); | 389 | LOG_ERROR(Service_ACC, "Failed to update user data and base!"); |
| 396 | IPC::ResponseBuilder rb{ctx, 2}; | 390 | IPC::ResponseBuilder rb{ctx, 2}; |
| 397 | rb.Push(ERR_FAILED_SAVE_DATA); | 391 | rb.Push(Account::ResultAccountUpdateFailed); |
| 398 | return; | 392 | return; |
| 399 | } | 393 | } |
| 400 | 394 | ||
| @@ -417,7 +411,7 @@ protected: | |||
| 417 | if (user_data.size() < sizeof(UserData)) { | 411 | if (user_data.size() < sizeof(UserData)) { |
| 418 | LOG_ERROR(Service_ACC, "UserData buffer too small!"); | 412 | LOG_ERROR(Service_ACC, "UserData buffer too small!"); |
| 419 | IPC::ResponseBuilder rb{ctx, 2}; | 413 | IPC::ResponseBuilder rb{ctx, 2}; |
| 420 | rb.Push(ERR_INVALID_BUFFER); | 414 | rb.Push(Account::ResultInvalidArrayLength); |
| 421 | return; | 415 | return; |
| 422 | } | 416 | } |
| 423 | 417 | ||
| @@ -432,7 +426,7 @@ protected: | |||
| 432 | !profile_manager.SetProfileBaseAndData(user_id, base, data)) { | 426 | !profile_manager.SetProfileBaseAndData(user_id, base, data)) { |
| 433 | LOG_ERROR(Service_ACC, "Failed to update profile data, base, and image!"); | 427 | LOG_ERROR(Service_ACC, "Failed to update profile data, base, and image!"); |
| 434 | IPC::ResponseBuilder rb{ctx, 2}; | 428 | IPC::ResponseBuilder rb{ctx, 2}; |
| 435 | rb.Push(ERR_FAILED_SAVE_DATA); | 429 | rb.Push(Account::ResultAccountUpdateFailed); |
| 436 | return; | 430 | return; |
| 437 | } | 431 | } |
| 438 | 432 | ||
| @@ -764,7 +758,7 @@ void Module::Interface::InitializeApplicationInfoRestricted(HLERequestContext& c | |||
| 764 | Result Module::Interface::InitializeApplicationInfoBase() { | 758 | Result Module::Interface::InitializeApplicationInfoBase() { |
| 765 | if (application_info) { | 759 | if (application_info) { |
| 766 | LOG_ERROR(Service_ACC, "Application already initialized"); | 760 | LOG_ERROR(Service_ACC, "Application already initialized"); |
| 767 | return ERR_ACCOUNTINFO_ALREADY_INITIALIZED; | 761 | return Account::ResultApplicationInfoAlreadyInitialized; |
| 768 | } | 762 | } |
| 769 | 763 | ||
| 770 | // TODO(ogniK): This should be changed to reflect the target process for when we have multiple | 764 | // TODO(ogniK): This should be changed to reflect the target process for when we have multiple |
| @@ -775,7 +769,7 @@ Result Module::Interface::InitializeApplicationInfoBase() { | |||
| 775 | 769 | ||
| 776 | if (launch_property.Failed()) { | 770 | if (launch_property.Failed()) { |
| 777 | LOG_ERROR(Service_ACC, "Failed to get launch property"); | 771 | LOG_ERROR(Service_ACC, "Failed to get launch property"); |
| 778 | return ERR_ACCOUNTINFO_BAD_APPLICATION; | 772 | return Account::ResultInvalidApplication; |
| 779 | } | 773 | } |
| 780 | 774 | ||
| 781 | switch (launch_property->base_game_storage_id) { | 775 | switch (launch_property->base_game_storage_id) { |
| @@ -791,7 +785,7 @@ Result Module::Interface::InitializeApplicationInfoBase() { | |||
| 791 | default: | 785 | default: |
| 792 | LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", | 786 | LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", |
| 793 | launch_property->base_game_storage_id); | 787 | launch_property->base_game_storage_id); |
| 794 | return ERR_ACCOUNTINFO_BAD_APPLICATION; | 788 | return Account::ResultInvalidApplication; |
| 795 | } | 789 | } |
| 796 | 790 | ||
| 797 | LOG_WARNING(Service_ACC, "ApplicationInfo init required"); | 791 | LOG_WARNING(Service_ACC, "ApplicationInfo init required"); |
| @@ -899,20 +893,20 @@ void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Com | |||
| 899 | 893 | ||
| 900 | if (tid == 0) { | 894 | if (tid == 0) { |
| 901 | LOG_ERROR(Service_ACC, "TitleID is not valid!"); | 895 | LOG_ERROR(Service_ACC, "TitleID is not valid!"); |
| 902 | rb.Push(ERR_INVALID_APPLICATION_ID); | 896 | rb.Push(Account::ResultInvalidApplication); |
| 903 | return; | 897 | return; |
| 904 | } | 898 | } |
| 905 | 899 | ||
| 906 | if (uuid.IsInvalid()) { | 900 | if (uuid.IsInvalid()) { |
| 907 | LOG_ERROR(Service_ACC, "User ID is not valid!"); | 901 | LOG_ERROR(Service_ACC, "User ID is not valid!"); |
| 908 | rb.Push(ERR_INVALID_USER_ID); | 902 | rb.Push(Account::ResultInvalidUserId); |
| 909 | return; | 903 | return; |
| 910 | } | 904 | } |
| 911 | const auto thumbnail_size = ctx.GetReadBufferSize(); | 905 | const auto thumbnail_size = ctx.GetReadBufferSize(); |
| 912 | if (thumbnail_size != THUMBNAIL_SIZE) { | 906 | if (thumbnail_size != THUMBNAIL_SIZE) { |
| 913 | LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, | 907 | LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, |
| 914 | THUMBNAIL_SIZE); | 908 | THUMBNAIL_SIZE); |
| 915 | rb.Push(ERR_INVALID_BUFFER_SIZE); | 909 | rb.Push(Account::ResultInvalidArrayLength); |
| 916 | return; | 910 | return; |
| 917 | } | 911 | } |
| 918 | 912 | ||
diff --git a/src/core/hle/service/acc/errors.h b/src/core/hle/service/acc/errors.h index e9c16b951..433ebfe9d 100644 --- a/src/core/hle/service/acc/errors.h +++ b/src/core/hle/service/acc/errors.h | |||
| @@ -7,7 +7,13 @@ | |||
| 7 | 7 | ||
| 8 | namespace Service::Account { | 8 | namespace Service::Account { |
| 9 | 9 | ||
| 10 | constexpr Result ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22}; | 10 | constexpr Result ResultCancelledByUser{ErrorModule::Account, 1}; |
| 11 | constexpr Result ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41}; | 11 | constexpr Result ResultNoNotifications{ErrorModule::Account, 15}; |
| 12 | constexpr Result ResultInvalidUserId{ErrorModule::Account, 20}; | ||
| 13 | constexpr Result ResultInvalidApplication{ErrorModule::Account, 22}; | ||
| 14 | constexpr Result ResultNullptr{ErrorModule::Account, 30}; | ||
| 15 | constexpr Result ResultInvalidArrayLength{ErrorModule::Account, 32}; | ||
| 16 | constexpr Result ResultApplicationInfoAlreadyInitialized{ErrorModule::Account, 41}; | ||
| 17 | constexpr Result ResultAccountUpdateFailed{ErrorModule::Account, 100}; | ||
| 12 | 18 | ||
| 13 | } // namespace Service::Account | 19 | } // namespace Service::Account |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index f74c7b550..f17df5124 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -39,9 +39,9 @@ | |||
| 39 | 39 | ||
| 40 | namespace Service::AM { | 40 | namespace Service::AM { |
| 41 | 41 | ||
| 42 | constexpr Result ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 2}; | 42 | constexpr Result ResultNoDataInChannel{ErrorModule::AM, 2}; |
| 43 | constexpr Result ERR_NO_MESSAGES{ErrorModule::AM, 3}; | 43 | constexpr Result ResultNoMessages{ErrorModule::AM, 3}; |
| 44 | constexpr Result ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 503}; | 44 | constexpr Result ResultInvalidOffset{ErrorModule::AM, 503}; |
| 45 | 45 | ||
| 46 | enum class LaunchParameterKind : u32 { | 46 | enum class LaunchParameterKind : u32 { |
| 47 | ApplicationSpecific = 1, | 47 | ApplicationSpecific = 1, |
| @@ -758,7 +758,7 @@ void ICommonStateGetter::ReceiveMessage(HLERequestContext& ctx) { | |||
| 758 | 758 | ||
| 759 | if (message == AppletMessageQueue::AppletMessage::None) { | 759 | if (message == AppletMessageQueue::AppletMessage::None) { |
| 760 | LOG_ERROR(Service_AM, "Message queue is empty"); | 760 | LOG_ERROR(Service_AM, "Message queue is empty"); |
| 761 | rb.Push(ERR_NO_MESSAGES); | 761 | rb.Push(AM::ResultNoMessages); |
| 762 | rb.PushEnum<AppletMessageQueue::AppletMessage>(message); | 762 | rb.PushEnum<AppletMessageQueue::AppletMessage>(message); |
| 763 | return; | 763 | return; |
| 764 | } | 764 | } |
| @@ -1028,7 +1028,7 @@ private: | |||
| 1028 | LOG_DEBUG(Service_AM, | 1028 | LOG_DEBUG(Service_AM, |
| 1029 | "storage is a nullptr. There is no data in the current normal channel"); | 1029 | "storage is a nullptr. There is no data in the current normal channel"); |
| 1030 | IPC::ResponseBuilder rb{ctx, 2}; | 1030 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1031 | rb.Push(ERR_NO_DATA_IN_CHANNEL); | 1031 | rb.Push(AM::ResultNoDataInChannel); |
| 1032 | return; | 1032 | return; |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| @@ -1059,7 +1059,7 @@ private: | |||
| 1059 | LOG_DEBUG(Service_AM, | 1059 | LOG_DEBUG(Service_AM, |
| 1060 | "storage is a nullptr. There is no data in the current interactive channel"); | 1060 | "storage is a nullptr. There is no data in the current interactive channel"); |
| 1061 | IPC::ResponseBuilder rb{ctx, 2}; | 1061 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1062 | rb.Push(ERR_NO_DATA_IN_CHANNEL); | 1062 | rb.Push(AM::ResultNoDataInChannel); |
| 1063 | return; | 1063 | return; |
| 1064 | } | 1064 | } |
| 1065 | 1065 | ||
| @@ -1138,7 +1138,7 @@ void IStorageAccessor::Write(HLERequestContext& ctx) { | |||
| 1138 | backing.GetSize(), size, offset); | 1138 | backing.GetSize(), size, offset); |
| 1139 | 1139 | ||
| 1140 | IPC::ResponseBuilder rb{ctx, 2}; | 1140 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1141 | rb.Push(ERR_SIZE_OUT_OF_BOUNDS); | 1141 | rb.Push(AM::ResultInvalidOffset); |
| 1142 | return; | 1142 | return; |
| 1143 | } | 1143 | } |
| 1144 | 1144 | ||
| @@ -1161,7 +1161,7 @@ void IStorageAccessor::Read(HLERequestContext& ctx) { | |||
| 1161 | backing.GetSize(), size, offset); | 1161 | backing.GetSize(), size, offset); |
| 1162 | 1162 | ||
| 1163 | IPC::ResponseBuilder rb{ctx, 2}; | 1163 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1164 | rb.Push(ERR_SIZE_OUT_OF_BOUNDS); | 1164 | rb.Push(AM::ResultInvalidOffset); |
| 1165 | return; | 1165 | return; |
| 1166 | } | 1166 | } |
| 1167 | 1167 | ||
| @@ -1502,7 +1502,7 @@ void IApplicationFunctions::PopLaunchParameter(HLERequestContext& ctx) { | |||
| 1502 | 1502 | ||
| 1503 | LOG_ERROR(Service_AM, "Attempted to load launch parameter but none was found!"); | 1503 | LOG_ERROR(Service_AM, "Attempted to load launch parameter but none was found!"); |
| 1504 | IPC::ResponseBuilder rb{ctx, 2}; | 1504 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1505 | rb.Push(ERR_NO_DATA_IN_CHANNEL); | 1505 | rb.Push(AM::ResultNoDataInChannel); |
| 1506 | } | 1506 | } |
| 1507 | 1507 | ||
| 1508 | void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) { | 1508 | void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) { |
| @@ -1799,7 +1799,7 @@ void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel(HLERequestC | |||
| 1799 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 1799 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 1800 | 1800 | ||
| 1801 | IPC::ResponseBuilder rb{ctx, 2}; | 1801 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1802 | rb.Push(ERR_NO_DATA_IN_CHANNEL); | 1802 | rb.Push(AM::ResultNoDataInChannel); |
| 1803 | } | 1803 | } |
| 1804 | 1804 | ||
| 1805 | void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) { | 1805 | void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/applets/applet_cabinet.cpp b/src/core/hle/service/am/applets/applet_cabinet.cpp index d0969b0f1..162687b29 100644 --- a/src/core/hle/service/am/applets/applet_cabinet.cpp +++ b/src/core/hle/service/am/applets/applet_cabinet.cpp | |||
| @@ -119,7 +119,7 @@ void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name) | |||
| 119 | case Service::NFP::CabinetMode::StartNicknameAndOwnerSettings: { | 119 | case Service::NFP::CabinetMode::StartNicknameAndOwnerSettings: { |
| 120 | Service::NFP::AmiiboName name{}; | 120 | Service::NFP::AmiiboName name{}; |
| 121 | std::memcpy(name.data(), amiibo_name.data(), std::min(amiibo_name.size(), name.size() - 1)); | 121 | std::memcpy(name.data(), amiibo_name.data(), std::min(amiibo_name.size(), name.size() - 1)); |
| 122 | nfp_device->SetNicknameAndOwner(name); | 122 | nfp_device->SetRegisterInfoPrivate(name); |
| 123 | break; | 123 | break; |
| 124 | } | 124 | } |
| 125 | case Service::NFP::CabinetMode::StartGameDataEraser: | 125 | case Service::NFP::CabinetMode::StartGameDataEraser: |
| @@ -129,7 +129,7 @@ void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name) | |||
| 129 | nfp_device->RestoreAmiibo(); | 129 | nfp_device->RestoreAmiibo(); |
| 130 | break; | 130 | break; |
| 131 | case Service::NFP::CabinetMode::StartFormatter: | 131 | case Service::NFP::CabinetMode::StartFormatter: |
| 132 | nfp_device->DeleteAllData(); | 132 | nfp_device->Format(); |
| 133 | break; | 133 | break; |
| 134 | default: | 134 | default: |
| 135 | UNIMPLEMENTED_MSG("Unknown CabinetMode={}", applet_input_common.applet_mode); | 135 | UNIMPLEMENTED_MSG("Unknown CabinetMode={}", applet_input_common.applet_mode); |
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp index b418031de..58484519b 100644 --- a/src/core/hle/service/am/applets/applet_controller.cpp +++ b/src/core/hle/service/am/applets/applet_controller.cpp | |||
| @@ -19,10 +19,9 @@ | |||
| 19 | 19 | ||
| 20 | namespace Service::AM::Applets { | 20 | namespace Service::AM::Applets { |
| 21 | 21 | ||
| 22 | // This error code (0x183ACA) is thrown when the applet fails to initialize. | 22 | [[maybe_unused]] constexpr Result ResultControllerSupportCanceled{ErrorModule::HID, 3101}; |
| 23 | [[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3101{ErrorModule::HID, 3101}; | 23 | [[maybe_unused]] constexpr Result ResultControllerSupportNotSupportedNpadStyle{ErrorModule::HID, |
| 24 | // This error code (0x183CCA) is thrown when the u32 result in ControllerSupportResultInfo is 2. | 24 | 3102}; |
| 25 | [[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102}; | ||
| 26 | 25 | ||
| 27 | static Core::Frontend::ControllerParameters ConvertToFrontendParameters( | 26 | static Core::Frontend::ControllerParameters ConvertToFrontendParameters( |
| 28 | ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text, | 27 | ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text, |
diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index c738db028..1d69f5447 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp | |||
| @@ -7,13 +7,12 @@ | |||
| 7 | #include "common/string_util.h" | 7 | #include "common/string_util.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/frontend/applets/profile_select.h" | 9 | #include "core/frontend/applets/profile_select.h" |
| 10 | #include "core/hle/service/acc/errors.h" | ||
| 10 | #include "core/hle/service/am/am.h" | 11 | #include "core/hle/service/am/am.h" |
| 11 | #include "core/hle/service/am/applets/applet_profile_select.h" | 12 | #include "core/hle/service/am/applets/applet_profile_select.h" |
| 12 | 13 | ||
| 13 | namespace Service::AM::Applets { | 14 | namespace Service::AM::Applets { |
| 14 | 15 | ||
| 15 | constexpr Result ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; | ||
| 16 | |||
| 17 | ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, | 16 | ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, |
| 18 | const Core::Frontend::ProfileSelectApplet& frontend_) | 17 | const Core::Frontend::ProfileSelectApplet& frontend_) |
| 19 | : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} | 18 | : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} |
| @@ -63,8 +62,8 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { | |||
| 63 | output.result = 0; | 62 | output.result = 0; |
| 64 | output.uuid_selected = *uuid; | 63 | output.uuid_selected = *uuid; |
| 65 | } else { | 64 | } else { |
| 66 | status = ERR_USER_CANCELLED_SELECTION; | 65 | status = Account::ResultCancelledByUser; |
| 67 | output.result = ERR_USER_CANCELLED_SELECTION.raw; | 66 | output.result = Account::ResultCancelledByUser.raw; |
| 68 | output.uuid_selected = Common::InvalidUUID; | 67 | output.uuid_selected = Common::InvalidUUID; |
| 69 | } | 68 | } |
| 70 | 69 | ||
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 0a6830ffa..7086d4750 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -170,7 +170,7 @@ private: | |||
| 170 | 170 | ||
| 171 | if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) { | 171 | if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) { |
| 172 | IPC::ResponseBuilder rb{ctx, 2}; | 172 | IPC::ResponseBuilder rb{ctx, 2}; |
| 173 | rb.Push(ERR_NOT_SUPPORTED); | 173 | rb.Push(Audio::ResultNotSupported); |
| 174 | return; | 174 | return; |
| 175 | } | 175 | } |
| 176 | 176 | ||
| @@ -448,7 +448,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) { | |||
| 448 | if (impl->GetSessionCount() + 1 > AudioCore::MaxRendererSessions) { | 448 | if (impl->GetSessionCount() + 1 > AudioCore::MaxRendererSessions) { |
| 449 | LOG_ERROR(Service_Audio, "Too many AudioRenderer sessions open!"); | 449 | LOG_ERROR(Service_Audio, "Too many AudioRenderer sessions open!"); |
| 450 | IPC::ResponseBuilder rb{ctx, 2}; | 450 | IPC::ResponseBuilder rb{ctx, 2}; |
| 451 | rb.Push(ERR_MAXIMUM_SESSIONS_REACHED); | 451 | rb.Push(Audio::ResultOutOfSessions); |
| 452 | return; | 452 | return; |
| 453 | } | 453 | } |
| 454 | 454 | ||
| @@ -461,7 +461,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) { | |||
| 461 | if (session_id == -1) { | 461 | if (session_id == -1) { |
| 462 | LOG_ERROR(Service_Audio, "Tried to open a session that's already in use!"); | 462 | LOG_ERROR(Service_Audio, "Tried to open a session that's already in use!"); |
| 463 | IPC::ResponseBuilder rb{ctx, 2}; | 463 | IPC::ResponseBuilder rb{ctx, 2}; |
| 464 | rb.Push(ERR_MAXIMUM_SESSIONS_REACHED); | 464 | rb.Push(Audio::ResultOutOfSessions); |
| 465 | return; | 465 | return; |
| 466 | } | 466 | } |
| 467 | 467 | ||
diff --git a/src/core/hle/service/audio/errors.h b/src/core/hle/service/audio/errors.h index d706978cb..3d3d3d97a 100644 --- a/src/core/hle/service/audio/errors.h +++ b/src/core/hle/service/audio/errors.h | |||
| @@ -7,17 +7,17 @@ | |||
| 7 | 7 | ||
| 8 | namespace Service::Audio { | 8 | namespace Service::Audio { |
| 9 | 9 | ||
| 10 | constexpr Result ERR_INVALID_DEVICE_NAME{ErrorModule::Audio, 1}; | 10 | constexpr Result ResultNotFound{ErrorModule::Audio, 1}; |
| 11 | constexpr Result ERR_OPERATION_FAILED{ErrorModule::Audio, 2}; | 11 | constexpr Result ResultOperationFailed{ErrorModule::Audio, 2}; |
| 12 | constexpr Result ERR_INVALID_SAMPLE_RATE{ErrorModule::Audio, 3}; | 12 | constexpr Result ResultInvalidSampleRate{ErrorModule::Audio, 3}; |
| 13 | constexpr Result ERR_INSUFFICIENT_BUFFER_SIZE{ErrorModule::Audio, 4}; | 13 | constexpr Result ResultInsufficientBuffer{ErrorModule::Audio, 4}; |
| 14 | constexpr Result ERR_MAXIMUM_SESSIONS_REACHED{ErrorModule::Audio, 5}; | 14 | constexpr Result ResultOutOfSessions{ErrorModule::Audio, 5}; |
| 15 | constexpr Result ERR_BUFFER_COUNT_EXCEEDED{ErrorModule::Audio, 8}; | 15 | constexpr Result ResultBufferCountReached{ErrorModule::Audio, 8}; |
| 16 | constexpr Result ERR_INVALID_CHANNEL_COUNT{ErrorModule::Audio, 10}; | 16 | constexpr Result ResultInvalidChannelCount{ErrorModule::Audio, 10}; |
| 17 | constexpr Result ERR_INVALID_UPDATE_DATA{ErrorModule::Audio, 41}; | 17 | constexpr Result ResultInvalidUpdateInfo{ErrorModule::Audio, 41}; |
| 18 | constexpr Result ERR_POOL_MAPPING_FAILED{ErrorModule::Audio, 42}; | 18 | constexpr Result ResultInvalidAddressInfo{ErrorModule::Audio, 42}; |
| 19 | constexpr Result ERR_NOT_SUPPORTED{ErrorModule::Audio, 513}; | 19 | constexpr Result ResultNotSupported{ErrorModule::Audio, 513}; |
| 20 | constexpr Result ERR_INVALID_PROCESS_HANDLE{ErrorModule::Audio, 1536}; | 20 | constexpr Result ResultInvalidHandle{ErrorModule::Audio, 1536}; |
| 21 | constexpr Result ERR_INVALID_REVISION{ErrorModule::Audio, 1537}; | 21 | constexpr Result ResultInvalidRevision{ErrorModule::Audio, 1537}; |
| 22 | 22 | ||
| 23 | } // namespace Service::Audio | 23 | } // namespace Service::Audio |
diff --git a/src/core/hle/service/friend/errors.h b/src/core/hle/service/friend/errors.h deleted file mode 100644 index ff525d865..000000000 --- a/src/core/hle/service/friend/errors.h +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/result.h" | ||
| 7 | |||
| 8 | namespace Service::Friend { | ||
| 9 | |||
| 10 | constexpr Result ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15}; | ||
| 11 | } | ||
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 447deab8b..9d05f9801 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "common/uuid.h" | 6 | #include "common/uuid.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/hle/kernel/k_event.h" | 8 | #include "core/hle/kernel/k_event.h" |
| 9 | #include "core/hle/service/friend/errors.h" | 9 | #include "core/hle/service/acc/errors.h" |
| 10 | #include "core/hle/service/friend/friend.h" | 10 | #include "core/hle/service/friend/friend.h" |
| 11 | #include "core/hle/service/friend/friend_interface.h" | 11 | #include "core/hle/service/friend/friend_interface.h" |
| 12 | #include "core/hle/service/ipc_helpers.h" | 12 | #include "core/hle/service/ipc_helpers.h" |
| @@ -259,7 +259,7 @@ private: | |||
| 259 | if (notifications.empty()) { | 259 | if (notifications.empty()) { |
| 260 | LOG_ERROR(Service_Friend, "No notifications in queue!"); | 260 | LOG_ERROR(Service_Friend, "No notifications in queue!"); |
| 261 | IPC::ResponseBuilder rb{ctx, 2}; | 261 | IPC::ResponseBuilder rb{ctx, 2}; |
| 262 | rb.Push(ERR_NO_NOTIFICATIONS); | 262 | rb.Push(Account::ResultNoNotifications); |
| 263 | return; | 263 | return; |
| 264 | } | 264 | } |
| 265 | 265 | ||
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 9db136bac..929dcca0d 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp | |||
| @@ -61,7 +61,7 @@ void ARP_R::GetApplicationLaunchProperty(HLERequestContext& ctx) { | |||
| 61 | if (!title_id.has_value()) { | 61 | if (!title_id.has_value()) { |
| 62 | LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!"); | 62 | LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!"); |
| 63 | IPC::ResponseBuilder rb{ctx, 2}; | 63 | IPC::ResponseBuilder rb{ctx, 2}; |
| 64 | rb.Push(ERR_NOT_REGISTERED); | 64 | rb.Push(Glue::ResultProcessIdNotRegistered); |
| 65 | return; | 65 | return; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| @@ -109,7 +109,7 @@ void ARP_R::GetApplicationControlProperty(HLERequestContext& ctx) { | |||
| 109 | if (!title_id.has_value()) { | 109 | if (!title_id.has_value()) { |
| 110 | LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!"); | 110 | LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!"); |
| 111 | IPC::ResponseBuilder rb{ctx, 2}; | 111 | IPC::ResponseBuilder rb{ctx, 2}; |
| 112 | rb.Push(ERR_NOT_REGISTERED); | 112 | rb.Push(Glue::ResultProcessIdNotRegistered); |
| 113 | return; | 113 | return; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -178,7 +178,7 @@ private: | |||
| 178 | if (process_id == 0) { | 178 | if (process_id == 0) { |
| 179 | LOG_ERROR(Service_ARP, "Must have non-zero process ID!"); | 179 | LOG_ERROR(Service_ARP, "Must have non-zero process ID!"); |
| 180 | IPC::ResponseBuilder rb{ctx, 2}; | 180 | IPC::ResponseBuilder rb{ctx, 2}; |
| 181 | rb.Push(ERR_INVALID_PROCESS_ID); | 181 | rb.Push(Glue::ResultInvalidProcessId); |
| 182 | return; | 182 | return; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| @@ -186,7 +186,7 @@ private: | |||
| 186 | LOG_ERROR(Service_ARP, | 186 | LOG_ERROR(Service_ARP, |
| 187 | "Attempted to issue registrar, but registrar is already issued!"); | 187 | "Attempted to issue registrar, but registrar is already issued!"); |
| 188 | IPC::ResponseBuilder rb{ctx, 2}; | 188 | IPC::ResponseBuilder rb{ctx, 2}; |
| 189 | rb.Push(ERR_INVALID_ACCESS); | 189 | rb.Push(Glue::ResultAlreadyBound); |
| 190 | return; | 190 | return; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| @@ -205,7 +205,7 @@ private: | |||
| 205 | Service_ARP, | 205 | Service_ARP, |
| 206 | "Attempted to set application launch property, but registrar is already issued!"); | 206 | "Attempted to set application launch property, but registrar is already issued!"); |
| 207 | IPC::ResponseBuilder rb{ctx, 2}; | 207 | IPC::ResponseBuilder rb{ctx, 2}; |
| 208 | rb.Push(ERR_INVALID_ACCESS); | 208 | rb.Push(Glue::ResultAlreadyBound); |
| 209 | return; | 209 | return; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| @@ -224,7 +224,7 @@ private: | |||
| 224 | Service_ARP, | 224 | Service_ARP, |
| 225 | "Attempted to set application control property, but registrar is already issued!"); | 225 | "Attempted to set application control property, but registrar is already issued!"); |
| 226 | IPC::ResponseBuilder rb{ctx, 2}; | 226 | IPC::ResponseBuilder rb{ctx, 2}; |
| 227 | rb.Push(ERR_INVALID_ACCESS); | 227 | rb.Push(Glue::ResultAlreadyBound); |
| 228 | return; | 228 | return; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| @@ -263,7 +263,7 @@ void ARP_W::AcquireRegistrar(HLERequestContext& ctx) { | |||
| 263 | system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) { | 263 | system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) { |
| 264 | const auto res = GetTitleIDForProcessID(system, process_id); | 264 | const auto res = GetTitleIDForProcessID(system, process_id); |
| 265 | if (!res.has_value()) { | 265 | if (!res.has_value()) { |
| 266 | return ERR_NOT_REGISTERED; | 266 | return Glue::ResultProcessIdNotRegistered; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | return manager.Register(*res, launch, std::move(control)); | 269 | return manager.Register(*res, launch, std::move(control)); |
| @@ -283,7 +283,7 @@ void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) { | |||
| 283 | if (process_id == 0) { | 283 | if (process_id == 0) { |
| 284 | LOG_ERROR(Service_ARP, "Must have non-zero process ID!"); | 284 | LOG_ERROR(Service_ARP, "Must have non-zero process ID!"); |
| 285 | IPC::ResponseBuilder rb{ctx, 2}; | 285 | IPC::ResponseBuilder rb{ctx, 2}; |
| 286 | rb.Push(ERR_INVALID_PROCESS_ID); | 286 | rb.Push(Glue::ResultInvalidProcessId); |
| 287 | return; | 287 | return; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| @@ -292,7 +292,7 @@ void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) { | |||
| 292 | if (!title_id.has_value()) { | 292 | if (!title_id.has_value()) { |
| 293 | LOG_ERROR(Service_ARP, "No title ID for process ID!"); | 293 | LOG_ERROR(Service_ARP, "No title ID for process ID!"); |
| 294 | IPC::ResponseBuilder rb{ctx, 2}; | 294 | IPC::ResponseBuilder rb{ctx, 2}; |
| 295 | rb.Push(ERR_NOT_REGISTERED); | 295 | rb.Push(Glue::ResultProcessIdNotRegistered); |
| 296 | return; | 296 | return; |
| 297 | } | 297 | } |
| 298 | 298 | ||
diff --git a/src/core/hle/service/glue/errors.h b/src/core/hle/service/glue/errors.h index d4ce7f44e..30feaa5c0 100644 --- a/src/core/hle/service/glue/errors.h +++ b/src/core/hle/service/glue/errors.h | |||
| @@ -7,9 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | namespace Service::Glue { | 8 | namespace Service::Glue { |
| 9 | 9 | ||
| 10 | constexpr Result ERR_INVALID_RESOURCE{ErrorModule::ARP, 30}; | 10 | constexpr Result ResultInvalidProcessId{ErrorModule::ARP, 31}; |
| 11 | constexpr Result ERR_INVALID_PROCESS_ID{ErrorModule::ARP, 31}; | 11 | constexpr Result ResultAlreadyBound{ErrorModule::ARP, 42}; |
| 12 | constexpr Result ERR_INVALID_ACCESS{ErrorModule::ARP, 42}; | 12 | constexpr Result ResultProcessIdNotRegistered{ErrorModule::ARP, 102}; |
| 13 | constexpr Result ERR_NOT_REGISTERED{ErrorModule::ARP, 102}; | ||
| 14 | 13 | ||
| 15 | } // namespace Service::Glue | 14 | } // namespace Service::Glue |
diff --git a/src/core/hle/service/glue/glue_manager.cpp b/src/core/hle/service/glue/glue_manager.cpp index 8a654cdca..4bf67921b 100644 --- a/src/core/hle/service/glue/glue_manager.cpp +++ b/src/core/hle/service/glue/glue_manager.cpp | |||
| @@ -17,12 +17,12 @@ ARPManager::~ARPManager() = default; | |||
| 17 | 17 | ||
| 18 | ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const { | 18 | ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const { |
| 19 | if (title_id == 0) { | 19 | if (title_id == 0) { |
| 20 | return ERR_INVALID_PROCESS_ID; | 20 | return Glue::ResultInvalidProcessId; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | const auto iter = entries.find(title_id); | 23 | const auto iter = entries.find(title_id); |
| 24 | if (iter == entries.end()) { | 24 | if (iter == entries.end()) { |
| 25 | return ERR_NOT_REGISTERED; | 25 | return Glue::ResultProcessIdNotRegistered; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | return iter->second.launch; | 28 | return iter->second.launch; |
| @@ -30,12 +30,12 @@ ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) | |||
| 30 | 30 | ||
| 31 | ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const { | 31 | ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const { |
| 32 | if (title_id == 0) { | 32 | if (title_id == 0) { |
| 33 | return ERR_INVALID_PROCESS_ID; | 33 | return Glue::ResultInvalidProcessId; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | const auto iter = entries.find(title_id); | 36 | const auto iter = entries.find(title_id); |
| 37 | if (iter == entries.end()) { | 37 | if (iter == entries.end()) { |
| 38 | return ERR_NOT_REGISTERED; | 38 | return Glue::ResultProcessIdNotRegistered; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | return iter->second.control; | 41 | return iter->second.control; |
| @@ -44,12 +44,12 @@ ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const { | |||
| 44 | Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, | 44 | Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, |
| 45 | std::vector<u8> control) { | 45 | std::vector<u8> control) { |
| 46 | if (title_id == 0) { | 46 | if (title_id == 0) { |
| 47 | return ERR_INVALID_PROCESS_ID; | 47 | return Glue::ResultInvalidProcessId; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | const auto iter = entries.find(title_id); | 50 | const auto iter = entries.find(title_id); |
| 51 | if (iter != entries.end()) { | 51 | if (iter != entries.end()) { |
| 52 | return ERR_INVALID_ACCESS; | 52 | return Glue::ResultAlreadyBound; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)}); | 55 | entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)}); |
| @@ -58,12 +58,12 @@ Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, | |||
| 58 | 58 | ||
| 59 | Result ARPManager::Unregister(u64 title_id) { | 59 | Result ARPManager::Unregister(u64 title_id) { |
| 60 | if (title_id == 0) { | 60 | if (title_id == 0) { |
| 61 | return ERR_INVALID_PROCESS_ID; | 61 | return Glue::ResultInvalidProcessId; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | const auto iter = entries.find(title_id); | 64 | const auto iter = entries.find(title_id); |
| 65 | if (iter == entries.end()) { | 65 | if (iter == entries.end()) { |
| 66 | return ERR_NOT_REGISTERED; | 66 | return Glue::ResultProcessIdNotRegistered; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | entries.erase(iter); | 69 | entries.erase(iter); |
diff --git a/src/core/hle/service/glue/glue_manager.h b/src/core/hle/service/glue/glue_manager.h index cd0b092ac..1cf53d9d9 100644 --- a/src/core/hle/service/glue/glue_manager.h +++ b/src/core/hle/service/glue/glue_manager.h | |||
| @@ -30,23 +30,23 @@ public: | |||
| 30 | ~ARPManager(); | 30 | ~ARPManager(); |
| 31 | 31 | ||
| 32 | // Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was | 32 | // Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was |
| 33 | // previously registered, otherwise ERR_NOT_REGISTERED if it was never registered or | 33 | // previously registered, otherwise ResultProcessIdNotRegistered if it was never registered or |
| 34 | // ERR_INVALID_PROCESS_ID if the title ID is 0. | 34 | // ResultInvalidProcessId if the title ID is 0. |
| 35 | ResultVal<ApplicationLaunchProperty> GetLaunchProperty(u64 title_id) const; | 35 | ResultVal<ApplicationLaunchProperty> GetLaunchProperty(u64 title_id) const; |
| 36 | 36 | ||
| 37 | // Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to | 37 | // Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to |
| 38 | // the provided title ID if it was previously registered, otherwise ERR_NOT_REGISTERED if it was | 38 | // the provided title ID if it was previously registered, otherwise ResultProcessIdNotRegistered |
| 39 | // never registered or ERR_INVALID_PROCESS_ID if the title ID is 0. | 39 | // if it was never registered or ResultInvalidProcessId if the title ID is 0. |
| 40 | ResultVal<std::vector<u8>> GetControlProperty(u64 title_id) const; | 40 | ResultVal<std::vector<u8>> GetControlProperty(u64 title_id) const; |
| 41 | 41 | ||
| 42 | // Adds a new entry to the internal database with the provided parameters, returning | 42 | // Adds a new entry to the internal database with the provided parameters, returning |
| 43 | // ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister | 43 | // ResultProcessIdNotRegistered if attempting to re-register a title ID without an intermediate |
| 44 | // step, and ERR_INVALID_PROCESS_ID if the title ID is 0. | 44 | // Unregister step, and ResultInvalidProcessId if the title ID is 0. |
| 45 | Result Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control); | 45 | Result Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control); |
| 46 | 46 | ||
| 47 | // Removes the registration for the provided title ID from the database, returning | 47 | // Removes the registration for the provided title ID from the database, returning |
| 48 | // ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the | 48 | // ResultProcessIdNotRegistered if it doesn't exist in the database and ResultInvalidProcessId |
| 49 | // title ID is 0. | 49 | // if the title ID is 0. |
| 50 | Result Unregister(u64 title_id); | 50 | Result Unregister(u64 title_id); |
| 51 | 51 | ||
| 52 | // Removes all entries from the database, always succeeds. Should only be used when resetting | 52 | // Removes all entries from the database, always succeeds. Should only be used when resetting |
diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp index df9ee0c3f..9e2f3ab21 100644 --- a/src/core/hle/service/hid/controllers/stubbed.cpp +++ b/src/core/hle/service/hid/controllers/stubbed.cpp | |||
| @@ -26,7 +26,7 @@ void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | CommonHeader header{}; | 28 | CommonHeader header{}; |
| 29 | header.timestamp = core_timing.GetCPUTicks(); | 29 | header.timestamp = core_timing.GetGlobalTimeNs().count(); |
| 30 | header.total_entry_count = 17; | 30 | header.total_entry_count = 17; |
| 31 | header.entry_count = 0; | 31 | header.entry_count = 0; |
| 32 | header.last_entry_index = 0; | 32 | header.last_entry_index = 0; |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index d90a4e732..3ef91df4b 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -32,7 +32,7 @@ void Controller_Touchscreen::OnInit() {} | |||
| 32 | void Controller_Touchscreen::OnRelease() {} | 32 | void Controller_Touchscreen::OnRelease() {} |
| 33 | 33 | ||
| 34 | void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 34 | void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 35 | shared_memory->touch_screen_lifo.timestamp = core_timing.GetCPUTicks(); | 35 | shared_memory->touch_screen_lifo.timestamp = core_timing.GetGlobalTimeNs().count(); |
| 36 | 36 | ||
| 37 | if (!IsControllerActivated()) { | 37 | if (!IsControllerActivated()) { |
| 38 | shared_memory->touch_screen_lifo.buffer_count = 0; | 38 | shared_memory->touch_screen_lifo.buffer_count = 0; |
| @@ -85,7 +85,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 85 | const auto active_fingers_count = | 85 | const auto active_fingers_count = |
| 86 | static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter)); | 86 | static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter)); |
| 87 | 87 | ||
| 88 | const u64 tick = core_timing.GetCPUTicks(); | 88 | const u64 timestamp = static_cast<u64>(core_timing.GetGlobalTimeNs().count()); |
| 89 | const auto& last_entry = shared_memory->touch_screen_lifo.ReadCurrentEntry().state; | 89 | const auto& last_entry = shared_memory->touch_screen_lifo.ReadCurrentEntry().state; |
| 90 | 90 | ||
| 91 | next_state.sampling_number = last_entry.sampling_number + 1; | 91 | next_state.sampling_number = last_entry.sampling_number + 1; |
| @@ -102,8 +102,8 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 102 | touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; | 102 | touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; |
| 103 | touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; | 103 | touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; |
| 104 | touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; | 104 | touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; |
| 105 | touch_entry.delta_time = tick - active_fingers[id].last_touch; | 105 | touch_entry.delta_time = timestamp - active_fingers[id].last_touch; |
| 106 | fingers[active_fingers[id].id].last_touch = tick; | 106 | fingers[active_fingers[id].id].last_touch = timestamp; |
| 107 | touch_entry.finger = active_fingers[id].id; | 107 | touch_entry.finger = active_fingers[id].id; |
| 108 | touch_entry.attribute.raw = active_fingers[id].attribute.raw; | 108 | touch_entry.attribute.raw = active_fingers[id].attribute.raw; |
| 109 | } else { | 109 | } else { |
diff --git a/src/core/hle/service/ipc_helpers.h b/src/core/hle/service/ipc_helpers.h index 3e67123c7..8703b57ca 100644 --- a/src/core/hle/service/ipc_helpers.h +++ b/src/core/hle/service/ipc_helpers.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | namespace IPC { | 20 | namespace IPC { |
| 21 | 21 | ||
| 22 | constexpr Result ERR_REMOTE_PROCESS_DEAD{ErrorModule::HIPC, 301}; | 22 | constexpr Result ResultSessionClosed{ErrorModule::HIPC, 301}; |
| 23 | 23 | ||
| 24 | class RequestHelperBase { | 24 | class RequestHelperBase { |
| 25 | protected: | 25 | protected: |
diff --git a/src/core/hle/service/nfp/amiibo_crypto.cpp b/src/core/hle/service/nfp/amiibo_crypto.cpp index ffb2f959c..ddf04b1d7 100644 --- a/src/core/hle/service/nfp/amiibo_crypto.cpp +++ b/src/core/hle/service/nfp/amiibo_crypto.cpp | |||
| @@ -80,13 +80,16 @@ NTAG215File NfcDataToEncodedData(const EncryptedNTAG215File& nfc_data) { | |||
| 80 | encoded_data.hmac_data = nfc_data.user_memory.hmac_data; | 80 | encoded_data.hmac_data = nfc_data.user_memory.hmac_data; |
| 81 | encoded_data.constant_value = nfc_data.user_memory.constant_value; | 81 | encoded_data.constant_value = nfc_data.user_memory.constant_value; |
| 82 | encoded_data.write_counter = nfc_data.user_memory.write_counter; | 82 | encoded_data.write_counter = nfc_data.user_memory.write_counter; |
| 83 | encoded_data.amiibo_version = nfc_data.user_memory.amiibo_version; | ||
| 83 | encoded_data.settings = nfc_data.user_memory.settings; | 84 | encoded_data.settings = nfc_data.user_memory.settings; |
| 84 | encoded_data.owner_mii = nfc_data.user_memory.owner_mii; | 85 | encoded_data.owner_mii = nfc_data.user_memory.owner_mii; |
| 85 | encoded_data.title_id = nfc_data.user_memory.title_id; | 86 | encoded_data.application_id = nfc_data.user_memory.application_id; |
| 86 | encoded_data.applicaton_write_counter = nfc_data.user_memory.applicaton_write_counter; | 87 | encoded_data.application_write_counter = nfc_data.user_memory.application_write_counter; |
| 87 | encoded_data.application_area_id = nfc_data.user_memory.application_area_id; | 88 | encoded_data.application_area_id = nfc_data.user_memory.application_area_id; |
| 89 | encoded_data.application_id_byte = nfc_data.user_memory.application_id_byte; | ||
| 88 | encoded_data.unknown = nfc_data.user_memory.unknown; | 90 | encoded_data.unknown = nfc_data.user_memory.unknown; |
| 89 | encoded_data.unknown2 = nfc_data.user_memory.unknown2; | 91 | encoded_data.unknown2 = nfc_data.user_memory.unknown2; |
| 92 | encoded_data.application_area_crc = nfc_data.user_memory.application_area_crc; | ||
| 90 | encoded_data.application_area = nfc_data.user_memory.application_area; | 93 | encoded_data.application_area = nfc_data.user_memory.application_area; |
| 91 | encoded_data.hmac_tag = nfc_data.user_memory.hmac_tag; | 94 | encoded_data.hmac_tag = nfc_data.user_memory.hmac_tag; |
| 92 | encoded_data.lock_bytes = nfc_data.uuid.lock_bytes; | 95 | encoded_data.lock_bytes = nfc_data.uuid.lock_bytes; |
| @@ -111,13 +114,16 @@ EncryptedNTAG215File EncodedDataToNfcData(const NTAG215File& encoded_data) { | |||
| 111 | nfc_data.user_memory.hmac_data = encoded_data.hmac_data; | 114 | nfc_data.user_memory.hmac_data = encoded_data.hmac_data; |
| 112 | nfc_data.user_memory.constant_value = encoded_data.constant_value; | 115 | nfc_data.user_memory.constant_value = encoded_data.constant_value; |
| 113 | nfc_data.user_memory.write_counter = encoded_data.write_counter; | 116 | nfc_data.user_memory.write_counter = encoded_data.write_counter; |
| 117 | nfc_data.user_memory.amiibo_version = encoded_data.amiibo_version; | ||
| 114 | nfc_data.user_memory.settings = encoded_data.settings; | 118 | nfc_data.user_memory.settings = encoded_data.settings; |
| 115 | nfc_data.user_memory.owner_mii = encoded_data.owner_mii; | 119 | nfc_data.user_memory.owner_mii = encoded_data.owner_mii; |
| 116 | nfc_data.user_memory.title_id = encoded_data.title_id; | 120 | nfc_data.user_memory.application_id = encoded_data.application_id; |
| 117 | nfc_data.user_memory.applicaton_write_counter = encoded_data.applicaton_write_counter; | 121 | nfc_data.user_memory.application_write_counter = encoded_data.application_write_counter; |
| 118 | nfc_data.user_memory.application_area_id = encoded_data.application_area_id; | 122 | nfc_data.user_memory.application_area_id = encoded_data.application_area_id; |
| 123 | nfc_data.user_memory.application_id_byte = encoded_data.application_id_byte; | ||
| 119 | nfc_data.user_memory.unknown = encoded_data.unknown; | 124 | nfc_data.user_memory.unknown = encoded_data.unknown; |
| 120 | nfc_data.user_memory.unknown2 = encoded_data.unknown2; | 125 | nfc_data.user_memory.unknown2 = encoded_data.unknown2; |
| 126 | nfc_data.user_memory.application_area_crc = encoded_data.application_area_crc; | ||
| 121 | nfc_data.user_memory.application_area = encoded_data.application_area; | 127 | nfc_data.user_memory.application_area = encoded_data.application_area; |
| 122 | nfc_data.user_memory.hmac_tag = encoded_data.hmac_tag; | 128 | nfc_data.user_memory.hmac_tag = encoded_data.hmac_tag; |
| 123 | nfc_data.user_memory.model_info = encoded_data.model_info; | 129 | nfc_data.user_memory.model_info = encoded_data.model_info; |
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp index 1bdc42741..ddff90d6a 100644 --- a/src/core/hle/service/nfp/nfp_device.cpp +++ b/src/core/hle/service/nfp/nfp_device.cpp | |||
| @@ -174,8 +174,8 @@ Result NfpDevice::StopDetection() { | |||
| 174 | 174 | ||
| 175 | if (device_state == DeviceState::TagFound || device_state == DeviceState::TagMounted) { | 175 | if (device_state == DeviceState::TagFound || device_state == DeviceState::TagMounted) { |
| 176 | CloseAmiibo(); | 176 | CloseAmiibo(); |
| 177 | return ResultSuccess; | ||
| 178 | } | 177 | } |
| 178 | |||
| 179 | if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) { | 179 | if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) { |
| 180 | device_state = DeviceState::Initialized; | 180 | device_state = DeviceState::Initialized; |
| 181 | return ResultSuccess; | 181 | return ResultSuccess; |
| @@ -204,9 +204,7 @@ Result NfpDevice::Flush() { | |||
| 204 | const auto& current_date = GetAmiiboDate(current_posix_time); | 204 | const auto& current_date = GetAmiiboDate(current_posix_time); |
| 205 | if (settings.write_date.raw_date != current_date.raw_date) { | 205 | if (settings.write_date.raw_date != current_date.raw_date) { |
| 206 | settings.write_date = current_date; | 206 | settings.write_date = current_date; |
| 207 | settings.crc_counter++; | 207 | UpdateSettingsCrc(); |
| 208 | // TODO: Find how to calculate the crc check | ||
| 209 | // settings.crc = CalculateCRC(settings); | ||
| 210 | } | 208 | } |
| 211 | 209 | ||
| 212 | tag_data.write_counter++; | 210 | tag_data.write_counter++; |
| @@ -318,7 +316,7 @@ Result NfpDevice::GetCommonInfo(CommonInfo& common_info) const { | |||
| 318 | common_info = { | 316 | common_info = { |
| 319 | .last_write_date = settings.write_date.GetWriteDate(), | 317 | .last_write_date = settings.write_date.GetWriteDate(), |
| 320 | .write_counter = tag_data.write_counter, | 318 | .write_counter = tag_data.write_counter, |
| 321 | .version = 0, | 319 | .version = tag_data.amiibo_version, |
| 322 | .application_area_size = sizeof(ApplicationArea), | 320 | .application_area_size = sizeof(ApplicationArea), |
| 323 | }; | 321 | }; |
| 324 | return ResultSuccess; | 322 | return ResultSuccess; |
| @@ -370,13 +368,95 @@ Result NfpDevice::GetRegisterInfo(RegisterInfo& register_info) const { | |||
| 370 | .mii_char_info = manager.ConvertV3ToCharInfo(tag_data.owner_mii), | 368 | .mii_char_info = manager.ConvertV3ToCharInfo(tag_data.owner_mii), |
| 371 | .creation_date = settings.init_date.GetWriteDate(), | 369 | .creation_date = settings.init_date.GetWriteDate(), |
| 372 | .amiibo_name = GetAmiiboName(settings), | 370 | .amiibo_name = GetAmiiboName(settings), |
| 373 | .font_region = {}, | 371 | .font_region = settings.settings.font_region, |
| 372 | }; | ||
| 373 | |||
| 374 | return ResultSuccess; | ||
| 375 | } | ||
| 376 | |||
| 377 | Result NfpDevice::GetAdminInfo(AdminInfo& admin_info) const { | ||
| 378 | if (device_state != DeviceState::TagMounted) { | ||
| 379 | LOG_ERROR(Service_NFC, "Wrong device state {}", device_state); | ||
| 380 | if (device_state == DeviceState::TagRemoved) { | ||
| 381 | return TagRemoved; | ||
| 382 | } | ||
| 383 | return WrongDeviceState; | ||
| 384 | } | ||
| 385 | |||
| 386 | if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) { | ||
| 387 | LOG_ERROR(Service_NFC, "Amiibo is read only", device_state); | ||
| 388 | return WrongDeviceState; | ||
| 389 | } | ||
| 390 | |||
| 391 | u8 flags = static_cast<u8>(tag_data.settings.settings.raw >> 0x4); | ||
| 392 | if (tag_data.settings.settings.amiibo_initialized == 0) { | ||
| 393 | flags = flags & 0xfe; | ||
| 394 | } | ||
| 395 | |||
| 396 | u64 application_id = 0; | ||
| 397 | u32 application_area_id = 0; | ||
| 398 | AppAreaVersion app_area_version = AppAreaVersion::NotSet; | ||
| 399 | if (tag_data.settings.settings.appdata_initialized != 0) { | ||
| 400 | application_id = tag_data.application_id; | ||
| 401 | app_area_version = | ||
| 402 | static_cast<AppAreaVersion>(application_id >> application_id_version_offset & 0xf); | ||
| 403 | |||
| 404 | // Restore application id to original value | ||
| 405 | if (application_id >> 0x38 != 0) { | ||
| 406 | const u8 application_byte = tag_data.application_id_byte & 0xf; | ||
| 407 | application_id = RemoveVersionByte(application_id) | | ||
| 408 | (static_cast<u64>(application_byte) << application_id_version_offset); | ||
| 409 | } | ||
| 410 | |||
| 411 | application_area_id = tag_data.application_area_id; | ||
| 412 | } | ||
| 413 | |||
| 414 | // TODO: Validate this data | ||
| 415 | admin_info = { | ||
| 416 | .application_id = application_id, | ||
| 417 | .application_area_id = application_area_id, | ||
| 418 | .crc_change_counter = tag_data.settings.crc_counter, | ||
| 419 | .flags = flags, | ||
| 420 | .tag_type = PackedTagType::Type2, | ||
| 421 | .app_area_version = app_area_version, | ||
| 374 | }; | 422 | }; |
| 375 | 423 | ||
| 376 | return ResultSuccess; | 424 | return ResultSuccess; |
| 377 | } | 425 | } |
| 378 | 426 | ||
| 379 | Result NfpDevice::SetNicknameAndOwner(const AmiiboName& amiibo_name) { | 427 | Result NfpDevice::DeleteRegisterInfo() { |
| 428 | if (device_state != DeviceState::TagMounted) { | ||
| 429 | LOG_ERROR(Service_NFC, "Wrong device state {}", device_state); | ||
| 430 | if (device_state == DeviceState::TagRemoved) { | ||
| 431 | return TagRemoved; | ||
| 432 | } | ||
| 433 | return WrongDeviceState; | ||
| 434 | } | ||
| 435 | |||
| 436 | if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) { | ||
| 437 | LOG_ERROR(Service_NFC, "Amiibo is read only", device_state); | ||
| 438 | return WrongDeviceState; | ||
| 439 | } | ||
| 440 | |||
| 441 | if (tag_data.settings.settings.amiibo_initialized == 0) { | ||
| 442 | return RegistrationIsNotInitialized; | ||
| 443 | } | ||
| 444 | |||
| 445 | Common::TinyMT rng{}; | ||
| 446 | rng.GenerateRandomBytes(&tag_data.owner_mii, sizeof(tag_data.owner_mii)); | ||
| 447 | rng.GenerateRandomBytes(&tag_data.settings.amiibo_name, sizeof(tag_data.settings.amiibo_name)); | ||
| 448 | rng.GenerateRandomBytes(&tag_data.unknown, sizeof(u8)); | ||
| 449 | rng.GenerateRandomBytes(&tag_data.unknown2[0], sizeof(u32)); | ||
| 450 | rng.GenerateRandomBytes(&tag_data.unknown2[1], sizeof(u32)); | ||
| 451 | rng.GenerateRandomBytes(&tag_data.application_area_crc, sizeof(u32)); | ||
| 452 | rng.GenerateRandomBytes(&tag_data.settings.init_date, sizeof(u32)); | ||
| 453 | tag_data.settings.settings.font_region.Assign(0); | ||
| 454 | tag_data.settings.settings.amiibo_initialized.Assign(0); | ||
| 455 | |||
| 456 | return Flush(); | ||
| 457 | } | ||
| 458 | |||
| 459 | Result NfpDevice::SetRegisterInfoPrivate(const AmiiboName& amiibo_name) { | ||
| 380 | if (device_state != DeviceState::TagMounted) { | 460 | if (device_state != DeviceState::TagMounted) { |
| 381 | LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); | 461 | LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); |
| 382 | if (device_state == DeviceState::TagRemoved) { | 462 | if (device_state == DeviceState::TagRemoved) { |
| @@ -393,16 +473,23 @@ Result NfpDevice::SetNicknameAndOwner(const AmiiboName& amiibo_name) { | |||
| 393 | Service::Mii::MiiManager manager; | 473 | Service::Mii::MiiManager manager; |
| 394 | auto& settings = tag_data.settings; | 474 | auto& settings = tag_data.settings; |
| 395 | 475 | ||
| 396 | settings.init_date = GetAmiiboDate(current_posix_time); | 476 | if (tag_data.settings.settings.amiibo_initialized == 0) { |
| 397 | settings.write_date = GetAmiiboDate(current_posix_time); | 477 | settings.init_date = GetAmiiboDate(current_posix_time); |
| 398 | settings.crc_counter++; | 478 | settings.write_date.raw_date = 0; |
| 399 | // TODO: Find how to calculate the crc check | 479 | } |
| 400 | // settings.crc = CalculateCRC(settings); | ||
| 401 | 480 | ||
| 402 | SetAmiiboName(settings, amiibo_name); | 481 | SetAmiiboName(settings, amiibo_name); |
| 403 | tag_data.owner_mii = manager.ConvertCharInfoToV3(manager.BuildDefault(0)); | 482 | tag_data.owner_mii = manager.ConvertCharInfoToV3(manager.BuildDefault(0)); |
| 483 | tag_data.unknown = 0; | ||
| 484 | tag_data.unknown2[6] = 0; | ||
| 485 | settings.country_code_id = 0; | ||
| 486 | settings.settings.font_region.Assign(0); | ||
| 404 | settings.settings.amiibo_initialized.Assign(1); | 487 | settings.settings.amiibo_initialized.Assign(1); |
| 405 | 488 | ||
| 489 | // TODO: this is a mix of tag.file input | ||
| 490 | std::array<u8, 0x7e> unknown_input{}; | ||
| 491 | tag_data.application_area_crc = CalculateCrc(unknown_input); | ||
| 492 | |||
| 406 | return Flush(); | 493 | return Flush(); |
| 407 | } | 494 | } |
| 408 | 495 | ||
| @@ -425,23 +512,17 @@ Result NfpDevice::RestoreAmiibo() { | |||
| 425 | return ResultSuccess; | 512 | return ResultSuccess; |
| 426 | } | 513 | } |
| 427 | 514 | ||
| 428 | Result NfpDevice::DeleteAllData() { | 515 | Result NfpDevice::Format() { |
| 429 | const auto result = DeleteApplicationArea(); | 516 | auto result1 = DeleteApplicationArea(); |
| 430 | if (result.IsError()) { | 517 | auto result2 = DeleteRegisterInfo(); |
| 431 | return result; | ||
| 432 | } | ||
| 433 | 518 | ||
| 434 | if (device_state != DeviceState::TagMounted) { | 519 | if (result1.IsError()) { |
| 435 | LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); | 520 | return result1; |
| 436 | if (device_state == DeviceState::TagRemoved) { | ||
| 437 | return TagRemoved; | ||
| 438 | } | ||
| 439 | return WrongDeviceState; | ||
| 440 | } | 521 | } |
| 441 | 522 | ||
| 442 | Common::TinyMT rng{}; | 523 | if (result2.IsError()) { |
| 443 | rng.GenerateRandomBytes(&tag_data.owner_mii, sizeof(tag_data.owner_mii)); | 524 | return result2; |
| 444 | tag_data.settings.settings.amiibo_initialized.Assign(0); | 525 | } |
| 445 | 526 | ||
| 446 | return Flush(); | 527 | return Flush(); |
| 447 | } | 528 | } |
| @@ -569,7 +650,10 @@ Result NfpDevice::SetApplicationArea(std::span<const u8> data) { | |||
| 569 | rng.GenerateRandomBytes(tag_data.application_area.data() + data.size(), | 650 | rng.GenerateRandomBytes(tag_data.application_area.data() + data.size(), |
| 570 | sizeof(ApplicationArea) - data.size()); | 651 | sizeof(ApplicationArea) - data.size()); |
| 571 | 652 | ||
| 572 | tag_data.applicaton_write_counter++; | 653 | if (tag_data.application_write_counter != counter_limit) { |
| 654 | tag_data.application_write_counter++; | ||
| 655 | } | ||
| 656 | |||
| 573 | is_data_moddified = true; | 657 | is_data_moddified = true; |
| 574 | 658 | ||
| 575 | return ResultSuccess; | 659 | return ResultSuccess; |
| @@ -617,14 +701,25 @@ Result NfpDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> dat | |||
| 617 | rng.GenerateRandomBytes(tag_data.application_area.data() + data.size(), | 701 | rng.GenerateRandomBytes(tag_data.application_area.data() + data.size(), |
| 618 | sizeof(ApplicationArea) - data.size()); | 702 | sizeof(ApplicationArea) - data.size()); |
| 619 | 703 | ||
| 620 | // TODO: Investigate why the title id needs to be moddified | 704 | if (tag_data.application_write_counter != counter_limit) { |
| 621 | tag_data.title_id = system.GetApplicationProcessProgramID(); | 705 | tag_data.application_write_counter++; |
| 622 | tag_data.title_id = tag_data.title_id | 0x30000000ULL; | 706 | } |
| 707 | |||
| 708 | const u64 application_id = system.GetApplicationProcessProgramID(); | ||
| 709 | |||
| 710 | tag_data.application_id_byte = | ||
| 711 | static_cast<u8>(application_id >> application_id_version_offset & 0xf); | ||
| 712 | tag_data.application_id = | ||
| 713 | RemoveVersionByte(application_id) | | ||
| 714 | (static_cast<u64>(AppAreaVersion::NintendoSwitch) << application_id_version_offset); | ||
| 623 | tag_data.settings.settings.appdata_initialized.Assign(1); | 715 | tag_data.settings.settings.appdata_initialized.Assign(1); |
| 624 | tag_data.application_area_id = access_id; | 716 | tag_data.application_area_id = access_id; |
| 625 | tag_data.applicaton_write_counter++; | ||
| 626 | tag_data.unknown = {}; | 717 | tag_data.unknown = {}; |
| 627 | 718 | ||
| 719 | // TODO: this is a mix of tag_data input | ||
| 720 | std::array<u8, 0x7e> unknown_input{}; | ||
| 721 | tag_data.application_area_crc = CalculateCrc(unknown_input); | ||
| 722 | |||
| 628 | return Flush(); | 723 | return Flush(); |
| 629 | } | 724 | } |
| 630 | 725 | ||
| @@ -642,12 +737,20 @@ Result NfpDevice::DeleteApplicationArea() { | |||
| 642 | return WrongDeviceState; | 737 | return WrongDeviceState; |
| 643 | } | 738 | } |
| 644 | 739 | ||
| 740 | if (tag_data.settings.settings.appdata_initialized == 0) { | ||
| 741 | return ApplicationAreaIsNotInitialized; | ||
| 742 | } | ||
| 743 | |||
| 744 | if (tag_data.application_write_counter != counter_limit) { | ||
| 745 | tag_data.application_write_counter++; | ||
| 746 | } | ||
| 747 | |||
| 645 | Common::TinyMT rng{}; | 748 | Common::TinyMT rng{}; |
| 646 | rng.GenerateRandomBytes(tag_data.application_area.data(), sizeof(ApplicationArea)); | 749 | rng.GenerateRandomBytes(tag_data.application_area.data(), sizeof(ApplicationArea)); |
| 647 | rng.GenerateRandomBytes(&tag_data.title_id, sizeof(u64)); | 750 | rng.GenerateRandomBytes(&tag_data.application_id, sizeof(u64)); |
| 648 | rng.GenerateRandomBytes(&tag_data.application_area_id, sizeof(u32)); | 751 | rng.GenerateRandomBytes(&tag_data.application_area_id, sizeof(u32)); |
| 752 | rng.GenerateRandomBytes(&tag_data.application_id_byte, sizeof(u8)); | ||
| 649 | tag_data.settings.settings.appdata_initialized.Assign(0); | 753 | tag_data.settings.settings.appdata_initialized.Assign(0); |
| 650 | tag_data.applicaton_write_counter++; | ||
| 651 | tag_data.unknown = {}; | 754 | tag_data.unknown = {}; |
| 652 | 755 | ||
| 653 | return Flush(); | 756 | return Flush(); |
| @@ -719,4 +822,45 @@ AmiiboDate NfpDevice::GetAmiiboDate(s64 posix_time) const { | |||
| 719 | return amiibo_date; | 822 | return amiibo_date; |
| 720 | } | 823 | } |
| 721 | 824 | ||
| 825 | u64 NfpDevice::RemoveVersionByte(u64 application_id) const { | ||
| 826 | return application_id & ~(0xfULL << application_id_version_offset); | ||
| 827 | } | ||
| 828 | |||
| 829 | void NfpDevice::UpdateSettingsCrc() { | ||
| 830 | auto& settings = tag_data.settings; | ||
| 831 | |||
| 832 | if (settings.crc_counter != counter_limit) { | ||
| 833 | settings.crc_counter++; | ||
| 834 | } | ||
| 835 | |||
| 836 | // TODO: this reads data from a global, find what it is | ||
| 837 | std::array<u8, 8> unknown_input{}; | ||
| 838 | settings.crc = CalculateCrc(unknown_input); | ||
| 839 | } | ||
| 840 | |||
| 841 | u32 NfpDevice::CalculateCrc(std::span<const u8> data) { | ||
| 842 | constexpr u32 magic = 0xedb88320; | ||
| 843 | u32 crc = 0xffffffff; | ||
| 844 | |||
| 845 | if (data.size() == 0) { | ||
| 846 | return 0; | ||
| 847 | } | ||
| 848 | |||
| 849 | for (u8 input : data) { | ||
| 850 | u32 temp = (crc ^ input) >> 1; | ||
| 851 | if (((crc ^ input) & 1) != 0) { | ||
| 852 | temp = temp ^ magic; | ||
| 853 | } | ||
| 854 | |||
| 855 | for (std::size_t step = 0; step < 7; ++step) { | ||
| 856 | crc = temp >> 1; | ||
| 857 | if ((temp & 1) != 0) { | ||
| 858 | crc = temp >> 1 ^ magic; | ||
| 859 | } | ||
| 860 | } | ||
| 861 | } | ||
| 862 | |||
| 863 | return ~crc; | ||
| 864 | } | ||
| 865 | |||
| 722 | } // namespace Service::NFP | 866 | } // namespace Service::NFP |
diff --git a/src/core/hle/service/nfp/nfp_device.h b/src/core/hle/service/nfp/nfp_device.h index b6a46f2ac..06386401d 100644 --- a/src/core/hle/service/nfp/nfp_device.h +++ b/src/core/hle/service/nfp/nfp_device.h | |||
| @@ -47,10 +47,12 @@ public: | |||
| 47 | Result GetCommonInfo(CommonInfo& common_info) const; | 47 | Result GetCommonInfo(CommonInfo& common_info) const; |
| 48 | Result GetModelInfo(ModelInfo& model_info) const; | 48 | Result GetModelInfo(ModelInfo& model_info) const; |
| 49 | Result GetRegisterInfo(RegisterInfo& register_info) const; | 49 | Result GetRegisterInfo(RegisterInfo& register_info) const; |
| 50 | Result GetAdminInfo(AdminInfo& admin_info) const; | ||
| 50 | 51 | ||
| 51 | Result SetNicknameAndOwner(const AmiiboName& amiibo_name); | 52 | Result DeleteRegisterInfo(); |
| 53 | Result SetRegisterInfoPrivate(const AmiiboName& amiibo_name); | ||
| 52 | Result RestoreAmiibo(); | 54 | Result RestoreAmiibo(); |
| 53 | Result DeleteAllData(); | 55 | Result Format(); |
| 54 | 56 | ||
| 55 | Result OpenApplicationArea(u32 access_id); | 57 | Result OpenApplicationArea(u32 access_id); |
| 56 | Result GetApplicationAreaId(u32& application_area_id) const; | 58 | Result GetApplicationAreaId(u32& application_area_id) const; |
| @@ -76,6 +78,9 @@ private: | |||
| 76 | AmiiboName GetAmiiboName(const AmiiboSettings& settings) const; | 78 | AmiiboName GetAmiiboName(const AmiiboSettings& settings) const; |
| 77 | void SetAmiiboName(AmiiboSettings& settings, const AmiiboName& amiibo_name); | 79 | void SetAmiiboName(AmiiboSettings& settings, const AmiiboName& amiibo_name); |
| 78 | AmiiboDate GetAmiiboDate(s64 posix_time) const; | 80 | AmiiboDate GetAmiiboDate(s64 posix_time) const; |
| 81 | u64 RemoveVersionByte(u64 application_id) const; | ||
| 82 | void UpdateSettingsCrc(); | ||
| 83 | u32 CalculateCrc(std::span<const u8>); | ||
| 79 | 84 | ||
| 80 | bool is_controller_set{}; | 85 | bool is_controller_set{}; |
| 81 | int callback_key; | 86 | int callback_key; |
diff --git a/src/core/hle/service/nfp/nfp_types.h b/src/core/hle/service/nfp/nfp_types.h index fc228c2b2..142343d6e 100644 --- a/src/core/hle/service/nfp/nfp_types.h +++ b/src/core/hle/service/nfp/nfp_types.h | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | namespace Service::NFP { | 11 | namespace Service::NFP { |
| 12 | static constexpr std::size_t amiibo_name_length = 0xA; | 12 | static constexpr std::size_t amiibo_name_length = 0xA; |
| 13 | static constexpr std::size_t application_id_version_offset = 0x1c; | ||
| 14 | static constexpr std::size_t counter_limit = 0xffff; | ||
| 13 | 15 | ||
| 14 | enum class ServiceType : u32 { | 16 | enum class ServiceType : u32 { |
| 15 | User, | 17 | User, |
| @@ -99,6 +101,14 @@ enum class TagProtocol : u32 { | |||
| 99 | All = 0xFFFFFFFFU, | 101 | All = 0xFFFFFFFFU, |
| 100 | }; | 102 | }; |
| 101 | 103 | ||
| 104 | enum class AppAreaVersion : u8 { | ||
| 105 | Nintendo3DS = 0, | ||
| 106 | NintendoWiiU = 1, | ||
| 107 | Nintendo3DSv2 = 2, | ||
| 108 | NintendoSwitch = 3, | ||
| 109 | NotSet = 0xFF, | ||
| 110 | }; | ||
| 111 | |||
| 102 | enum class CabinetMode : u8 { | 112 | enum class CabinetMode : u8 { |
| 103 | StartNicknameAndOwnerSettings, | 113 | StartNicknameAndOwnerSettings, |
| 104 | StartGameDataEraser, | 114 | StartGameDataEraser, |
| @@ -197,6 +207,7 @@ struct Settings { | |||
| 197 | union { | 207 | union { |
| 198 | u8 raw{}; | 208 | u8 raw{}; |
| 199 | 209 | ||
| 210 | BitField<0, 4, u8> font_region; | ||
| 200 | BitField<4, 1, u8> amiibo_initialized; | 211 | BitField<4, 1, u8> amiibo_initialized; |
| 201 | BitField<5, 1, u8> appdata_initialized; | 212 | BitField<5, 1, u8> appdata_initialized; |
| 202 | }; | 213 | }; |
| @@ -236,18 +247,20 @@ static_assert(sizeof(NTAG215Password) == 0x8, "NTAG215Password is an invalid siz | |||
| 236 | struct EncryptedAmiiboFile { | 247 | struct EncryptedAmiiboFile { |
| 237 | u8 constant_value; // Must be A5 | 248 | u8 constant_value; // Must be A5 |
| 238 | u16_be write_counter; // Number of times the amiibo has been written? | 249 | u16_be write_counter; // Number of times the amiibo has been written? |
| 239 | INSERT_PADDING_BYTES(0x1); // Unknown 1 | 250 | u8 amiibo_version; // Amiibo file version |
| 240 | AmiiboSettings settings; // Encrypted amiibo settings | 251 | AmiiboSettings settings; // Encrypted amiibo settings |
| 241 | HashData hmac_tag; // Hash | 252 | HashData hmac_tag; // Hash |
| 242 | AmiiboModelInfo model_info; // Encrypted amiibo model info | 253 | AmiiboModelInfo model_info; // Encrypted amiibo model info |
| 243 | HashData keygen_salt; // Salt | 254 | HashData keygen_salt; // Salt |
| 244 | HashData hmac_data; // Hash | 255 | HashData hmac_data; // Hash |
| 245 | Service::Mii::Ver3StoreData owner_mii; // Encrypted Mii data | 256 | Service::Mii::Ver3StoreData owner_mii; // Encrypted Mii data |
| 246 | u64_be title_id; // Encrypted Game id | 257 | u64_be application_id; // Encrypted Game id |
| 247 | u16_be applicaton_write_counter; // Encrypted Counter | 258 | u16_be application_write_counter; // Encrypted Counter |
| 248 | u32_be application_area_id; // Encrypted Game id | 259 | u32_be application_area_id; // Encrypted Game id |
| 249 | std::array<u8, 0x2> unknown; | 260 | u8 application_id_byte; |
| 250 | std::array<u32, 0x8> unknown2; | 261 | u8 unknown; |
| 262 | std::array<u32, 0x7> unknown2; | ||
| 263 | u32_be application_area_crc; | ||
| 251 | ApplicationArea application_area; // Encrypted Game data | 264 | ApplicationArea application_area; // Encrypted Game data |
| 252 | }; | 265 | }; |
| 253 | static_assert(sizeof(EncryptedAmiiboFile) == 0x1F8, "AmiiboFile is an invalid size"); | 266 | static_assert(sizeof(EncryptedAmiiboFile) == 0x1F8, "AmiiboFile is an invalid size"); |
| @@ -259,14 +272,16 @@ struct NTAG215File { | |||
| 259 | HashData hmac_data; // Hash | 272 | HashData hmac_data; // Hash |
| 260 | u8 constant_value; // Must be A5 | 273 | u8 constant_value; // Must be A5 |
| 261 | u16_be write_counter; // Number of times the amiibo has been written? | 274 | u16_be write_counter; // Number of times the amiibo has been written? |
| 262 | INSERT_PADDING_BYTES(0x1); // Unknown 1 | 275 | u8 amiibo_version; // Amiibo file version |
| 263 | AmiiboSettings settings; | 276 | AmiiboSettings settings; |
| 264 | Service::Mii::Ver3StoreData owner_mii; // Encrypted Mii data | 277 | Service::Mii::Ver3StoreData owner_mii; // Mii data |
| 265 | u64_be title_id; | 278 | u64_be application_id; // Game id |
| 266 | u16_be applicaton_write_counter; // Encrypted Counter | 279 | u16_be application_write_counter; // Counter |
| 267 | u32_be application_area_id; | 280 | u32_be application_area_id; |
| 268 | std::array<u8, 0x2> unknown; | 281 | u8 application_id_byte; |
| 269 | std::array<u32, 0x8> unknown2; | 282 | u8 unknown; |
| 283 | std::array<u32, 0x7> unknown2; | ||
| 284 | u32_be application_area_crc; | ||
| 270 | ApplicationArea application_area; // Encrypted Game data | 285 | ApplicationArea application_area; // Encrypted Game data |
| 271 | HashData hmac_tag; // Hash | 286 | HashData hmac_tag; // Hash |
| 272 | UniqueSerialNumber uid; // Unique serial number | 287 | UniqueSerialNumber uid; // Unique serial number |
| @@ -336,6 +351,18 @@ struct RegisterInfo { | |||
| 336 | }; | 351 | }; |
| 337 | static_assert(sizeof(RegisterInfo) == 0x100, "RegisterInfo is an invalid size"); | 352 | static_assert(sizeof(RegisterInfo) == 0x100, "RegisterInfo is an invalid size"); |
| 338 | 353 | ||
| 354 | struct AdminInfo { | ||
| 355 | u64 application_id; | ||
| 356 | u32 application_area_id; | ||
| 357 | u16 crc_change_counter; | ||
| 358 | u8 flags; | ||
| 359 | PackedTagType tag_type; | ||
| 360 | AppAreaVersion app_area_version; | ||
| 361 | INSERT_PADDING_BYTES(0x7); | ||
| 362 | INSERT_PADDING_BYTES(0x28); | ||
| 363 | }; | ||
| 364 | static_assert(sizeof(AdminInfo) == 0x40, "AdminInfo is an invalid size"); | ||
| 365 | |||
| 339 | struct SectorKey { | 366 | struct SectorKey { |
| 340 | MifareCmd command; | 367 | MifareCmd command; |
| 341 | u8 unknown; // Usually 1 | 368 | u8 unknown; // Usually 1 |
diff --git a/src/core/hle/service/ns/errors.h b/src/core/hle/service/ns/errors.h index 8a7621798..16d2ea6f7 100644 --- a/src/core/hle/service/ns/errors.h +++ b/src/core/hle/service/ns/errors.h | |||
| @@ -7,5 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | namespace Service::NS { | 8 | namespace Service::NS { |
| 9 | 9 | ||
| 10 | constexpr Result ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300}; | 10 | constexpr Result ResultApplicationLanguageNotFound{ErrorModule::NS, 300}; |
| 11 | } \ No newline at end of file | 11 | |
| 12 | } | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index d6f0faea2..376067a95 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -416,14 +416,14 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( | |||
| 416 | if (application_language == std::nullopt) { | 416 | if (application_language == std::nullopt) { |
| 417 | LOG_ERROR(Service_NS, "Could not convert application language! language_code={}", | 417 | LOG_ERROR(Service_NS, "Could not convert application language! language_code={}", |
| 418 | language_code); | 418 | language_code); |
| 419 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; | 419 | return Service::NS::ResultApplicationLanguageNotFound; |
| 420 | } | 420 | } |
| 421 | const auto priority_list = GetApplicationLanguagePriorityList(*application_language); | 421 | const auto priority_list = GetApplicationLanguagePriorityList(*application_language); |
| 422 | if (!priority_list) { | 422 | if (!priority_list) { |
| 423 | LOG_ERROR(Service_NS, | 423 | LOG_ERROR(Service_NS, |
| 424 | "Could not find application language priorities! application_language={}", | 424 | "Could not find application language priorities! application_language={}", |
| 425 | *application_language); | 425 | *application_language); |
| 426 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; | 426 | return Service::NS::ResultApplicationLanguageNotFound; |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | // Try to find a valid language. | 429 | // Try to find a valid language. |
| @@ -436,7 +436,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( | |||
| 436 | 436 | ||
| 437 | LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}", | 437 | LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}", |
| 438 | supported_languages); | 438 | supported_languages); |
| 439 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; | 439 | return Service::NS::ResultApplicationLanguageNotFound; |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( | 442 | void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( |
| @@ -461,7 +461,7 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag | |||
| 461 | ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language)); | 461 | ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language)); |
| 462 | if (language_code == std::nullopt) { | 462 | if (language_code == std::nullopt) { |
| 463 | LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language); | 463 | LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language); |
| 464 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; | 464 | return Service::NS::ResultApplicationLanguageNotFound; |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | return static_cast<u64>(*language_code); | 467 | return static_cast<u64>(*language_code); |
diff --git a/src/core/hle/service/server_manager.cpp b/src/core/hle/service/server_manager.cpp index c91f6d880..bd04cd023 100644 --- a/src/core/hle/service/server_manager.cpp +++ b/src/core/hle/service/server_manager.cpp | |||
| @@ -404,7 +404,7 @@ Result ServerManager::CompleteSyncRequest(RequestState&& request) { | |||
| 404 | rc = request.session->SendReplyHLE(); | 404 | rc = request.session->SendReplyHLE(); |
| 405 | 405 | ||
| 406 | // If the session has been closed, we're done. | 406 | // If the session has been closed, we're done. |
| 407 | if (rc == Kernel::ResultSessionClosed || service_rc == IPC::ERR_REMOTE_PROCESS_DEAD) { | 407 | if (rc == Kernel::ResultSessionClosed || service_rc == IPC::ResultSessionClosed) { |
| 408 | // Close the session. | 408 | // Close the session. |
| 409 | request.session->Close(); | 409 | request.session->Close(); |
| 410 | 410 | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index eed615377..69cdb5918 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -176,7 +176,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, | |||
| 176 | case IPC::CommandType::TIPC_Close: { | 176 | case IPC::CommandType::TIPC_Close: { |
| 177 | IPC::ResponseBuilder rb{ctx, 2}; | 177 | IPC::ResponseBuilder rb{ctx, 2}; |
| 178 | rb.Push(ResultSuccess); | 178 | rb.Push(ResultSuccess); |
| 179 | result = IPC::ERR_REMOTE_PROCESS_DEAD; | 179 | result = IPC::ResultSessionClosed; |
| 180 | break; | 180 | break; |
| 181 | } | 181 | } |
| 182 | case IPC::CommandType::ControlWithContext: | 182 | case IPC::CommandType::ControlWithContext: |
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 88df52331..f5788b481 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -74,7 +74,7 @@ constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_la | |||
| 74 | constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; | 74 | constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; |
| 75 | constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; | 75 | constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; |
| 76 | 76 | ||
| 77 | constexpr Result ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625}; | 77 | constexpr Result ResultInvalidLanguage{ErrorModule::Settings, 625}; |
| 78 | 78 | ||
| 79 | void PushResponseLanguageCode(HLERequestContext& ctx, std::size_t num_language_codes) { | 79 | void PushResponseLanguageCode(HLERequestContext& ctx, std::size_t num_language_codes) { |
| 80 | IPC::ResponseBuilder rb{ctx, 3}; | 80 | IPC::ResponseBuilder rb{ctx, 3}; |
| @@ -130,7 +130,7 @@ void SET::MakeLanguageCode(HLERequestContext& ctx) { | |||
| 130 | if (index >= available_language_codes.size()) { | 130 | if (index >= available_language_codes.size()) { |
| 131 | LOG_ERROR(Service_SET, "Invalid language code index! index={}", index); | 131 | LOG_ERROR(Service_SET, "Invalid language code index! index={}", index); |
| 132 | IPC::ResponseBuilder rb{ctx, 2}; | 132 | IPC::ResponseBuilder rb{ctx, 2}; |
| 133 | rb.Push(ERR_INVALID_LANGUAGE); | 133 | rb.Push(Set::ResultInvalidLanguage); |
| 134 | return; | 134 | return; |
| 135 | } | 135 | } |
| 136 | 136 | ||
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index a46f47d3e..b4046d3ce 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp | |||
| @@ -18,10 +18,10 @@ | |||
| 18 | 18 | ||
| 19 | namespace Service::SM { | 19 | namespace Service::SM { |
| 20 | 20 | ||
| 21 | constexpr Result ERR_NOT_INITIALIZED(ErrorModule::SM, 2); | 21 | constexpr Result ResultInvalidClient(ErrorModule::SM, 2); |
| 22 | constexpr Result ERR_ALREADY_REGISTERED(ErrorModule::SM, 4); | 22 | constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4); |
| 23 | constexpr Result ERR_INVALID_NAME(ErrorModule::SM, 6); | 23 | constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6); |
| 24 | constexpr Result ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7); | 24 | constexpr Result ResultNotRegistered(ErrorModule::SM, 7); |
| 25 | 25 | ||
| 26 | ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { | 26 | ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { |
| 27 | controller_interface = std::make_unique<Controller>(kernel.System()); | 27 | controller_interface = std::make_unique<Controller>(kernel.System()); |
| @@ -45,7 +45,7 @@ void ServiceManager::InvokeControlRequest(HLERequestContext& context) { | |||
| 45 | static Result ValidateServiceName(const std::string& name) { | 45 | static Result ValidateServiceName(const std::string& name) { |
| 46 | if (name.empty() || name.size() > 8) { | 46 | if (name.empty() || name.size() > 8) { |
| 47 | LOG_ERROR(Service_SM, "Invalid service name! service={}", name); | 47 | LOG_ERROR(Service_SM, "Invalid service name! service={}", name); |
| 48 | return ERR_INVALID_NAME; | 48 | return Service::SM::ResultInvalidServiceName; |
| 49 | } | 49 | } |
| 50 | return ResultSuccess; | 50 | return ResultSuccess; |
| 51 | } | 51 | } |
| @@ -58,7 +58,7 @@ Result ServiceManager::RegisterService(std::string name, u32 max_sessions, | |||
| 58 | std::scoped_lock lk{lock}; | 58 | std::scoped_lock lk{lock}; |
| 59 | if (registered_services.find(name) != registered_services.end()) { | 59 | if (registered_services.find(name) != registered_services.end()) { |
| 60 | LOG_ERROR(Service_SM, "Service is already registered! service={}", name); | 60 | LOG_ERROR(Service_SM, "Service is already registered! service={}", name); |
| 61 | return ERR_ALREADY_REGISTERED; | 61 | return Service::SM::ResultAlreadyRegistered; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | auto* port = Kernel::KPort::Create(kernel); | 64 | auto* port = Kernel::KPort::Create(kernel); |
| @@ -80,7 +80,7 @@ Result ServiceManager::UnregisterService(const std::string& name) { | |||
| 80 | const auto iter = registered_services.find(name); | 80 | const auto iter = registered_services.find(name); |
| 81 | if (iter == registered_services.end()) { | 81 | if (iter == registered_services.end()) { |
| 82 | LOG_ERROR(Service_SM, "Server is not registered! service={}", name); | 82 | LOG_ERROR(Service_SM, "Server is not registered! service={}", name); |
| 83 | return ERR_SERVICE_NOT_REGISTERED; | 83 | return Service::SM::ResultNotRegistered; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | registered_services.erase(iter); | 86 | registered_services.erase(iter); |
| @@ -96,7 +96,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name | |||
| 96 | auto it = service_ports.find(name); | 96 | auto it = service_ports.find(name); |
| 97 | if (it == service_ports.end()) { | 97 | if (it == service_ports.end()) { |
| 98 | LOG_WARNING(Service_SM, "Server is not registered! service={}", name); | 98 | LOG_WARNING(Service_SM, "Server is not registered! service={}", name); |
| 99 | return ERR_SERVICE_NOT_REGISTERED; | 99 | return Service::SM::ResultNotRegistered; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | return it->second; | 102 | return it->second; |
| @@ -160,7 +160,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) { | |||
| 160 | 160 | ||
| 161 | ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) { | 161 | ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) { |
| 162 | if (!ctx.GetManager()->GetIsInitializedForSm()) { | 162 | if (!ctx.GetManager()->GetIsInitializedForSm()) { |
| 163 | return ERR_NOT_INITIALIZED; | 163 | return Service::SM::ResultInvalidClient; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | IPC::RequestParser rp{ctx}; | 166 | IPC::RequestParser rp{ctx}; |
| @@ -168,15 +168,15 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) { | |||
| 168 | 168 | ||
| 169 | // Find the named port. | 169 | // Find the named port. |
| 170 | auto port_result = service_manager.GetServicePort(name); | 170 | auto port_result = service_manager.GetServicePort(name); |
| 171 | if (port_result.Code() == ERR_INVALID_NAME) { | 171 | if (port_result.Code() == Service::SM::ResultInvalidServiceName) { |
| 172 | LOG_ERROR(Service_SM, "Invalid service name '{}'", name); | 172 | LOG_ERROR(Service_SM, "Invalid service name '{}'", name); |
| 173 | return ERR_INVALID_NAME; | 173 | return Service::SM::ResultInvalidServiceName; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | if (port_result.Failed()) { | 176 | if (port_result.Failed()) { |
| 177 | LOG_INFO(Service_SM, "Waiting for service {} to become available", name); | 177 | LOG_INFO(Service_SM, "Waiting for service {} to become available", name); |
| 178 | ctx.SetIsDeferred(); | 178 | ctx.SetIsDeferred(); |
| 179 | return ERR_SERVICE_NOT_REGISTERED; | 179 | return Service::SM::ResultNotRegistered; |
| 180 | } | 180 | } |
| 181 | auto& port = port_result.Unwrap(); | 181 | auto& port = port_result.Unwrap(); |
| 182 | 182 | ||
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index f09c176f8..1231c0dc8 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp | |||
| @@ -126,8 +126,8 @@ double PerfStats::GetLastFrameTimeScale() const { | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) { | 128 | void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) { |
| 129 | if (!Settings::values.use_speed_limit.GetValue() || | 129 | if (Settings::values.use_multi_core.GetValue() || |
| 130 | Settings::values.use_multi_core.GetValue()) { | 130 | !Settings::values.use_speed_limit.GetValue()) { |
| 131 | return; | 131 | return; |
| 132 | } | 132 | } |
| 133 | 133 | ||