diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-06-27 01:07:34 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-06-27 01:07:34 +0200 |
commit | bce4bfffb64683c1033a875d35885f4ea650c2a9 (patch) | |
tree | 8225d45804534954a6fba289b7b1a291056b0bd2 /src/core/hle/service/pm/pm.cpp | |
parent | pm: Implement pm:dmnt GetTitlePid (diff) | |
download | yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.tar yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.tar.gz yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.tar.bz2 yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.tar.lz yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.tar.xz yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.tar.zst yuzu-bce4bfffb64683c1033a875d35885f4ea650c2a9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/pm/pm.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index d03187410..fe6b5f798 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -28,6 +28,17 @@ std::optional<Kernel::SharedPtr<Kernel::Process>> SearchProcessList( return *iter; } +void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, + const std::vector<Kernel::SharedPtr<Kernel::Process>>& process_list) { + const auto process = SearchProcessList(process_list, [](const auto& process) { + return process->GetProcessID() == Kernel::Process::ProcessIDMin; + }); + + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); + rb.Push(process.has_value() ? (*process)->GetProcessID() : NO_PROCESS_FOUND_PID); +} + } // Anonymous namespace class BootMode final : public ServiceFramework<BootMode> { @@ -71,7 +82,7 @@ public: {1, nullptr, "StartDebugProcess"}, {2, &DebugMonitor::GetTitlePid, "GetTitlePid"}, {3, nullptr, "EnableDebugForTitleId"}, - {4, nullptr, "GetApplicationPid"}, + {4, &DebugMonitor::GetApplicationPid, "GetApplicationPid"}, {5, nullptr, "EnableDebugForApplication"}, {6, nullptr, "DisableDebug"}, }; @@ -103,6 +114,11 @@ private: rb.Push((*process)->GetProcessID()); } + void GetApplicationPid(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_PM, "called"); + GetApplicationPidGeneric(ctx, kernel.GetProcessList()); + } + const Kernel::KernelCore& kernel; }; @@ -143,7 +159,8 @@ private: class Shell final : public ServiceFramework<Shell> { public: - explicit Shell() : ServiceFramework{"pm:shell"} { + explicit Shell(const Kernel::KernelCore& kernel) + : ServiceFramework{"pm:shell"}, kernel(kernel) { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "LaunchProcess"}, @@ -152,14 +169,23 @@ public: {3, nullptr, "GetProcessEventWaiter"}, {4, nullptr, "GetProcessEventType"}, {5, nullptr, "NotifyBootFinished"}, - {6, nullptr, "GetApplicationPid"}, + {6, &Shell::GetApplicationPid, "GetApplicationPid"}, {7, nullptr, "BoostSystemMemoryResourceLimit"}, {8, nullptr, "EnableAdditionalSystemThreads"}, + {9, nullptr, "GetUnimplementedEventHandle"}, }; // clang-format on RegisterHandlers(functions); } + +private: + void GetApplicationPid(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_PM, "called"); + GetApplicationPidGeneric(ctx, kernel.GetProcessList()); + } + + const Kernel::KernelCore& kernel; }; void InstallInterfaces(Core::System& system) { |