diff options
| author | 2016-12-05 13:44:41 -0500 | |
|---|---|---|
| committer | 2016-12-05 13:44:41 -0500 | |
| commit | 61a2fe8c3bcd5e6dc7e97945b923d1a5bd8099ec (patch) | |
| tree | b32d013cfd1758df64f324f850b2c0af470be255 /src/core | |
| parent | Split SessionRequestHandler::HandleSyncRequest into HandleSyncRequest, Transl... (diff) | |
| download | yuzu-61a2fe8c3bcd5e6dc7e97945b923d1a5bd8099ec.tar.gz yuzu-61a2fe8c3bcd5e6dc7e97945b923d1a5bd8099ec.tar.xz yuzu-61a2fe8c3bcd5e6dc7e97945b923d1a5bd8099ec.zip | |
HLE: Use a member variable instead of a virtual function to retrieve the max number of sessions that can be connected to an HLE service at the same time.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/apt/apt.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_a.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_s.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_u.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 18 |
5 files changed, 18 insertions, 8 deletions
diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 44dbd8757..9bc6327ed 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h | |||
| @@ -14,6 +14,8 @@ class Interface; | |||
| 14 | 14 | ||
| 15 | namespace APT { | 15 | namespace APT { |
| 16 | 16 | ||
| 17 | static const u32 MaxAPTSessions = 2; ///< Each APT service can only have up to 2 sessions connected at the same time. | ||
| 18 | |||
| 17 | /// Holds information about the parameters used in Send/Glance/ReceiveParameter | 19 | /// Holds information about the parameters used in Send/Glance/ReceiveParameter |
| 18 | struct MessageParameter { | 20 | struct MessageParameter { |
| 19 | u32 sender_id = 0; | 21 | u32 sender_id = 0; |
diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index a7a0c8a41..7f37a7f54 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp | |||
| @@ -39,7 +39,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 39 | {0x01020000, CheckNew3DS, "CheckNew3DS"}, | 39 | {0x01020000, CheckNew3DS, "CheckNew3DS"}, |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | APT_A_Interface::APT_A_Interface() { | 42 | APT_A_Interface::APT_A_Interface() : Interface(MaxAPTSessions) { |
| 43 | Register(FunctionTable); | 43 | Register(FunctionTable); |
| 44 | } | 44 | } |
| 45 | 45 | ||
diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index c4556a5de..933f26e60 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp | |||
| @@ -99,7 +99,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 99 | {0x01020000, CheckNew3DS, "CheckNew3DS"}, | 99 | {0x01020000, CheckNew3DS, "CheckNew3DS"}, |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | APT_S_Interface::APT_S_Interface() { | 102 | APT_S_Interface::APT_S_Interface() : Interface(MaxAPTSessions) { |
| 103 | Register(FunctionTable); | 103 | Register(FunctionTable); |
| 104 | } | 104 | } |
| 105 | 105 | ||
diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index a731c39f6..e06084a1e 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp | |||
| @@ -99,7 +99,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 99 | {0x01020000, CheckNew3DS, "CheckNew3DS"}, | 99 | {0x01020000, CheckNew3DS, "CheckNew3DS"}, |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | APT_U_Interface::APT_U_Interface() { | 102 | APT_U_Interface::APT_U_Interface() : Interface(MaxAPTSessions) { |
| 103 | Register(FunctionTable); | 103 | Register(FunctionTable); |
| 104 | } | 104 | } |
| 105 | 105 | ||
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 7b7db8499..2274e50ca 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -174,7 +174,7 @@ inline DescriptorType GetDescriptorType(u32 descriptor) { | |||
| 174 | namespace Service { | 174 | namespace Service { |
| 175 | 175 | ||
| 176 | static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters) | 176 | static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters) |
| 177 | static const u32 DefaultMaxSessions = 10; ///< Arbitrary default number of maximum connections to an HLE port | 177 | static const u32 DefaultMaxSessions = 10; ///< Arbitrary default number of maximum connections to an HLE service |
| 178 | 178 | ||
| 179 | /** | 179 | /** |
| 180 | * Interface implemented by HLE Session handlers. | 180 | * Interface implemented by HLE Session handlers. |
| @@ -215,6 +215,15 @@ private: | |||
| 215 | */ | 215 | */ |
| 216 | class Interface : public SessionRequestHandler { | 216 | class Interface : public SessionRequestHandler { |
| 217 | public: | 217 | public: |
| 218 | /** | ||
| 219 | * Creates an HLE interface with the specified max sessions. | ||
| 220 | * @param max_sessions Maximum number of sessions that can be | ||
| 221 | * connected to this service at the same time. | ||
| 222 | */ | ||
| 223 | Interface(u32 max_sessions = DefaultMaxSessions) : max_sessions(max_sessions) { } | ||
| 224 | |||
| 225 | virtual ~Interface() = default; | ||
| 226 | |||
| 218 | std::string GetName() const { | 227 | std::string GetName() const { |
| 219 | return GetPortName(); | 228 | return GetPortName(); |
| 220 | } | 229 | } |
| @@ -222,14 +231,12 @@ public: | |||
| 222 | virtual void SetVersion(u32 raw_version) { | 231 | virtual void SetVersion(u32 raw_version) { |
| 223 | version.raw = raw_version; | 232 | version.raw = raw_version; |
| 224 | } | 233 | } |
| 225 | virtual ~Interface() {} | ||
| 226 | 234 | ||
| 227 | /** | 235 | /** |
| 228 | * Gets the maximum allowed number of sessions that can be connected to this port at the same time. | 236 | * Gets the maximum allowed number of sessions that can be connected to this service at the same time. |
| 229 | * It should be overwritten by each service implementation for more fine-grained control. | ||
| 230 | * @returns The maximum number of connections allowed. | 237 | * @returns The maximum number of connections allowed. |
| 231 | */ | 238 | */ |
| 232 | virtual u32 GetMaxSessions() const { return DefaultMaxSessions; } | 239 | u32 GetMaxSessions() const { return max_sessions; } |
| 233 | 240 | ||
| 234 | typedef void (*Function)(Interface*); | 241 | typedef void (*Function)(Interface*); |
| 235 | 242 | ||
| @@ -269,6 +276,7 @@ protected: | |||
| 269 | } version = {}; | 276 | } version = {}; |
| 270 | 277 | ||
| 271 | private: | 278 | private: |
| 279 | u32 max_sessions; ///< Maximum number of concurrent sessions that this service can handle. | ||
| 272 | boost::container::flat_map<u32, FunctionInfo> m_functions; | 280 | boost::container::flat_map<u32, FunctionInfo> m_functions; |
| 273 | }; | 281 | }; |
| 274 | 282 | ||