/*---------------------------------------------------------------------------* Project: Horizon File: PreinstallImporter.cpp Copyright 2009-2011 Nintendo. 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 "CommonLogger.h" #include "HeapManager.h" #include "PreinstallImporter.h" #include #include namespace ConsoleRestore { PreinstallImporter::PreinstallImporter() { // TODO 自動生成されたコンストラクター・スタブ } PreinstallImporter::~PreinstallImporter() { // TODO Auto-generated destructor stub } nn::Result PreinstallImporter::SetupSd(bool* isAlreadyAvailable, bool forcePreinstall) { // SDカードがインポート可能状態かどうかチェック COMMON_LOGGER_RETURN_RESULT_IF_FAILED( nn::am::QueryAvailableExternalTitleDatabase(isAlreadyAvailable) ); // タイトルデータベースを作成する if (!*isAlreadyAvailable) { COMMON_LOGGER_RETURN_RESULT_IF_FAILED( nn::am::InitializeExternalTitleDatabase() ); } if(forcePreinstall) { // 未初期化として返す *isAlreadyAvailable = false; } return nn::ResultSuccess(); } nn::Result PreinstallImporter::ListTitlesBasedOnTickets(nn::ProgramId* list, size_t* num) { s32 personalizedTicketNum; nn::am::TicketInfo ticketInfo[256]; COMMON_LOGGER_RETURN_RESULT_IF_FAILED( nn::am::GetPersonalizedTicketInfoList(&personalizedTicketNum, ticketInfo, 256) ); if(personalizedTicketNum == 0) { return nn::MakePermanentResult(nn::Result::SUMMARY_NOT_FOUND, nn::Result::MODULE_APPLICATION, nn::Result::DESCRIPTION_NOT_FOUND); } *num = 0; for(s32 i = 0; i < personalizedTicketNum; i++) { list[*num] = ticketInfo[i].titleId; (*num)++; } return nn::ResultSuccess(); } } /* namespace ConsoleRestore */