summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-04-28 18:51:18 -0400
committerGravatar Zach Hilman2019-09-30 17:23:26 -0400
commit78d146f907cbab60026f972e1be7cc8eb83e05bb (patch)
tree12c4190b1da9c2b9ca56a5a7eac3a654d8f6c23c /src
parentmodule: Create BCAT backend based upon Settings value on construction (diff)
downloadyuzu-78d146f907cbab60026f972e1be7cc8eb83e05bb.tar.gz
yuzu-78d146f907cbab60026f972e1be7cc8eb83e05bb.tar.xz
yuzu-78d146f907cbab60026f972e1be7cc8eb83e05bb.zip
bcat: Add commands to create IDeliveryCacheStorageService
Used to access contents of download.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/bcat/bcat.cpp4
-rw-r--r--src/core/hle/service/bcat/module.cpp28
-rw-r--r--src/core/hle/service/bcat/module.h2
3 files changed, 32 insertions, 2 deletions
diff --git a/src/core/hle/service/bcat/bcat.cpp b/src/core/hle/service/bcat/bcat.cpp
index 179aa4949..391f599ee 100644
--- a/src/core/hle/service/bcat/bcat.cpp
+++ b/src/core/hle/service/bcat/bcat.cpp
@@ -8,9 +8,13 @@ namespace Service::BCAT {
8 8
9BCAT::BCAT(std::shared_ptr<Module> module, const char* name) 9BCAT::BCAT(std::shared_ptr<Module> module, const char* name)
10 : Module::Interface(std::move(module), name) { 10 : Module::Interface(std::move(module), name) {
11 // clang-format off
11 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
12 {0, &BCAT::CreateBcatService, "CreateBcatService"}, 13 {0, &BCAT::CreateBcatService, "CreateBcatService"},
14 {1, &BCAT::CreateDeliveryCacheStorageService, "CreateDeliveryCacheStorageService"},
15 {2, &BCAT::CreateDeliveryCacheStorageServiceWithApplicationId, "CreateDeliveryCacheStorageServiceWithApplicationId"},
13 }; 16 };
17 // clang-format on
14 RegisterHandlers(functions); 18 RegisterHandlers(functions);
15} 19}
16 20
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index 32d3d5cfc..fd742fde2 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -11,7 +11,8 @@ namespace Service::BCAT {
11 11
12class IBcatService final : public ServiceFramework<IBcatService> { 12class IBcatService final : public ServiceFramework<IBcatService> {
13public: 13public:
14 IBcatService() : ServiceFramework("IBcatService") { 14 IBcatService(Backend& backend) : ServiceFramework("IBcatService"), backend(backend) {
15 // clang-format off
15 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
16 {10100, nullptr, "RequestSyncDeliveryCache"}, 17 {10100, nullptr, "RequestSyncDeliveryCache"},
17 {10101, nullptr, "RequestSyncDeliveryCacheWithDirectoryName"}, 18 {10101, nullptr, "RequestSyncDeliveryCacheWithDirectoryName"},
@@ -28,6 +29,7 @@ public:
28 {90201, nullptr, "ClearDeliveryCacheStorage"}, 29 {90201, nullptr, "ClearDeliveryCacheStorage"},
29 {90300, nullptr, "GetPushNotificationLog"}, 30 {90300, nullptr, "GetPushNotificationLog"},
30 }; 31 };
32 // clang-format on
31 RegisterHandlers(functions); 33 RegisterHandlers(functions);
32 } 34 }
33}; 35};
@@ -37,7 +39,29 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
37 39
38 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 40 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
39 rb.Push(RESULT_SUCCESS); 41 rb.Push(RESULT_SUCCESS);
40 rb.PushIpcInterface<IBcatService>(); 42 rb.PushIpcInterface<IBcatService>(*backend);
43void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
44 LOG_DEBUG(Service_BCAT, "called");
45
46 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
47 rb.Push(RESULT_SUCCESS);
48 rb.PushIpcInterface<IDeliveryCacheStorageService>(
49 Service::FileSystem::GetBCATDirectory(Core::CurrentProcess()->GetTitleID()));
50}
51
52void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
53 Kernel::HLERequestContext& ctx) {
54 IPC::RequestParser rp{ctx};
55 const auto title_id = rp.PopRaw<u64>();
56
57 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id);
58
59 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
60 rb.Push(RESULT_SUCCESS);
61 rb.PushIpcInterface<IDeliveryCacheStorageService>(
62 Service::FileSystem::GetBCATDirectory(title_id));
63}
64
41namespace { 65namespace {
42std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { 66std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
43 const auto backend = Settings::values.bcat_backend; 67 const auto backend = Settings::values.bcat_backend;
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h
index 4af363bfd..fc52574c2 100644
--- a/src/core/hle/service/bcat/module.h
+++ b/src/core/hle/service/bcat/module.h
@@ -18,6 +18,8 @@ public:
18 ~Interface() override; 18 ~Interface() override;
19 19
20 void CreateBcatService(Kernel::HLERequestContext& ctx); 20 void CreateBcatService(Kernel::HLERequestContext& ctx);
21 void CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx);
22 void CreateDeliveryCacheStorageServiceWithApplicationId(Kernel::HLERequestContext& ctx);
21 23
22 protected: 24 protected:
23 std::shared_ptr<Module> module; 25 std::shared_ptr<Module> module;