NUP実行部分を関数に

eTicket同期後にIVSを送信するように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@214 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-04-22 02:31:33 +00:00
parent 19aa839160
commit 77c01cef2c

View File

@ -109,6 +109,7 @@ typedef enum RestoreState
DELETE_ACCOUNT, // ショップアカウントを削除する
DELETE_ACCOUNT_DONE, // ショップアカウント削除完了
SYNC_TICKET, // eTicketを同期する
UPLOAD_IVS, // IVSを送信する
READ_FILELIST, // ファイル一覧の読み込み
RESTORE_TWL_NAND, // TWL NANDの書き込み中
RESTORE_TWL_SOUND, // TWLサウンドの書き込み中
@ -505,6 +506,77 @@ void ShopOperationSingleTemplate(
}
}
void UpdateOperation(::std::vector<std::string>& message, RestoreState nextState)
{
// ACアダプタが必要か
if (NeedsAcAdater())
{
message.push_back(::std::string("Connect AC Adapter!!"));
}
// アップデートを行う
if (!s_ExecuteFgNup)
{
if (ImportCountryLanguageData().IsSuccess())
{
StartFGNetworkUpdate();
s_ExecuteFgNup = true;
}
else
{
s_RestoreState = FAIL;
}
}
// 動いていることを表示
{
PutAliveMessage(message, "Updating");
}
if (IsNetworkUpdateFinished())
{
FinishFGNetworkUpdate();
// エラーがあったら表示する
if (GetUpdateResult().IsFailure())
{
// APが見つからない
if (GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint())
{
COMMON_LOGGER("No Access Point Found!");
}
}
if (GetUpdateResult().IsSuccess())
{
COMMON_LOGGER("Network Update Finished.\n");
if(nextState == UPDATE_DONE)
{
// アップデート完了ファイルを作成
CreateUpdateFinishedFile();
}
s_RestoreState = nextState;
}
else
{
if (s_FgNupRetryCount++ < RETRY_MAX)
{
// エラーのためやり直す
COMMON_LOGGER_RESULT_IF_FAILED(GetUpdateResult());
COMMON_LOGGER("Network Update Failed. Retrying... %d\n", s_FgNupRetryCount);
// FGNUP用のスレッドを作るとこからやり直し
s_ExecuteFgNup = false;
}
else
{
s_RestoreState = FAIL;
}
}
}
}
bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage)
{
using namespace common;
@ -718,71 +790,7 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep)
// アップデート中
case UPDATE_IN_PROGRESS:
{
// ACアダプタが必要か
if (NeedsAcAdater())
{
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
}
// アップデートを行う
if (!s_ExecuteFgNup)
{
if (ImportCountryLanguageData().IsSuccess())
{
StartFGNetworkUpdate();
s_ExecuteFgNup = true;
}
else
{
s_RestoreState = FAIL;
}
}
// 動いていることを表示
{
PutAliveMessage(operationMessage, "Updating");
}
if (IsNetworkUpdateFinished())
{
FinishFGNetworkUpdate();
// エラーがあったら表示する
if (GetUpdateResult().IsFailure())
{
// APが見つからない
if (GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint())
{
COMMON_LOGGER("No Access Point Found!");
}
}
if (GetUpdateResult().IsSuccess())
{
COMMON_LOGGER("Network Update Finished.\n");
// アップデート完了ファイルを作成
CreateUpdateFinishedFile();
s_RestoreState = UPDATE_DONE;
}
else
{
if (s_FgNupRetryCount++ < RETRY_MAX)
{
// エラーのためやり直す
COMMON_LOGGER_RESULT_IF_FAILED(GetUpdateResult());
COMMON_LOGGER("Network Update Failed. Retrying... %d\n", s_FgNupRetryCount);
// FGNUP用のスレッドを作るとこからやり直し
s_ExecuteFgNup = false;
}
else
{
s_RestoreState = FAIL;
}
}
}
UpdateOperation(operationMessage, UPDATE_DONE);
}
break;
@ -1042,7 +1050,14 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep)
case SYNC_TICKET:
{
ShopOperationSingleTemplate(operationMessage, SHOP_OPERATION_CONNECT_ONLY, "Shop Connect",
"Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", DOWNLOAD_TWL);
"Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", UPLOAD_IVS);
}
break;
// NUPすることでIVSが送信される
case UPLOAD_IVS:
{
UpdateOperation(operationMessage, DOWNLOAD_TWL);
}
break;