summaryrefslogtreecommitdiff
path: root/src/core/hle/service/sm
diff options
context:
space:
mode:
authorGravatar Kelebek12023-10-29 13:50:55 +0000
committerGravatar Kelebek12024-01-24 04:26:55 +0000
commite4915fb7d2077584a11a15141bc81d28ed2b0125 (patch)
tree1783055dc2e98eaf9099e8e7b194b55f8f607747 /src/core/hle/service/sm
parentMerge pull request #12678 from german77/settings_impl (diff)
downloadyuzu-e4915fb7d2077584a11a15141bc81d28ed2b0125.tar.gz
yuzu-e4915fb7d2077584a11a15141bc81d28ed2b0125.tar.xz
yuzu-e4915fb7d2077584a11a15141bc81d28ed2b0125.zip
Rework time service to fix time passing offline.
Diffstat (limited to 'src/core/hle/service/sm')
-rw-r--r--src/core/hle/service/sm/sm.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index 4ae32a9c1..32c218638 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -3,6 +3,7 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <chrono>
6#include <memory> 7#include <memory>
7#include <mutex> 8#include <mutex>
8#include <string> 9#include <string>
@@ -10,6 +11,7 @@
10 11
11#include "common/concepts.h" 12#include "common/concepts.h"
12#include "core/hle/kernel/k_port.h" 13#include "core/hle/kernel/k_port.h"
14#include "core/hle/kernel/svc.h"
13#include "core/hle/result.h" 15#include "core/hle/result.h"
14#include "core/hle/service/service.h" 16#include "core/hle/service/service.h"
15 17
@@ -62,12 +64,21 @@ public:
62 Result GetServicePort(Kernel::KClientPort** out_client_port, const std::string& name); 64 Result GetServicePort(Kernel::KClientPort** out_client_port, const std::string& name);
63 65
64 template <Common::DerivedFrom<SessionRequestHandler> T> 66 template <Common::DerivedFrom<SessionRequestHandler> T>
65 std::shared_ptr<T> GetService(const std::string& service_name) const { 67 std::shared_ptr<T> GetService(const std::string& service_name, bool block = false) const {
66 auto service = registered_services.find(service_name); 68 auto service = registered_services.find(service_name);
67 if (service == registered_services.end()) { 69 if (service == registered_services.end() && !block) {
68 LOG_DEBUG(Service, "Can't find service: {}", service_name); 70 LOG_DEBUG(Service, "Can't find service: {}", service_name);
69 return nullptr; 71 return nullptr;
72 } else if (block) {
73 using namespace std::literals::chrono_literals;
74 while (service == registered_services.end()) {
75 Kernel::Svc::SleepThread(
76 kernel.System(),
77 std::chrono::duration_cast<std::chrono::nanoseconds>(100ms).count());
78 service = registered_services.find(service_name);
79 }
70 } 80 }
81
71 return std::static_pointer_cast<T>(service->second()); 82 return std::static_pointer_cast<T>(service->second());
72 } 83 }
73 84