From 0569827a68aefb2567742de453c873b57212dd15 Mon Sep 17 00:00:00 2001 From: mailwl Date: Sun, 8 Sep 2019 12:53:55 +0300 Subject: [PATCH] BCAT: Stub CreateDeliveryCacheStorageService, add some services --- src/core/hle/service/bcat/bcat.cpp | 7 ++ src/core/hle/service/bcat/module.cpp | 108 ++++++++++++++++++++++++++- src/core/hle/service/bcat/module.h | 1 + 3 files changed, 115 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/bcat/bcat.cpp b/src/core/hle/service/bcat/bcat.cpp index 179aa49499..c228ba0764 100644 --- a/src/core/hle/service/bcat/bcat.cpp +++ b/src/core/hle/service/bcat/bcat.cpp @@ -8,9 +8,16 @@ namespace Service::BCAT { BCAT::BCAT(std::shared_ptr module, const char* name) : Module::Interface(std::move(module), name) { + // clang-format off static const FunctionInfo functions[] = { {0, &BCAT::CreateBcatService, "CreateBcatService"}, + {1, &BCAT::CreateDeliveryCacheStorageService, "CreateDeliveryCacheStorageService"}, + {2, nullptr, "CreateDeliveryCacheStorageServiceWithApplicationId"}, + {3, nullptr, "CreateDeliveryCacheProgressService"}, + {4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"}, }; + // clang-format on + RegisterHandlers(functions); } diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index b7bd738fcb..6c14b3370e 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -9,11 +9,26 @@ namespace Service::BCAT { +class IDeliveryCacheProgressService final : public ServiceFramework { +public: + IDeliveryCacheProgressService() : ServiceFramework("IDeliveryCacheProgressService") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetEvent"}, + {1, nullptr, "GetImpl"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + class IBcatService final : public ServiceFramework { public: IBcatService() : ServiceFramework("IBcatService") { + // clang-format off static const FunctionInfo functions[] = { - {10100, nullptr, "RequestSyncDeliveryCache"}, + {10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"}, {10101, nullptr, "RequestSyncDeliveryCacheWithDirectoryName"}, {10200, nullptr, "CancelSyncDeliveryCacheRequest"}, {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, @@ -28,8 +43,91 @@ public: {90201, nullptr, "ClearDeliveryCacheStorage"}, {90300, nullptr, "GetPushNotificationLog"}, }; + // clang-format on + RegisterHandlers(functions); } + +private: + void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_BCAT, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + } +}; + +class IDeliveryCacheFileService final : public ServiceFramework { +public: + IDeliveryCacheFileService() : ServiceFramework("IDeliveryCacheFileService") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Open"}, + {1, nullptr, "Read"}, + {2, nullptr, "GetSize"}, + {4, nullptr, "GetDigest"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +class IDeliveryCacheDirectoryService final + : public ServiceFramework { +public: + IDeliveryCacheDirectoryService() : ServiceFramework("IDeliveryCacheDirectoryService") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Open"}, + {1, nullptr, "Read"}, + {2, nullptr, "GetCount"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +class IDeliveryCacheStorageService final : public ServiceFramework { +public: + IDeliveryCacheStorageService() : ServiceFramework("IDeliveryCacheStorageService") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"}, + {1, &IDeliveryCacheStorageService::CreateDirectoryService, "CreateDirectoryService"}, + {10, &IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory, "EnumerateDeliveryCacheDirectory"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + +private: + void CreateFileService(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_BCAT, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + } + + void CreateDirectoryService(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_BCAT, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + } + + void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_BCAT, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push(0); + } }; void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { @@ -40,6 +138,14 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface(); } +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(); +} + Module::Interface::Interface(std::shared_ptr module, const char* name) : ServiceFramework(name), module(std::move(module)) {} diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h index f0d63cab02..65167a60e6 100644 --- a/src/core/hle/service/bcat/module.h +++ b/src/core/hle/service/bcat/module.h @@ -16,6 +16,7 @@ public: ~Interface() override; void CreateBcatService(Kernel::HLERequestContext& ctx); + void CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx); protected: std::shared_ptr module;