From 71e0c40310df741414a54111965903f8afd931cf Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Mon, 22 Jul 2019 20:24:01 +0800 Subject: [PATCH] service: Add service function name lookup based on header code This is for displaying the function name for HLE requests. Probably it is possible to do the same for LLE ones but it would require having the HLE handlers available even when not using them, which doesn't seem to make sense and is more of a hack than a proper solution in my opinion. --- src/core/hle/service/service.cpp | 8 ++++++++ src/core/hle/service/service.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 461d0930f..057562488 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -179,6 +179,14 @@ void ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& context) handler_invoker(this, info->handler_callback, context); } +std::string ServiceFrameworkBase::GetFunctionName(u32 header) const { + if (!handlers.count(header)) { + return ""; + } + + return handlers.at(header).name; +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // Module interface diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 1d9e800e2..db6a0ad23 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -64,6 +64,9 @@ public: void HandleSyncRequest(Kernel::HLERequestContext& context) override; + /// Retrieves name of a function based on the header code. For IPC Recorder. + std::string GetFunctionName(u32 header) const; + protected: /// Member-function pointer type of SyncRequest handlers. template