TWLタイトルダウンロードの進捗を表示するように

Updater、Shopのエラーをログ出力するように

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
This commit is contained in:
N2614 2011-05-26 11:51:58 +00:00
parent af27b44ed1
commit d1c5bd626c
5 changed files with 20 additions and 4 deletions

View File

@ -1589,6 +1589,10 @@ u32 GetProgress()
{ {
return GetUpdateProgress(); return GetUpdateProgress();
} }
else if(s_RestoreState == DOWNLOAD_TWL)
{
return GetTitleDownloadProgress();
}
else else
{ {
return 0; return 0;

View File

@ -34,11 +34,12 @@ do { \
if (result.IsFailure()) \ if (result.IsFailure()) \
{ \ { \
ECCustomerSupportCode csc; \ ECCustomerSupportCode csc; \
nn::nim::Shop::GetCustomerSupportCode(&csc); \ nn::nim::Shop::GetCustomerSupportCode(&csc); \
COMMON_LOGGER("CSCode: %d\n", csc); \ COMMON_LOGGER("CSCode: %d\n", csc); \
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); \
nn::dbg::PrintResult(result); \ nn::dbg::PrintResult(result); \
s_ShopResult = result; \ s_ShopResult = result; \
return; \ return; \
} \ } \
} while(0) } while(0)
namespace namespace

View File

@ -34,6 +34,7 @@ bit8 s_buffer1[400 * 1024];
const size_t TITLE_DOWNLOADER_STACK_SIZE = 0x1000; const size_t TITLE_DOWNLOADER_STACK_SIZE = 0x1000;
nn::os::Thread s_TitleDownloaderThread; nn::os::Thread s_TitleDownloaderThread;
nn::os::StackBuffer<TITLE_DOWNLOADER_STACK_SIZE> s_TitleDownloaderThreadStack; nn::os::StackBuffer<TITLE_DOWNLOADER_STACK_SIZE> s_TitleDownloaderThreadStack;
u64 s_Progress;
nn::fs::MediaType GetMediaType(const ES_NAMESPACE::ESTitleId titleId) nn::fs::MediaType GetMediaType(const ES_NAMESPACE::ESTitleId titleId)
{ {
@ -117,6 +118,7 @@ void TitleDownloaderThreadFunc()
{ {
TitleDownloader TwlTitleDownloader; TitleDownloader TwlTitleDownloader;
s_Progress = 0;
TwlTitleDownloader.Start(); TwlTitleDownloader.Start();
} }
@ -135,6 +137,10 @@ bool DownloadTitleSucceeded()
return TitleDownloader::m_Result.IsSuccess() && GetShopOperationSingleResult().IsSuccess(); return TitleDownloader::m_Result.IsSuccess() && GetShopOperationSingleResult().IsSuccess();
} }
u32 GetTitleDownloadProgress()
{
return s_Progress;
}
TitleDownloader::TitleDownloader() : m_TwlTiteNum(0) TitleDownloader::TitleDownloader() : m_TwlTiteNum(0)
@ -190,6 +196,7 @@ void TitleDownloader::Start()
for(u8 i = 0; i < m_TwlTiteNum; i++) for(u8 i = 0; i < m_TwlTiteNum; i++)
{ {
s_Progress = i * 100 / m_TwlTiteNum;
StartShopOperationSingle(SHOP_OPERATION_CONNECT_WITHOUT_CLOSE); StartShopOperationSingle(SHOP_OPERATION_CONNECT_WITHOUT_CLOSE);
WaitShopOperationAndFinalize(); WaitShopOperationAndFinalize();

View File

@ -30,6 +30,9 @@ bool DownloadTitleFinished();
// タイトルのダウンロードスレッドが成功したかどうか // タイトルのダウンロードスレッドが成功したかどうか
bool DownloadTitleSucceeded(); bool DownloadTitleSucceeded();
// タイトルダウンロードの進捗を取得する
u32 GetTitleDownloadProgress();
// ショップからタイトルをダウンロードするためのクラス // ショップからタイトルをダウンロードするためのクラス
class TitleDownloader class TitleDownloader
{ {

View File

@ -41,6 +41,7 @@ do { \
NN_UTIL_PANIC_IF_FAILED( \ NN_UTIL_PANIC_IF_FAILED( \
nn::nim::Updater::GetCustomerSupportCode(&csc)); \ nn::nim::Updater::GetCustomerSupportCode(&csc)); \
COMMON_LOGGER("CSCode: %d\n", csc); \ COMMON_LOGGER("CSCode: %d\n", csc); \
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); \
nn::dbg::PrintResult(result); \ nn::dbg::PrintResult(result); \
s_Result = result; \ s_Result = result; \
goto LABEL_FINALIZE; \ goto LABEL_FINALIZE; \