mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
1.5CUP済み本体の場合 or IVS取得モードの場合、移行先が1.5CUP状態でなければエラーにする
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@463 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
af51014941
commit
26e053cf0b
@ -88,6 +88,11 @@ bool s_ShopOperationExecuted[SHOP_OPERATION_NUM_MAX];
|
||||
// ショップ処理を何回リトライしたか
|
||||
u32 s_ShopOperationRetryCount[SHOP_OPERATION_NUM_MAX];
|
||||
|
||||
// SDカード上のバージョン情報を読んだかどうか
|
||||
bool s_ReadSdVersionData = false;
|
||||
// CUPが必要かどうか
|
||||
bool s_NeedsCup = true;
|
||||
|
||||
void PutAliveMessage(::std::vector<std::string>& operationMessage, const char* str);
|
||||
bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage);
|
||||
|
||||
@ -101,6 +106,22 @@ bool HasValidRtcData()
|
||||
return !s_CheckSdOnlyMode && !s_NupOnlyMode && !s_GetIvsOnlyMode;
|
||||
}
|
||||
|
||||
bool IsLowerthan1_5(common::HardwareStateManager& manager)
|
||||
{
|
||||
common::VerDef version;
|
||||
manager.GetVersionData(&version);
|
||||
if (version.cup.majorVersion < common::CUP_MAJOR_VER_1_5_CUP
|
||||
|| version.cup.minorVersion < common::CUP_MINOR_VER_1_5_CUP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef enum RestoreState
|
||||
{
|
||||
STARTUP, // 初期値
|
||||
@ -157,6 +178,7 @@ void CheckSdInserted(common::HardwareStateManager& manager, ::std::vector<std::s
|
||||
void CheckAcAdapter(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckSdWritable(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckApSetting(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
bool CheckNeedsCup(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckNupExecuted(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckDownloadIvs(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
void CheckAccountDeleted(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep);
|
||||
@ -226,6 +248,14 @@ void CheckApSetting(common::HardwareStateManager& manager, ::std::vector<std::st
|
||||
|
||||
if (CheckAndReadAPSetting(message))
|
||||
{
|
||||
// 1.5CUP限定
|
||||
// バックアップバージョンが1.5CUP or IVS取得モードなら
|
||||
// リストアせずCUPツールを要求する画面に飛ばす。
|
||||
if(CheckNeedsCup(manager, message, goNextStep))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s_RestoreState = IMPORT_RTC;
|
||||
}
|
||||
else
|
||||
@ -234,6 +264,55 @@ void CheckApSetting(common::HardwareStateManager& manager, ::std::vector<std::st
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckNeedsCup(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep)
|
||||
{
|
||||
NN_UNUSED_VAR(message);
|
||||
NN_UNUSED_VAR(goNextStep);
|
||||
|
||||
if (s_GetIvsOnlyMode)
|
||||
{
|
||||
if (IsLowerthan1_5(manager))
|
||||
{
|
||||
COMMON_LOGGER("New Version Required.\n");
|
||||
s_RestoreState = FAIL;
|
||||
s_NeedsCup = true;
|
||||
return s_NeedsCup;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_NeedsCup = false;
|
||||
return s_NeedsCup;
|
||||
}
|
||||
}
|
||||
|
||||
if(s_ReadSdVersionData)
|
||||
{
|
||||
return s_NeedsCup;
|
||||
}
|
||||
|
||||
nn::Result result = ReadVersionData();
|
||||
s_ReadSdVersionData = true;
|
||||
if(result.IsFailure())
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
s_NeedsCup = true;
|
||||
return s_NeedsCup;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Is1_5CUPExecuted() && IsLowerthan1_5(manager))
|
||||
{
|
||||
COMMON_LOGGER("New Version Required.\n");
|
||||
s_RestoreState = FAIL;
|
||||
s_NeedsCup = true;
|
||||
return s_NeedsCup;
|
||||
}
|
||||
|
||||
s_NeedsCup = false;
|
||||
return s_NeedsCup;
|
||||
}
|
||||
}
|
||||
|
||||
// NUP済みかどうかチェック
|
||||
void CheckNupExecuted(common::HardwareStateManager& manager, ::std::vector<std::string>& message, bool& goNextStep)
|
||||
{
|
||||
|
||||
@ -1880,6 +1880,12 @@ bool IsImportSucceeded()
|
||||
return s_IsImportSucceeded;
|
||||
}
|
||||
|
||||
bool Is1_5CUPExecuted()
|
||||
{
|
||||
return s_SDVersionData.cup.majorVersion == common::CUP_MAJOR_VER_1_5_CUP &&
|
||||
s_SDVersionData.cup.minorVersion == common::CUP_MINOR_VER_1_5_CUP;
|
||||
}
|
||||
|
||||
nn::Result ImportData()
|
||||
{
|
||||
static nn::Result result = nn::ResultSuccess();
|
||||
|
||||
@ -160,6 +160,10 @@ bool ImportIvsData();
|
||||
// 書き込みが成功したかどうか
|
||||
bool IsImportSucceeded();
|
||||
|
||||
// 1.5CUP限定
|
||||
// 1.5CUP済み本体かどうか
|
||||
bool Is1_5CUPExecuted();
|
||||
|
||||
}
|
||||
|
||||
#endif /* IMPORTER_H_ */
|
||||
|
||||
@ -41,6 +41,9 @@ const u64 INFRA_DEVICE_ID_OFFSET = 0x400000000;
|
||||
|
||||
const size_t FILE_COPY_HEAP_SIZE = 16 * 1024 * 1024;
|
||||
|
||||
const u8 CUP_MAJOR_VER_1_5_CUP = 2;
|
||||
const u8 CUP_MINOR_VER_1_5_CUP = 2;
|
||||
|
||||
// NOR領域のみにある設定データ用構造体
|
||||
struct NtrNorData
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user