mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
TitleDownloaderでプリインストールタイトルをダウンロードできるように
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@589 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
d2f55502a0
commit
38b5e07c82
@ -34,6 +34,7 @@ SOURCES[] =
|
||||
SimpleXmlPreprocessor.cpp
|
||||
XmlCreator.cpp
|
||||
BgsCommunicator.cpp
|
||||
PreinstallImporter.cpp
|
||||
../common/Util.cpp
|
||||
../common/DrawSystemState.cpp
|
||||
../common/FileTransfer.cpp
|
||||
@ -71,6 +72,7 @@ LIBS += libnn_cfg \
|
||||
libnn_ns \
|
||||
libnn_am \
|
||||
libnn_nim \
|
||||
libnn_xml_simple \
|
||||
|
||||
INSTALL_SDK_TOOL = true
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <nn/am.h>
|
||||
#include <nn/nim.h>
|
||||
#include <nn/CTR/CTR_ProgramId.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiSys.h>
|
||||
|
||||
#include "common_Types.h"
|
||||
#include "FileName.h"
|
||||
@ -25,6 +26,7 @@
|
||||
#include "TitleDownloader.h"
|
||||
#include "Shop.h"
|
||||
#include "SdReaderWriter.h"
|
||||
#include "PreinstallImporter.h"
|
||||
|
||||
|
||||
namespace
|
||||
@ -131,11 +133,37 @@ void TwlTitleDownloaderThreadFunc()
|
||||
TwlTitleDownloader.Start();
|
||||
}
|
||||
|
||||
void PreinstallTitleDownloaderThreadFunc(PreinstallListupParam param)
|
||||
{
|
||||
TitleDownloader PreinstallTitleDownloader;
|
||||
PreinstallImporter importer;
|
||||
|
||||
s_Progress = 0;
|
||||
size_t num = 0;
|
||||
nn::ProgramId list[256];
|
||||
TitleDownloader::m_Result = importer.ListTitles(list, &num, param.deviceId, param.serialNo);
|
||||
if(TitleDownloader::m_Result.IsFailure())
|
||||
{
|
||||
return;
|
||||
}
|
||||
PreinstallTitleDownloader.SetupTitleList(list, num);
|
||||
PreinstallTitleDownloader.Start();
|
||||
}
|
||||
|
||||
void StartTwlTitleDownload()
|
||||
{
|
||||
s_TitleDownloaderThread.Start(TwlTitleDownloaderThreadFunc, s_TitleDownloaderThreadStack);
|
||||
}
|
||||
|
||||
void StartPreinstallTitleDownload(bit64 deviceId, u8* serialNo)
|
||||
{
|
||||
PreinstallListupParam param;
|
||||
param.deviceId = deviceId;
|
||||
std::memcpy(param.serialNo, serialNo, nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN);
|
||||
|
||||
s_TitleDownloaderThread.Start(PreinstallTitleDownloaderThreadFunc, param, s_TitleDownloaderThreadStack);
|
||||
}
|
||||
|
||||
bool IsDownloadTitleFinished()
|
||||
{
|
||||
return s_TitleDownloaderThread.IsValid() && !s_TitleDownloaderThread.IsAlive();
|
||||
|
||||
@ -24,6 +24,18 @@ namespace ConsoleRestore
|
||||
// 新たにスレッドを立て、TWLタイトルのダウンロードを開始する
|
||||
void StartTwlTitleDownload();
|
||||
|
||||
//! @brief 新たにスレッドを立て、プリインストールタイトルのダウンロードを開始します <BR/>
|
||||
//! SDカードはインポート可能な状態にしておく必要があります。
|
||||
void StartPreinstallTitleDownload(bit64 deviceId, u8* serialNo);
|
||||
|
||||
|
||||
// プリインストール情報取得に必要なパラメータをまとめた構造体
|
||||
struct PreinstallListupParam
|
||||
{
|
||||
bit64 deviceId;
|
||||
u8 serialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN];
|
||||
};
|
||||
|
||||
//! @brief ダウンロードするTWLタイトルをSDカードからリストアップする
|
||||
nn::Result ListUpTwlTitles(nn::ProgramId* list, size_t* num);
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ void PreinstallImporterTest::ListUp()
|
||||
{
|
||||
ConsoleRestore::PreinstallImporter importer;
|
||||
|
||||
size_t num = 0;
|
||||
size_t num;
|
||||
nn::ProgramId list[256];
|
||||
NN_TEST_ASSERT_RESULT_SUCCESS(
|
||||
importer.ListTitles(list, &num, 17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940"))));
|
||||
|
||||
@ -27,6 +27,10 @@ INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR) \
|
||||
TEST_COMMON_SOURCES[] =
|
||||
../../../ConsoleRestore/TitleDownloader.cpp
|
||||
../../../ConsoleRestore/Shop.cpp
|
||||
../../../ConsoleRestore/BgsCommunicator.cpp
|
||||
../../../ConsoleRestore/SimpleXmlPreprocessor.cpp
|
||||
../../../ConsoleRestore/XmlCreator.cpp
|
||||
../../../ConsoleRestore/PreinstallImporter.cpp
|
||||
../../../common/Util.cpp
|
||||
../../../common/HeapManager.cpp
|
||||
../../../common/SdLogger.cpp
|
||||
@ -53,6 +57,7 @@ LIBS += libnn_test \
|
||||
libnn_am \
|
||||
lib_demo \
|
||||
libnn_nim \
|
||||
libnn_xml_simple \
|
||||
|
||||
|
||||
ROM_SPEC_FILE = ../../../ConsoleRestore/ConsoleRestore.rsf
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/test/test_Test.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiInit.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiSys.h>
|
||||
#include <nn/fs.h>
|
||||
#include <nn/fs/CTR/fs_ArchiveTypesForSystem.h>
|
||||
@ -39,9 +40,11 @@ public:
|
||||
TitleDownloaderTest() {
|
||||
SUITE_NAME("TestUtil");
|
||||
TEST_ADD(TitleDownloaderTest::ListUp);
|
||||
TEST_ADD(TitleDownloaderTest::DownloadPreinstall);
|
||||
}
|
||||
private:
|
||||
void ListUp();
|
||||
void DownloadPreinstall();
|
||||
};
|
||||
|
||||
namespace
|
||||
@ -61,6 +64,8 @@ bool TitleDownloaderTest::InitializeSuite()
|
||||
nn::os::Initialize();
|
||||
|
||||
nn::fs::Initialize();
|
||||
nn::cfg::CTR::init::Initialize();
|
||||
nn::cfg::CTR::system::Initialize();
|
||||
|
||||
// amの初期化
|
||||
nn::am::InitializeForLocalImporter();
|
||||
@ -107,6 +112,16 @@ void TitleDownloaderTest::ListUp()
|
||||
dl.SetupTitleList(list, num);
|
||||
}
|
||||
|
||||
void TitleDownloaderTest::DownloadPreinstall()
|
||||
{
|
||||
ConsoleRestore::StartPreinstallTitleDownload(17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940")));
|
||||
|
||||
while(!ConsoleRestore::IsDownloadTitleFinished())
|
||||
{
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
NN_TEST_DEFINE_MAIN(TitleDownloaderTest)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user