diff options
| author | 2016-06-17 17:09:43 -0500 | |
|---|---|---|
| committer | 2016-11-30 23:03:59 -0500 | |
| commit | c19afd21188e91b9dd2780cf5cb9872a17ad113d (patch) | |
| tree | 5404cd7850f049d474dbcc3cc4ee80874b0c7627 /src/core/hle/service | |
| parent | fixup! Kernel/IPC: Use Ports and Sessions as the fundamental building block ... (diff) | |
| download | yuzu-c19afd21188e91b9dd2780cf5cb9872a17ad113d.tar.gz yuzu-c19afd21188e91b9dd2780cf5cb9872a17ad113d.tar.xz yuzu-c19afd21188e91b9dd2780cf5cb9872a17ad113d.zip | |
Kernel/HLE: Service::Interface no longer inherits from any Kernel object, and is now its own standalone class.
Interface is now used by aggregation in ClientPort, to forward service commands to their HLE implementation if needed.
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/service.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 12 |
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 | ||
| 99 | static void AddNamedPort(Interface* interface_) { | 99 | static 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 | ||
| 106 | void AddService(Interface* interface_) { | 104 | void 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 | |||
| 22 | static const u32 DefaultMaxSessions = 10; ///< Arbitrary default number of maximum connections to an HLE port | 22 | static 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 |
| 25 | class Interface : public Kernel::ClientPort { | 25 | class 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. | ||
| 29 | public: | 26 | public: |
| 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 | ||
| 65 | protected: | 61 | protected: |
| 66 | /** | 62 | /** |