summaryrefslogtreecommitdiff
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/service.cpp12
-rw-r--r--src/core/hle/service/service.h12
2 files changed, 8 insertions, 16 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index f51a042ff..abfc1806b 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -97,17 +97,13 @@ void Interface::Register(const FunctionInfo* functions, size_t n) {
97// Module interface 97// Module interface
98 98
99static void AddNamedPort(Interface* interface_) { 99static void AddNamedPort(Interface* interface_) {
100 interface_->name = interface_->GetPortName(); 100 auto client_port = Kernel::ClientPort::CreateForHLE(interface_->GetMaxSessions(), std::unique_ptr<Interface>(interface_));
101 interface_->active_sessions = 0; 101 g_kernel_named_ports.emplace(interface_->GetPortName(), client_port);
102 interface_->max_sessions = interface_->GetMaxSessions();
103 g_kernel_named_ports.emplace(interface_->GetPortName(), interface_);
104} 102}
105 103
106void AddService(Interface* interface_) { 104void AddService(Interface* interface_) {
107 interface_->name = interface_->GetPortName(); 105 auto client_port = Kernel::ClientPort::CreateForHLE(interface_->GetMaxSessions(), std::unique_ptr<Interface>(interface_));
108 interface_->active_sessions = 0; 106 g_srv_services.emplace(interface_->GetPortName(), client_port);
109 interface_->max_sessions = interface_->GetMaxSessions();
110 g_srv_services.emplace(interface_->GetPortName(), interface_);
111} 107}
112 108
113/// Initialize ServiceManager 109/// Initialize ServiceManager
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 8df968b2e..b22caca07 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -22,18 +22,16 @@ static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 character
22static const u32 DefaultMaxSessions = 10; ///< Arbitrary default number of maximum connections to an HLE port 22static const u32 DefaultMaxSessions = 10; ///< Arbitrary default number of maximum connections to an HLE port
23 23
24/// Interface to a CTROS service 24/// Interface to a CTROS service
25class Interface : public Kernel::ClientPort { 25class Interface {
26 // TODO(yuriks): An "Interface" being a Kernel::Object is mostly non-sense. Interface should be
27 // just something that encapsulates a session and acts as a helper to implement service
28 // processes.
29public: 26public:
30 std::string GetName() const override { 27 std::string GetName() const {
31 return GetPortName(); 28 return GetPortName();
32 } 29 }
33 30
34 virtual void SetVersion(u32 raw_version) { 31 virtual void SetVersion(u32 raw_version) {
35 version.raw = raw_version; 32 version.raw = raw_version;
36 } 33 }
34 virtual ~Interface() {}
37 35
38 /** 36 /**
39 * Gets the maximum allowed number of sessions that can be connected to this port at the same time. 37 * Gets the maximum allowed number of sessions that can be connected to this port at the same time.
@@ -42,8 +40,6 @@ public:
42 */ 40 */
43 virtual u32 GetMaxSessions() const { return DefaultMaxSessions; } 41 virtual u32 GetMaxSessions() const { return DefaultMaxSessions; }
44 42
45 void AddWaitingSession(Kernel::SharedPtr<Kernel::ServerSession> server_session) override { }
46
47 typedef void (*Function)(Interface*); 43 typedef void (*Function)(Interface*);
48 44
49 struct FunctionInfo { 45 struct FunctionInfo {
@@ -60,7 +56,7 @@ public:
60 return "[UNKNOWN SERVICE PORT]"; 56 return "[UNKNOWN SERVICE PORT]";
61 } 57 }
62 58
63 ResultCode HandleSyncRequest() override; 59 ResultCode HandleSyncRequest();
64 60
65protected: 61protected:
66 /** 62 /**