diff options
| author | 2019-04-28 18:49:46 -0400 | |
|---|---|---|
| committer | 2019-09-30 17:23:26 -0400 | |
| commit | 68658a8385b74454c8523efe95ceb81b34bb8812 (patch) | |
| tree | c66190e40aa52d7de174653bccbdff78104865b1 /src | |
| parent | bcat: Add BCAT backend for Boxcat service (diff) | |
| download | yuzu-68658a8385b74454c8523efe95ceb81b34bb8812.tar.gz yuzu-68658a8385b74454c8523efe95ceb81b34bb8812.tar.xz yuzu-68658a8385b74454c8523efe95ceb81b34bb8812.zip | |
module: Create BCAT backend based upon Settings value on construction
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 20 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/module.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/module.h | 3 |
3 files changed, 36 insertions, 1 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a6b56c9c6..3416854db 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | if (YUZU_ENABLE_BOXCAT) | ||
| 2 | set(BCAT_BOXCAT_ADDITIONAL_SOURCES hle/service/bcat/backend/boxcat.cpp hle/service/bcat/backend/boxcat.h) | ||
| 3 | else() | ||
| 4 | set(BCAT_BOXCAT_ADDITIONAL_SOURCES) | ||
| 5 | endif() | ||
| 6 | |||
| 1 | add_library(core STATIC | 7 | add_library(core STATIC |
| 2 | arm/arm_interface.h | 8 | arm/arm_interface.h |
| 3 | arm/arm_interface.cpp | 9 | arm/arm_interface.cpp |
| @@ -82,6 +88,8 @@ add_library(core STATIC | |||
| 82 | file_sys/vfs_concat.h | 88 | file_sys/vfs_concat.h |
| 83 | file_sys/vfs_layered.cpp | 89 | file_sys/vfs_layered.cpp |
| 84 | file_sys/vfs_layered.h | 90 | file_sys/vfs_layered.h |
| 91 | file_sys/vfs_libzip.cpp | ||
| 92 | file_sys/vfs_libzip.h | ||
| 85 | file_sys/vfs_offset.cpp | 93 | file_sys/vfs_offset.cpp |
| 86 | file_sys/vfs_offset.h | 94 | file_sys/vfs_offset.h |
| 87 | file_sys/vfs_real.cpp | 95 | file_sys/vfs_real.cpp |
| @@ -241,6 +249,9 @@ add_library(core STATIC | |||
| 241 | hle/service/audio/errors.h | 249 | hle/service/audio/errors.h |
| 242 | hle/service/audio/hwopus.cpp | 250 | hle/service/audio/hwopus.cpp |
| 243 | hle/service/audio/hwopus.h | 251 | hle/service/audio/hwopus.h |
| 252 | hle/service/bcat/backend/backend.cpp | ||
| 253 | hle/service/bcat/backend/backend.h | ||
| 254 | ${BCAT_BOXCAT_ADDITIONAL_SOURCES} | ||
| 244 | hle/service/bcat/bcat.cpp | 255 | hle/service/bcat/bcat.cpp |
| 245 | hle/service/bcat/bcat.h | 256 | hle/service/bcat/bcat.h |
| 246 | hle/service/bcat/module.cpp | 257 | hle/service/bcat/module.cpp |
| @@ -499,6 +510,15 @@ create_target_directory_groups(core) | |||
| 499 | 510 | ||
| 500 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | 511 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) |
| 501 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn open_source_archives) | 512 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn open_source_archives) |
| 513 | |||
| 514 | if (YUZU_ENABLE_BOXCAT) | ||
| 515 | get_directory_property(OPENSSL_LIBS | ||
| 516 | DIRECTORY ${PROJECT_SOURCE_DIR}/externals/libressl | ||
| 517 | DEFINITION OPENSSL_LIBS) | ||
| 518 | target_compile_definitions(core PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT -DYUZU_ENABLE_BOXCAT) | ||
| 519 | target_link_libraries(core PRIVATE httplib json-headers ${OPENSSL_LIBS} zip) | ||
| 520 | endif() | ||
| 521 | |||
| 502 | if (ENABLE_WEB_SERVICE) | 522 | if (ENABLE_WEB_SERVICE) |
| 503 | target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) | 523 | target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) |
| 504 | target_link_libraries(core PRIVATE web_service) | 524 | target_link_libraries(core PRIVATE web_service) |
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index b7bd738fc..32d3d5cfc 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp | |||
| @@ -38,10 +38,22 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { | |||
| 38 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 38 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 39 | rb.Push(RESULT_SUCCESS); | 39 | rb.Push(RESULT_SUCCESS); |
| 40 | rb.PushIpcInterface<IBcatService>(); | 40 | rb.PushIpcInterface<IBcatService>(); |
| 41 | namespace { | ||
| 42 | std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { | ||
| 43 | const auto backend = Settings::values.bcat_backend; | ||
| 44 | |||
| 45 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 46 | if (backend == "boxcat") | ||
| 47 | return std::make_unique<Boxcat>(std::move(getter)); | ||
| 48 | #endif | ||
| 49 | |||
| 50 | return std::make_unique<NullBackend>(std::move(getter)); | ||
| 41 | } | 51 | } |
| 52 | } // Anonymous namespace | ||
| 42 | 53 | ||
| 43 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) | 54 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) |
| 44 | : ServiceFramework(name), module(std::move(module)) {} | 55 | : ServiceFramework(name), module(std::move(module)), |
| 56 | backend(CreateBackendFromSettings(&Service::FileSystem::GetBCATDirectory)) {} | ||
| 45 | 57 | ||
| 46 | Module::Interface::~Interface() = default; | 58 | Module::Interface::~Interface() = default; |
| 47 | 59 | ||
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h index f0d63cab0..4af363bfd 100644 --- a/src/core/hle/service/bcat/module.h +++ b/src/core/hle/service/bcat/module.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service::BCAT { | 9 | namespace Service::BCAT { |
| 10 | 10 | ||
| 11 | class Backend; | ||
| 12 | |||
| 11 | class Module final { | 13 | class Module final { |
| 12 | public: | 14 | public: |
| 13 | class Interface : public ServiceFramework<Interface> { | 15 | class Interface : public ServiceFramework<Interface> { |
| @@ -19,6 +21,7 @@ public: | |||
| 19 | 21 | ||
| 20 | protected: | 22 | protected: |
| 21 | std::shared_ptr<Module> module; | 23 | std::shared_ptr<Module> module; |
| 24 | std::unique_ptr<Backend> backend; | ||
| 22 | }; | 25 | }; |
| 23 | }; | 26 | }; |
| 24 | 27 | ||