From 23faebb31cc5f9c2813858d3f9c0281792b6e60e Mon Sep 17 00:00:00 2001 From: Adubbz Date: Mon, 16 Mar 2020 23:04:15 +1100 Subject: [PATCH] ncm install task: implement IncrementProgress and update UpdateThroughputMeasurement --- .../include/stratosphere/ncm/ncm_install_task.hpp | 1 + libraries/libstratosphere/source/ncm/ncm_install_task.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task.hpp index 00e798407..3d46eb6eb 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task.hpp @@ -66,6 +66,7 @@ PrepareContentMeta (both), WritePlaceHolderBuffer, Get/Delete InstallContentMeta void ResetThroughputMeasurement(); void SetProgressState(InstallProgressState state); + void IncrementProgress(s64 size); void UpdateThroughputMeasurement(s64 throughput); bool IsNecessaryInstallTicket(const fs::RightsId &rights_id); void SetTotalSize(s64 size); diff --git a/libraries/libstratosphere/source/ncm/ncm_install_task.cpp b/libraries/libstratosphere/source/ncm/ncm_install_task.cpp index 08e9f93a3..1ae93863c 100644 --- a/libraries/libstratosphere/source/ncm/ncm_install_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_install_task.cpp @@ -414,12 +414,17 @@ namespace ams::ncm { /* ... */ + void InstallTaskBase::IncrementProgress(s64 size) { + std::scoped_lock lk(this->progress_mutex); + this->progress.installed_size += size; + } + void InstallTaskBase::UpdateThroughputMeasurement(s64 throughput) { std::scoped_lock lk(this->throughput_mutex); if (this->throughput_start_time.GetNanoSeconds() != 0) { this->throughput.installed += throughput; - /* TODO. */ + this->throughput.elapsed_time = os::ConvertToTimeSpan(os::GetSystemTick()) - this->throughput_start_time; } }