|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
#include "common/hex_util.h"
|
|
|
|
|
#include "common/string_util.h"
|
|
|
|
|
#include "core/core.h"
|
|
|
|
|
#include "core/file_sys/errors.h"
|
|
|
|
|
#include "core/hle/service/bcat/backend/backend.h"
|
|
|
|
|
#include "core/hle/service/bcat/bcat_result.h"
|
|
|
|
|
#include "core/hle/service/bcat/bcat_service.h"
|
|
|
|
@ -14,7 +15,7 @@
|
|
|
|
|
|
|
|
|
|
namespace Service::BCAT {
|
|
|
|
|
|
|
|
|
|
u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) {
|
|
|
|
|
static u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) {
|
|
|
|
|
u64 out{};
|
|
|
|
|
std::memcpy(&out, id.data(), sizeof(u64));
|
|
|
|
|
return out;
|
|
|
|
@ -28,8 +29,8 @@ IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_)
|
|
|
|
|
}} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{10100, C<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"},
|
|
|
|
|
{10101, C<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"},
|
|
|
|
|
{10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"},
|
|
|
|
|
{10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"},
|
|
|
|
|
{10200, nullptr, "CancelSyncDeliveryCacheRequest"},
|
|
|
|
|
{20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"},
|
|
|
|
|
{20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"},
|
|
|
|
@ -38,7 +39,7 @@ IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_)
|
|
|
|
|
{20400, nullptr, "RegisterSystemApplicationDeliveryTask"},
|
|
|
|
|
{20401, nullptr, "UnregisterSystemApplicationDeliveryTask"},
|
|
|
|
|
{20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"},
|
|
|
|
|
{30100, C<&IBcatService::SetPassphrase>, "SetPassphrase"},
|
|
|
|
|
{30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"},
|
|
|
|
|
{30101, nullptr, "Unknown30101"},
|
|
|
|
|
{30102, nullptr, "Unknown30102"},
|
|
|
|
|
{30200, nullptr, "RegisterBackgroundDeliveryTask"},
|
|
|
|
@ -46,11 +47,11 @@ IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_)
|
|
|
|
|
{30202, nullptr, "BlockDeliveryTask"},
|
|
|
|
|
{30203, nullptr, "UnblockDeliveryTask"},
|
|
|
|
|
{30210, nullptr, "SetDeliveryTaskTimer"},
|
|
|
|
|
{30300, C<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"},
|
|
|
|
|
{30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"},
|
|
|
|
|
{90100, nullptr, "EnumerateBackgroundDeliveryTask"},
|
|
|
|
|
{90101, nullptr, "Unknown90101"},
|
|
|
|
|
{90200, nullptr, "GetDeliveryList"},
|
|
|
|
|
{90201, C<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"},
|
|
|
|
|
{90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"},
|
|
|
|
|
{90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"},
|
|
|
|
|
{90300, nullptr, "GetPushNotificationLog"},
|
|
|
|
|
{90301, nullptr, "Unknown90301"},
|
|
|
|
@ -76,7 +77,7 @@ Result IBcatService::RequestSyncDeliveryCache(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Result IBcatService::RequestSyncDeliveryCacheWithDirectoryName(
|
|
|
|
|
DirectoryName name_raw, OutInterface<IDeliveryCacheProgressService> out_interface) {
|
|
|
|
|
const DirectoryName& name_raw, OutInterface<IDeliveryCacheProgressService> out_interface) {
|
|
|
|
|
const auto name = Common::StringFromFixedZeroTerminatedBuffer(name_raw.data(), name_raw.size());
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_BCAT, "called, name={}", name);
|
|
|
|
@ -91,19 +92,19 @@ Result IBcatService::RequestSyncDeliveryCacheWithDirectoryName(
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Result IBcatService::SetPassphrase(u64 title_id,
|
|
|
|
|
Result IBcatService::SetPassphrase(u64 application_id,
|
|
|
|
|
InBuffer<BufferAttr_HipcPointer> passphrase_buffer) {
|
|
|
|
|
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id,
|
|
|
|
|
LOG_DEBUG(Service_BCAT, "called, application_id={:016X}, passphrase={}", application_id,
|
|
|
|
|
Common::HexToString(passphrase_buffer));
|
|
|
|
|
|
|
|
|
|
R_UNLESS(title_id != 0, ResultInvalidArgument);
|
|
|
|
|
R_UNLESS(application_id != 0, ResultInvalidArgument);
|
|
|
|
|
R_UNLESS(passphrase_buffer.size() <= 0x40, ResultInvalidArgument);
|
|
|
|
|
|
|
|
|
|
Passphrase passphrase{};
|
|
|
|
|
std::memcpy(passphrase.data(), passphrase_buffer.data(),
|
|
|
|
|
std::min(passphrase.size(), passphrase_buffer.size()));
|
|
|
|
|
|
|
|
|
|
backend.SetPassphrase(title_id, passphrase);
|
|
|
|
|
backend.SetPassphrase(application_id, passphrase);
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -112,11 +113,11 @@ Result IBcatService::RegisterSystemApplicationDeliveryTasks() {
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Result IBcatService::ClearDeliveryCacheStorage(u64 title_id) {
|
|
|
|
|
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id);
|
|
|
|
|
Result IBcatService::ClearDeliveryCacheStorage(u64 application_id) {
|
|
|
|
|
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", application_id);
|
|
|
|
|
|
|
|
|
|
R_UNLESS(title_id != 0, ResultInvalidArgument);
|
|
|
|
|
R_UNLESS(backend.Clear(title_id), ResultFailedClearCache);
|
|
|
|
|
R_UNLESS(application_id != 0, ResultInvalidArgument);
|
|
|
|
|
R_UNLESS(backend.Clear(application_id), FileSys::ResultPermissionDenied);
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|