summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar bunnei2021-05-10 15:57:59 -0700
committerGravatar bunnei2021-05-10 20:34:38 -0700
commitc6de9657be71a9c659f9c991ec8d024ebf44d56e (patch)
tree8e5e3087a136fdcc218d789ae6f6457e83554919 /src/core/hle/kernel/kernel.h
parenthle: kernel: KSession: Improve implementation of CloneCurrentObject. (diff)
downloadyuzu-c6de9657be71a9c659f9c991ec8d024ebf44d56e.tar.gz
yuzu-c6de9657be71a9c659f9c991ec8d024ebf44d56e.tar.xz
yuzu-c6de9657be71a9c659f9c991ec8d024ebf44d56e.zip
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.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r--src/core/hle/kernel/kernel.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 51aaccbc7..2d01e1ae0 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -27,6 +27,10 @@ class CoreTiming;
27struct EventType; 27struct EventType;
28} // namespace Core::Timing 28} // namespace Core::Timing
29 29
30namespace Service::SM {
31class ServiceManager;
32}
33
30namespace Kernel { 34namespace Kernel {
31 35
32class KClientPort; 36class KClientPort;
@@ -51,6 +55,9 @@ class ServiceThread;
51class Synchronization; 55class Synchronization;
52class TimeManager; 56class TimeManager;
53 57
58using ServiceInterfaceFactory =
59 std::function<KClientPort&(Service::SM::ServiceManager&, Core::System&)>;
60
54namespace Init { 61namespace Init {
55struct KSlabResourceCounts; 62struct KSlabResourceCounts;
56} 63}
@@ -172,14 +179,11 @@ public:
172 179
173 void InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size); 180 void InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size);
174 181
175 /// Adds a port to the named port table 182 /// Registers a named HLE service, passing a factory used to open a port to that service.
176 void AddNamedPort(std::string name, KClientPort* port); 183 void RegisterNamedService(std::string name, ServiceInterfaceFactory&& factory);
177
178 /// Finds a port within the named port table with the given name.
179 NamedPortTable::iterator FindNamedPort(const std::string& name);
180 184
181 /// Finds a port within the named port table with the given name. 185 /// Opens a port to a service previously registered with RegisterNamedService.
182 NamedPortTable::const_iterator FindNamedPort(const std::string& name) const; 186 KClientPort* CreateNamedServicePort(std::string name);
183 187
184 /// Determines whether or not the given port is a valid named port. 188 /// Determines whether or not the given port is a valid named port.
185 bool IsValidNamedPort(NamedPortTable::const_iterator port) const; 189 bool IsValidNamedPort(NamedPortTable::const_iterator port) const;