summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Liam2023-02-21 12:19:12 -0500
committerGravatar Liam2023-02-21 12:19:25 -0500
commit72e5552409305fe57781b83c3145fb2b66552be2 (patch)
tree7c88edce6084274a0c79a9284fc7290033e2e0bc
parentcheat_engine: add check for hid initialization (diff)
downloadyuzu-72e5552409305fe57781b83c3145fb2b66552be2.tar.gz
yuzu-72e5552409305fe57781b83c3145fb2b66552be2.tar.xz
yuzu-72e5552409305fe57781b83c3145fb2b66552be2.zip
sm:: fix lingering session initialization issues
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/hle_ipc.h12
-rw-r--r--src/core/hle/service/sm/sm.cpp9
2 files changed, 19 insertions, 2 deletions
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 6cbc974fe..b4364f984 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -147,9 +147,21 @@ public:
147 return server_manager; 147 return server_manager;
148 } 148 }
149 149
150 // TODO: remove this when sm: is implemented with the proper IUserInterface
151 // abstraction, creating a new C++ handler object for each session:
152
153 bool GetIsInitializedForSm() const {
154 return is_initialized_for_sm;
155 }
156
157 void SetIsInitializedForSm() {
158 is_initialized_for_sm = true;
159 }
160
150private: 161private:
151 bool convert_to_domain{}; 162 bool convert_to_domain{};
152 bool is_domain{}; 163 bool is_domain{};
164 bool is_initialized_for_sm{};
153 SessionRequestHandlerPtr session_handler; 165 SessionRequestHandlerPtr session_handler;
154 std::vector<SessionRequestHandlerPtr> domain_handlers; 166 std::vector<SessionRequestHandlerPtr> domain_handlers;
155 167
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index 6eba48f03..53c877836 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -112,7 +112,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name
112void SM::Initialize(Kernel::HLERequestContext& ctx) { 112void SM::Initialize(Kernel::HLERequestContext& ctx) {
113 LOG_DEBUG(Service_SM, "called"); 113 LOG_DEBUG(Service_SM, "called");
114 114
115 is_initialized = true; 115 ctx.GetManager()->SetIsInitializedForSm();
116 116
117 IPC::ResponseBuilder rb{ctx, 2}; 117 IPC::ResponseBuilder rb{ctx, 2};
118 rb.Push(ResultSuccess); 118 rb.Push(ResultSuccess);
@@ -159,7 +159,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) {
159} 159}
160 160
161ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext& ctx) { 161ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext& ctx) {
162 if (!is_initialized) { 162 if (!ctx.GetManager()->GetIsInitializedForSm()) {
163 return ERR_NOT_INITIALIZED; 163 return ERR_NOT_INITIALIZED;
164 } 164 }
165 165
@@ -168,6 +168,11 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
168 168
169 // Find the named port. 169 // Find the named port.
170 auto port_result = service_manager.GetServicePort(name); 170 auto port_result = service_manager.GetServicePort(name);
171 if (port_result.Code() == ERR_INVALID_NAME) {
172 LOG_ERROR(Service_SM, "Invalid service name '{}'", name);
173 return ERR_INVALID_NAME;
174 }
175
171 if (port_result.Failed()) { 176 if (port_result.Failed()) {
172 LOG_INFO(Service_SM, "Waiting for service {} to become available", name); 177 LOG_INFO(Service_SM, "Waiting for service {} to become available", name);
173 ctx.SetIsDeferred(); 178 ctx.SetIsDeferred();