summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-06-20 20:31:17 -0400
committerGravatar Zach Hilman2019-09-30 17:28:23 -0400
commitbcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f (patch)
treea63e45e3d4d53667357f927987374fa151a08f6b /src/core
parentbcat: Implement DeliveryCacheProgressImpl structure (diff)
downloadyuzu-bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f.tar.gz
yuzu-bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f.tar.xz
yuzu-bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f.zip
boxcat: Implement events global field
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/bcat/backend/backend.cpp13
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp5
-rw-r--r--src/core/hle/service/bcat/module.cpp8
3 files changed, 14 insertions, 12 deletions
diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp
index e389ad568..9b677debe 100644
--- a/src/core/hle/service/bcat/backend/backend.cpp
+++ b/src/core/hle/service/bcat/backend/backend.cpp
@@ -13,7 +13,7 @@ namespace Service::BCAT {
13ProgressServiceBackend::ProgressServiceBackend(std::string event_name) : impl{} { 13ProgressServiceBackend::ProgressServiceBackend(std::string event_name) : impl{} {
14 auto& kernel{Core::System::GetInstance().Kernel()}; 14 auto& kernel{Core::System::GetInstance().Kernel()};
15 event = Kernel::WritableEvent::CreateEventPair( 15 event = Kernel::WritableEvent::CreateEventPair(
16 kernel, Kernel::ResetType::OneShot, "ProgressServiceBackend:UpdateEvent:" + event_name); 16 kernel, Kernel::ResetType::Automatic, "ProgressServiceBackend:UpdateEvent:" + event_name);
17} 17}
18 18
19Kernel::SharedPtr<Kernel::ReadableEvent> ProgressServiceBackend::GetEvent() { 19Kernel::SharedPtr<Kernel::ReadableEvent> ProgressServiceBackend::GetEvent() {
@@ -48,8 +48,10 @@ void ProgressServiceBackend::StartDownloadingFile(std::string_view dir_name,
48 impl.status = DeliveryCacheProgressImpl::Status::Downloading; 48 impl.status = DeliveryCacheProgressImpl::Status::Downloading;
49 impl.current_downloaded_bytes = 0; 49 impl.current_downloaded_bytes = 0;
50 impl.current_total_bytes = file_size; 50 impl.current_total_bytes = file_size;
51 std::memcpy(impl.current_directory.data(), dir_name.data(), std::min(dir_name.size(), 0x31ull)); 51 std::memcpy(impl.current_directory.data(), dir_name.data(),
52 std::memcpy(impl.current_file.data(), file_name.data(), std::min(file_name.size(), 0x31ull)); 52 std::min<u64>(dir_name.size(), 0x31ull));
53 std::memcpy(impl.current_file.data(), file_name.data(),
54 std::min<u64>(file_name.size(), 0x31ull));
53 SignalUpdate(); 55 SignalUpdate();
54} 56}
55 57
@@ -68,7 +70,8 @@ void ProgressServiceBackend::CommitDirectory(std::string_view dir_name) {
68 impl.current_file.fill(0); 70 impl.current_file.fill(0);
69 impl.current_downloaded_bytes = 0; 71 impl.current_downloaded_bytes = 0;
70 impl.current_total_bytes = 0; 72 impl.current_total_bytes = 0;
71 std::memcpy(impl.current_directory.data(), dir_name.data(), std::min(dir_name.size(), 0x31ull)); 73 std::memcpy(impl.current_directory.data(), dir_name.data(),
74 std::min<u64>(dir_name.size(), 0x31ull));
72 SignalUpdate(); 75 SignalUpdate();
73} 76}
74 77
@@ -121,7 +124,7 @@ bool NullBackend::Clear(u64 title_id) {
121 124
122void NullBackend::SetPassphrase(u64 title_id, const Passphrase& passphrase) { 125void NullBackend::SetPassphrase(u64 title_id, const Passphrase& passphrase) {
123 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase = {}", title_id, 126 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase = {}", title_id,
124 Common::HexArrayToString(passphrase)); 127 Common::HexToString(passphrase));
125} 128}
126 129
127std::optional<std::vector<u8>> NullBackend::GetLaunchParameter(TitleIDVersion title) { 130std::optional<std::vector<u8>> NullBackend::GetLaunchParameter(TitleIDVersion title) {
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index 3754594df..5bc2e22d7 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -214,8 +214,7 @@ private:
214 std::vector<u8> bytes(file.GetSize()); 214 std::vector<u8> bytes(file.GetSize());
215 file.ReadBytes(bytes.data(), bytes.size()); 215 file.ReadBytes(bytes.data(), bytes.size());
216 const auto digest = DigestFile(bytes); 216 const auto digest = DigestFile(bytes);
217 headers.insert( 217 headers.insert({std::string("If-None-Match"), Common::HexToString(digest, false)});
218 {std::string("If-None-Match"), Common::HexArrayToString(digest, false)});
219 } 218 }
220 } 219 }
221 220
@@ -402,7 +401,7 @@ bool Boxcat::Clear(u64 title_id) {
402 401
403void Boxcat::SetPassphrase(u64 title_id, const Passphrase& passphrase) { 402void Boxcat::SetPassphrase(u64 title_id, const Passphrase& passphrase) {
404 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id, 403 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id,
405 Common::HexArrayToString(passphrase)); 404 Common::HexToString(passphrase));
406} 405}
407 406
408std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title) { 407std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title) {
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index d5f9e9d3b..1b9a75a1c 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -195,7 +195,7 @@ private:
195 const auto passphrase_raw = ctx.ReadBuffer(); 195 const auto passphrase_raw = ctx.ReadBuffer();
196 196
197 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id, 197 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id,
198 Common::HexVectorToString(passphrase_raw)); 198 Common::HexToString(passphrase_raw));
199 199
200 if (title_id == 0) { 200 if (title_id == 0) {
201 LOG_ERROR(Service_BCAT, "Invalid title ID!"); 201 LOG_ERROR(Service_BCAT, "Invalid title ID!");
@@ -335,7 +335,7 @@ private:
335 rb.Push(ERROR_NO_OPEN_ENTITY); 335 rb.Push(ERROR_NO_OPEN_ENTITY);
336 } 336 }
337 337
338 size = std::min(current_file->GetSize() - offset, size); 338 size = std::min<u64>(current_file->GetSize() - offset, size);
339 const auto buffer = current_file->ReadBytes(size, offset); 339 const auto buffer = current_file->ReadBytes(size, offset);
340 ctx.WriteBuffer(buffer); 340 ctx.WriteBuffer(buffer);
341 341
@@ -437,7 +437,7 @@ private:
437 } 437 }
438 438
439 const auto files = current_dir->GetFiles(); 439 const auto files = current_dir->GetFiles();
440 write_size = std::min(write_size, files.size()); 440 write_size = std::min<u64>(write_size, files.size());
441 std::vector<DeliveryCacheDirectoryEntry> entries(write_size); 441 std::vector<DeliveryCacheDirectoryEntry> entries(write_size);
442 std::transform( 442 std::transform(
443 files.begin(), files.begin() + write_size, entries.begin(), [](const auto& file) { 443 files.begin(), files.begin() + write_size, entries.begin(), [](const auto& file) {
@@ -519,7 +519,7 @@ private:
519 519
520 LOG_DEBUG(Service_BCAT, "called, size={:016X}", size); 520 LOG_DEBUG(Service_BCAT, "called, size={:016X}", size);
521 521
522 size = std::min(size, entries.size() - next_read_index); 522 size = std::min<u64>(size, entries.size() - next_read_index);
523 ctx.WriteBuffer(entries.data() + next_read_index, size * sizeof(DirectoryName)); 523 ctx.WriteBuffer(entries.data() + next_read_index, size * sizeof(DirectoryName));
524 next_read_index += size; 524 next_read_index += size;
525 525