2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-10-01 02:59:49 +02:00
|
|
|
#include <memory>
|
2019-12-22 23:49:51 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "core/hle/service/time/clock_types.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
2021-01-30 08:51:40 +01:00
|
|
|
class KWritableEvent;
|
2019-12-22 23:49:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Service::Time::Clock {
|
|
|
|
|
|
|
|
// Parts of this implementation were based on Ryujinx (https://github.com/Ryujinx/Ryujinx/pull/783).
|
|
|
|
// This code was released under public domain.
|
|
|
|
|
|
|
|
class SystemClockContextUpdateCallback {
|
|
|
|
public:
|
|
|
|
SystemClockContextUpdateCallback();
|
2020-04-18 01:57:48 +02:00
|
|
|
virtual ~SystemClockContextUpdateCallback();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
bool NeedUpdate(const SystemClockContext& value) const;
|
|
|
|
|
2021-01-30 08:51:40 +01:00
|
|
|
void RegisterOperationEvent(std::shared_ptr<Kernel::KWritableEvent>&& writable_event);
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
void BroadcastOperationEvent();
|
|
|
|
|
2022-06-26 05:44:19 +02:00
|
|
|
Result Update(const SystemClockContext& value);
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
protected:
|
2022-06-26 05:44:19 +02:00
|
|
|
virtual Result Update();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
SystemClockContext context{};
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool has_context{};
|
2021-01-30 08:51:40 +01:00
|
|
|
std::vector<std::shared_ptr<Kernel::KWritableEvent>> operation_event_list;
|
2019-12-22 23:49:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Service::Time::Clock
|