early-access version 2041

This commit is contained in:
pineappleEA
2021-09-09 00:11:45 +02:00
parent 5e020e5a75
commit d189d8fac4
17 changed files with 72 additions and 243 deletions

View File

@@ -491,7 +491,7 @@ public:
class EnsureTokenIdCacheAsyncInterface final : public IAsyncContext {
public:
explicit EnsureTokenIdCacheAsyncInterface(Core::System& system_) : IAsyncContext(system_) {
explicit EnsureTokenIdCacheAsyncInterface(Core::System& system_) : IAsyncContext{system_} {
MarkComplete();
}
~EnsureTokenIdCacheAsyncInterface() = default;
@@ -504,13 +504,13 @@ public:
}
protected:
bool IsComplete() override {
bool IsComplete() const override {
return true;
}
void Cancel() override {}
ResultCode GetResult() override {
ResultCode GetResult() const override {
return ResultSuccess;
}
};
@@ -518,7 +518,9 @@ protected:
class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {
public:
explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_)
: ServiceFramework{system_, "IManagerForApplication"}, user_id{user_id_}, system(system_) {
: ServiceFramework{system_, "IManagerForApplication"},
ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)},
user_id{user_id_} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},
@@ -533,8 +535,6 @@ public:
// clang-format on
RegisterHandlers(functions);
ensure_token_id = std::make_shared<EnsureTokenIdCacheAsyncInterface>(system);
}
private:
@@ -591,7 +591,6 @@ private:
std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{};
Common::UUID user_id{Common::INVALID_UUID};
Core::System& system;
};
// 6.0.0+

View File

@@ -14,12 +14,12 @@ IAsyncContext::IAsyncContext(Core::System& system_)
compeletion_event.Initialize("IAsyncContext:CompletionEvent");
// clang-format off
static const FunctionInfo functions[] = {
{0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"},
{1, &IAsyncContext::Cancel, "Cancel"},
{2, &IAsyncContext::HasDone, "HasDone"},
{3, &IAsyncContext::GetResult, "GetResult"},
};
static const FunctionInfo functions[] = {
{0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"},
{1, &IAsyncContext::Cancel, "Cancel"},
{2, &IAsyncContext::HasDone, "HasDone"},
{3, &IAsyncContext::GetResult, "GetResult"},
};
// clang-format on
RegisterHandlers(functions);
@@ -46,11 +46,11 @@ void IAsyncContext::Cancel(Kernel::HLERequestContext& ctx) {
void IAsyncContext::HasDone(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
is_complete = IsComplete();
is_complete.store(IsComplete());
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(is_complete);
rb.Push(is_complete.load());
}
void IAsyncContext::GetResult(Kernel::HLERequestContext& ctx) {
@@ -61,7 +61,7 @@ void IAsyncContext::GetResult(Kernel::HLERequestContext& ctx) {
}
void IAsyncContext::MarkComplete() {
is_complete = true;
is_complete.store(true);
compeletion_event.GetWritableEvent().Signal();
}

View File

@@ -4,6 +4,7 @@
#pragma once
#include <atomic>
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/service.h"
@@ -23,13 +24,13 @@ public:
void GetResult(Kernel::HLERequestContext& ctx);
protected:
virtual bool IsComplete() = 0;
virtual bool IsComplete() const = 0;
virtual void Cancel() = 0;
virtual ResultCode GetResult() = 0;
virtual ResultCode GetResult() const = 0;
void MarkComplete();
bool is_complete{false};
std::atomic<bool> is_complete{false};
Kernel::KEvent compeletion_event;
};