summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/time/time.cpp40
-rw-r--r--src/core/hle/service/time/time.h22
-rw-r--r--src/core/hle/service/time/time_s.cpp20
-rw-r--r--src/core/hle/service/time/time_s.h18
-rw-r--r--src/core/hle/service/time/time_u.cpp23
-rw-r--r--src/core/hle/service/time/time_u.h18
7 files changed, 113 insertions, 32 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 4cdfffecb..57f578bae 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -135,6 +135,10 @@ add_library(core STATIC
135 hle/service/sockets/sockets.h 135 hle/service/sockets/sockets.h
136 hle/service/time/time.cpp 136 hle/service/time/time.cpp
137 hle/service/time/time.h 137 hle/service/time/time.h
138 hle/service/time/time_s.cpp
139 hle/service/time/time_s.h
140 hle/service/time/time_u.cpp
141 hle/service/time/time_u.h
138 hle/service/vi/vi.cpp 142 hle/service/vi/vi.cpp
139 hle/service/vi/vi.h 143 hle/service/vi/vi.h
140 hle/service/vi/vi_m.cpp 144 hle/service/vi/vi_m.cpp
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 674b59509..a48d7b304 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -8,6 +8,8 @@
8#include "core/hle/kernel/client_port.h" 8#include "core/hle/kernel/client_port.h"
9#include "core/hle/kernel/client_session.h" 9#include "core/hle/kernel/client_session.h"
10#include "core/hle/service/time/time.h" 10#include "core/hle/service/time/time.h"
11#include "core/hle/service/time/time_s.h"
12#include "core/hle/service/time/time_u.h"
11 13
12namespace Service { 14namespace Service {
13namespace Time { 15namespace Time {
@@ -59,20 +61,20 @@ private:
59 61
60 void ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx) { 62 void ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx) {
61 IPC::RequestParser rp{ctx}; 63 IPC::RequestParser rp{ctx};
62 u64 posixTime = rp.Pop<u64>(); 64 u64 posix_time = rp.Pop<u64>();
63 65
64 LOG_WARNING(Service, "(STUBBED) called, posixTime=0x%016llX", posixTime); 66 LOG_WARNING(Service, "(STUBBED) called, posix_time=0x%016llX", posix_time);
65 67
66 CalendarTime calendarTime{2018, 1, 1, 0, 0, 0}; 68 CalendarTime calendar_time{2018, 1, 1, 0, 0, 0};
67 CalendarAdditionalInfo additionalInfo{}; 69 CalendarAdditionalInfo additional_info{};
68 IPC::RequestBuilder rb{ctx, 10}; 70 IPC::RequestBuilder rb{ctx, 10};
69 rb.Push(RESULT_SUCCESS); 71 rb.Push(RESULT_SUCCESS);
70 rb.PushRaw(calendarTime); 72 rb.PushRaw(calendar_time);
71 rb.PushRaw(additionalInfo); 73 rb.PushRaw(additional_info);
72 } 74 }
73}; 75};
74 76
75void TIME::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) { 77void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) {
76 auto client_port = std::make_shared<ISystemClock>()->CreatePort(); 78 auto client_port = std::make_shared<ISystemClock>()->CreatePort();
77 auto session = client_port->Connect(); 79 auto session = client_port->Connect();
78 if (session.Succeeded()) { 80 if (session.Succeeded()) {
@@ -86,7 +88,7 @@ void TIME::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) {
86 } 88 }
87} 89}
88 90
89void TIME::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { 91void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) {
90 auto client_port = std::make_shared<ISystemClock>()->CreatePort(); 92 auto client_port = std::make_shared<ISystemClock>()->CreatePort();
91 auto session = client_port->Connect(); 93 auto session = client_port->Connect();
92 if (session.Succeeded()) { 94 if (session.Succeeded()) {
@@ -100,7 +102,7 @@ void TIME::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) {
100 } 102 }
101} 103}
102 104
103void TIME::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { 105void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) {
104 auto client_port = std::make_shared<ISteadyClock>()->CreatePort(); 106 auto client_port = std::make_shared<ISteadyClock>()->CreatePort();
105 auto session = client_port->Connect(); 107 auto session = client_port->Connect();
106 if (session.Succeeded()) { 108 if (session.Succeeded()) {
@@ -114,28 +116,20 @@ void TIME::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) {
114 } 116 }
115} 117}
116 118
117void TIME::GetTimeZoneService(Kernel::HLERequestContext& ctx) { 119void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
118 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; 120 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
119 rb.Push(RESULT_SUCCESS); 121 rb.Push(RESULT_SUCCESS);
120 rb.PushIpcInterface<ITimeZoneService>(); 122 rb.PushIpcInterface<ITimeZoneService>();
121 LOG_DEBUG(Service, "called"); 123 LOG_DEBUG(Service, "called");
122} 124}
123 125
124TIME::TIME(const char* name) : ServiceFramework(name) { 126Module::Interface::Interface(std::shared_ptr<Module> time, const char* name)
125 static const FunctionInfo functions[] = { 127 : ServiceFramework(name), time(std::move(time)) {}
126 {0x00000000, &TIME::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
127 {0x00000001, &TIME::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
128 {0x00000002, &TIME::GetStandardSteadyClock, "GetStandardSteadyClock"},
129 {0x00000003, &TIME::GetTimeZoneService, "GetTimeZoneService"},
130 };
131 RegisterHandlers(functions);
132}
133 128
134void InstallInterfaces(SM::ServiceManager& service_manager) { 129void InstallInterfaces(SM::ServiceManager& service_manager) {
135 std::make_shared<TIME>("time:a")->InstallAsService(service_manager); 130 auto time = std::make_shared<Module>();
136 std::make_shared<TIME>("time:r")->InstallAsService(service_manager); 131 std::make_shared<TIME_S>(time)->InstallAsService(service_manager);
137 std::make_shared<TIME>("time:s")->InstallAsService(service_manager); 132 std::make_shared<TIME_U>(time)->InstallAsService(service_manager);
138 std::make_shared<TIME>("time:u")->InstallAsService(service_manager);
139} 133}
140 134
141} // namespace Time 135} // namespace Time
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 5f332d057..2aa424dbb 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -33,16 +33,20 @@ struct CalendarAdditionalInfo {
33static_assert(sizeof(CalendarAdditionalInfo) == 0x18, 33static_assert(sizeof(CalendarAdditionalInfo) == 0x18,
34 "CalendarAdditionalInfo structure has incorrect size"); 34 "CalendarAdditionalInfo structure has incorrect size");
35 35
36class TIME final : public ServiceFramework<TIME> { 36class Module final {
37public: 37public:
38 explicit TIME(const char* name); 38 class Interface : public ServiceFramework<Interface> {
39 ~TIME() = default; 39 public:
40 40 Interface(std::shared_ptr<Module> time, const char* name);
41private: 41
42 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); 42 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
43 void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx); 43 void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx);
44 void GetStandardSteadyClock(Kernel::HLERequestContext& ctx); 44 void GetStandardSteadyClock(Kernel::HLERequestContext& ctx);
45 void GetTimeZoneService(Kernel::HLERequestContext& ctx); 45 void GetTimeZoneService(Kernel::HLERequestContext& ctx);
46
47 protected:
48 std::shared_ptr<Module> time;
49 };
46}; 50};
47 51
48/// Registers all Time services with the specified service manager. 52/// Registers all Time services with the specified service manager.
diff --git a/src/core/hle/service/time/time_s.cpp b/src/core/hle/service/time/time_s.cpp
new file mode 100644
index 000000000..52de888d3
--- /dev/null
+++ b/src/core/hle/service/time/time_s.cpp
@@ -0,0 +1,20 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/time/time_s.h"
8
9namespace Service {
10namespace Time {
11
12TIME_S::TIME_S(std::shared_ptr<Module> time) : Module::Interface(std::move(time), "time:s") {
13 static const FunctionInfo functions[] = {
14 {0, &TIME_S::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
15 };
16 RegisterHandlers(functions);
17}
18
19} // namespace Time
20} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/time/time_s.h b/src/core/hle/service/time/time_s.h
new file mode 100644
index 000000000..6a9c5e673
--- /dev/null
+++ b/src/core/hle/service/time/time_s.h
@@ -0,0 +1,18 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/time/time.h"
8
9namespace Service {
10namespace Time {
11
12class TIME_S final : public Module::Interface {
13public:
14 explicit TIME_S(std::shared_ptr<Module> time);
15};
16
17} // namespace Time
18} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/time/time_u.cpp b/src/core/hle/service/time/time_u.cpp
new file mode 100644
index 000000000..87fa9da79
--- /dev/null
+++ b/src/core/hle/service/time/time_u.cpp
@@ -0,0 +1,23 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/time/time_u.h"
8
9namespace Service {
10namespace Time {
11
12TIME_U::TIME_U(std::shared_ptr<Module> time) : Module::Interface(std::move(time), "time:u") {
13 static const FunctionInfo functions[] = {
14 {0, &TIME_U::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
15 {1, &TIME_U::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
16 {2, &TIME_U::GetStandardSteadyClock, "GetStandardSteadyClock"},
17 {3, &TIME_U::GetTimeZoneService, "GetTimeZoneService"},
18 };
19 RegisterHandlers(functions);
20}
21
22} // namespace Time
23} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/time/time_u.h b/src/core/hle/service/time/time_u.h
new file mode 100644
index 000000000..44e17425f
--- /dev/null
+++ b/src/core/hle/service/time/time_u.h
@@ -0,0 +1,18 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/time/time.h"
8
9namespace Service {
10namespace Time {
11
12class TIME_U final : public Module::Interface {
13public:
14 explicit TIME_U(std::shared_ptr<Module> time);
15};
16
17} // namespace Time
18} // namespace Service \ No newline at end of file