From a61124a9e7f2a6eab7f51c2b4dd30574e62ba25a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Jul 2018 02:45:23 -0400 Subject: time: Simplify interface creation We can use one instance of the interface instead of duplicating code. --- src/core/hle/service/time/interface.cpp | 32 ++++++++++++++++++++++++++++++++ src/core/hle/service/time/interface.h | 16 ++++++++++++++++ src/core/hle/service/time/time.cpp | 7 +++---- src/core/hle/service/time/time_s.cpp | 31 ------------------------------- src/core/hle/service/time/time_s.h | 16 ---------------- src/core/hle/service/time/time_u.cpp | 31 ------------------------------- src/core/hle/service/time/time_u.h | 16 ---------------- 7 files changed, 51 insertions(+), 98 deletions(-) create mode 100644 src/core/hle/service/time/interface.cpp create mode 100644 src/core/hle/service/time/interface.h delete mode 100644 src/core/hle/service/time/time_s.cpp delete mode 100644 src/core/hle/service/time/time_s.h delete mode 100644 src/core/hle/service/time/time_u.cpp delete mode 100644 src/core/hle/service/time/time_u.h (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp new file mode 100644 index 000000000..e61788db8 --- /dev/null +++ b/src/core/hle/service/time/interface.cpp @@ -0,0 +1,32 @@ +// 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 time, const char* name) + : Module::Interface(std::move(time), name) { + 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"}, + {50, nullptr, "SetStandardSteadyClockInternalOffset"}, + {100, nullptr, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, + {101, nullptr, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, + {102, nullptr, "GetStandardUserSystemClockInitialYear"}, + {200, nullptr, "IsStandardNetworkSystemClockAccuracySufficient"}, + {300, nullptr, "CalculateMonotonicSystemClockBaseTimePoint"}, + {400, nullptr, "GetClockSnapshot"}, + {401, nullptr, "GetClockSnapshotFromSystemClockContext"}, + {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"}, + {501, nullptr, "CalculateSpanBetween"}, + }; + RegisterHandlers(functions); +} + +} // namespace Service::Time diff --git a/src/core/hle/service/time/interface.h b/src/core/hle/service/time/interface.h new file mode 100644 index 000000000..0f97cec35 --- /dev/null +++ b/src/core/hle/service/time/interface.h @@ -0,0 +1,16 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/time/time.h" + +namespace Service::Time { + +class TIME final : public Module::Interface { +public: + explicit TIME(std::shared_ptr time, const char* name); +}; + +} // namespace Service::Time diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 507ae95f4..dbaa661bb 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -9,9 +9,8 @@ #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h" +#include "core/hle/service/time/interface.h" #include "core/hle/service/time/time.h" -#include "core/hle/service/time/time_s.h" -#include "core/hle/service/time/time_u.h" namespace Service::Time { @@ -212,8 +211,8 @@ Module::Interface::Interface(std::shared_ptr time, const char* name) void InstallInterfaces(SM::ServiceManager& service_manager) { auto time = std::make_shared(); - std::make_shared(time)->InstallAsService(service_manager); - std::make_shared(time)->InstallAsService(service_manager); + std::make_shared