From d1c5bd626cb2bbaab08d4165fee5020a4c5ff5ee Mon Sep 17 00:00:00 2001 From: N2614 Date: Thu, 26 May 2011 11:51:58 +0000 Subject: [PATCH] =?UTF-8?q?TWL=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB?= =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E3=81=AE?= =?UTF-8?q?=E9=80=B2=E6=8D=97=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=20Updater=E3=80=81Shop=E3=81=AE?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E3=83=AD=E3=82=B0=E5=87=BA?= =?UTF-8?q?=E5=8A=9B=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@289 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../sources/ConsoleRestore/Controller.cpp | 4 ++++ .../ConsoleDataMigration/sources/ConsoleRestore/Shop.cpp | 9 +++++---- .../sources/ConsoleRestore/TitleDownloader.cpp | 7 +++++++ .../sources/ConsoleRestore/TitleDownloader.h | 3 +++ .../sources/ConsoleRestore/Updater.cpp | 1 + 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/Controller.cpp b/trunk/ConsoleDataMigration/sources/ConsoleRestore/Controller.cpp index fda7da1..1679df9 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/Controller.cpp +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/Controller.cpp @@ -1589,6 +1589,10 @@ u32 GetProgress() { return GetUpdateProgress(); } + else if(s_RestoreState == DOWNLOAD_TWL) + { + return GetTitleDownloadProgress(); + } else { return 0; diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/Shop.cpp b/trunk/ConsoleDataMigration/sources/ConsoleRestore/Shop.cpp index 32f208b..6364bda 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/Shop.cpp +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/Shop.cpp @@ -34,11 +34,12 @@ do { \ if (result.IsFailure()) \ { \ ECCustomerSupportCode csc; \ - nn::nim::Shop::GetCustomerSupportCode(&csc); \ - COMMON_LOGGER("CSCode: %d\n", csc); \ + nn::nim::Shop::GetCustomerSupportCode(&csc); \ + COMMON_LOGGER("CSCode: %d\n", csc); \ + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); \ nn::dbg::PrintResult(result); \ - s_ShopResult = result; \ - return; \ + s_ShopResult = result; \ + return; \ } \ } while(0) namespace diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.cpp b/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.cpp index cf89456..d48a07a 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.cpp +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.cpp @@ -34,6 +34,7 @@ bit8 s_buffer1[400 * 1024]; const size_t TITLE_DOWNLOADER_STACK_SIZE = 0x1000; nn::os::Thread s_TitleDownloaderThread; nn::os::StackBuffer s_TitleDownloaderThreadStack; +u64 s_Progress; nn::fs::MediaType GetMediaType(const ES_NAMESPACE::ESTitleId titleId) { @@ -117,6 +118,7 @@ void TitleDownloaderThreadFunc() { TitleDownloader TwlTitleDownloader; + s_Progress = 0; TwlTitleDownloader.Start(); } @@ -135,6 +137,10 @@ bool DownloadTitleSucceeded() return TitleDownloader::m_Result.IsSuccess() && GetShopOperationSingleResult().IsSuccess(); } +u32 GetTitleDownloadProgress() +{ + return s_Progress; +} TitleDownloader::TitleDownloader() : m_TwlTiteNum(0) @@ -190,6 +196,7 @@ void TitleDownloader::Start() for(u8 i = 0; i < m_TwlTiteNum; i++) { + s_Progress = i * 100 / m_TwlTiteNum; StartShopOperationSingle(SHOP_OPERATION_CONNECT_WITHOUT_CLOSE); WaitShopOperationAndFinalize(); diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.h b/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.h index 043ef6b..6e6449e 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.h +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/TitleDownloader.h @@ -30,6 +30,9 @@ bool DownloadTitleFinished(); // タイトルのダウンロードスレッドが成功したかどうか bool DownloadTitleSucceeded(); +// タイトルダウンロードの進捗を取得する +u32 GetTitleDownloadProgress(); + // ショップからタイトルをダウンロードするためのクラス class TitleDownloader { diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/Updater.cpp b/trunk/ConsoleDataMigration/sources/ConsoleRestore/Updater.cpp index 2da6a7f..c6d8a25 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/Updater.cpp +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/Updater.cpp @@ -41,6 +41,7 @@ do { \ NN_UTIL_PANIC_IF_FAILED( \ nn::nim::Updater::GetCustomerSupportCode(&csc)); \ COMMON_LOGGER("CSCode: %d\n", csc); \ + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); \ nn::dbg::PrintResult(result); \ s_Result = result; \ goto LABEL_FINALIZE; \