summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-04-28 18:59:35 -0400
committerGravatar Zach Hilman2019-09-30 17:23:26 -0400
commit1bde5a3c6a205de445b2086f2fda2a830d70b8f6 (patch)
tree32dc640cf2fab51c8e966b3bb3cc577851fcbe42 /src
parentbcat: Implement cmd RequestSyncDeliveryCache and variant (diff)
downloadyuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.gz
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.tar.xz
yuzu-1bde5a3c6a205de445b2086f2fda2a830d70b8f6.zip
bcat: Implement cmd 30100 SetPassphrase
Takes a title ID and passphrase (0x40 byte string) and passes it to the backend.
Diffstat (limited to 'src')
-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:
150 {10200, nullptr, "CancelSyncDeliveryCacheRequest"}, 150 {10200, nullptr, "CancelSyncDeliveryCacheRequest"},
151 {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, 151 {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"},
152 {20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, 152 {20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"},
153 {30100, nullptr, "SetPassphrase"}, 153 {30100, &IBcatService::SetPassphrase, "SetPassphrase"},
154 {30200, nullptr, "RegisterBackgroundDeliveryTask"}, 154 {30200, nullptr, "RegisterBackgroundDeliveryTask"},
155 {30201, nullptr, "UnregisterBackgroundDeliveryTask"}, 155 {30201, nullptr, "UnregisterBackgroundDeliveryTask"},
156 {30202, nullptr, "BlockDeliveryTask"}, 156 {30202, nullptr, "BlockDeliveryTask"},
@@ -220,6 +220,38 @@ private:
220 rb.PushIpcInterface(CreateProgressService(SyncType::Directory)); 220 rb.PushIpcInterface(CreateProgressService(SyncType::Directory));
221 } 221 }
222 222
223 void SetPassphrase(Kernel::HLERequestContext& ctx) {
224 IPC::RequestParser rp{ctx};
225 const auto title_id = rp.PopRaw<u64>();
226
227 const auto passphrase_raw = ctx.ReadBuffer();
228
229 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id,
230 Common::HexVectorToString(passphrase_raw));
231
232 if (title_id == 0) {
233 LOG_ERROR(Service_BCAT, "Invalid title ID!");
234 IPC::ResponseBuilder rb{ctx, 2};
235 rb.Push(ERROR_INVALID_ARGUMENT);
236 }
237
238 if (passphrase_raw.size() > 0x40) {
239 LOG_ERROR(Service_BCAT, "Passphrase too large!");
240 IPC::ResponseBuilder rb{ctx, 2};
241 rb.Push(ERROR_INVALID_ARGUMENT);
242 return;
243 }
244
245 Passphrase passphrase{};
246 std::memcpy(passphrase.data(), passphrase_raw.data(),
247 std::min(passphrase.size(), passphrase_raw.size()));
248
249 backend.SetPassphrase(title_id, passphrase);
250
251 IPC::ResponseBuilder rb{ctx, 2};
252 rb.Push(RESULT_SUCCESS);
253 }
254
223 } 255 }
224 256
225 Backend& backend; 257 Backend& backend;