hle: Eliminate need to specify command headers for IPC. (#6678)

This commit is contained in:
Steveice10 2023-07-14 17:32:59 -07:00 committed by GitHub
parent 0bedb28bdc
commit e043caac27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 2691 additions and 2707 deletions

View file

@ -68,7 +68,7 @@ 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;
std::string GetFunctionName(IPC::Header header) const;
protected:
/// Member-function pointer type of SyncRequest handlers.
@ -80,7 +80,7 @@ private:
friend class ServiceFramework;
struct FunctionInfoBase {
u32 expected_header;
u32 command_id;
HandlerFnP<ServiceFrameworkBase> handler_callback;
const char* name;
};
@ -122,21 +122,18 @@ class ServiceFramework : public ServiceFrameworkBase {
protected:
/// Contains information about a request type which is handled by the service.
struct FunctionInfo : FunctionInfoBase {
// TODO(yuriks): This function could be constexpr, but clang is the only compiler that
// doesn't emit an ICE or a wrong diagnostic because of the static_cast.
/**
* Constructs a FunctionInfo for a function.
*
* @param expected_header request header in the command buffer which will trigger dispatch
* @param command_id command ID in the command buffer which will trigger dispatch
* to this handler
* @param handler_callback member function in this service which will be called to handle
* the request
* @param name human-friendly name for the request. Used mostly for logging purposes.
*/
FunctionInfo(u32 expected_header, HandlerFnP<Self> handler_callback, const char* name)
constexpr FunctionInfo(u32 command_id, HandlerFnP<Self> handler_callback, const char* name)
: FunctionInfoBase{
expected_header,
command_id,
// Type-erase member function pointer by casting it down to the base class.
static_cast<HandlerFnP<ServiceFrameworkBase>>(handler_callback), name} {}
};