summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/bcat/module.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-04-29 00:59:35 +0200
committerZach Hilman <zachhilman@gmail.com>2019-09-30 23:23:26 +0200
commit1bde5a3c6a205de445b2086f2fda2a830d70b8f6 (patch)
tree32dc640cf2fab51c8e966b3bb3cc577851fcbe42 /src/core/hle/service/bcat/module.cpp
parentbcat: Implement cmd RequestSyncDeliveryCache and variant (diff)
downloadyuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.gz
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.bz2
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.lz
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.xz
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.zst
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.zip
Diffstat (limited to 'src/core/hle/service/bcat/module.cpp')
-rw-r--r--src/core/hle/service/bcat/module.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index 605aa6e00..cbda8e0d3 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -150,7 +150,7 @@ public:
{10200, nullptr, "CancelSyncDeliveryCacheRequest"},
{20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"},
{20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"},
- {30100, nullptr, "SetPassphrase"},
+ {30100, &IBcatService::SetPassphrase, "SetPassphrase"},
{30200, nullptr, "RegisterBackgroundDeliveryTask"},
{30201, nullptr, "UnregisterBackgroundDeliveryTask"},
{30202, nullptr, "BlockDeliveryTask"},
@@ -220,6 +220,38 @@ private:
rb.PushIpcInterface(CreateProgressService(SyncType::Directory));
}
+ void SetPassphrase(Kernel::HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const auto title_id = rp.PopRaw<u64>();
+
+ const auto passphrase_raw = ctx.ReadBuffer();
+
+ LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id,
+ Common::HexVectorToString(passphrase_raw));
+
+ if (title_id == 0) {
+ LOG_ERROR(Service_BCAT, "Invalid title ID!");
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ERROR_INVALID_ARGUMENT);
+ }
+
+ if (passphrase_raw.size() > 0x40) {
+ LOG_ERROR(Service_BCAT, "Passphrase too large!");
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ERROR_INVALID_ARGUMENT);
+ return;
+ }
+
+ Passphrase passphrase{};
+ std::memcpy(passphrase.data(), passphrase_raw.data(),
+ std::min(passphrase.size(), passphrase_raw.size()));
+
+ backend.SetPassphrase(title_id, passphrase);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ }
+
}
Backend& backend;