タイトルダウンロードのリトライ前にスレッドをFinalizeするように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@309 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-06-03 05:50:41 +00:00
parent 7540f46573
commit a72bdc5f70
3 changed files with 14 additions and 4 deletions

View File

@ -1342,8 +1342,9 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
PutAliveMessage(operationMessage, "Download Twl Title"); PutAliveMessage(operationMessage, "Download Twl Title");
} }
if (DownloadTitleFinished()) if (IsDownloadTitleFinished())
{ {
FinalizeTitleDownload();
if (DownloadTitleSucceeded()) if (DownloadTitleSucceeded())
{ {
s_IsSyncClock = true; s_IsSyncClock = true;

View File

@ -127,11 +127,17 @@ void StartTitleDownload()
s_TitleDownloaderThread.Start(TitleDownloaderThreadFunc, s_TitleDownloaderThreadStack); s_TitleDownloaderThread.Start(TitleDownloaderThreadFunc, s_TitleDownloaderThreadStack);
} }
bool DownloadTitleFinished() bool IsDownloadTitleFinished()
{ {
return s_TitleDownloaderThread.IsValid() && !s_TitleDownloaderThread.IsAlive(); return s_TitleDownloaderThread.IsValid() && !s_TitleDownloaderThread.IsAlive();
} }
void FinalizeTitleDownload()
{
s_TitleDownloaderThread.Join();
s_TitleDownloaderThread.Finalize();
}
bool DownloadTitleSucceeded() bool DownloadTitleSucceeded()
{ {
return TitleDownloader::m_Result.IsSuccess() && GetShopOperationSingleResult().IsSuccess(); return TitleDownloader::m_Result.IsSuccess() && GetShopOperationSingleResult().IsSuccess();

View File

@ -24,12 +24,15 @@ namespace ConsoleRestore
// 新たにスレッドを立て、タイトルのダウンロードを開始する // 新たにスレッドを立て、タイトルのダウンロードを開始する
void StartTitleDownload(); void StartTitleDownload();
// タイトルのダウンロードスレッドを終了する // タイトルのダウンロードスレッドが終了したかどうか
bool DownloadTitleFinished(); bool IsDownloadTitleFinished();
// タイトルのダウンロードスレッドが成功したかどうか // タイトルのダウンロードスレッドが成功したかどうか
bool DownloadTitleSucceeded(); bool DownloadTitleSucceeded();
// タイトルのダウンロードスレッドを終了する
void FinalizeTitleDownload();
// タイトルダウンロードの進捗を取得する // タイトルダウンロードの進捗を取得する
u32 GetTitleDownloadProgress(); u32 GetTitleDownloadProgress();