diff options
| author | 2020-11-26 15:19:08 -0500 | |
|---|---|---|
| committer | 2020-11-26 20:03:11 -0500 | |
| commit | 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch) | |
| tree | 3593cd42e0ba676c3919561983f7e9766fcb641c /src/yuzu_tester | |
| parent | Merge pull request #4975 from comex/invalid-syncpoint-id (diff) | |
| download | yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip | |
service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
Diffstat (limited to 'src/yuzu_tester')
| -rw-r--r-- | src/yuzu_tester/service/yuzutest.cpp | 15 | ||||
| -rw-r--r-- | src/yuzu_tester/service/yuzutest.h | 6 | ||||
| -rw-r--r-- | src/yuzu_tester/yuzu.cpp | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/yuzu_tester/service/yuzutest.cpp b/src/yuzu_tester/service/yuzutest.cpp index 2d3f6e3a7..e257fae25 100644 --- a/src/yuzu_tester/service/yuzutest.cpp +++ b/src/yuzu_tester/service/yuzutest.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include "common/string_util.h" | 6 | #include "common/string_util.h" |
| 7 | #include "core/core.h" | ||
| 7 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 9 | #include "core/hle/service/sm/sm.h" | 10 | #include "core/hle/service/sm/sm.h" |
| @@ -15,10 +16,10 @@ constexpr u64 SERVICE_VERSION = 0x00000002; | |||
| 15 | 16 | ||
| 16 | class YuzuTest final : public ServiceFramework<YuzuTest> { | 17 | class YuzuTest final : public ServiceFramework<YuzuTest> { |
| 17 | public: | 18 | public: |
| 18 | explicit YuzuTest(std::string data, | 19 | explicit YuzuTest(Core::System& system_, std::string data_, |
| 19 | std::function<void(std::vector<TestResult>)> finish_callback) | 20 | std::function<void(std::vector<TestResult>)> finish_callback_) |
| 20 | : ServiceFramework{"yuzutest"}, data(std::move(data)), | 21 | : ServiceFramework{system_, "yuzutest"}, data{std::move(data_)}, finish_callback{std::move( |
| 21 | finish_callback(std::move(finish_callback)) { | 22 | finish_callback_)} { |
| 22 | static const FunctionInfo functions[] = { | 23 | static const FunctionInfo functions[] = { |
| 23 | {0, &YuzuTest::Initialize, "Initialize"}, | 24 | {0, &YuzuTest::Initialize, "Initialize"}, |
| 24 | {1, &YuzuTest::GetServiceVersion, "GetServiceVersion"}, | 25 | {1, &YuzuTest::GetServiceVersion, "GetServiceVersion"}, |
| @@ -104,9 +105,11 @@ private: | |||
| 104 | std::function<void(std::vector<TestResult>)> finish_callback; | 105 | std::function<void(std::vector<TestResult>)> finish_callback; |
| 105 | }; | 106 | }; |
| 106 | 107 | ||
| 107 | void InstallInterfaces(SM::ServiceManager& sm, std::string data, | 108 | void InstallInterfaces(Core::System& system, std::string data, |
| 108 | std::function<void(std::vector<TestResult>)> finish_callback) { | 109 | std::function<void(std::vector<TestResult>)> finish_callback) { |
| 109 | std::make_shared<YuzuTest>(data, finish_callback)->InstallAsService(sm); | 110 | auto& sm = system.ServiceManager(); |
| 111 | std::make_shared<YuzuTest>(system, std::move(data), std::move(finish_callback)) | ||
| 112 | ->InstallAsService(sm); | ||
| 110 | } | 113 | } |
| 111 | 114 | ||
| 112 | } // namespace Service::Yuzu | 115 | } // namespace Service::Yuzu |
diff --git a/src/yuzu_tester/service/yuzutest.h b/src/yuzu_tester/service/yuzutest.h index eca129c8c..7794814fa 100644 --- a/src/yuzu_tester/service/yuzutest.h +++ b/src/yuzu_tester/service/yuzutest.h | |||
| @@ -7,8 +7,8 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | 9 | ||
| 10 | namespace Service::SM { | 10 | namespace Core { |
| 11 | class ServiceManager; | 11 | class System; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | namespace Service::Yuzu { | 14 | namespace Service::Yuzu { |
| @@ -19,7 +19,7 @@ struct TestResult { | |||
| 19 | std::string name; | 19 | std::string name; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | void InstallInterfaces(SM::ServiceManager& sm, std::string data, | 22 | void InstallInterfaces(Core::System& system, std::string data, |
| 23 | std::function<void(std::vector<TestResult>)> finish_callback); | 23 | std::function<void(std::vector<TestResult>)> finish_callback); |
| 24 | 24 | ||
| 25 | } // namespace Service::Yuzu | 25 | } // namespace Service::Yuzu |
diff --git a/src/yuzu_tester/yuzu.cpp b/src/yuzu_tester/yuzu.cpp index 88e4bd1f7..ea94a6537 100644 --- a/src/yuzu_tester/yuzu.cpp +++ b/src/yuzu_tester/yuzu.cpp | |||
| @@ -247,9 +247,10 @@ int main(int argc, char** argv) { | |||
| 247 | "additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}", | 247 | "additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}", |
| 248 | loader_id, error_id, static_cast<Loader::ResultStatus>(error_id)); | 248 | loader_id, error_id, static_cast<Loader::ResultStatus>(error_id)); |
| 249 | } | 249 | } |
| 250 | break; | ||
| 250 | } | 251 | } |
| 251 | 252 | ||
| 252 | Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback); | 253 | Service::Yuzu::InstallInterfaces(system, datastring, callback); |
| 253 | 254 | ||
| 254 | system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", | 255 | system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", |
| 255 | "SDLHideTester"); | 256 | "SDLHideTester"); |