hle: kernel: Implement named service ports using service interface factory.

- This allows us to create a new interface each time ConnectToNamedPort is called, removing the assumption that these are static.
This commit is contained in:
bunnei 2021-05-10 15:57:59 -07:00
parent 44c763f9c6
commit c6de9657be
4 changed files with 30 additions and 22 deletions

View file

@ -27,6 +27,10 @@ class CoreTiming;
struct EventType;
} // namespace Core::Timing
namespace Service::SM {
class ServiceManager;
}
namespace Kernel {
class KClientPort;
@ -51,6 +55,9 @@ class ServiceThread;
class Synchronization;
class TimeManager;
using ServiceInterfaceFactory =
std::function<KClientPort&(Service::SM::ServiceManager&, Core::System&)>;
namespace Init {
struct KSlabResourceCounts;
}
@ -172,14 +179,11 @@ public:
void InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size);
/// Adds a port to the named port table
void AddNamedPort(std::string name, KClientPort* port);
/// Registers a named HLE service, passing a factory used to open a port to that service.
void RegisterNamedService(std::string name, ServiceInterfaceFactory&& factory);
/// Finds a port within the named port table with the given name.
NamedPortTable::iterator FindNamedPort(const std::string& name);
/// Finds a port within the named port table with the given name.
NamedPortTable::const_iterator FindNamedPort(const std::string& name) const;
/// Opens a port to a service previously registered with RegisterNamedService.
KClientPort* CreateNamedServicePort(std::string name);
/// Determines whether or not the given port is a valid named port.
bool IsValidNamedPort(NamedPortTable::const_iterator port) const;