module: Create BCAT backend based upon Settings value on construction
This commit is contained in:
parent
2903f3524e
commit
68658a8385
3 changed files with 36 additions and 1 deletions
|
@ -38,10 +38,22 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
|
|||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IBcatService>();
|
||||
namespace {
|
||||
std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
|
||||
const auto backend = Settings::values.bcat_backend;
|
||||
|
||||
#ifdef YUZU_ENABLE_BOXCAT
|
||||
if (backend == "boxcat")
|
||||
return std::make_unique<Boxcat>(std::move(getter));
|
||||
#endif
|
||||
|
||||
return std::make_unique<NullBackend>(std::move(getter));
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
|
||||
: ServiceFramework(name), module(std::move(module)) {}
|
||||
: ServiceFramework(name), module(std::move(module)),
|
||||
backend(CreateBackendFromSettings(&Service::FileSystem::GetBCATDirectory)) {}
|
||||
|
||||
Module::Interface::~Interface() = default;
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
namespace Service::BCAT {
|
||||
|
||||
class Backend;
|
||||
|
||||
class Module final {
|
||||
public:
|
||||
class Interface : public ServiceFramework<Interface> {
|
||||
|
@ -19,6 +21,7 @@ public:
|
|||
|
||||
protected:
|
||||
std::shared_ptr<Module> module;
|
||||
std::unique_ptr<Backend> backend;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue