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@761 385bec56-5757-e545-9c3a-d8741f4650f1
97 lines
2.5 KiB
C++
97 lines
2.5 KiB
C++
/*---------------------------------------------------------------------------*
|
|
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 */
|