mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
19dc36ce06
This PR attempts to implement the shared memory provided by GetSharedMemoryNativeHandle. There is still more work to be done however that requires a rehaul of the current time module to handle clock contexts. This PR is mainly to get the basic functionality of the SharedMemory working and allow the use of addition to it whilst things get improved on. Things to note: Memory Barriers are used in the SharedMemory and a better solution would need to be done to implement this. Currently in this PR I’m faking the memory barriers as everything is sync and single threaded. They work by incrementing the counter and just populate the two data slots. On data reading, it will read the last added data. Specific values in the shared memory would need to be updated periodically. This isn't included in this PR since we don't actively do this yet. In a later PR when time is refactored this should be done. Finally, as we don't handle clock contexts. When time is refactored, we will need to update the shared memory for specific contexts. This PR does this already however since the contexts are all identical and not separated. We're just updating the same values for each context which in this case is empty. Tiime:SetStandardUserSystemClockAutomaticCorrectionEnabled, Time:IsStandardUserSystemClockAutomaticCorrectionEnabled are also partially implemented in this PR. The reason the implementation is partial is because once again, a lack of clock contexts. This will be improved on in a future PR. This PR closes issue #2556
43 lines
2.1 KiB
C++
43 lines
2.1 KiB
C++
// Copyright 2018 yuzu emulator team
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#include "core/hle/service/time/interface.h"
|
|
|
|
namespace Service::Time {
|
|
|
|
Time::Time(std::shared_ptr<Module> time, std::shared_ptr<SharedMemory> shared_memory,
|
|
const char* name)
|
|
: Module::Interface(std::move(time), std::move(shared_memory), name) {
|
|
// clang-format off
|
|
static const FunctionInfo functions[] = {
|
|
{0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
|
|
{1, &Time::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
|
|
{2, &Time::GetStandardSteadyClock, "GetStandardSteadyClock"},
|
|
{3, &Time::GetTimeZoneService, "GetTimeZoneService"},
|
|
{4, &Time::GetStandardLocalSystemClock, "GetStandardLocalSystemClock"},
|
|
{5, nullptr, "GetEphemeralNetworkSystemClock"},
|
|
{20, &Time::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"},
|
|
{30, nullptr, "GetStandardNetworkClockOperationEventReadableHandle"},
|
|
{31, nullptr, "GetEphemeralNetworkClockOperationEventReadableHandle"},
|
|
{50, nullptr, "SetStandardSteadyClockInternalOffset"},
|
|
{100, &Time::IsStandardUserSystemClockAutomaticCorrectionEnabled, "IsStandardUserSystemClockAutomaticCorrectionEnabled"},
|
|
{101, &Time::SetStandardUserSystemClockAutomaticCorrectionEnabled, "SetStandardUserSystemClockAutomaticCorrectionEnabled"},
|
|
{102, nullptr, "GetStandardUserSystemClockInitialYear"},
|
|
{200, nullptr, "IsStandardNetworkSystemClockAccuracySufficient"},
|
|
{201, nullptr, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"},
|
|
{300, nullptr, "CalculateMonotonicSystemClockBaseTimePoint"},
|
|
{400, &Time::GetClockSnapshot, "GetClockSnapshot"},
|
|
{401, nullptr, "GetClockSnapshotFromSystemClockContext"},
|
|
{500, &Time::CalculateStandardUserSystemClockDifferenceByUser, "CalculateStandardUserSystemClockDifferenceByUser"},
|
|
{501, nullptr, "CalculateSpanBetween"},
|
|
};
|
|
// clang-format on
|
|
|
|
RegisterHandlers(functions);
|
|
}
|
|
|
|
Time::~Time() = default;
|
|
|
|
} // namespace Service::Time
|