/*---------------------------------------------------------------------------* 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 #include #include #include namespace ConsoleRestore { nn::Result ActCompleter::s_Result; const size_t ActCompleter::STACK_SIZE; nn::os::Thread ActCompleter::s_Thread; nn::os::StackBuffer 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() { s_Result = ExecImpl(); } nn::Result ActCompleter::ExecImpl() { if(!nn::ac::IsConnected()) { NN_UTIL_RETURN_IF_FAILED( common::InitializeNetwork()); } NN_UTIL_RETURN_IF_FAILED( nn::act::InitializeAdmin()); nn::Result result = nn::act::CompleteTransfer(); if(result.IsFailure()) { if (nn::act::ResultAccountNotLoaded().Includes(result) || nn::act::ResultAuthenticationError().Includes(result)) { // これらは発生する可能性があるので無視する } else { return result; } } NN_UTIL_RETURN_IF_FAILED( nn::act::FinalizeAdmin()); NN_UTIL_RETURN_IF_FAILED( common::FinalizeNetwork()); return nn::ResultSuccess(); } } /* namespace ConsoleRestore */