summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/glue/time/alarm_worker.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-01-25 20:19:01 +0100
committerGitHub <noreply@github.com>2024-01-25 20:19:01 +0100
commitd45561ace069024f47ed710d1165b607644d1ec3 (patch)
treea316f59c5a722dc15fe5c49b3641d9801c264970 /src/core/hle/service/glue/time/alarm_worker.h
parentMerge pull request #12781 from goldenx86/dozen (diff)
parentRework time service to fix time passing offline. (diff)
downloadyuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar
yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.gz
yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.bz2
yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.lz
yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.xz
yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.zst
yuzu-d45561ace069024f47ed710d1165b607644d1ec3.zip
Diffstat (limited to 'src/core/hle/service/glue/time/alarm_worker.h')
-rw-r--r--src/core/hle/service/glue/time/alarm_worker.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/core/hle/service/glue/time/alarm_worker.h b/src/core/hle/service/glue/time/alarm_worker.h
new file mode 100644
index 000000000..f269cffdb
--- /dev/null
+++ b/src/core/hle/service/glue/time/alarm_worker.h
@@ -0,0 +1,53 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "common/common_types.h"
+#include "core/hle/kernel/k_event.h"
+#include "core/hle/service/kernel_helpers.h"
+#include "core/hle/service/psc/time/common.h"
+
+namespace Core {
+class System;
+}
+
+namespace Service::PSC::Time {
+class ServiceManager;
+}
+
+namespace Service::Glue::Time {
+class StandardSteadyClockResource;
+
+class AlarmWorker {
+public:
+ explicit AlarmWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource);
+ ~AlarmWorker();
+
+ void Initialize(std::shared_ptr<Service::PSC::Time::ServiceManager> time_m);
+
+ Kernel::KEvent& GetEvent() {
+ return *m_event;
+ }
+
+ Kernel::KEvent& GetTimerEvent() {
+ return *m_timer_event;
+ }
+
+ void OnPowerStateChanged();
+
+private:
+ bool GetClosestAlarmInfo(Service::PSC::Time::AlarmInfo& out_alarm_info, s64& out_time);
+ Result AttachToClosestAlarmEvent();
+
+ Core::System& m_system;
+ KernelHelpers::ServiceContext m_ctx;
+ std::shared_ptr<Service::PSC::Time::ServiceManager> m_time_m;
+
+ Kernel::KEvent* m_event{};
+ Kernel::KEvent* m_timer_event{};
+ std::shared_ptr<Core::Timing::EventType> m_timer_timing_event;
+ StandardSteadyClockResource& m_steady_clock_resource;
+};
+
+} // namespace Service::Glue::Time