1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/ldr/ldr.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"
namespace Service::LDR {
class DebugMonitor final : public ServiceFramework<DebugMonitor> {
public:
explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} {}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "SetProgramArgument"},
FunctionInfo{1, nullptr, "FlushArguments"},
FunctionInfo{2, nullptr, "GetProcessModuleInfo"}
);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
};
class ProcessManager final : public ServiceFramework<ProcessManager> {
public:
explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} {}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "CreateProcess"},
FunctionInfo{1, nullptr, "GetProgramInfo"},
FunctionInfo{2, nullptr, "PinProgram"},
FunctionInfo{3, nullptr, "UnpinProgram"},
FunctionInfo{4, nullptr, "SetEnabledProgramVerification"}
);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
};
class Shell final : public ServiceFramework<Shell> {
public:
explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} {}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "SetProgramArgument"},
FunctionInfo{1, nullptr, "FlushArguments"}
);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("ldr:dmnt", std::make_shared<DebugMonitor>(system), 3);
server_manager->RegisterNamedService("ldr:pm", std::make_shared<ProcessManager>(system), 1);
server_manager->RegisterNamedService("ldr:shel", std::make_shared<Shell>(system), 3);
ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::LDR
|