summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-10-01 09:13:09 -0400
committerGravatar Zach Hilman2019-10-01 09:13:09 -0400
commit19c466dfb1f997eaa16fc9d9b832aaf3321adc40 (patch)
treef5aa993c55239c4d5bb8af83496895fe9f98b7b0 /src
parentboxcat: Implement events global field (diff)
downloadyuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.gz
yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.xz
yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.zip
bcat: Add FSC accessors for BCAT data
Ports BCAT to use FSC interface
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp3
-rw-r--r--src/core/hle/service/bcat/backend/backend.h10
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp11
-rw-r--r--src/core/hle/service/bcat/bcat.cpp4
-rw-r--r--src/core/hle/service/bcat/bcat.h3
-rw-r--r--src/core/hle/service/bcat/module.cpp26
-rw-r--r--src/core/hle/service/bcat/module.h19
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp2
-rw-r--r--src/core/hle/service/filesystem/filesystem.h2
-rw-r--r--src/core/hle/service/service.cpp2
10 files changed, 51 insertions, 31 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 79f9a393e..34409e0c3 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1140,7 +1140,8 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
1140 LOG_DEBUG(Service_AM, "called, kind={:08X}", static_cast<u8>(kind)); 1140 LOG_DEBUG(Service_AM, "called, kind={:08X}", static_cast<u8>(kind));
1141 1141
1142 if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) { 1142 if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) {
1143 const auto backend = BCAT::CreateBackendFromSettings(&FileSystem::GetBCATDirectory); 1143 const auto backend = BCAT::CreateBackendFromSettings(
1144 [this](u64 tid) { return system.GetFileSystemController().GetBCATDirectory(tid); });
1144 const auto build_id_full = Core::System::GetInstance().GetCurrentProcessBuildID(); 1145 const auto build_id_full = Core::System::GetInstance().GetCurrentProcessBuildID();
1145 u64 build_id{}; 1146 u64 build_id{};
1146 std::memcpy(&build_id, build_id_full.data(), sizeof(u64)); 1147 std::memcpy(&build_id, build_id_full.data(), sizeof(u64));
diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h
index 50973a13a..3f5d8b5dd 100644
--- a/src/core/hle/service/bcat/backend/backend.h
+++ b/src/core/hle/service/bcat/backend/backend.h
@@ -57,11 +57,6 @@ static_assert(sizeof(DeliveryCacheProgressImpl) == 0x200,
57class ProgressServiceBackend { 57class ProgressServiceBackend {
58 friend class IBcatService; 58 friend class IBcatService;
59 59
60 ProgressServiceBackend(std::string event_name);
61
62 Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent();
63 DeliveryCacheProgressImpl& GetImpl();
64
65public: 60public:
66 // Clients should call this with true if any of the functions are going to be called from a 61 // Clients should call this with true if any of the functions are going to be called from a
67 // non-HLE thread and this class need to lock the hle mutex. (default is false) 62 // non-HLE thread and this class need to lock the hle mutex. (default is false)
@@ -90,6 +85,11 @@ public:
90 void FinishDownload(ResultCode result); 85 void FinishDownload(ResultCode result);
91 86
92private: 87private:
88 explicit ProgressServiceBackend(std::string event_name);
89
90 Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent();
91 DeliveryCacheProgressImpl& GetImpl();
92
93 void SignalUpdate() const; 93 void SignalUpdate() const;
94 94
95 DeliveryCacheProgressImpl impl; 95 DeliveryCacheProgressImpl impl;
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index 5bc2e22d7..2c3309268 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -364,17 +364,18 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
364 364
365bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) { 365bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {
366 is_syncing.exchange(true); 366 is_syncing.exchange(true);
367 std::thread([this, title, &progress] { SynchronizeInternal(dir_getter, title, progress); }) 367 std::thread([this, title, &progress] {
368 .detach(); 368 SynchronizeInternal(dir_getter, title, progress);
369 }).detach();
369 return true; 370 return true;
370} 371}
371 372
372bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name, 373bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
373 ProgressServiceBackend& progress) { 374 ProgressServiceBackend& progress) {
374 is_syncing.exchange(true); 375 is_syncing.exchange(true);
375 std::thread( 376 std::thread([this, title, name, &progress] {
376 [this, title, name, &progress] { SynchronizeInternal(dir_getter, title, progress, name); }) 377 SynchronizeInternal(dir_getter, title, progress, name);
377 .detach(); 378 }).detach();
378 return true; 379 return true;
379} 380}
380 381
diff --git a/src/core/hle/service/bcat/bcat.cpp b/src/core/hle/service/bcat/bcat.cpp
index 391f599ee..c2f946424 100644
--- a/src/core/hle/service/bcat/bcat.cpp
+++ b/src/core/hle/service/bcat/bcat.cpp
@@ -6,8 +6,8 @@
6 6
7namespace Service::BCAT { 7namespace Service::BCAT {
8 8
9BCAT::BCAT(std::shared_ptr<Module> module, const char* name) 9BCAT::BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, const char* name)
10 : Module::Interface(std::move(module), name) { 10 : Module::Interface(std::move(module), fsc, name) {
11 // clang-format off 11 // clang-format off
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, &BCAT::CreateBcatService, "CreateBcatService"}, 13 {0, &BCAT::CreateBcatService, "CreateBcatService"},
diff --git a/src/core/hle/service/bcat/bcat.h b/src/core/hle/service/bcat/bcat.h
index 802bd689a..813073658 100644
--- a/src/core/hle/service/bcat/bcat.h
+++ b/src/core/hle/service/bcat/bcat.h
@@ -10,7 +10,8 @@ namespace Service::BCAT {
10 10
11class BCAT final : public Module::Interface { 11class BCAT final : public Module::Interface {
12public: 12public:
13 explicit BCAT(std::shared_ptr<Module> module, const char* name); 13 explicit BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc,
14 const char* name);
14 ~BCAT() override; 15 ~BCAT() override;
15}; 16};
16 17
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index 1b9a75a1c..b3fed56c7 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -539,7 +539,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont
539 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 539 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
540 rb.Push(RESULT_SUCCESS); 540 rb.Push(RESULT_SUCCESS);
541 rb.PushIpcInterface<IDeliveryCacheStorageService>( 541 rb.PushIpcInterface<IDeliveryCacheStorageService>(
542 Service::FileSystem::GetBCATDirectory(Core::CurrentProcess()->GetTitleID())); 542 fsc.GetBCATDirectory(Core::CurrentProcess()->GetTitleID()));
543} 543}
544 544
545void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( 545void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
@@ -551,8 +551,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
551 551
552 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 552 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
553 rb.Push(RESULT_SUCCESS); 553 rb.Push(RESULT_SUCCESS);
554 rb.PushIpcInterface<IDeliveryCacheStorageService>( 554 rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id));
555 Service::FileSystem::GetBCATDirectory(title_id));
556} 555}
557 556
558std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { 557std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
@@ -566,18 +565,23 @@ std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
566 return std::make_unique<NullBackend>(std::move(getter)); 565 return std::make_unique<NullBackend>(std::move(getter));
567} 566}
568 567
569Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) 568Module::Interface::Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc,
570 : ServiceFramework(name), module(std::move(module)), 569 const char* name)
571 backend(CreateBackendFromSettings(&Service::FileSystem::GetBCATDirectory)) {} 570 : ServiceFramework(name), module(std::move(module)), fsc(fsc),
571 backend(CreateBackendFromSettings([&fsc](u64 tid) { return fsc.GetBCATDirectory(tid); })) {}
572 572
573Module::Interface::~Interface() = default; 573Module::Interface::~Interface() = default;
574 574
575void InstallInterfaces(SM::ServiceManager& service_manager) { 575void InstallInterfaces(Core::System& system) {
576 auto module = std::make_shared<Module>(); 576 auto module = std::make_shared<Module>();
577 std::make_shared<BCAT>(module, "bcat:a")->InstallAsService(service_manager); 577 std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:a")
578 std::make_shared<BCAT>(module, "bcat:m")->InstallAsService(service_manager); 578 ->InstallAsService(system.ServiceManager());
579 std::make_shared<BCAT>(module, "bcat:u")->InstallAsService(service_manager); 579 std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:m")
580 std::make_shared<BCAT>(module, "bcat:s")->InstallAsService(service_manager); 580 ->InstallAsService(system.ServiceManager());
581 std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:u")
582 ->InstallAsService(system.ServiceManager());
583 std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:s")
584 ->InstallAsService(system.ServiceManager());
581} 585}
582 586
583} // namespace Service::BCAT 587} // namespace Service::BCAT
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h
index fc52574c2..27469926a 100644
--- a/src/core/hle/service/bcat/module.h
+++ b/src/core/hle/service/bcat/module.h
@@ -6,7 +6,13 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Service::BCAT { 9namespace Service {
10
11namespace FileSystem {
12class FileSystemController;
13} // namespace FileSystem
14
15namespace BCAT {
10 16
11class Backend; 17class Backend;
12 18
@@ -14,7 +20,8 @@ class Module final {
14public: 20public:
15 class Interface : public ServiceFramework<Interface> { 21 class Interface : public ServiceFramework<Interface> {
16 public: 22 public:
17 explicit Interface(std::shared_ptr<Module> module, const char* name); 23 explicit Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc,
24 const char* name);
18 ~Interface() override; 25 ~Interface() override;
19 26
20 void CreateBcatService(Kernel::HLERequestContext& ctx); 27 void CreateBcatService(Kernel::HLERequestContext& ctx);
@@ -22,12 +29,16 @@ public:
22 void CreateDeliveryCacheStorageServiceWithApplicationId(Kernel::HLERequestContext& ctx); 29 void CreateDeliveryCacheStorageServiceWithApplicationId(Kernel::HLERequestContext& ctx);
23 30
24 protected: 31 protected:
32 FileSystem::FileSystemController& fsc;
33
25 std::shared_ptr<Module> module; 34 std::shared_ptr<Module> module;
26 std::unique_ptr<Backend> backend; 35 std::unique_ptr<Backend> backend;
27 }; 36 };
28}; 37};
29 38
30/// Registers all BCAT services with the specified service manager. 39/// Registers all BCAT services with the specified service manager.
31void InstallInterfaces(SM::ServiceManager& service_manager); 40void InstallInterfaces(Core::System& system);
41
42} // namespace BCAT
32 43
33} // namespace Service::BCAT 44} // namespace Service
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 9cb107668..7fa4e820b 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -674,7 +674,7 @@ FileSys::VirtualDir FileSystemController::GetModificationDumpRoot(u64 title_id)
674 return bis_factory->GetModificationDumpRoot(title_id); 674 return bis_factory->GetModificationDumpRoot(title_id);
675} 675}
676 676
677FileSys::VirtualDir GetBCATDirectory(u64 title_id) { 677FileSys::VirtualDir FileSystemController::GetBCATDirectory(u64 title_id) const {
678 LOG_TRACE(Service_FS, "Opening BCAT root for tid={:016X}", title_id); 678 LOG_TRACE(Service_FS, "Opening BCAT root for tid={:016X}", title_id);
679 679
680 if (bis_factory == nullptr) 680 if (bis_factory == nullptr)
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 3e0c03ec0..e6b49d8a2 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -110,6 +110,8 @@ public:
110 FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) const; 110 FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) const;
111 FileSys::VirtualDir GetModificationDumpRoot(u64 title_id) const; 111 FileSys::VirtualDir GetModificationDumpRoot(u64 title_id) const;
112 112
113 FileSys::VirtualDir GetBCATDirectory(u64 title_id) const;
114
113 // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function 115 // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
114 // above is called. 116 // above is called.
115 void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true); 117 void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true);
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 831a427de..f2c6fe9dc 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -208,7 +208,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) {
208 AOC::InstallInterfaces(*sm, system); 208 AOC::InstallInterfaces(*sm, system);
209 APM::InstallInterfaces(system); 209 APM::InstallInterfaces(system);
210 Audio::InstallInterfaces(*sm, system); 210 Audio::InstallInterfaces(*sm, system);
211 BCAT::InstallInterfaces(*sm); 211 BCAT::InstallInterfaces(system);
212 BPC::InstallInterfaces(*sm); 212 BPC::InstallInterfaces(*sm);
213 BtDrv::InstallInterfaces(*sm, system); 213 BtDrv::InstallInterfaces(*sm, system);
214 BTM::InstallInterfaces(*sm, system); 214 BTM::InstallInterfaces(*sm, system);