特殊キー入力により本体初期化後シャットダウンできるように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@47 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-02-10 10:57:27 +00:00
parent 27290b0227
commit 3eaa0b3f59
3 changed files with 36 additions and 5 deletions

View File

@ -304,6 +304,8 @@ extern "C" void nnMain(void)
for(;;)
{
bool nextStep = false;
bool specialKey = false;
s_PadReader.ReadLatest(&padStatus);
// AまたはSTARTボタンで進行
@ -342,6 +344,13 @@ 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;
}
// 情報更新
// バッテリ
@ -361,7 +370,7 @@ extern "C" void nnMain(void)
// 進捗確認メッセージを兼ねる?
::std::vector<std::string> operationMessage;
ControlState(operationMessage, nextStep, continueRestore);
ControlState(operationMessage, nextStep, continueRestore, specialKey);
nn::util::FloatColor titleColor;

View File

@ -18,6 +18,8 @@
#include <nn/CTR/CTR_DeliverArg.h>
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
#include <nn/ptm/CTR/ptm_ApiSysmenu.h>
#include <nn/ptm/CTR/ptm_ApiSystem.h>
#include <nn/pl/CTR/pl_PlayHistoryApiSysmenu.h>
#include "Controller.h"
#include "FileChecker.h"
@ -52,6 +54,7 @@ typedef enum RestoreState
TIME_ADJUST, // 時計あわせを行う
WAIT_SD_EJECT, // SDカードぬき待ち
ALL_DONE, // すべて完了
SHUTDOWN, // シャットダウン中
FAIL // 失敗
} RestoreState;
@ -161,7 +164,7 @@ void ExecSyncMcuRtc()
}
}
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore)
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey)
{
using namespace common;
@ -313,7 +316,12 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
}
}
if (nextStep && !error)
if(specialKey)
{
s_RestoreState = SHUTDOWN;
}
if (nextStep && !error && !specialKey)
{
if (needsUpdate)
{
@ -353,7 +361,12 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
PlaySound(SOUND_ANNOTATION);
}
if (nextStep)
if(specialKey)
{
s_RestoreState = SHUTDOWN;
}
if (nextStep && !specialKey)
{
s_RestoreState = RESTORE_TWL_SOUND;
}
@ -682,6 +695,15 @@ void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep,
}
break;
case SHUTDOWN:
{
// 本体初期化を行う
InitializeFileSystem();
// シャットダウンする
nn::ptm::CTR::ShutdownAsync(0, nn::fnd::TimeSpan::FromSeconds(0));
}
}
}

View File

@ -25,7 +25,7 @@ namespace ConsoleRestore
const u32 RETRY_MAX = 3;
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore);
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey);
bool InProgress();
bool IsRestoreSucceeded();
bool IsRestoreFailed();