mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
NUP専用モードの追加
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@63 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
9f0e693e94
commit
834f59c092
@ -304,7 +304,6 @@ extern "C" void nnMain(void)
|
||||
for(;;)
|
||||
{
|
||||
bool nextStep = false;
|
||||
bool specialKey = false;
|
||||
|
||||
s_PadReader.ReadLatest(&padStatus);
|
||||
|
||||
@ -344,14 +343,6 @@ extern "C" void nnMain(void)
|
||||
common::Logger::GetLoggerInstance()->ScrollToEnd();
|
||||
}
|
||||
|
||||
// 特殊入力
|
||||
if(padStatus.hold & nn::hid::BUTTON_R &&
|
||||
padStatus.hold & nn::hid::BUTTON_L &&
|
||||
padStatus.hold & nn::hid::BUTTON_B)
|
||||
{
|
||||
specialKey = true;
|
||||
}
|
||||
|
||||
// 情報更新
|
||||
// バッテリ
|
||||
mcu.GetBatteryRemain(&batteryRemain);
|
||||
@ -370,7 +361,7 @@ extern "C" void nnMain(void)
|
||||
// 進捗確認メッセージを兼ねる?
|
||||
::std::vector<std::string> operationMessage;
|
||||
|
||||
ControlState(operationMessage, nextStep, continueRestore, specialKey);
|
||||
ControlState(operationMessage, nextStep, continueRestore);
|
||||
|
||||
nn::util::FloatColor titleColor;
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ typedef enum RestoreState
|
||||
SERIAL_IN_SD, // シリアルナンバーの情報を表示
|
||||
UPDATE_IN_PROGRESS, // アップデート中
|
||||
UPDATE_DONE, // アップデート完了
|
||||
NUP_ONLY_WAIT_SD_EJECT, // NUP_ONLYモードでSDカード抜き待ち
|
||||
NUP_ONLY_WAIT_NEXT, // NUP_ONLYモードでキー入力待ち
|
||||
RESTORE_TWL_SOUND, // TWLサウンドの書き込み中
|
||||
RESTORE_TWL_PHOTO, // TWL写真の書き込み中
|
||||
RESTORE_IN_PROGRESS, // 書き込み中
|
||||
@ -66,6 +68,8 @@ RestoreState s_RestoreState = STARTUP;
|
||||
bool s_ReadSettingDone = false;
|
||||
// インターネット設定を読んだ結果
|
||||
bool s_ReadSettingSuccess = false;
|
||||
// NUP専用モードかどうか
|
||||
bool s_NupOnlyMode = false;
|
||||
|
||||
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
||||
bool s_ExistAPSettingAnnotation = false;
|
||||
@ -114,7 +118,7 @@ bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage)
|
||||
if (!s_ReadSettingDone)
|
||||
{
|
||||
s_ReadSettingDone = true;
|
||||
s_ReadSettingSuccess = ReadSetting();
|
||||
s_ReadSettingSuccess = ReadSetting(&s_NupOnlyMode);
|
||||
}
|
||||
|
||||
if (!s_ReadSettingSuccess)
|
||||
@ -164,7 +168,7 @@ void ExecSyncMcuRtc()
|
||||
}
|
||||
}
|
||||
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey)
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore)
|
||||
{
|
||||
using namespace common;
|
||||
|
||||
@ -184,6 +188,17 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||
// SDカードにアップデート完了ファイルがあるか?
|
||||
if (ExistsUpdateCheckedFile())
|
||||
{
|
||||
CheckAndReadAPSetting(operationMessage);
|
||||
if (s_NupOnlyMode)
|
||||
{
|
||||
s_RestoreState = NUP_ONLY_WAIT_SD_EJECT;
|
||||
|
||||
// リストア状態チェックファイルをすべて削除
|
||||
DeleteAllCheckFiles();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// SDカードに書き込み完了ファイルがあるか?
|
||||
if (!ExistsWriteFinishedFile())
|
||||
{
|
||||
@ -318,12 +333,7 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||
}
|
||||
}
|
||||
|
||||
if(specialKey)
|
||||
{
|
||||
s_RestoreState = SHUTDOWN;
|
||||
}
|
||||
|
||||
if (nextStep && !error && !specialKey)
|
||||
if (nextStep && !error)
|
||||
{
|
||||
if (needsUpdate)
|
||||
{
|
||||
@ -363,12 +373,7 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||
PlaySound(SOUND_ANNOTATION);
|
||||
}
|
||||
|
||||
if(specialKey)
|
||||
{
|
||||
s_RestoreState = SHUTDOWN;
|
||||
}
|
||||
|
||||
if (nextStep && !specialKey)
|
||||
if (nextStep)
|
||||
{
|
||||
s_RestoreState = RESTORE_TWL_SOUND;
|
||||
}
|
||||
@ -701,17 +706,39 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||
}
|
||||
break;
|
||||
|
||||
case NUP_ONLY_WAIT_SD_EJECT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Update Done. Pull Out SD Card."));
|
||||
|
||||
// SDカード抜けのみで次の状態に遷移する
|
||||
if (!s_PlayedSdPullOutCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedSdPullOutCursor = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NUP_ONLY_WAIT_NEXT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("A or START Button to Shutdown."));
|
||||
|
||||
if(nextStep)
|
||||
{
|
||||
s_RestoreState = SHUTDOWN;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHUTDOWN:
|
||||
{
|
||||
// リストア状態チェックファイルをすべて削除
|
||||
DeleteAllCheckFiles();
|
||||
|
||||
// 本体初期化を行う
|
||||
InitializeFileSystem();
|
||||
|
||||
// シャットダウンする
|
||||
nn::ptm::CTR::ShutdownAsync(0, nn::fnd::TimeSpan::FromSeconds(0));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@ -737,6 +764,10 @@ void OnSdEjected()
|
||||
{
|
||||
s_RestoreState = ALL_DONE;
|
||||
}
|
||||
else if(s_RestoreState == NUP_ONLY_WAIT_SD_EJECT)
|
||||
{
|
||||
s_RestoreState = NUP_ONLY_WAIT_NEXT;
|
||||
}
|
||||
// FAILのときは一旦電源を切らないと動かないようにしておく
|
||||
else if(s_RestoreState != FAIL)
|
||||
{
|
||||
@ -762,6 +793,7 @@ void InitializeState()
|
||||
s_PlayedStartCursor = false;
|
||||
s_PlayedRebootCursor = false;
|
||||
s_PlayedSdPullOutCursor = false;
|
||||
s_NupOnlyMode = false;
|
||||
}
|
||||
|
||||
u32 GetProgress()
|
||||
|
||||
@ -25,7 +25,7 @@ namespace ConsoleRestore
|
||||
|
||||
const u32 RETRY_MAX = 3;
|
||||
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey);
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore);
|
||||
bool InProgress();
|
||||
bool IsRestoreSucceeded();
|
||||
bool IsRestoreFailed();
|
||||
|
||||
@ -831,7 +831,7 @@ bool UpdateNetworkSetting(nn::ac::NetworkSetting& networkSetting)
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool ReadSetting()
|
||||
bool ReadSetting(bool* nupOnly)
|
||||
{
|
||||
nn::Result result;
|
||||
bool retval = true;
|
||||
@ -1132,6 +1132,21 @@ bool ReadSetting()
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
if (nupOnly != NULL)
|
||||
{
|
||||
if (configfileLoader.ReadAsChar(L"NUP_ONLY") != NULL)
|
||||
{
|
||||
s32 num = configfileLoader.ReadAsInteger(L"NUP_ONLY");
|
||||
if (num == 1)
|
||||
{
|
||||
*nupOnly = true;
|
||||
COMMON_LOGGER("NUP Only Mode.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configfileLoader.Finalize();
|
||||
|
||||
// 書き込み完了しなければfalse
|
||||
|
||||
@ -60,7 +60,7 @@ struct TimeZone
|
||||
NN_PADDING3;
|
||||
};
|
||||
|
||||
bool ReadSetting();
|
||||
bool ReadSetting(bool* nupOnly);
|
||||
char* GetNtpServerName();
|
||||
TimeZone GetTimeZone();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user