summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/acc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/acc')
-rw-r--r--src/core/hle/service/acc/acc.cpp3
-rw-r--r--src/core/hle/service/acc/async_context.cpp17
-rw-r--r--src/core/hle/service/acc/async_context.h7
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp9
4 files changed, 21 insertions, 15 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 6d9ec0a8a..689b36056 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -929,8 +929,7 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
}
const auto user_list = profile_manager->GetAllUsers();
- if (std::all_of(user_list.begin(), user_list.end(),
- [](const auto& user) { return user.uuid == Common::INVALID_UUID; })) {
+ if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) {
rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code
rb.PushRaw<u128>(Common::INVALID_UUID);
return;
diff --git a/src/core/hle/service/acc/async_context.cpp b/src/core/hle/service/acc/async_context.cpp
index 459323132..a49dfdec7 100644
--- a/src/core/hle/service/acc/async_context.cpp
+++ b/src/core/hle/service/acc/async_context.cpp
@@ -4,15 +4,12 @@
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
+#include "core/hle/kernel/k_event.h"
#include "core/hle/service/acc/async_context.h"
namespace Service::Account {
IAsyncContext::IAsyncContext(Core::System& system_)
- : ServiceFramework{system_, "IAsyncContext"}, compeletion_event{system_.Kernel()} {
-
- Kernel::KAutoObject::Create(std::addressof(compeletion_event));
- compeletion_event.Initialize("IAsyncContext:CompletionEvent");
-
+ : ServiceFramework{system_, "IAsyncContext"}, service_context{system_, "IAsyncContext"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"},
@@ -23,6 +20,12 @@ IAsyncContext::IAsyncContext(Core::System& system_)
// clang-format on
RegisterHandlers(functions);
+
+ completion_event = service_context.CreateEvent("IAsyncContext:CompletionEvent");
+}
+
+IAsyncContext::~IAsyncContext() {
+ service_context.CloseEvent(completion_event);
}
void IAsyncContext::GetSystemEvent(Kernel::HLERequestContext& ctx) {
@@ -30,7 +33,7 @@ void IAsyncContext::GetSystemEvent(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
- rb.PushCopyObjects(compeletion_event.GetReadableEvent());
+ rb.PushCopyObjects(completion_event->GetReadableEvent());
}
void IAsyncContext::Cancel(Kernel::HLERequestContext& ctx) {
@@ -62,7 +65,7 @@ void IAsyncContext::GetResult(Kernel::HLERequestContext& ctx) {
void IAsyncContext::MarkComplete() {
is_complete.store(true);
- compeletion_event.GetWritableEvent().Signal();
+ completion_event->GetWritableEvent().Signal();
}
} // namespace Service::Account
diff --git a/src/core/hle/service/acc/async_context.h b/src/core/hle/service/acc/async_context.h
index c694b4946..cc3a0a9fe 100644
--- a/src/core/hle/service/acc/async_context.h
+++ b/src/core/hle/service/acc/async_context.h
@@ -5,7 +5,7 @@
#pragma once
#include <atomic>
-#include "core/hle/kernel/k_event.h"
+#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/service.h"
namespace Core {
@@ -17,6 +17,7 @@ namespace Service::Account {
class IAsyncContext : public ServiceFramework<IAsyncContext> {
public:
explicit IAsyncContext(Core::System& system_);
+ ~IAsyncContext() override;
void GetSystemEvent(Kernel::HLERequestContext& ctx);
void Cancel(Kernel::HLERequestContext& ctx);
@@ -30,8 +31,10 @@ protected:
void MarkComplete();
+ KernelHelpers::ServiceContext service_context;
+
std::atomic<bool> is_complete{false};
- Kernel::KEvent compeletion_event;
+ Kernel::KEvent* completion_event;
};
} // namespace Service::Account
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index 24a1c9157..568303ced 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -208,9 +208,10 @@ bool ProfileManager::UserExists(UUID uuid) const {
}
bool ProfileManager::UserExistsIndex(std::size_t index) const {
- if (index >= MAX_USERS)
+ if (index >= MAX_USERS) {
return false;
- return profiles[index].user_uuid.uuid != Common::INVALID_UUID;
+ }
+ return profiles[index].user_uuid.IsValid();
}
/// Opens a specific user
@@ -304,7 +305,7 @@ bool ProfileManager::RemoveUser(UUID uuid) {
bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) {
const auto index = GetUserIndex(uuid);
- if (!index || profile_new.user_uuid == UUID(Common::INVALID_UUID)) {
+ if (!index || profile_new.user_uuid.IsInvalid()) {
return false;
}
@@ -346,7 +347,7 @@ void ProfileManager::ParseUserSaveFile() {
}
for (const auto& user : data.users) {
- if (user.uuid == UUID(Common::INVALID_UUID)) {
+ if (user.uuid.IsInvalid()) {
continue;
}