diff options
| author | 2018-07-25 22:30:43 -0700 | |
|---|---|---|
| committer | 2018-07-25 22:30:43 -0700 | |
| commit | 57cd80c410ecaf064a6983b6a74e2bd6aa58bf03 (patch) | |
| tree | 66dfa1660ecf1e972b5f65d6a7d74f7861d0b7ef | |
| parent | Merge pull request #825 from greggameplayer/R16_G16 (diff) | |
| parent | lm: Move LM's class declaration into the cpp file (diff) | |
| download | yuzu-57cd80c410ecaf064a6983b6a74e2bd6aa58bf03.tar.gz yuzu-57cd80c410ecaf064a6983b6a74e2bd6aa58bf03.tar.xz yuzu-57cd80c410ecaf064a6983b6a74e2bd6aa58bf03.zip | |
Merge pull request #827 from lioncash/log
service/lm: Minor changes
| -rw-r--r-- | src/core/hle/service/lm/lm.cpp | 60 | ||||
| -rw-r--r-- | src/core/hle/service/lm/lm.h | 15 |
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 | ||
| 12 | namespace Service::LM { | 14 | namespace Service::LM { |
| 13 | 15 | ||
| @@ -15,13 +17,12 @@ class Logger final : public ServiceFramework<Logger> { | |||
| 15 | public: | 17 | public: |
| 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 | |||
| 25 | private: | 26 | private: |
| 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 | ||
| 165 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 166 | class LM final : public ServiceFramework<LM> { |
| 166 | std::make_shared<LM>()->InstallAsService(service_manager); | 167 | public: |
| 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 | */ |
| 176 | void 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 | ||
| 184 | LM::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); | 191 | void 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> | 7 | namespace Service::SM { |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | class ServiceManager; |
| 9 | #include "core/hle/service/service.h" | 9 | } |
| 10 | 10 | ||
| 11 | namespace Service::LM { | 11 | namespace Service::LM { |
| 12 | 12 | ||
| 13 | class LM final : public ServiceFramework<LM> { | ||
| 14 | public: | ||
| 15 | LM(); | ||
| 16 | ~LM() = default; | ||
| 17 | |||
| 18 | private: | ||
| 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. |
| 23 | void InstallInterfaces(SM::ServiceManager& service_manager); | 14 | void InstallInterfaces(SM::ServiceManager& service_manager); |
| 24 | 15 | ||