time: Simplify interface creation
We can use one instance of the interface instead of duplicating code.
This commit is contained in:
parent
47ac369180
commit
a61124a9e7
|
@ -235,12 +235,10 @@ add_library(core STATIC
|
||||||
hle/service/spl/spl.h
|
hle/service/spl/spl.h
|
||||||
hle/service/ssl/ssl.cpp
|
hle/service/ssl/ssl.cpp
|
||||||
hle/service/ssl/ssl.h
|
hle/service/ssl/ssl.h
|
||||||
|
hle/service/time/interface.cpp
|
||||||
|
hle/service/time/interface.h
|
||||||
hle/service/time/time.cpp
|
hle/service/time/time.cpp
|
||||||
hle/service/time/time.h
|
hle/service/time/time.h
|
||||||
hle/service/time/time_s.cpp
|
|
||||||
hle/service/time/time_s.h
|
|
||||||
hle/service/time/time_u.cpp
|
|
||||||
hle/service/time/time_u.h
|
|
||||||
hle/service/vi/vi.cpp
|
hle/service/vi/vi.cpp
|
||||||
hle/service/vi/vi.h
|
hle/service/vi/vi.h
|
||||||
hle/service/vi/vi_m.cpp
|
hle/service/vi/vi_m.cpp
|
||||||
|
|
|
@ -2,17 +2,18 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/hle/service/time/time_s.h"
|
#include "core/hle/service/time/interface.h"
|
||||||
|
|
||||||
namespace Service::Time {
|
namespace Service::Time {
|
||||||
|
|
||||||
TIME_S::TIME_S(std::shared_ptr<Module> time) : Module::Interface(std::move(time), "time:s") {
|
TIME::TIME(std::shared_ptr<Module> time, const char* name)
|
||||||
|
: Module::Interface(std::move(time), name) {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &TIME_S::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
|
{0, &TIME::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
|
||||||
{1, &TIME_S::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
|
{1, &TIME::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
|
||||||
{2, &TIME_S::GetStandardSteadyClock, "GetStandardSteadyClock"},
|
{2, &TIME::GetStandardSteadyClock, "GetStandardSteadyClock"},
|
||||||
{3, &TIME_S::GetTimeZoneService, "GetTimeZoneService"},
|
{3, &TIME::GetTimeZoneService, "GetTimeZoneService"},
|
||||||
{4, &TIME_S::GetStandardLocalSystemClock, "GetStandardLocalSystemClock"},
|
{4, &TIME::GetStandardLocalSystemClock, "GetStandardLocalSystemClock"},
|
||||||
{5, nullptr, "GetEphemeralNetworkSystemClock"},
|
{5, nullptr, "GetEphemeralNetworkSystemClock"},
|
||||||
{50, nullptr, "SetStandardSteadyClockInternalOffset"},
|
{50, nullptr, "SetStandardSteadyClockInternalOffset"},
|
||||||
{100, nullptr, "IsStandardUserSystemClockAutomaticCorrectionEnabled"},
|
{100, nullptr, "IsStandardUserSystemClockAutomaticCorrectionEnabled"},
|
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
namespace Service::Time {
|
namespace Service::Time {
|
||||||
|
|
||||||
class TIME_S final : public Module::Interface {
|
class TIME final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit TIME_S(std::shared_ptr<Module> time);
|
explicit TIME(std::shared_ptr<Module> time, const char* name);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Time
|
} // namespace Service::Time
|
|
@ -9,9 +9,8 @@
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/client_port.h"
|
#include "core/hle/kernel/client_port.h"
|
||||||
#include "core/hle/kernel/client_session.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.h"
|
||||||
#include "core/hle/service/time/time_s.h"
|
|
||||||
#include "core/hle/service/time/time_u.h"
|
|
||||||
|
|
||||||
namespace Service::Time {
|
namespace Service::Time {
|
||||||
|
|
||||||
|
@ -212,8 +211,8 @@ Module::Interface::Interface(std::shared_ptr<Module> time, const char* name)
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
||||||
auto time = std::make_shared<Module>();
|
auto time = std::make_shared<Module>();
|
||||||
std::make_shared<TIME_S>(time)->InstallAsService(service_manager);
|
std::make_shared<TIME>(time, "time:s")->InstallAsService(service_manager);
|
||||||
std::make_shared<TIME_U>(time)->InstallAsService(service_manager);
|
std::make_shared<TIME>(time, "time:u")->InstallAsService(service_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Time
|
} // namespace Service::Time
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
// Copyright 2018 yuzu emulator team
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include "core/hle/service/time/time_u.h"
|
|
||||||
|
|
||||||
namespace Service::Time {
|
|
||||||
|
|
||||||
TIME_U::TIME_U(std::shared_ptr<Module> time) : Module::Interface(std::move(time), "time:u") {
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{0, &TIME_U::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
|
|
||||||
{1, &TIME_U::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
|
|
||||||
{2, &TIME_U::GetStandardSteadyClock, "GetStandardSteadyClock"},
|
|
||||||
{3, &TIME_U::GetTimeZoneService, "GetTimeZoneService"},
|
|
||||||
{4, &TIME_U::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
|
|
|
@ -1,16 +0,0 @@
|
||||||
// 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_U final : public Module::Interface {
|
|
||||||
public:
|
|
||||||
explicit TIME_U(std::shared_ptr<Module> time);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Service::Time
|
|
Loading…
Reference in a new issue