diff options
| -rw-r--r-- | CONTRIBUTING.md | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/client_port.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/client_port.h | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/server_port.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.h | 19 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 1 |
6 files changed, 28 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 008dc5b50..1b2056885 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md | |||
| @@ -22,7 +22,7 @@ If clang format is found, then cmake will add a custom build target that can be | |||
| 22 | * Don't ever introduce new external dependencies into Core | 22 | * Don't ever introduce new external dependencies into Core |
| 23 | * Don't use any platform specific code in Core | 23 | * Don't use any platform specific code in Core |
| 24 | * Use namespaces often | 24 | * Use namespaces often |
| 25 | * Avoid the use of C-style casts and instead prefer C++-style `static_cast` and `reinterpret_cast`. Try to avoid using `dynamic_cast`. Never use `const_cast`. The only exception to this rule is for casting between two numeric types, where C-style casts are encouraged for brevity and readability. | 25 | * Avoid the use of C-style casts and instead prefer C++-style `static_cast` and `reinterpret_cast`. Try to avoid using `dynamic_cast`. Never use `const_cast`. |
| 26 | 26 | ||
| 27 | ### Naming Rules | 27 | ### Naming Rules |
| 28 | * Functions: `PascalCase` | 28 | * Functions: `PascalCase` |
diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 873d6c516..d4c91d529 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp | |||
| @@ -17,6 +17,10 @@ namespace Kernel { | |||
| 17 | ClientPort::ClientPort(KernelCore& kernel) : Object{kernel} {} | 17 | ClientPort::ClientPort(KernelCore& kernel) : Object{kernel} {} |
| 18 | ClientPort::~ClientPort() = default; | 18 | ClientPort::~ClientPort() = default; |
| 19 | 19 | ||
| 20 | SharedPtr<ServerPort> ClientPort::GetServerPort() const { | ||
| 21 | return server_port; | ||
| 22 | } | ||
| 23 | |||
| 20 | ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() { | 24 | ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() { |
| 21 | // Note: Threads do not wait for the server endpoint to call | 25 | // Note: Threads do not wait for the server endpoint to call |
| 22 | // AcceptSession before returning from this call. | 26 | // AcceptSession before returning from this call. |
diff --git a/src/core/hle/kernel/client_port.h b/src/core/hle/kernel/client_port.h index f3dfebbb1..6cd607206 100644 --- a/src/core/hle/kernel/client_port.h +++ b/src/core/hle/kernel/client_port.h | |||
| @@ -30,6 +30,8 @@ public: | |||
| 30 | return HANDLE_TYPE; | 30 | return HANDLE_TYPE; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | SharedPtr<ServerPort> GetServerPort() const; | ||
| 34 | |||
| 33 | /** | 35 | /** |
| 34 | * Creates a new Session pair, adds the created ServerSession to the associated ServerPort's | 36 | * Creates a new Session pair, adds the created ServerSession to the associated ServerPort's |
| 35 | * list of pending sessions, and signals the ServerPort, causing any threads | 37 | * list of pending sessions, and signals the ServerPort, causing any threads |
diff --git a/src/core/hle/kernel/server_port.h b/src/core/hle/kernel/server_port.h index 62fb51349..e52f8245f 100644 --- a/src/core/hle/kernel/server_port.h +++ b/src/core/hle/kernel/server_port.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/object.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | #include "core/hle/kernel/wait_object.h" | 13 | #include "core/hle/kernel/wait_object.h" |
| 14 | #include "core/hle/result.h" | ||
| 14 | 15 | ||
| 15 | namespace Kernel { | 16 | namespace Kernel { |
| 16 | 17 | ||
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index da2c51082..4f8145dda 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h | |||
| @@ -6,9 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <type_traits> | ||
| 9 | #include <unordered_map> | 10 | #include <unordered_map> |
| 10 | 11 | ||
| 12 | #include "core/hle/kernel/client_port.h" | ||
| 11 | #include "core/hle/kernel/object.h" | 13 | #include "core/hle/kernel/object.h" |
| 14 | #include "core/hle/kernel/server_port.h" | ||
| 12 | #include "core/hle/result.h" | 15 | #include "core/hle/result.h" |
| 13 | #include "core/hle/service/service.h" | 16 | #include "core/hle/service/service.h" |
| 14 | 17 | ||
| @@ -48,6 +51,22 @@ public: | |||
| 48 | ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> GetServicePort(const std::string& name); | 51 | ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> GetServicePort(const std::string& name); |
| 49 | ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ConnectToService(const std::string& name); | 52 | ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ConnectToService(const std::string& name); |
| 50 | 53 | ||
| 54 | template <typename T> | ||
| 55 | std::shared_ptr<T> GetService(const std::string& service_name) const { | ||
| 56 | static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>, | ||
| 57 | "Not a base of ServiceFrameworkBase"); | ||
| 58 | auto service = registered_services.find(service_name); | ||
| 59 | if (service == registered_services.end()) { | ||
| 60 | LOG_DEBUG(Service, "Can't find service: {}", service_name); | ||
| 61 | return nullptr; | ||
| 62 | } | ||
| 63 | auto port = service->second->GetServerPort(); | ||
| 64 | if (port == nullptr) { | ||
| 65 | return nullptr; | ||
| 66 | } | ||
| 67 | return std::static_pointer_cast<T>(port->hle_handler); | ||
| 68 | } | ||
| 69 | |||
| 51 | void InvokeControlRequest(Kernel::HLERequestContext& context); | 70 | void InvokeControlRequest(Kernel::HLERequestContext& context); |
| 52 | 71 | ||
| 53 | private: | 72 | private: |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 60dcdc184..a91bc6dee 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -252,6 +252,7 @@ DrawParameters RasterizerOpenGL::SetupDraw() { | |||
| 252 | params.count = regs.vertex_buffer.count; | 252 | params.count = regs.vertex_buffer.count; |
| 253 | params.vertex_first = regs.vertex_buffer.first; | 253 | params.vertex_first = regs.vertex_buffer.first; |
| 254 | } | 254 | } |
| 255 | return params; | ||
| 255 | } | 256 | } |
| 256 | 257 | ||
| 257 | void RasterizerOpenGL::SetupShaders() { | 258 | void RasterizerOpenGL::SetupShaders() { |