mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
暗号式予約販売タイトルの修理をシーケンスに組み込む
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@844 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
1d7e693f9f
commit
df7a9c9db6
@ -35,6 +35,8 @@
|
|||||||
#include "Shop.h"
|
#include "Shop.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "ActCompleter.h"
|
#include "ActCompleter.h"
|
||||||
|
#include "PreorderTitleRestorerManager.h"
|
||||||
|
#include "HeapManager.h"
|
||||||
|
|
||||||
namespace ConsoleRestore
|
namespace ConsoleRestore
|
||||||
{
|
{
|
||||||
@ -96,6 +98,13 @@ bool s_ShopOperationExecuted[SHOP_OPERATION_NUM_MAX];
|
|||||||
// ショップ処理を何回リトライしたか
|
// ショップ処理を何回リトライしたか
|
||||||
u32 s_ShopOperationRetryCount[SHOP_OPERATION_NUM_MAX];
|
u32 s_ShopOperationRetryCount[SHOP_OPERATION_NUM_MAX];
|
||||||
|
|
||||||
|
// Personal eTicketで権利を持つプログラムIDのリストへのポインタ
|
||||||
|
nn::ProgramId* sp_ProgramId;
|
||||||
|
|
||||||
|
// 予約販売タイトルの修復を何回リトライしたか
|
||||||
|
u32 s_PreorderTitleRestorerRetryCount = 0;
|
||||||
|
|
||||||
|
|
||||||
ActCompleter::CompleteMode s_ActCompleteMode;
|
ActCompleter::CompleteMode s_ActCompleteMode;
|
||||||
|
|
||||||
void PutAliveMessage(common::OperationMessage& operationMessage, const char* str);
|
void PutAliveMessage(common::OperationMessage& operationMessage, const char* str);
|
||||||
@ -154,6 +163,8 @@ typedef enum RestoreState
|
|||||||
ERASE, // 削除処理を行う
|
ERASE, // 削除処理を行う
|
||||||
COMPLETE_ACT, // actアカウント移行完了処理を行う
|
COMPLETE_ACT, // actアカウント移行完了処理を行う
|
||||||
COMPLETE_ACT_WAIT, // actアカウント移行完了処理の完了待ち
|
COMPLETE_ACT_WAIT, // actアカウント移行完了処理の完了待ち
|
||||||
|
RESTORE_PREORDER_TITLE, // 予約販売タイトルの修復を行う
|
||||||
|
RESTORE_PREORDER_TITLE_WAIT, // 予約販売タイトルの修復完了待ち
|
||||||
RESTORE_CAL, // cfgの一部をcal値で上書きする
|
RESTORE_CAL, // cfgの一部をcal値で上書きする
|
||||||
REPAIR_SIMPLE_ADDRESS_ID, // 本ツールで過去に破壊されたSimpleAddress.idを修正する
|
REPAIR_SIMPLE_ADDRESS_ID, // 本ツールで過去に破壊されたSimpleAddress.idを修正する
|
||||||
TIME_ADJUST, // 時計あわせを行う
|
TIME_ADJUST, // 時計あわせを行う
|
||||||
@ -179,6 +190,8 @@ typedef enum RestoreState
|
|||||||
PREINSTALL_WAIT_USER_SD_EJECT, // ユーザSD抜き出し待ち
|
PREINSTALL_WAIT_USER_SD_EJECT, // ユーザSD抜き出し待ち
|
||||||
PREINSTALL_CHECK_REPAIR_SD_WAIT_NEXT, // 修理用SDのチェック・Aボタン待ち
|
PREINSTALL_CHECK_REPAIR_SD_WAIT_NEXT, // 修理用SDのチェック・Aボタン待ち
|
||||||
PREINSTALL_CHECK_REPAIR_SD, // 修理用SDのチェック
|
PREINSTALL_CHECK_REPAIR_SD, // 修理用SDのチェック
|
||||||
|
PREINSTALL_RESTORE_PREORDER_TITLE, // プリインストールダウンロードモード向けに予約販売タイトルの修復を行う
|
||||||
|
PREINSTALL_RESTORE_PREORDER_TITLE_WAIT, // プリインストールダウンロードモード向けに予約販売タイトルの修復完了待ち
|
||||||
|
|
||||||
RESTORE_STATE_MAX
|
RESTORE_STATE_MAX
|
||||||
} RestoreState;
|
} RestoreState;
|
||||||
@ -873,6 +886,51 @@ nn::Result ExecSyncMcuRtc(common::HardwareStateManager& manager)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SetUpProgramIdListBasedOnPersonalizedTicket(nn::ProgramId* list, s32* personalizedTicketNum)
|
||||||
|
{
|
||||||
|
const size_t MAX_TICKET_NUM = 2000;
|
||||||
|
common::HeapManager ticketBuffer(sizeof(nn::am::TicketInfo) * MAX_TICKET_NUM);
|
||||||
|
if(!ticketBuffer.GetAddr())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::am::TicketInfo* ticketInfo = new (ticketBuffer.GetAddr()) nn::am::TicketInfo[MAX_TICKET_NUM];
|
||||||
|
|
||||||
|
nn::Result result = nn::am::GetPersonalizedTicketInfoList(personalizedTicketNum, ticketInfo, MAX_TICKET_NUM);
|
||||||
|
if(result.IsFailure())
|
||||||
|
{
|
||||||
|
COMMON_LOGGER_RESULT(result, __func__)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
list = reinterpret_cast<nn::ProgramId*>(common::GetAllocator()->Allocate(
|
||||||
|
sizeof(nn::ProgramId) * (*personalizedTicketNum), nn::fnd::ExpHeap::DEFAULT_ALIGNMENT));
|
||||||
|
if(!list)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (s32 i = 0; i < *personalizedTicketNum; i++)
|
||||||
|
{
|
||||||
|
list[i] = ticketInfo[i].titleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupCountryCodeForPreorder(nn::cfg::CTR::CfgCountryCode& country)
|
||||||
|
{
|
||||||
|
if (GetCountryCodeFromEci() != nn::cfg::CTR::CFG_COUNTRY_UNDEFINED)
|
||||||
|
{
|
||||||
|
country = GetCountryCodeFromEci();
|
||||||
|
}
|
||||||
|
else if (ActCompleter::GetCountryCodeFromNna() != nn::cfg::CTR::CFG_COUNTRY_UNDEFINED)
|
||||||
|
{
|
||||||
|
country = ActCompleter::GetCountryCodeFromNna();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace <unnamed>
|
} // namespace <unnamed>
|
||||||
|
|
||||||
void ControlState(common::HardwareStateManager& manager, common::OperationMessage& operationMessage, bool& nextStep,
|
void ControlState(common::HardwareStateManager& manager, common::OperationMessage& operationMessage, bool& nextStep,
|
||||||
@ -1476,12 +1534,12 @@ void ControlState(common::HardwareStateManager& manager, common::OperationMessag
|
|||||||
if(s_GetIvsOnlyMode)
|
if(s_GetIvsOnlyMode)
|
||||||
{
|
{
|
||||||
ShopOperationSingleTemplate(manager, operationMessage, SHOP_OPERATION_CONNECT, "Shop Connect",
|
ShopOperationSingleTemplate(manager, operationMessage, SHOP_OPERATION_CONNECT, "Shop Connect",
|
||||||
"Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", WAIT_SD_EJECT);
|
"Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", RESTORE_PREORDER_TITLE);
|
||||||
}
|
}
|
||||||
else if(s_DownloadPreinstallMode)
|
else if(s_DownloadPreinstallMode)
|
||||||
{
|
{
|
||||||
ShopOperationSingleTemplate(manager, operationMessage, SHOP_OPERATION_CONNECT, "Shop Connect",
|
ShopOperationSingleTemplate(manager, operationMessage, SHOP_OPERATION_CONNECT, "Shop Connect",
|
||||||
"Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", REPAIR_SIMPLE_ADDRESS_ID);
|
"Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", PREINSTALL_RESTORE_PREORDER_TITLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1491,6 +1549,86 @@ void ControlState(common::HardwareStateManager& manager, common::OperationMessag
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RESTORE_PREORDER_TITLE:
|
||||||
|
{
|
||||||
|
s32 personalizedTicketNum;
|
||||||
|
if(!SetUpProgramIdListBasedOnPersonalizedTicket(sp_ProgramId, &personalizedTicketNum))
|
||||||
|
{
|
||||||
|
s_RestoreState = FAIL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 適切な国コードを設定する
|
||||||
|
nn::cfg::CTR::CfgCountryCode country = nn::cfg::CTR::CFG_COUNTRY_UNDEFINED;;
|
||||||
|
SetupCountryCodeForPreorder(country);
|
||||||
|
|
||||||
|
PreorderTitleRestorerManager::Start(sp_ProgramId, personalizedTicketNum, country, nn::cfg::CTR::GetRegion());
|
||||||
|
s_RestoreState = RESTORE_PREORDER_TITLE_WAIT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RESTORE_PREORDER_TITLE_WAIT:
|
||||||
|
{
|
||||||
|
PutAliveMessage(operationMessage, "Restoring PreOrdered Title");
|
||||||
|
if(PreorderTitleRestorerManager::IsFinished())
|
||||||
|
{
|
||||||
|
PreorderTitleRestorerManager::End();
|
||||||
|
if(PreorderTitleRestorerManager::GetResult().IsFailure())
|
||||||
|
{
|
||||||
|
if(s_PreorderTitleRestorerRetryCount++ < RETRY_MAX)
|
||||||
|
{
|
||||||
|
common::GetAllocator()->Free(sp_ProgramId);
|
||||||
|
s_RestoreState = RESTORE_PREORDER_TITLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_RestoreState = WAIT_SD_EJECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PREINSTALL_RESTORE_PREORDER_TITLE:
|
||||||
|
{
|
||||||
|
s32 personalizedTicketNum;
|
||||||
|
if(!SetUpProgramIdListBasedOnPersonalizedTicket(sp_ProgramId, &personalizedTicketNum))
|
||||||
|
{
|
||||||
|
s_RestoreState = FAIL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// アカウントから国コードが取れないので、UNDEFINEDを渡す
|
||||||
|
PreorderTitleRestorerManager::Start(sp_ProgramId, personalizedTicketNum, nn::cfg::CTR::CFG_COUNTRY_UNDEFINED, nn::cfg::CTR::GetRegion());
|
||||||
|
s_RestoreState = PREINSTALL_RESTORE_PREORDER_TITLE_WAIT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PREINSTALL_RESTORE_PREORDER_TITLE_WAIT:
|
||||||
|
{
|
||||||
|
PutAliveMessage(operationMessage, "Restoring PreOrdered Title");
|
||||||
|
if(PreorderTitleRestorerManager::IsFinished())
|
||||||
|
{
|
||||||
|
PreorderTitleRestorerManager::End();
|
||||||
|
if(PreorderTitleRestorerManager::GetResult().IsFailure())
|
||||||
|
{
|
||||||
|
if(s_PreorderTitleRestorerRetryCount++ < RETRY_MAX)
|
||||||
|
{
|
||||||
|
common::GetAllocator()->Free(sp_ProgramId);
|
||||||
|
s_RestoreState = PREINSTALL_RESTORE_PREORDER_TITLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_RestoreState = REPAIR_SIMPLE_ADDRESS_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case DOWNLOAD_TWL:
|
case DOWNLOAD_TWL:
|
||||||
{
|
{
|
||||||
// ファイルリストがなければ次へ
|
// ファイルリストがなければ次へ
|
||||||
@ -2134,6 +2272,7 @@ void InitializeState()
|
|||||||
s_PlayedFailSound = false;
|
s_PlayedFailSound = false;
|
||||||
s_ExecuteFgNup = false;
|
s_ExecuteFgNup = false;
|
||||||
s_FgNupRetryCount = 0;
|
s_FgNupRetryCount = 0;
|
||||||
|
s_PreorderTitleRestorerRetryCount = 0;
|
||||||
|
|
||||||
s_NupOnlyMode = false;
|
s_NupOnlyMode = false;
|
||||||
s_GetIvsOnlyMode = false;
|
s_GetIvsOnlyMode = false;
|
||||||
@ -2171,6 +2310,10 @@ u32 GetProgress()
|
|||||||
{
|
{
|
||||||
return GetTitleDownloadProgress();
|
return GetTitleDownloadProgress();
|
||||||
}
|
}
|
||||||
|
else if(s_RestoreState == RESTORE_PREORDER_TITLE_WAIT || s_RestoreState == PREINSTALL_RESTORE_PREORDER_TITLE_WAIT)
|
||||||
|
{
|
||||||
|
return PreorderTitleRestorerManager::GetProgress();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ SOURCES[] =
|
|||||||
NinjaCommunicator.cpp
|
NinjaCommunicator.cpp
|
||||||
SimpleXmlPreprocessor.cpp
|
SimpleXmlPreprocessor.cpp
|
||||||
PreorderTitleRestorer.cpp
|
PreorderTitleRestorer.cpp
|
||||||
|
PreorderTitleRestorerManager.cpp
|
||||||
NinjaXmlReader.cpp
|
NinjaXmlReader.cpp
|
||||||
../common/Util.cpp
|
../common/Util.cpp
|
||||||
../common/DrawSystemState.cpp
|
../common/DrawSystemState.cpp
|
||||||
|
|||||||
@ -53,7 +53,7 @@ const size_t s_TypicalCountryCodeSize = sizeof(s_TypicalCountryCode) / sizeof(s_
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PreorderTitleRestorer::PreorderTitleRestorer()
|
PreorderTitleRestorer::PreorderTitleRestorer() : m_Progress(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -66,6 +66,7 @@ nn::Result PreorderTitleRestorer::Execute(nn::ProgramId list[], size_t size, nn:
|
|||||||
{
|
{
|
||||||
for(s32 i = 0; i < size; ++i)
|
for(s32 i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
|
m_Progress = i * 100 / size;
|
||||||
std::string xml;
|
std::string xml;
|
||||||
nn::cfg::CfgCountryCode deliveredCountry;
|
nn::cfg::CfgCountryCode deliveredCountry;
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(
|
||||||
@ -78,6 +79,11 @@ nn::Result PreorderTitleRestorer::Execute(nn::ProgramId list[], size_t size, nn:
|
|||||||
return nn::ResultSuccess();
|
return nn::ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 PreorderTitleRestorer::GetProgress()
|
||||||
|
{
|
||||||
|
return m_Progress;
|
||||||
|
}
|
||||||
|
|
||||||
nn::Result PreorderTitleRestorer::GetExternalSeedInfo(
|
nn::Result PreorderTitleRestorer::GetExternalSeedInfo(
|
||||||
nn::cfg::CTR::CfgCountryCode* deliveredCountry,
|
nn::cfg::CTR::CfgCountryCode* deliveredCountry,
|
||||||
std::string& xml,
|
std::string& xml,
|
||||||
|
|||||||
@ -32,13 +32,17 @@ public:
|
|||||||
PreorderTitleRestorer();
|
PreorderTitleRestorer();
|
||||||
virtual ~PreorderTitleRestorer();
|
virtual ~PreorderTitleRestorer();
|
||||||
|
|
||||||
//! @brief @予約販売タイトルの修復を行います
|
//! @brief 予約販売タイトルの修復を行います
|
||||||
//! @param[in] list[] Personalized eTicketで権利を持っているタイトルの配列
|
//! @param[in] list[] Personalized eTicketで権利を持っているタイトルの配列
|
||||||
//! @param[in] size listのサイズ
|
//! @param[in] size listのサイズ
|
||||||
//! @param[in] country 国コード。国コードが取得できない場合はCFG_COUNTRY_UNDEFINEDを渡してください
|
//! @param[in] country 国コード。国コードが取得できない場合はCFG_COUNTRY_UNDEFINEDを渡してください
|
||||||
//! @param[in] region リージョンコード
|
//! @param[in] region リージョンコード
|
||||||
nn::Result Execute(nn::ProgramId list[], size_t size, nn::cfg::CTR::CfgCountryCode country, nn::cfg::CTR::CfgRegionCode region);
|
nn::Result Execute(nn::ProgramId list[], size_t size, nn::cfg::CTR::CfgCountryCode country, nn::cfg::CTR::CfgRegionCode region);
|
||||||
|
|
||||||
|
// @brief 進捗状況を取得します
|
||||||
|
// @return 0-100の進捗
|
||||||
|
u64 GetProgress();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nn::Result GetExternalSeedInfo(
|
nn::Result GetExternalSeedInfo(
|
||||||
nn::cfg::CTR::CfgCountryCode* deliveredCountry,
|
nn::cfg::CTR::CfgCountryCode* deliveredCountry,
|
||||||
@ -57,6 +61,7 @@ private:
|
|||||||
bool IsValidCountry(nn::cfg::CfgCountryCode countryCode, nn::cfg::CfgRegionCode region);
|
bool IsValidCountry(nn::cfg::CfgCountryCode countryCode, nn::cfg::CfgRegionCode region);
|
||||||
|
|
||||||
std::map<nn::cfg::CTR::CfgCountryCode, bool> m_SuccessfulCountryMap;
|
std::map<nn::cfg::CTR::CfgCountryCode, bool> m_SuccessfulCountryMap;
|
||||||
|
u64 m_Progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ConsoleRestore */
|
} /* namespace ConsoleRestore */
|
||||||
|
|||||||
@ -0,0 +1,94 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: Horizon
|
||||||
|
File: PreorderTitleRestoreManager.cpp
|
||||||
|
|
||||||
|
Copyright (C)2015 Nintendo Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
|
These coded instructions, statements, and computer programs contain
|
||||||
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||||
|
Company Ltd., and are protected by Federal copyright law. They may
|
||||||
|
not be disclosed to third parties or copied or duplicated in any form,
|
||||||
|
in whole or in part, without the prior written consent of Nintendo.
|
||||||
|
|
||||||
|
$Rev$
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
#include "PreorderTitleRestorerManager.h"
|
||||||
|
#include "HeapManager.h"
|
||||||
|
|
||||||
|
namespace ConsoleRestore
|
||||||
|
{
|
||||||
|
|
||||||
|
const size_t PreorderTitleRestorerManager::STACK_SIZE;
|
||||||
|
nn::Result PreorderTitleRestorerManager::s_Result;
|
||||||
|
nn::os::Thread PreorderTitleRestorerManager::s_Thread;
|
||||||
|
nn::os::StackBuffer<PreorderTitleRestorerManager::STACK_SIZE> PreorderTitleRestorerManager::s_ThreadStack;
|
||||||
|
bool PreorderTitleRestorerManager::s_Started = false;
|
||||||
|
PreorderTitleRestorer* PreorderTitleRestorerManager::m_Restorer = NULL;
|
||||||
|
nn::ProgramId* PreorderTitleRestorerManager::s_List;
|
||||||
|
size_t PreorderTitleRestorerManager::s_Size;
|
||||||
|
nn::cfg::CTR::CfgCountryCode PreorderTitleRestorerManager::s_Country;
|
||||||
|
nn::cfg::CTR::CfgRegionCode PreorderTitleRestorerManager::s_Region;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PreorderTitleRestorerManager::PreorderTitleRestorerManager()
|
||||||
|
{
|
||||||
|
// TODO 自動生成されたコンストラクター・スタブ
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PreorderTitleRestorerManager::~PreorderTitleRestorerManager()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated destructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreorderTitleRestorerManager::Start(nn::ProgramId list[], size_t size, nn::cfg::CTR::CfgCountryCode country, nn::cfg::CTR::CfgRegionCode region)
|
||||||
|
{
|
||||||
|
if(!s_Started)
|
||||||
|
{
|
||||||
|
s_List = list;
|
||||||
|
s_Size = size;
|
||||||
|
s_Country = country;
|
||||||
|
s_Region = region;
|
||||||
|
s_Thread.Start(ThreadFunc, s_ThreadStack);
|
||||||
|
s_Started = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PreorderTitleRestorerManager::IsFinished()
|
||||||
|
{
|
||||||
|
return s_Thread.IsAlive();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::Result PreorderTitleRestorerManager::GetResult()
|
||||||
|
{
|
||||||
|
return s_Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreorderTitleRestorerManager::End()
|
||||||
|
{
|
||||||
|
if(s_Started)
|
||||||
|
{
|
||||||
|
s_Thread.Join();
|
||||||
|
s_Thread.Finalize();
|
||||||
|
if(m_Restorer)
|
||||||
|
{
|
||||||
|
delete m_Restorer;
|
||||||
|
}
|
||||||
|
s_Started = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 PreorderTitleRestorerManager::GetProgress()
|
||||||
|
{
|
||||||
|
return m_Restorer->GetProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreorderTitleRestorerManager::ThreadFunc()
|
||||||
|
{
|
||||||
|
m_Restorer = new PreorderTitleRestorer;
|
||||||
|
s_Result = m_Restorer->Execute(s_List, s_Size, s_Country, s_Region);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace ConsoleRestore */
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: Horizon
|
||||||
|
File: PreorderTitleRestoreManager.h
|
||||||
|
|
||||||
|
Copyright (C)2015 Nintendo Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
|
These coded instructions, statements, and computer programs contain
|
||||||
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||||
|
Company Ltd., and are protected by Federal copyright law. They may
|
||||||
|
not be disclosed to third parties or copied or duplicated in any form,
|
||||||
|
in whole or in part, without the prior written consent of Nintendo.
|
||||||
|
|
||||||
|
$Rev$
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
#ifndef SOURCES_CONSOLERESTORE_PREORDERTITLERESTORERMANAGER_H_
|
||||||
|
#define SOURCES_CONSOLERESTORE_PREORDERTITLERESTORERMANAGER_H_
|
||||||
|
|
||||||
|
#include <nn/Result.h>
|
||||||
|
#include <nn/cfg.h>
|
||||||
|
#include <nn/CTR/CTR_ProgramId.h>
|
||||||
|
#include "PreorderTitleRestorer.h"
|
||||||
|
|
||||||
|
namespace ConsoleRestore
|
||||||
|
{
|
||||||
|
|
||||||
|
class PreorderTitleRestorerManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PreorderTitleRestorerManager();
|
||||||
|
virtual ~PreorderTitleRestorerManager();
|
||||||
|
|
||||||
|
// 修復を開始する。既に開始していた場合何もしない
|
||||||
|
static void Start(nn::ProgramId list[], size_t size, nn::cfg::CTR::CfgCountryCode country, nn::cfg::CTR::CfgRegionCode region);
|
||||||
|
|
||||||
|
static bool IsFinished();
|
||||||
|
static nn::Result GetResult();
|
||||||
|
static void End();
|
||||||
|
static u64 GetProgress();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void ThreadFunc();
|
||||||
|
static nn::ProgramId* s_List;
|
||||||
|
static size_t s_Size;
|
||||||
|
static nn::cfg::CTR::CfgCountryCode s_Country;
|
||||||
|
static nn::cfg::CTR::CfgRegionCode s_Region;
|
||||||
|
|
||||||
|
static nn::Result s_Result;
|
||||||
|
static nn::os::Thread s_Thread;
|
||||||
|
static const size_t STACK_SIZE = 12 * 1024;
|
||||||
|
static nn::os::StackBuffer<STACK_SIZE> s_ThreadStack;
|
||||||
|
static PreorderTitleRestorer* m_Restorer;
|
||||||
|
static bool s_Started;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace ConsoleRestore */
|
||||||
|
|
||||||
|
#endif /* SOURCES_CONSOLERESTORE_PREORDERTITLERESTORERMANAGER_H_ */
|
||||||
Loading…
Reference in New Issue
Block a user