summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/lm/lm.cpp60
-rw-r--r--src/core/hle/service/lm/lm.h15
2 files changed, 35 insertions, 40 deletions
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index e85a8bdb9..b497376d7 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -4,10 +4,12 @@
4 4
5#include <sstream> 5#include <sstream>
6#include <string> 6#include <string>
7
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "core/hle/ipc_helpers.h" 9#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/client_session.h"
10#include "core/hle/service/lm/lm.h" 10#include "core/hle/service/lm/lm.h"
11#include "core/hle/service/service.h"
12#include "core/memory.h"
11 13
12namespace Service::LM { 14namespace Service::LM {
13 15
@@ -15,13 +17,12 @@ class Logger final : public ServiceFramework<Logger> {
15public: 17public:
16 Logger() : ServiceFramework("Logger") { 18 Logger() : ServiceFramework("Logger") {
17 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
18 {0x00000000, &Logger::Log, "Log"}, 20 {0x00000000, &Logger::Initialize, "Initialize"},
21 {0x00000001, nullptr, "SetDestination"},
19 }; 22 };
20 RegisterHandlers(functions); 23 RegisterHandlers(functions);
21 } 24 }
22 25
23 ~Logger() = default;
24
25private: 26private:
26 struct MessageHeader { 27 struct MessageHeader {
27 enum Flags : u32_le { 28 enum Flags : u32_le {
@@ -66,13 +67,13 @@ private:
66 }; 67 };
67 68
68 /** 69 /**
69 * LM::Log service function 70 * ILogger::Initialize service function
70 * Inputs: 71 * Inputs:
71 * 0: 0x00000000 72 * 0: 0x00000000
72 * Outputs: 73 * Outputs:
73 * 0: ResultCode 74 * 0: ResultCode
74 */ 75 */
75 void Log(Kernel::HLERequestContext& ctx) { 76 void Initialize(Kernel::HLERequestContext& ctx) {
76 // This function only succeeds - Get that out of the way 77 // This function only succeeds - Get that out of the way
77 IPC::ResponseBuilder rb{ctx, 2}; 78 IPC::ResponseBuilder rb{ctx, 2};
78 rb.Push(RESULT_SUCCESS); 79 rb.Push(RESULT_SUCCESS);
@@ -162,30 +163,33 @@ private:
162 std::ostringstream log_stream; 163 std::ostringstream log_stream;
163}; 164};
164 165
165void InstallInterfaces(SM::ServiceManager& service_manager) { 166class LM final : public ServiceFramework<LM> {
166 std::make_shared<LM>()->InstallAsService(service_manager); 167public:
167} 168 explicit LM() : ServiceFramework{"lm"} {
169 static const FunctionInfo functions[] = {
170 {0x00000000, &LM::OpenLogger, "OpenLogger"},
171 };
172 RegisterHandlers(functions);
173 }
168 174
169/** 175 /**
170 * LM::Initialize service function 176 * LM::OpenLogger service function
171 * Inputs: 177 * Inputs:
172 * 0: 0x00000000 178 * 0: 0x00000000
173 * Outputs: 179 * Outputs:
174 * 0: ResultCode 180 * 0: ResultCode
175 */ 181 */
176void LM::Initialize(Kernel::HLERequestContext& ctx) { 182 void OpenLogger(Kernel::HLERequestContext& ctx) {
177 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 183 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
178 rb.Push(RESULT_SUCCESS); 184 rb.Push(RESULT_SUCCESS);
179 rb.PushIpcInterface<Logger>(); 185 rb.PushIpcInterface<Logger>();
180
181 LOG_DEBUG(Service_LM, "called");
182}
183 186
184LM::LM() : ServiceFramework("lm") { 187 LOG_DEBUG(Service_LM, "called");
185 static const FunctionInfo functions[] = { 188 }
186 {0x00000000, &LM::Initialize, "Initialize"}, 189};
187 }; 190
188 RegisterHandlers(functions); 191void InstallInterfaces(SM::ServiceManager& service_manager) {
192 std::make_shared<LM>()->InstallAsService(service_manager);
189} 193}
190 194
191} // namespace Service::LM 195} // namespace Service::LM
diff --git a/src/core/hle/service/lm/lm.h b/src/core/hle/service/lm/lm.h
index 63d6506fe..7806ae27b 100644
--- a/src/core/hle/service/lm/lm.h
+++ b/src/core/hle/service/lm/lm.h
@@ -4,21 +4,12 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <vector> 7namespace Service::SM {
8#include "core/hle/kernel/kernel.h" 8class ServiceManager;
9#include "core/hle/service/service.h" 9}
10 10
11namespace Service::LM { 11namespace Service::LM {
12 12
13class LM final : public ServiceFramework<LM> {
14public:
15 LM();
16 ~LM() = default;
17
18private:
19 void Initialize(Kernel::HLERequestContext& ctx);
20};
21
22/// Registers all LM services with the specified service manager. 13/// Registers all LM services with the specified service manager.
23void InstallInterfaces(SM::ServiceManager& service_manager); 14void InstallInterfaces(SM::ServiceManager& service_manager);
24 15