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@777 385bec56-5757-e545-9c3a-d8741f4650f1
84 lines
2.4 KiB
C++
84 lines
2.4 KiB
C++
/*---------------------------------------------------------------------------*
|
|
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 <cstring>
|
|
#include <nn/am/am_ApiSystemMenu.h>
|
|
|
|
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 */
|