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@584 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
659b16d75d
commit
e3b63e777b
@ -265,7 +265,7 @@ bool BgsCommunicator::Execute(const void* buf, size_t size)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BgsCommunicator::GetBodySize()
|
bool BgsCommunicator::GetBodySize(size_t* size)
|
||||||
{
|
{
|
||||||
//HTTPヘッダの情報読み出し
|
//HTTPヘッダの情報読み出し
|
||||||
s32 statusCode = 0;
|
s32 statusCode = 0;
|
||||||
@ -278,10 +278,10 @@ size_t BgsCommunicator::GetBodySize()
|
|||||||
u32 fieldLen = sizeof(headerFields);
|
u32 fieldLen = sizeof(headerFields);
|
||||||
m_Result = m_HttpCon.GetHeaderField("Content-Length", headerFields, fieldLen, &fieldLen); //特定のヘッダフィールドをラベルから取得
|
m_Result = m_HttpCon.GetHeaderField("Content-Length", headerFields, fieldLen, &fieldLen); //特定のヘッダフィールドをラベルから取得
|
||||||
COMMON_LOGGER_RETURN_FALSE_IF_FAILED(m_Result);
|
COMMON_LOGGER_RETURN_FALSE_IF_FAILED(m_Result);
|
||||||
m_BodySize = std::strtol(headerFields, NULL, 10);
|
*size = std::strtol(headerFields, NULL, 10);
|
||||||
NN_LOG("---HTTP Content-Length = %d---\n", m_BodySize);
|
NN_LOG("---HTTP Content-Length = %d---\n", *size);
|
||||||
|
|
||||||
return m_BodySize;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BgsCommunicator::GetBody(u8 *buf, size_t size)
|
bool BgsCommunicator::GetBody(u8 *buf, size_t size)
|
||||||
|
|||||||
@ -33,7 +33,8 @@ public:
|
|||||||
bool Execute(const void* buf, size_t size);
|
bool Execute(const void* buf, size_t size);
|
||||||
|
|
||||||
//! @brief 通信結果のサイズを取得します
|
//! @brief 通信結果のサイズを取得します
|
||||||
size_t GetBodySize();
|
//! @param[out] 通信結果を取得するのに必要なバッファサイズ
|
||||||
|
bool GetBodySize(size_t* size);
|
||||||
|
|
||||||
//! @brief 通信結果をバッファに書き込みます。正しく結果を取得するには GetBodySizeで取得したサイズのバッファが必要です。
|
//! @brief 通信結果をバッファに書き込みます。正しく結果を取得するには GetBodySizeで取得したサイズのバッファが必要です。
|
||||||
//! @param[out] buf 通信結果を書き込むバッファ
|
//! @param[out] buf 通信結果を書き込むバッファ
|
||||||
@ -47,9 +48,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
nn::Result m_Result;
|
nn::Result m_Result;
|
||||||
|
|
||||||
//! @brief HTTPレスポンスのサイズ
|
|
||||||
size_t m_BodySize;
|
|
||||||
|
|
||||||
//Connectionインスタンス
|
//Connectionインスタンス
|
||||||
nn::http::Connection m_HttpCon;
|
nn::http::Connection m_HttpCon;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -124,7 +124,8 @@ void BgsCommunicatorTest::Exec()
|
|||||||
xml.Exec(17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940")));
|
xml.Exec(17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940")));
|
||||||
|
|
||||||
comm.Execute(xml.GetData().c_str(), xml.GetData().size());
|
comm.Execute(xml.GetData().c_str(), xml.GetData().size());
|
||||||
size_t bufSize = comm.GetBodySize();
|
size_t bufSize;
|
||||||
|
comm.GetBodySize(&bufSize);
|
||||||
common::HeapManager heap(bufSize);
|
common::HeapManager heap(bufSize);
|
||||||
void* buf = heap.GetAddr();
|
void* buf = heap.GetAddr();
|
||||||
comm.GetBody(reinterpret_cast<u8*>(buf), bufSize);
|
comm.GetBody(reinterpret_cast<u8*>(buf), bufSize);
|
||||||
|
|||||||
@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env omake
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: Horizon
|
||||||
|
# File: OMakefile
|
||||||
|
#
|
||||||
|
# Copyright (C)2009 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$
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
SUPPORTED_TARGETS = CTR-*.Process.MPCore.*
|
||||||
|
|
||||||
|
include $(makePlatformDefsPath tests)
|
||||||
|
|
||||||
|
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include)
|
||||||
|
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR) \
|
||||||
|
../../../common \
|
||||||
|
../../../ConsoleRestore \
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TEST_COMMON_SOURCES[] =
|
||||||
|
../../../ConsoleRestore/Shop.cpp
|
||||||
|
../../../ConsoleRestore/XmlCreator.cpp
|
||||||
|
../../../ConsoleRestore/SimpleXmlPreprocessor.cpp
|
||||||
|
../../../ConsoleRestore/BgsCommunicator.cpp
|
||||||
|
../../../ConsoleRestore/PreinstallImporter.cpp
|
||||||
|
../../../common/Util.cpp
|
||||||
|
../../../common/HeapManager.cpp
|
||||||
|
../../../common/SdLogger.cpp
|
||||||
|
../../../common/LogConsole.cpp
|
||||||
|
../../../common/CommonLogger.cpp
|
||||||
|
../../../common/SdMountManager.cpp
|
||||||
|
../../../common/VersionDetect.cpp
|
||||||
|
../../../common/HardwareStateManager.cpp
|
||||||
|
../../../common/FileTransfer.cpp
|
||||||
|
../../../common/SdReaderWriter.cpp
|
||||||
|
|
||||||
|
CCFLAGS += -DCOMMON_LOGGER_DETAIL_ENABLE
|
||||||
|
|
||||||
|
SOURCES_TEST[] = test_PreinstallImporter.cpp
|
||||||
|
|
||||||
|
ROMFS_ROOT = ../../../common/romfiles
|
||||||
|
|
||||||
|
TEST_ENVIRONMENT_PROCESSLIST = true
|
||||||
|
TEST_ENVIRONMENT_EMUMEM = true
|
||||||
|
|
||||||
|
LIBS += libnn_test \
|
||||||
|
libnn_mcu \
|
||||||
|
libnn_ps \
|
||||||
|
libnn_am \
|
||||||
|
lib_demo \
|
||||||
|
libnn_nim \
|
||||||
|
libnn_xml_simple \
|
||||||
|
|
||||||
|
ROM_SPEC_FILE = ../../../ConsoleRestore/ConsoleRestore.rsf
|
||||||
|
DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/private/RepairTool.desc
|
||||||
|
|
||||||
|
|
||||||
|
include $(makePlatformDefsPath build.tests)
|
||||||
|
|
||||||
|
|
||||||
|
tests: $(TEST_TARGETS)
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: Horizon
|
||||||
|
File: test_PreinstallImporter.cpp
|
||||||
|
|
||||||
|
Copyright (C)2011 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 <nn.h>
|
||||||
|
#include <nn/test/test_Test.h>
|
||||||
|
#include <nn/fs.h>
|
||||||
|
#include <nn/am.h>
|
||||||
|
#include <nn/cfg.h>
|
||||||
|
#include <nn/cfg/CTR/cfg_ApiInit.h>
|
||||||
|
#include <nn/cfg/CTR/cfg_ApiSys.h>
|
||||||
|
|
||||||
|
#include "demo.h"
|
||||||
|
|
||||||
|
#include "common_Types.h"
|
||||||
|
#include "CommonLogger.h"
|
||||||
|
#include "HeapManager.h"
|
||||||
|
#include "XmlCreator.h"
|
||||||
|
#include "BgsCommunicator.h"
|
||||||
|
#include "SimpleXmlPreprocessor.h"
|
||||||
|
#include "PreinstallImporter.h"
|
||||||
|
|
||||||
|
using namespace nn::test;
|
||||||
|
|
||||||
|
class PreinstallImporterTest : public Suite {
|
||||||
|
public:
|
||||||
|
virtual bool InitializeSuite();
|
||||||
|
virtual void FinalizeSuite();
|
||||||
|
|
||||||
|
PreinstallImporterTest() {
|
||||||
|
TEST_ADD(PreinstallImporterTest::ListUp);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
void ListUp();
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
const size_t s_GxHeapSize = 0x800000;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Initialize/Finalize
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool PreinstallImporterTest::InitializeSuite()
|
||||||
|
{
|
||||||
|
// os の初期化
|
||||||
|
nn::os::Initialize();
|
||||||
|
|
||||||
|
nn::fs::Initialize();
|
||||||
|
|
||||||
|
// amの初期化
|
||||||
|
nn::am::InitializeForLocalImporter();
|
||||||
|
|
||||||
|
// cfgの初期化
|
||||||
|
nn::cfg::init::Initialize();
|
||||||
|
nn::cfg::system::Initialize();
|
||||||
|
|
||||||
|
// ヒープの確保
|
||||||
|
common::InitializeHeap();
|
||||||
|
common::HeapManager gxHeap(s_GxHeapSize);
|
||||||
|
|
||||||
|
// RenderSystem の準備
|
||||||
|
uptr heapForGx = reinterpret_cast<uptr>(gxHeap.GetAddr());
|
||||||
|
demo::RenderSystemDrawing renderSystem;
|
||||||
|
renderSystem.Initialize(heapForGx, s_GxHeapSize);
|
||||||
|
|
||||||
|
// ログ描画の初期化
|
||||||
|
common::Logger::GetLoggerInstance()->Initialize(common::CONSOLE_WIDTH, common::CONSOLE_HEIGHT,
|
||||||
|
common::CONSOLE_MAX_LINE, &renderSystem);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreinstallImporterTest::FinalizeSuite()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Test Functions
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
void PreinstallImporterTest::ListUp()
|
||||||
|
{
|
||||||
|
ConsoleRestore::PreinstallImporter importer;
|
||||||
|
|
||||||
|
size_t num = 0;
|
||||||
|
nn::ProgramId list[256];
|
||||||
|
NN_TEST_ASSERT_RESULT_SUCCESS(
|
||||||
|
importer.ListTitles(list, &num, 17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940"))));
|
||||||
|
|
||||||
|
NN_LOG("Preinstalled num = %d\n", num);
|
||||||
|
for(u32 i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
NN_LOG("%016llx\n", list[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NN_TEST_DEFINE_MAIN(PreinstallImporterTest)
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
End of file
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
Loading…
Reference in New Issue
Block a user