forked from suyu/suyu
bcat: Add commands to create IDeliveryCacheStorageService
Used to access contents of download.
This commit is contained in:
parent
68658a8385
commit
78d146f907
3 changed files with 32 additions and 2 deletions
|
@ -8,9 +8,13 @@ namespace Service::BCAT {
|
||||||
|
|
||||||
BCAT::BCAT(std::shared_ptr<Module> module, const char* name)
|
BCAT::BCAT(std::shared_ptr<Module> module, const char* name)
|
||||||
: Module::Interface(std::move(module), name) {
|
: Module::Interface(std::move(module), name) {
|
||||||
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &BCAT::CreateBcatService, "CreateBcatService"},
|
{0, &BCAT::CreateBcatService, "CreateBcatService"},
|
||||||
|
{1, &BCAT::CreateDeliveryCacheStorageService, "CreateDeliveryCacheStorageService"},
|
||||||
|
{2, &BCAT::CreateDeliveryCacheStorageServiceWithApplicationId, "CreateDeliveryCacheStorageServiceWithApplicationId"},
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ namespace Service::BCAT {
|
||||||
|
|
||||||
class IBcatService final : public ServiceFramework<IBcatService> {
|
class IBcatService final : public ServiceFramework<IBcatService> {
|
||||||
public:
|
public:
|
||||||
IBcatService() : ServiceFramework("IBcatService") {
|
IBcatService(Backend& backend) : ServiceFramework("IBcatService"), backend(backend) {
|
||||||
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{10100, nullptr, "RequestSyncDeliveryCache"},
|
{10100, nullptr, "RequestSyncDeliveryCache"},
|
||||||
{10101, nullptr, "RequestSyncDeliveryCacheWithDirectoryName"},
|
{10101, nullptr, "RequestSyncDeliveryCacheWithDirectoryName"},
|
||||||
|
@ -28,6 +29,7 @@ public:
|
||||||
{90201, nullptr, "ClearDeliveryCacheStorage"},
|
{90201, nullptr, "ClearDeliveryCacheStorage"},
|
||||||
{90300, nullptr, "GetPushNotificationLog"},
|
{90300, nullptr, "GetPushNotificationLog"},
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,7 +39,29 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IBcatService>();
|
rb.PushIpcInterface<IBcatService>(*backend);
|
||||||
|
void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service_BCAT, "called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushIpcInterface<IDeliveryCacheStorageService>(
|
||||||
|
Service::FileSystem::GetBCATDirectory(Core::CurrentProcess()->GetTitleID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
|
||||||
|
Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto title_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushIpcInterface<IDeliveryCacheStorageService>(
|
||||||
|
Service::FileSystem::GetBCATDirectory(title_id));
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
|
std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
|
||||||
const auto backend = Settings::values.bcat_backend;
|
const auto backend = Settings::values.bcat_backend;
|
||||||
|
|
|
@ -18,6 +18,8 @@ public:
|
||||||
~Interface() override;
|
~Interface() override;
|
||||||
|
|
||||||
void CreateBcatService(Kernel::HLERequestContext& ctx);
|
void CreateBcatService(Kernel::HLERequestContext& ctx);
|
||||||
|
void CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx);
|
||||||
|
void CreateDeliveryCacheStorageServiceWithApplicationId(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<Module> module;
|
std::shared_ptr<Module> module;
|
||||||
|
|
Loading…
Reference in a new issue