mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
ConnectOnlyを関数に
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@211 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
7bd2ff96bf
commit
7186946b1c
@ -85,6 +85,7 @@ bool s_ExecuteConnectOnly = false;
|
||||
// ConnectOnlyを回リトライしたか
|
||||
u32 s_ConnectOnlyRetryCount = 0;
|
||||
|
||||
void PutAliveMessage(::std::vector<std::string>& operationMessage, const char* str);
|
||||
bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage);
|
||||
|
||||
bool NeedsAcAdater()
|
||||
@ -110,7 +111,7 @@ typedef enum RestoreState
|
||||
DOWNLOAD_IVS_DONE, // インフラからIVSを取得完了
|
||||
DELETE_ACCOUNT, // ショップアカウントを削除する
|
||||
DELETE_ACCOUNT_DONE, // ショップアカウント削除完了
|
||||
CONNECT_ONLY, // ショップに接続するのみ
|
||||
SYNC_TICKET, // eTicketを同期する
|
||||
READ_FILELIST, // ファイル一覧の読み込み
|
||||
RESTORE_TWL_NAND, // TWL NANDの書き込み中
|
||||
RESTORE_TWL_SOUND, // TWLサウンドの書き込み中
|
||||
@ -149,6 +150,7 @@ void CheckConsoleInitialized(::std::vector<std::string>& message, bool& goNextSt
|
||||
void CheckExistsSerialNumber(::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckIvsinSd(::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckRegioinSd(::std::vector<std::string>& message, bool& goNextStep);
|
||||
void ConnectOnly(::std::vector<std::string>& message, bool& goNextStep, RestoreState nextState);
|
||||
|
||||
// SDカード挿入チェック
|
||||
void CheckSdInserted(::std::vector<std::string>& message, bool& goNextStep)
|
||||
@ -432,6 +434,74 @@ void CheckRegioinSd(::std::vector<std::string>& message, bool& goNextStep)
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectOnly(::std::vector<std::string>& message, bool& goNextStep, RestoreState nextState)
|
||||
{
|
||||
NN_UNUSED_VAR(goNextStep);
|
||||
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdater())
|
||||
{
|
||||
message.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// アップデートを行う
|
||||
if (!s_ExecuteConnectOnly)
|
||||
{
|
||||
if (ImportCountryLanguageData().IsSuccess())
|
||||
{
|
||||
StartShopOperationSingle(SHOP_OPERATION_CONNECT_ONLY);
|
||||
s_ExecuteConnectOnly = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// 動いていることを表示
|
||||
{
|
||||
PutAliveMessage(message, "Shop Connect");
|
||||
}
|
||||
|
||||
if (IsShopOperationSingleFinished())
|
||||
{
|
||||
FinishShopOperationSingle();
|
||||
// エラーがあったら表示する
|
||||
if (GetShopOperationSingleResult().IsFailure())
|
||||
{
|
||||
// APが見つからない
|
||||
if (GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint())
|
||||
{
|
||||
COMMON_LOGGER("No Access Point Found!");
|
||||
}
|
||||
}
|
||||
|
||||
if (GetShopOperationSingleResult().IsSuccess())
|
||||
{
|
||||
COMMON_LOGGER("Shop Connect Finished.\n");
|
||||
|
||||
s_RestoreState = nextState;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_ConnectOnlyRetryCount++ < RETRY_MAX)
|
||||
{
|
||||
// エラーのためやり直す
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(GetShopOperationSingleResult());
|
||||
COMMON_LOGGER("Shop Connect Failed. Retrying... %d\n", s_ConnectOnlyRetryCount);
|
||||
|
||||
// Unregister用のスレッドを作るとこからやり直し
|
||||
s_ExecuteConnectOnly = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage)
|
||||
{
|
||||
using namespace common;
|
||||
@ -910,70 +980,9 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep)
|
||||
}
|
||||
break;
|
||||
|
||||
case CONNECT_ONLY:
|
||||
case SYNC_TICKET:
|
||||
{
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdater())
|
||||
{
|
||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// アップデートを行う
|
||||
if (!s_ExecuteConnectOnly)
|
||||
{
|
||||
if (ImportCountryLanguageData().IsSuccess())
|
||||
{
|
||||
StartShopOperationSingle(SHOP_OPERATION_CONNECT_ONLY);
|
||||
s_ExecuteConnectOnly = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// 動いていることを表示
|
||||
{
|
||||
PutAliveMessage(operationMessage, "Shop Connect");
|
||||
}
|
||||
|
||||
if (IsShopOperationSingleFinished())
|
||||
{
|
||||
FinishShopOperationSingle();
|
||||
// エラーがあったら表示する
|
||||
if (GetShopOperationSingleResult().IsFailure())
|
||||
{
|
||||
// APが見つからない
|
||||
if (GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint())
|
||||
{
|
||||
COMMON_LOGGER("No Access Point Found!");
|
||||
}
|
||||
}
|
||||
|
||||
if (GetShopOperationSingleResult().IsSuccess())
|
||||
{
|
||||
COMMON_LOGGER("Shop Connect Finished.\n");
|
||||
|
||||
s_RestoreState = DOWNLOAD_TWL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_ConnectOnlyRetryCount++ < RETRY_MAX)
|
||||
{
|
||||
// エラーのためやり直す
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(GetShopOperationSingleResult());
|
||||
COMMON_LOGGER("Shop Connect Failed. Retrying... %d\n", s_ConnectOnlyRetryCount);
|
||||
|
||||
// Unregister用のスレッドを作るとこからやり直し
|
||||
s_ExecuteConnectOnly = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
ConnectOnly(operationMessage, nextStep, DOWNLOAD_TWL);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1153,7 +1162,7 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep)
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
|
||||
s_RestoreState = CONNECT_ONLY;
|
||||
s_RestoreState = SYNC_TICKET;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user