summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/bcat
diff options
context:
space:
mode:
authorZach Hilman <DarkLordZach@users.noreply.github.com>2019-10-07 02:47:48 +0200
committerGitHub <noreply@github.com>2019-10-07 02:47:48 +0200
commit5326d3cb3a75a1f7df531e47cf0acadc3c5db32b (patch)
tree83697ca2dba90470ba59eff2f56e71769b03e3d9 /src/core/hle/service/bcat
parentMerge pull request #2952 from lioncash/warning (diff)
parentcore/core: Remove unused header (diff)
downloadyuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.tar
yuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.tar.gz
yuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.tar.bz2
yuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.tar.lz
yuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.tar.xz
yuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.tar.zst
yuzu-5326d3cb3a75a1f7df531e47cf0acadc3c5db32b.zip
Diffstat (limited to 'src/core/hle/service/bcat')
-rw-r--r--src/core/hle/service/bcat/bcat.cpp5
-rw-r--r--src/core/hle/service/bcat/bcat.h8
-rw-r--r--src/core/hle/service/bcat/module.cpp34
-rw-r--r--src/core/hle/service/bcat/module.h11
4 files changed, 37 insertions, 21 deletions
diff --git a/src/core/hle/service/bcat/bcat.cpp b/src/core/hle/service/bcat/bcat.cpp
index c2f946424..8bb2528c9 100644
--- a/src/core/hle/service/bcat/bcat.cpp
+++ b/src/core/hle/service/bcat/bcat.cpp
@@ -6,8 +6,9 @@
namespace Service::BCAT {
-BCAT::BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, const char* name)
- : Module::Interface(std::move(module), fsc, name) {
+BCAT::BCAT(Core::System& system, std::shared_ptr<Module> module,
+ FileSystem::FileSystemController& fsc, const char* name)
+ : Interface(system, std::move(module), fsc, name) {
// clang-format off
static const FunctionInfo functions[] = {
{0, &BCAT::CreateBcatService, "CreateBcatService"},
diff --git a/src/core/hle/service/bcat/bcat.h b/src/core/hle/service/bcat/bcat.h
index 813073658..6354465fc 100644
--- a/src/core/hle/service/bcat/bcat.h
+++ b/src/core/hle/service/bcat/bcat.h
@@ -6,12 +6,16 @@
#include "core/hle/service/bcat/module.h"
+namespace Core {
+class System;
+}
+
namespace Service::BCAT {
class BCAT final : public Module::Interface {
public:
- explicit BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc,
- const char* name);
+ explicit BCAT(Core::System& system, std::shared_ptr<Module> module,
+ FileSystem::FileSystemController& fsc, const char* name);
~BCAT() override;
};
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index 1f21b0434..4e4aa758b 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -35,8 +35,7 @@ using BCATDigest = std::array<u8, 0x10>;
namespace {
-u64 GetCurrentBuildID() {
- const auto& id = Core::System::GetInstance().GetCurrentProcessBuildID();
+u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) {
u64 out{};
std::memcpy(&out, id.data(), sizeof(u64));
return out;
@@ -125,7 +124,8 @@ private:
class IBcatService final : public ServiceFramework<IBcatService> {
public:
- IBcatService(Backend& backend) : ServiceFramework("IBcatService"), backend(backend) {
+ explicit IBcatService(Core::System& system_, Backend& backend_)
+ : ServiceFramework("IBcatService"), system{system_}, backend{backend_} {
// clang-format off
static const FunctionInfo functions[] = {
{10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"},
@@ -163,7 +163,8 @@ private:
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_BCAT, "called");
- backend.Synchronize({Core::CurrentProcess()->GetTitleID(), GetCurrentBuildID()},
+ backend.Synchronize({system.CurrentProcess()->GetTitleID(),
+ GetCurrentBuildID(system.GetCurrentProcessBuildID())},
progress.at(static_cast<std::size_t>(SyncType::Normal)));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -179,7 +180,8 @@ private:
LOG_DEBUG(Service_BCAT, "called, name={}", name);
- backend.SynchronizeDirectory({Core::CurrentProcess()->GetTitleID(), GetCurrentBuildID()},
+ backend.SynchronizeDirectory({system.CurrentProcess()->GetTitleID(),
+ GetCurrentBuildID(system.GetCurrentProcessBuildID())},
name,
progress.at(static_cast<std::size_t>(SyncType::Directory)));
@@ -244,6 +246,7 @@ private:
rb.Push(RESULT_SUCCESS);
}
+ Core::System& system;
Backend& backend;
std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress{
@@ -257,7 +260,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IBcatService>(*backend);
+ rb.PushIpcInterface<IBcatService>(system, *backend);
}
class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> {
@@ -539,7 +542,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDeliveryCacheStorageService>(
- fsc.GetBCATDirectory(Core::CurrentProcess()->GetTitleID()));
+ fsc.GetBCATDirectory(system.CurrentProcess()->GetTitleID()));
}
void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
@@ -565,22 +568,23 @@ std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
return std::make_unique<NullBackend>(std::move(getter));
}
-Module::Interface::Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc,
- const char* name)
- : ServiceFramework(name), fsc(fsc), module(std::move(module)),
- backend(CreateBackendFromSettings([&fsc](u64 tid) { return fsc.GetBCATDirectory(tid); })) {}
+Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
+ FileSystem::FileSystemController& fsc_, const char* name)
+ : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)},
+ backend{CreateBackendFromSettings([&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })},
+ system{system_} {}
Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) {
auto module = std::make_shared<Module>();
- std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:a")
+ std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a")
->InstallAsService(system.ServiceManager());
- std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:m")
+ std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:m")
->InstallAsService(system.ServiceManager());
- std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:u")
+ std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:u")
->InstallAsService(system.ServiceManager());
- std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:s")
+ std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:s")
->InstallAsService(system.ServiceManager());
}
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h
index 27469926a..e4ba23ba0 100644
--- a/src/core/hle/service/bcat/module.h
+++ b/src/core/hle/service/bcat/module.h
@@ -6,6 +6,10 @@
#include "core/hle/service/service.h"
+namespace Core {
+class System;
+}
+
namespace Service {
namespace FileSystem {
@@ -20,8 +24,8 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
- explicit Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc,
- const char* name);
+ explicit Interface(Core::System& system_, std::shared_ptr<Module> module_,
+ FileSystem::FileSystemController& fsc_, const char* name);
~Interface() override;
void CreateBcatService(Kernel::HLERequestContext& ctx);
@@ -33,6 +37,9 @@ public:
std::shared_ptr<Module> module;
std::unique_ptr<Backend> backend;
+
+ private:
+ Core::System& system;
};
};