diff options
author | Chloe Marcec <dmarcecguzman@gmail.com> | 2021-09-06 13:16:21 +0200 |
---|---|---|
committer | Chloe Marcec <dmarcecguzman@gmail.com> | 2021-09-06 13:16:21 +0200 |
commit | 4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e (patch) | |
tree | 0962f803f2826a1d6e3ae573309f4a84bd897950 /src/core/hle/service/acc/async_context.cpp | |
parent | Merge pull request #6968 from bunnei/nvflinger-event (diff) | |
download | yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.tar yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.tar.gz yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.tar.bz2 yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.tar.lz yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.tar.xz yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.tar.zst yuzu-4e2aa50cefd56f4bb119c9c6e6ab89afbb31351e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/acc/async_context.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/core/hle/service/acc/async_context.cpp b/src/core/hle/service/acc/async_context.cpp new file mode 100644 index 000000000..a58429090 --- /dev/null +++ b/src/core/hle/service/acc/async_context.cpp @@ -0,0 +1,68 @@ +// Copyright 2021 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/core.h" +#include "core/hle/ipc_helpers.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"); + + // clang-format off + 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); +} + +void IAsyncContext::GetSystemEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(compeletion_event.GetReadableEvent()); +} + +void IAsyncContext::Cancel(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + + Cancel(); + MarkComplete(); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IAsyncContext::HasDone(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + + is_complete = IsComplete(); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(is_complete); +} + +void IAsyncContext::GetResult(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(GetResult()); +} + +void IAsyncContext::MarkComplete() { + is_complete = true; + compeletion_event.GetWritableEvent().Signal(); +} + +} // namespace Service::Account |