mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
NNA移行完了処理を追加
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@761 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
a93a2a22d0
commit
e1e5748ccf
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: ActCompleter.cpp
|
||||
|
||||
Copyright (C)2013 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 "ActCompleter.h"
|
||||
#include "Util.h"
|
||||
#include "CommonLogger.h"
|
||||
#include <nn/ac/CTR/private/ac_InternalApi.h>
|
||||
#include <nn/act/act_ApiAdmin.h>
|
||||
#include <nn/act/act_ApiTransfer.h>
|
||||
#include <nn/act/act_ResultPrivate.h>
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
nn::Result ActCompleter::s_Result;
|
||||
const size_t ActCompleter::STACK_SIZE;
|
||||
nn::os::Thread ActCompleter::s_Thread;
|
||||
nn::os::StackBuffer<ActCompleter::STACK_SIZE> ActCompleter::s_ThreadStack;
|
||||
|
||||
|
||||
ActCompleter::ActCompleter()
|
||||
{
|
||||
// TODO 自動生成されたコンストラクター・スタブ
|
||||
|
||||
}
|
||||
|
||||
ActCompleter::~ActCompleter()
|
||||
{
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
nn::Result ActCompleter::GetResult()
|
||||
{
|
||||
return s_Result;
|
||||
}
|
||||
|
||||
void ActCompleter::Start()
|
||||
{
|
||||
s_Thread.Start(Exec, s_ThreadStack);
|
||||
}
|
||||
|
||||
bool ActCompleter::IsFinished()
|
||||
{
|
||||
return s_Thread.IsValid() && !s_Thread.IsAlive();
|
||||
}
|
||||
|
||||
void ActCompleter::Finish()
|
||||
{
|
||||
s_Thread.Join();
|
||||
s_Thread.Finalize();
|
||||
}
|
||||
|
||||
void ActCompleter::Exec()
|
||||
{
|
||||
if(!nn::ac::IsConnected())
|
||||
{
|
||||
s_Result = common::InitializeNetwork();
|
||||
COMMON_LOGGER_RETURN_VOID_IF_FAILED(s_Result);
|
||||
}
|
||||
|
||||
s_Result = nn::act::InitializeAdmin();
|
||||
COMMON_LOGGER_RETURN_VOID_IF_FAILED(s_Result);
|
||||
|
||||
s_Result = nn::act::CompleteTransfer();
|
||||
if(s_Result.IsFailure())
|
||||
{
|
||||
if (nn::act::ResultAccountNotLoaded().Includes(s_Result) || nn::act::ResultAuthenticationError().Includes(s_Result))
|
||||
{
|
||||
// これらは発生する可能性があるので成功で上書きする
|
||||
s_Result = nn::ResultSuccess();
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER_RETURN_VOID_IF_FAILED(s_Result);
|
||||
}
|
||||
}
|
||||
|
||||
s_Result = nn::act::FinalizeAdmin();
|
||||
COMMON_LOGGER_RETURN_VOID_IF_FAILED(s_Result);
|
||||
|
||||
s_Result = common::FinalizeNetwork();
|
||||
COMMON_LOGGER_RETURN_VOID_IF_FAILED(s_Result);
|
||||
}
|
||||
|
||||
} /* namespace ConsoleRestore */
|
||||
@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: ActCompleter.h
|
||||
|
||||
Copyright (C)2013 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 ACTCOMPLETER_H_
|
||||
#define ACTCOMPLETER_H_
|
||||
|
||||
#include <nn.h>
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
class ActCompleter
|
||||
{
|
||||
public:
|
||||
ActCompleter();
|
||||
virtual ~ActCompleter();
|
||||
|
||||
static nn::Result GetResult();
|
||||
static void Start();
|
||||
static bool IsFinished();
|
||||
static void Finish();
|
||||
|
||||
private:
|
||||
static void Exec();
|
||||
static nn::Result s_Result;
|
||||
static const size_t STACK_SIZE = 0x1000;
|
||||
static nn::os::Thread s_Thread;
|
||||
static nn::os::StackBuffer<STACK_SIZE> s_ThreadStack;
|
||||
|
||||
};
|
||||
|
||||
} /* namespace ConsoleRestore */
|
||||
#endif /* ACTCOMPLETER_H_ */
|
||||
@ -34,6 +34,7 @@
|
||||
#include "TitleDownloader.h"
|
||||
#include "Shop.h"
|
||||
#include "Util.h"
|
||||
#include "ActCompleter.h"
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
@ -72,6 +73,9 @@ bool s_ExecuteTwlTitleDownload = false;
|
||||
// TWLタイトルのダウンロードを何回リトライしたか
|
||||
u32 s_TwlTitleDownloadRetryCount = 0;
|
||||
|
||||
// NNA転送完了を何回リトライしたか
|
||||
u32 s_NNATransferRetryCount = 0;
|
||||
|
||||
// プリインストールタイトルのダウンロード準備を開始したかどうか
|
||||
bool s_ExecutePreparePreinstallTitleDownload = false;
|
||||
// プリインストールタイトルのダウンロード準備を何回リトライしたか
|
||||
@ -144,6 +148,8 @@ typedef enum RestoreState
|
||||
RESTORE_DONE, // 書き込み完了
|
||||
REBOOTING, // 再起動を行う
|
||||
ERASE, // 削除処理を行う
|
||||
COMPLETE_ACT, // actアカウント移行完了処理を行う
|
||||
COMPLETE_ACT_WAIT, // actアカウント移行完了処理の完了待ち
|
||||
RESTORE_CAL, // cfgの一部をcal値で上書きする
|
||||
REPAIR_SIMPLE_ADDRESS_ID, // 本ツールで過去に破壊されたSimpleAddress.idを修正する
|
||||
TIME_ADJUST, // 時計あわせを行う
|
||||
@ -1389,11 +1395,50 @@ void ControlState(common::HardwareStateManager& manager, common::OperationMessag
|
||||
result = InitializeHardwareDependentSetting();
|
||||
if (result.IsFailure())
|
||||
{
|
||||
COMMON_LOGGER_RESULT(result, __func__);
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = COMPLETE_ACT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
COMMON_LOGGER("Sync eTicket\n");
|
||||
s_RestoreState = SYNC_TICKET;
|
||||
case COMPLETE_ACT:
|
||||
{
|
||||
COMMON_LOGGER("Complete NNA Transfer\n");
|
||||
ActCompleter::Start();
|
||||
s_RestoreState = COMPLETE_ACT_WAIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPLETE_ACT_WAIT:
|
||||
{
|
||||
PutAliveMessage(operationMessage, "Complete NNA Transfer");
|
||||
if (ActCompleter::IsFinished())
|
||||
{
|
||||
ActCompleter::Finish();
|
||||
result = ActCompleter::GetResult();
|
||||
if (result.IsFailure())
|
||||
{
|
||||
if(++s_NNATransferRetryCount >= RETRY_MAX)
|
||||
{
|
||||
COMMON_LOGGER_RESULT(result, __func__);
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER("Complete NNA Transfer failed, Retrying...");
|
||||
s_RestoreState = COMPLETE_ACT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER("Sync eTicket\n");
|
||||
s_RestoreState = SYNC_TICKET;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ SOURCES[] =
|
||||
Shop.cpp
|
||||
RegionIdModifier.cpp
|
||||
PreinstallImporter.cpp
|
||||
ActCompleter.cpp
|
||||
../common/Util.cpp
|
||||
../common/DrawSystemState.cpp
|
||||
../common/FileTransfer.cpp
|
||||
@ -75,6 +76,7 @@ LIBS += libnn_cfg \
|
||||
libnn_am \
|
||||
libnn_nim \
|
||||
libnn_xml_simple \
|
||||
libnn_act \
|
||||
|
||||
QRE_LIBRARIES[] = libmw_qre
|
||||
LIBFILES += $`(addprefix $(CTRMW_QRE_ROOT)$(DIRSEP)$(SUBDIR_LIBRARIES)$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), $(QRE_LIBRARIES)) \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user