TWLタイトルリストがある時のみTWLタイトルをダウンロードするように

アカウント削除前にAボタン入力を待つように
NUP専用モードでNUP完了後アカウント削除するように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@262 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-05-20 02:03:08 +00:00
parent 32777626f5
commit 8d20911cbc
4 changed files with 88 additions and 45 deletions

View File

@ -101,7 +101,7 @@ typedef enum RestoreState
WAIT_START_UPDATE, // アップデート開始入力待ち
WAIT_START_IMPORT, // 書き込み開始入力待ち
WAIT_START_SYNC_CLOCK, // 時計合わせ開始入力待ち
IMPORT_RTC, // RTC同期
IMPORT_RTC, // RTC同期
UPDATE_IN_PROGRESS, // アップデート中
UPDATE_DONE, // アップデート完了
NUP_ONLY_WAIT_SD_EJECT, // NUP_ONLYモードでSDカード抜き待ち
@ -114,6 +114,7 @@ typedef enum RestoreState
CHECK_SD_DIRECTORY, // SDカードのIVS依存ディレクトリを探す
CHECK_SD_DIRECTORY_SUCCESS, // SDカードのIVS依存ディレクトリチェック完了
CHECK_SD_DIRECTORY_FAIL, // SDカードのIVS依存ディレクトリが見つからなかった
WAIT_START_DELETE_ACCOUNT, // ショップアカウント削除開始入力待ち,
DELETE_ACCOUNT, // ショップアカウントを削除する
DELETE_ACCOUNT_DONE, // ショップアカウント削除完了
SYNC_TICKET, // eTicketを同期する
@ -231,10 +232,7 @@ void CheckNupExecuted(common::HardwareStateManager& manager, ::std::vector<std::
}
else if (s_NupOnlyMode)
{
s_RestoreState = NUP_ONLY_WAIT_SD_EJECT;
// リストア状態チェックファイルをすべて削除
DeleteAllCheckFiles();
s_RestoreState = DELETE_ACCOUNT;
}
else
{
@ -311,7 +309,7 @@ void CheckAccountDeleted(common::HardwareStateManager& manager, ::std::vector<st
else
{
COMMON_LOGGER("Delete Account\n");
s_RestoreState = DELETE_ACCOUNT;
s_RestoreState = WAIT_START_DELETE_ACCOUNT;
}
}
}
@ -988,6 +986,24 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
}
break;
case WAIT_START_DELETE_ACCOUNT:
{
operationMessage.push_back(::std::string("Push A or START Button"));
operationMessage.push_back(::std::string("Delete Account Mode"));
if (!s_PlayedStartCursor)
{
PlaySound(SOUND_CURSOR);
s_PlayedStartCursor = true;
}
if (nextStep)
{
COMMON_LOGGER("Delete Account\n");
s_RestoreState = DELETE_ACCOUNT;
}
}
break;
case DELETE_ACCOUNT:
{
ShopOperationSingleTemplate(manager, operationMessage, SHOP_OPERATION_UNREGISTER, "Deleting Account",
@ -997,20 +1013,30 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
case DELETE_ACCOUNT_DONE:
{
operationMessage.push_back(::std::string("Delete Account Done."));
operationMessage.push_back(::std::string("Operate BMS."));
operationMessage.push_back(::std::string(""));
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
if (!s_PlayedRebootCursor)
if(s_NupOnlyMode)
{
PlaySound(SOUND_CURSOR);
s_PlayedRebootCursor = true;
s_RestoreState = NUP_ONLY_WAIT_SD_EJECT;
// リストア状態チェックファイルをすべて削除
DeleteAllCheckFiles();
}
if (nextStep)
else
{
s_RestoreState = REBOOTING;
operationMessage.push_back(::std::string("Delete Account Done."));
operationMessage.push_back(::std::string("Operate BMS."));
operationMessage.push_back(::std::string(""));
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
if (!s_PlayedRebootCursor)
{
PlaySound(SOUND_CURSOR);
s_PlayedRebootCursor = true;
}
if (nextStep)
{
s_RestoreState = REBOOTING;
}
}
}
break;
@ -1205,38 +1231,47 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
case DOWNLOAD_TWL:
{
if (!s_ExecuteTitleDownload)
// ファイルリストがなければ次へ
if( !ExistsTwlTitleListFile())
{
COMMON_LOGGER("Download Twl Title\n");
s_ExecuteTitleDownload = true;
StartTitleDownload();
s_IsSyncClock = true;
s_RestoreState = READ_FILELIST;
}
// 動いていることを表示
else
{
PutAliveMessage(operationMessage, "Download Twl Title");
}
if (DownloadTitleFinished())
{
if (DownloadTitleSucceeded())
if (!s_ExecuteTitleDownload)
{
s_IsSyncClock = true;
s_RestoreState = READ_FILELIST;
COMMON_LOGGER("Download Twl Title\n");
s_ExecuteTitleDownload = true;
StartTitleDownload();
}
else
{
if (s_TitleDownloadRetryCount++ < RETRY_MAX)
{
// エラーのためやり直す
COMMON_LOGGER_RESULT_IF_FAILED(GetShopOperationSingleResult());
COMMON_LOGGER("Download Twl Title Failed. Retrying... %d\n", s_TitleDownloadRetryCount);
s_ExecuteTitleDownload = false;
// 動いていることを表示
{
PutAliveMessage(operationMessage, "Download Twl Title");
}
if (DownloadTitleFinished())
{
if (DownloadTitleSucceeded())
{
s_IsSyncClock = true;
s_RestoreState = READ_FILELIST;
}
else
{
s_RestoreState = FAIL;
if (s_TitleDownloadRetryCount++ < RETRY_MAX)
{
// エラーのためやり直す
COMMON_LOGGER_RESULT_IF_FAILED(GetShopOperationSingleResult());
COMMON_LOGGER("Download Twl Title Failed. Retrying... %d\n", s_TitleDownloadRetryCount);
s_ExecuteTitleDownload = false;
}
else
{
s_RestoreState = FAIL;
}
}
}
}

View File

@ -46,9 +46,9 @@ namespace
nn::Result s_ShopResult = nn::ResultSuccess();
const size_t UNREGISTER_THREAD_STACK_SIZE = 0x1000;
const size_t SHOP_OPERATION_THREAD_STACK_SIZE = 0x1000;
nn::os::Thread s_ShopOperationThread;
nn::os::StackBuffer<UNREGISTER_THREAD_STACK_SIZE> s_UnregisterThreadStack;
nn::os::StackBuffer<SHOP_OPERATION_THREAD_STACK_SIZE> s_ShopOperationThreadStack;
const size_t EC_BUFFER_SIZE = 128 * 1024;
u8 s_EcBufffer[EC_BUFFER_SIZE];
@ -502,7 +502,7 @@ void StartShopOperationSingle(ShopOperation op, nn::nim::TitleConfig config)
ShopThreadParam param;
param.op = op;
param.config = config;
s_ShopOperationThread.Start(ShopOperationSingleThreadFunc, param, s_UnregisterThreadStack);
s_ShopOperationThread.Start(ShopOperationSingleThreadFunc, param, s_ShopOperationThreadStack);
}
void StartShopOperationSingle(ShopOperation op)
@ -511,7 +511,7 @@ void StartShopOperationSingle(ShopOperation op)
param.op = op;
NN_LOG("Start ShopOperationSingle, %s\n", SHOP_OPERATION_STR[op]);
s_ShopOperationThread.Start(ShopOperationSingleThreadFunc, param, s_UnregisterThreadStack);
s_ShopOperationThread.Start(ShopOperationSingleThreadFunc, param, s_ShopOperationThreadStack);
}
void FinalizeShopOperationSingle()

View File

@ -136,6 +136,11 @@ bool ExistsDownloadIvsCheckedFile()
return ExistsFile(EXISTS_DOWNLOAD_IVS);
}
bool ExistsTwlTitleListFile()
{
return ExistsFile(EXISTS_TWL_TITLELIST);
}
void InitializeFileCheck()
{
for(u32 i = 0; i < EXISTS_MAX; i++)

View File

@ -36,6 +36,7 @@ typedef enum FILE_EXISTS_CHECK
EXISTS_DELETE_ACCOUNT, // アカウント削除完了
EXISTS_TRANSFER_ACCOUNT, // アカウント移行完了
EXISTS_DOWNLOAD_IVS, // IVSダウロード完了
EXISTS_TWL_TITLELIST, // TWLタイトルリストファイル
EXISTS_MAX
} FileExistsCheck;
@ -53,7 +54,8 @@ const wchar_t* const FILENAME_TABLE[EXISTS_MAX] =
common::REGION_DATA_PATHNAME,
common::DELETE_ACCOUNT_CHECK_PATHNAME,
common::TRANSFER_ACCOUNT_CHECK_PATHNAME,
common::DOWNLOAD_IVS_CHECK_PATHNAME
common::DOWNLOAD_IVS_CHECK_PATHNAME,
common::TWL_TITLELIST_PATHNAME
};
// ファイルが存在するかどうか
@ -71,6 +73,7 @@ bool ExistsRegionData();
bool ExistsDeleteAccountChecked();
bool ExistsTransferAccountChecked();
bool ExistsDownloadIvsCheckedFile();
bool ExistsTwlTitleListFile();
// ファイルチェックの結果を初期化する
// 一度チェックするとその結果を保持するため