diff options
| author | 2019-06-20 20:31:17 -0400 | |
|---|---|---|
| committer | 2019-09-30 17:28:23 -0400 | |
| commit | bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f (patch) | |
| tree | a63e45e3d4d53667357f927987374fa151a08f6b | |
| parent | bcat: Implement DeliveryCacheProgressImpl structure (diff) | |
| download | yuzu-bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f.tar.gz yuzu-bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f.tar.xz yuzu-bcf1eafb8bd1a810fd33a7e7e06a86173b4bfb9f.zip | |
boxcat: Implement events global field
| m--------- | externals/libzip | 0 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/backend/backend.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/backend/boxcat.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/module.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 17 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_service.cpp | 24 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_service.h | 6 |
7 files changed, 43 insertions, 30 deletions
diff --git a/externals/libzip b/externals/libzip | |||
| Subproject bebbb54c8e691f019415fcb852ef4d53ebbc500 | Subproject bd7a8103e96bc6d50164447f6b7b57bb786d8e2 | ||
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 { | |||
| 13 | ProgressServiceBackend::ProgressServiceBackend(std::string event_name) : impl{} { | 13 | ProgressServiceBackend::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 | ||
| 19 | Kernel::SharedPtr<Kernel::ReadableEvent> ProgressServiceBackend::GetEvent() { | 19 | Kernel::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 | ||
| 122 | void NullBackend::SetPassphrase(u64 title_id, const Passphrase& passphrase) { | 125 | void 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 | ||
| 127 | std::optional<std::vector<u8>> NullBackend::GetLaunchParameter(TitleIDVersion title) { | 130 | std::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 | ||
| 403 | void Boxcat::SetPassphrase(u64 title_id, const Passphrase& passphrase) { | 402 | void 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 | ||
| 408 | std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title) { | 407 | std::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 | ||
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index ac7a77365..4cb27ddb2 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -526,9 +526,13 @@ void Config::ReadDebuggingValues() { | |||
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | void Config::ReadServiceValues() { | 528 | void Config::ReadServiceValues() { |
| 529 | qt_config->beginGroup("Services"); | 529 | qt_config->beginGroup(QStringLiteral("Services")); |
| 530 | Settings::values.bcat_backend = ReadSetting("bcat_backend", "boxcat").toString().toStdString(); | 530 | Settings::values.bcat_backend = |
| 531 | Settings::values.bcat_boxcat_local = ReadSetting("bcat_boxcat_local", false).toBool(); | 531 | ReadSetting(QStringLiteral("bcat_backend"), QStringLiteral("boxcat")) |
| 532 | .toString() | ||
| 533 | .toStdString(); | ||
| 534 | Settings::values.bcat_boxcat_local = | ||
| 535 | ReadSetting(QStringLiteral("bcat_boxcat_local"), false).toBool(); | ||
| 532 | qt_config->endGroup(); | 536 | qt_config->endGroup(); |
| 533 | } | 537 | } |
| 534 | 538 | ||
| @@ -973,9 +977,10 @@ void Config::SaveDebuggingValues() { | |||
| 973 | } | 977 | } |
| 974 | 978 | ||
| 975 | void Config::SaveServiceValues() { | 979 | void Config::SaveServiceValues() { |
| 976 | qt_config->beginGroup("Services"); | 980 | qt_config->beginGroup(QStringLiteral("Services")); |
| 977 | WriteSetting("bcat_backend", QString::fromStdString(Settings::values.bcat_backend), "null"); | 981 | WriteSetting(QStringLiteral("bcat_backend"), |
| 978 | WriteSetting("bcat_boxcat_local", Settings::values.bcat_boxcat_local, false); | 982 | QString::fromStdString(Settings::values.bcat_backend), QStringLiteral("null")); |
| 983 | WriteSetting(QStringLiteral("bcat_boxcat_local"), Settings::values.bcat_boxcat_local, false); | ||
| 979 | qt_config->endGroup(); | 984 | qt_config->endGroup(); |
| 980 | } | 985 | } |
| 981 | 986 | ||
diff --git a/src/yuzu/configuration/configure_service.cpp b/src/yuzu/configuration/configure_service.cpp index fca785d0e..86160b479 100644 --- a/src/yuzu/configuration/configure_service.cpp +++ b/src/yuzu/configuration/configure_service.cpp | |||
| @@ -48,20 +48,20 @@ ConfigureService::ConfigureService(QWidget* parent) | |||
| 48 | connect(ui->bcat_source, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | 48 | connect(ui->bcat_source, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
| 49 | &ConfigureService::OnBCATImplChanged); | 49 | &ConfigureService::OnBCATImplChanged); |
| 50 | 50 | ||
| 51 | this->setConfiguration(); | 51 | this->SetConfiguration(); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | ConfigureService::~ConfigureService() = default; | 54 | ConfigureService::~ConfigureService() = default; |
| 55 | 55 | ||
| 56 | void ConfigureService::applyConfiguration() { | 56 | void ConfigureService::ApplyConfiguration() { |
| 57 | Settings::values.bcat_backend = ui->bcat_source->currentText().toLower().toStdString(); | 57 | Settings::values.bcat_backend = ui->bcat_source->currentText().toLower().toStdString(); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | void ConfigureService::retranslateUi() { | 60 | void ConfigureService::RetranslateUi() { |
| 61 | ui->retranslateUi(this); | 61 | ui->retranslateUi(this); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | void ConfigureService::setConfiguration() { | 64 | void ConfigureService::SetConfiguration() { |
| 65 | int index = ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend)); | 65 | int index = ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend)); |
| 66 | ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index); | 66 | ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index); |
| 67 | } | 67 | } |
| @@ -73,13 +73,14 @@ std::pair<QString, QString> ConfigureService::BCATDownloadEvents() { | |||
| 73 | 73 | ||
| 74 | switch (res) { | 74 | switch (res) { |
| 75 | case Service::BCAT::Boxcat::StatusResult::Offline: | 75 | case Service::BCAT::Boxcat::StatusResult::Offline: |
| 76 | return {"", tr("The boxcat service is offline or you are not connected to the internet.")}; | 76 | return {QStringLiteral(""), |
| 77 | tr("The boxcat service is offline or you are not connected to the internet.")}; | ||
| 77 | case Service::BCAT::Boxcat::StatusResult::ParseError: | 78 | case Service::BCAT::Boxcat::StatusResult::ParseError: |
| 78 | return {"", | 79 | return {QStringLiteral(""), |
| 79 | tr("There was an error while processing the boxcat event data. Contact the yuzu " | 80 | tr("There was an error while processing the boxcat event data. Contact the yuzu " |
| 80 | "developers.")}; | 81 | "developers.")}; |
| 81 | case Service::BCAT::Boxcat::StatusResult::BadClientVersion: | 82 | case Service::BCAT::Boxcat::StatusResult::BadClientVersion: |
| 82 | return {"", | 83 | return {QStringLiteral(""), |
| 83 | tr("The version of yuzu you are using is either too new or too old for the server. " | 84 | tr("The version of yuzu you are using is either too new or too old for the server. " |
| 84 | "Try updating to the latest official release of yuzu.")}; | 85 | "Try updating to the latest official release of yuzu.")}; |
| 85 | } | 86 | } |
| @@ -90,9 +91,14 @@ std::pair<QString, QString> ConfigureService::BCATDownloadEvents() { | |||
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | QString out; | 93 | QString out; |
| 94 | |||
| 95 | if (global.has_value()) { | ||
| 96 | out += QStringLiteral("%1<br>").arg(QString::fromStdString(*global)); | ||
| 97 | } | ||
| 98 | |||
| 93 | for (const auto& [key, value] : map) { | 99 | for (const auto& [key, value] : map) { |
| 94 | out += QStringLiteral("%1<b>%2</b><br>%3") | 100 | out += QStringLiteral("%1<b>%2</b><br>%3") |
| 95 | .arg(out.isEmpty() ? "" : "<br>") | 101 | .arg(out.isEmpty() ? QStringLiteral("") : QStringLiteral("<br>")) |
| 96 | .arg(QString::fromStdString(key)) | 102 | .arg(QString::fromStdString(key)) |
| 97 | .arg(FormatEventStatusString(value)); | 103 | .arg(FormatEventStatusString(value)); |
| 98 | } | 104 | } |
| @@ -104,7 +110,7 @@ void ConfigureService::OnBCATImplChanged() { | |||
| 104 | const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat"); | 110 | const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat"); |
| 105 | ui->bcat_empty_header->setHidden(!boxcat); | 111 | ui->bcat_empty_header->setHidden(!boxcat); |
| 106 | ui->bcat_empty_label->setHidden(!boxcat); | 112 | ui->bcat_empty_label->setHidden(!boxcat); |
| 107 | ui->bcat_empty_header->setText(""); | 113 | ui->bcat_empty_header->setText(QStringLiteral("")); |
| 108 | ui->bcat_empty_label->setText(tr("Yuzu is retrieving the latest boxcat status...")); | 114 | ui->bcat_empty_label->setText(tr("Yuzu is retrieving the latest boxcat status...")); |
| 109 | 115 | ||
| 110 | if (!boxcat) | 116 | if (!boxcat) |
diff --git a/src/yuzu/configuration/configure_service.h b/src/yuzu/configuration/configure_service.h index ee50d5a79..efc8e21a8 100644 --- a/src/yuzu/configuration/configure_service.h +++ b/src/yuzu/configuration/configure_service.h | |||
| @@ -19,11 +19,11 @@ public: | |||
| 19 | explicit ConfigureService(QWidget* parent = nullptr); | 19 | explicit ConfigureService(QWidget* parent = nullptr); |
| 20 | ~ConfigureService() override; | 20 | ~ConfigureService() override; |
| 21 | 21 | ||
| 22 | void applyConfiguration(); | 22 | void ApplyConfiguration(); |
| 23 | void retranslateUi(); | 23 | void RetranslateUi(); |
| 24 | 24 | ||
| 25 | private: | 25 | private: |
| 26 | void setConfiguration(); | 26 | void SetConfiguration(); |
| 27 | 27 | ||
| 28 | std::pair<QString, QString> BCATDownloadEvents(); | 28 | std::pair<QString, QString> BCATDownloadEvents(); |
| 29 | void OnBCATImplChanged(); | 29 | void OnBCATImplChanged(); |