mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
SD挿抜をチェックしてユーザSD判定の成功率を上げる
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@598 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
9885fbd127
commit
1763a300ef
@ -149,6 +149,7 @@ typedef enum RestoreState
|
||||
INITIALIZE_AND_SHUTDOWN, // 本体初期化後にシャットダウン中
|
||||
FAIL, // 失敗
|
||||
|
||||
PREINSTALL_WAIT_SYNC_TICKET, //プリインストールダウンロードモード・Aボタン待ち
|
||||
PREINSTALL_WAIT_USER_SD_INSERT, // プリインストールダウンロードモード・ユーザSD挿入待ち
|
||||
PREINSTALL_CHECK_SD, // プリインストールダウンロードモード・ユーザSDのチェック
|
||||
PREINSTALL_CHECK_SD_FAIL, // プリインストールダウンロードモード・ユーザSDのチェック失敗
|
||||
@ -156,8 +157,22 @@ typedef enum RestoreState
|
||||
PREINSTALL_WAIT_USER_SD_EJECT // プリインストールダウンロードモード・ユーザSD抜き出し待ち
|
||||
} RestoreState;
|
||||
|
||||
#define BREAK_IF_STATE_CHANGED(saved, current) \
|
||||
if(saved != current) \
|
||||
{\
|
||||
break;\
|
||||
}\
|
||||
|
||||
|
||||
// SD挿抜が起こらなかった時のみ次の状態に遷移する
|
||||
void ChangeState(RestoreState saved, RestoreState& current, RestoreState next)
|
||||
{
|
||||
if(saved == current)
|
||||
{
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore状態管理
|
||||
RestoreState s_RestoreState = STARTUP;
|
||||
// Restoreモード管理
|
||||
@ -255,7 +270,7 @@ void CheckNupExecuted(common::HardwareStateManager& manager, ::std::vector<std::
|
||||
}
|
||||
else if(s_DownloadPreinstallMode)
|
||||
{
|
||||
s_RestoreState = SYNC_TICKET;
|
||||
s_RestoreState = PREINSTALL_WAIT_SYNC_TICKET;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1006,7 +1021,6 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
break;
|
||||
|
||||
case CHECK_IVS:
|
||||
case PREINSTALL_WAIT_USER_SD_INSERT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Insert User's SD Card"));
|
||||
}
|
||||
@ -1605,8 +1619,25 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
break;
|
||||
|
||||
case PREINSTALL_WAIT_SYNC_TICKET:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Continue."));
|
||||
if(nextStep)
|
||||
{
|
||||
s_RestoreState = SYNC_TICKET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PREINSTALL_WAIT_USER_SD_INSERT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Insert User's SD Card"));
|
||||
}
|
||||
break;
|
||||
|
||||
case PREINSTALL_CHECK_SD:
|
||||
{
|
||||
RestoreState saved = PREINSTALL_CHECK_SD;
|
||||
if (nn::fs::IsSdmcInserted())
|
||||
{
|
||||
NN_LOG("Check User's SD Card\n");
|
||||
@ -1614,18 +1645,20 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
if (ExistsAPSetting())
|
||||
{
|
||||
NN_LOG("AP Setting Exists. Retry\n");
|
||||
s_RestoreState = PREINSTALL_WAIT_USER_SD_INSERT;
|
||||
ChangeState(saved, s_RestoreState, PREINSTALL_WAIT_USER_SD_INSERT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(PreparePreinstallTitleDownload())
|
||||
// SD挿抜が起こったら抜ける
|
||||
BREAK_IF_STATE_CHANGED(saved, s_RestoreState);
|
||||
if (PreparePreinstallTitleDownload())
|
||||
{
|
||||
s_RestoreState = PREINSTALL_DOWNLOAD_APP;
|
||||
ChangeState(saved, s_RestoreState, PREINSTALL_DOWNLOAD_APP);
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER("Error: Valid User Savedata Exists.\n");
|
||||
s_RestoreState = PREINSTALL_CHECK_SD_FAIL;
|
||||
ChangeState(saved, s_RestoreState, PREINSTALL_CHECK_SD_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1680,14 +1713,15 @@ void OnSdEjected()
|
||||
}
|
||||
// FAILのときは一旦電源を切らないと動かないようにしておく
|
||||
// IVSチェック時はユーザのSDカードを挿入してもらうため
|
||||
else if (s_RestoreState != FAIL && s_RestoreState != CHECK_IVS)
|
||||
// プリインストール時はユーザのSDカードを挿入してもらうため
|
||||
else if (s_RestoreState != FAIL && s_RestoreState != CHECK_IVS && s_RestoreState != PREINSTALL_WAIT_USER_SD_INSERT)
|
||||
{
|
||||
InitializeState();
|
||||
ClearFileReadResult();
|
||||
}
|
||||
else if(s_RestoreState == PREINSTALL_WAIT_USER_SD_INSERT)
|
||||
else if(s_RestoreState == PREINSTALL_CHECK_SD)
|
||||
{
|
||||
s_RestoreState = PREINSTALL_CHECK_SD;
|
||||
s_RestoreState = PREINSTALL_WAIT_USER_SD_INSERT;
|
||||
}
|
||||
// ユーザのSDが抜かれてからFAILにする
|
||||
else if(s_RestoreState == PREINSTALL_CHECK_SD_FAIL)
|
||||
@ -1704,6 +1738,12 @@ void OnSdInserted()
|
||||
common::InitializeFileCheck();
|
||||
s_RestoreState = CHECK_SD_DIRECTORY;
|
||||
}
|
||||
else if(s_RestoreState == PREINSTALL_WAIT_USER_SD_INSERT)
|
||||
{
|
||||
// SDカードが変わるのでファイルチェックは初期化する
|
||||
common::InitializeFileCheck();
|
||||
s_RestoreState = PREINSTALL_CHECK_SD;
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeState()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user