mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
XML生成部分を分離
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@568 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
a1df85d401
commit
b4b01e1c1e
@ -15,37 +15,9 @@
|
|||||||
|
|
||||||
#include "BgsCommunicator.h"
|
#include "BgsCommunicator.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace ConsoleRestore
|
namespace ConsoleRestore
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
const char xmlDataPrefix[] = \
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
|
||||||
<SOAP-ENV:Envelope xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns0=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns2=\"urn:bgs.wsapi.broadon.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n\
|
|
||||||
<SOAP-ENV:Header/>\n\
|
|
||||||
<ns1:Body>\n\
|
|
||||||
<ns2:GetPreInstalledInfo>\n\
|
|
||||||
<ns2:GetPreInstalledInfo>\n\
|
|
||||||
<ns2:Version/>\n\
|
|
||||||
<ns2:MessageId/>\n";
|
|
||||||
const char xmlDeviceIdPrefix[] = \
|
|
||||||
" <ns2:DeviceId>";
|
|
||||||
const char xmlDeviceIdSuffix[] = "</ns2:DeviceId>\n";
|
|
||||||
const char xmlSerialNoPrefix[] = \
|
|
||||||
" <ns2:SerialNo>";
|
|
||||||
const char xmlSerialNoSuffix[] = "</ns2:SerialNo>\n";
|
|
||||||
const char xmlDataSuffix[] = \
|
|
||||||
" </ns2:GetPreInstalledInfo>\n\
|
|
||||||
</ns2:GetPreInstalledInfo>\n\
|
|
||||||
</ns1:Body>\n\
|
|
||||||
</SOAP-ENV:Envelope>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BgsCommunicator::BgsCommunicator()
|
BgsCommunicator::BgsCommunicator()
|
||||||
{
|
{
|
||||||
@ -57,31 +29,9 @@ BgsCommunicator::~BgsCommunicator()
|
|||||||
// TODO Auto-generated destructor stub
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
void BgsCommunicator::CreateXml(bit64 deviceId, u8* serialNo)
|
|
||||||
{
|
|
||||||
m_Xml.append(xmlDataPrefix);
|
|
||||||
|
|
||||||
m_Xml.append(xmlDeviceIdPrefix);
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << std::dec;
|
|
||||||
oss << deviceId;
|
|
||||||
m_Xml.append(oss.str());
|
|
||||||
m_Xml.append(xmlDeviceIdSuffix);
|
|
||||||
|
|
||||||
m_Xml.append(xmlSerialNoPrefix);
|
|
||||||
m_Xml.append(reinterpret_cast<char*>(serialNo));
|
|
||||||
m_Xml.append(xmlSerialNoSuffix);
|
|
||||||
|
|
||||||
m_Xml.append(xmlDataSuffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string BgsCommunicator::GetXml()
|
|
||||||
{
|
|
||||||
return m_Xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BgsCommunicator::Execute()
|
bool BgsCommunicator::Execute()
|
||||||
{
|
{
|
||||||
|
nn::Result result;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,13 +16,7 @@
|
|||||||
#ifndef BGSCOMMUNICATOR_H_
|
#ifndef BGSCOMMUNICATOR_H_
|
||||||
#define BGSCOMMUNICATOR_H_
|
#define BGSCOMMUNICATOR_H_
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#if defined(__ARMCC_VERSION)
|
|
||||||
#include <nn.h>
|
#include <nn.h>
|
||||||
#else
|
|
||||||
#include "test_common.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace ConsoleRestore
|
namespace ConsoleRestore
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -32,14 +26,6 @@ public:
|
|||||||
BgsCommunicator();
|
BgsCommunicator();
|
||||||
virtual ~BgsCommunicator();
|
virtual ~BgsCommunicator();
|
||||||
|
|
||||||
//! @brief プリインストール情報を取得するためのXMLを構築します
|
|
||||||
//! @param[in] deviceId デバイスID
|
|
||||||
//! @param[in] serialNo シリアルNo.
|
|
||||||
void CreateXml(bit64 deviceId, u8* serialNo);
|
|
||||||
|
|
||||||
//! @brief 構築したXMLデータを取得します
|
|
||||||
std::string GetXml();
|
|
||||||
|
|
||||||
//! @brief 構築したXMLを使ってBGSと通信します
|
//! @brief 構築したXMLを使ってBGSと通信します
|
||||||
bool Execute();
|
bool Execute();
|
||||||
|
|
||||||
@ -50,9 +36,6 @@ public:
|
|||||||
//! @param[out] buf 通信結果を書き込むバッファ
|
//! @param[out] buf 通信結果を書き込むバッファ
|
||||||
void GetBody(void* buf);
|
void GetBody(void* buf);
|
||||||
|
|
||||||
private:
|
|
||||||
std::string m_Xml;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ConsoleRestore */
|
} /* namespace ConsoleRestore */
|
||||||
|
|||||||
@ -32,6 +32,7 @@ SOURCES[] =
|
|||||||
Shop.cpp
|
Shop.cpp
|
||||||
RegionIdModifier.cpp
|
RegionIdModifier.cpp
|
||||||
SimpleXmlPreprocessor.cpp
|
SimpleXmlPreprocessor.cpp
|
||||||
|
XmlCreator.cpp
|
||||||
BgsCommunicator.cpp
|
BgsCommunicator.cpp
|
||||||
../common/Util.cpp
|
../common/Util.cpp
|
||||||
../common/DrawSystemState.cpp
|
../common/DrawSystemState.cpp
|
||||||
|
|||||||
@ -0,0 +1,84 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: Horizon
|
||||||
|
File: XmlCreator.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 "XmlCreator.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace ConsoleRestore
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const char xmlDataPrefix[] = \
|
||||||
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||||
|
<SOAP-ENV:Envelope xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns0=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns2=\"urn:bgs.wsapi.broadon.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n\
|
||||||
|
<SOAP-ENV:Header/>\n\
|
||||||
|
<ns1:Body>\n\
|
||||||
|
<ns2:GetPreInstalledInfo>\n\
|
||||||
|
<ns2:GetPreInstalledInfo>\n\
|
||||||
|
<ns2:Version/>\n\
|
||||||
|
<ns2:MessageId/>\n";
|
||||||
|
const char xmlDeviceIdPrefix[] = \
|
||||||
|
" <ns2:DeviceId>";
|
||||||
|
const char xmlDeviceIdSuffix[] = "</ns2:DeviceId>\n";
|
||||||
|
const char xmlSerialNoPrefix[] = \
|
||||||
|
" <ns2:SerialNo>";
|
||||||
|
const char xmlSerialNoSuffix[] = "</ns2:SerialNo>\n";
|
||||||
|
const char xmlDataSuffix[] = \
|
||||||
|
" </ns2:GetPreInstalledInfo>\n\
|
||||||
|
</ns2:GetPreInstalledInfo>\n\
|
||||||
|
</ns1:Body>\n\
|
||||||
|
</SOAP-ENV:Envelope>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XmlCreator::XmlCreator()
|
||||||
|
{
|
||||||
|
// TODO 自動生成されたコンストラクター・スタブ
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlCreator::~XmlCreator()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated destructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlCreator::Exec(bit64 deviceId, u8* serialNo)
|
||||||
|
{
|
||||||
|
m_Xml.append(xmlDataPrefix);
|
||||||
|
|
||||||
|
m_Xml.append(xmlDeviceIdPrefix);
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << std::dec;
|
||||||
|
oss << deviceId;
|
||||||
|
m_Xml.append(oss.str());
|
||||||
|
m_Xml.append(xmlDeviceIdSuffix);
|
||||||
|
|
||||||
|
m_Xml.append(xmlSerialNoPrefix);
|
||||||
|
m_Xml.append(reinterpret_cast<char*>(serialNo));
|
||||||
|
m_Xml.append(xmlSerialNoSuffix);
|
||||||
|
|
||||||
|
m_Xml.append(xmlDataSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string XmlCreator::GetData()
|
||||||
|
{
|
||||||
|
return m_Xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace ConsoleRestore */
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: Horizon
|
||||||
|
File: XmlCreator.h
|
||||||
|
|
||||||
|
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$
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef XMLCREATOR_H_
|
||||||
|
#define XMLCREATOR_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#if defined(__ARMCC_VERSION)
|
||||||
|
#include <nn.h>
|
||||||
|
#else
|
||||||
|
#include "test_common.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace ConsoleRestore
|
||||||
|
{
|
||||||
|
|
||||||
|
class XmlCreator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XmlCreator();
|
||||||
|
virtual ~XmlCreator();
|
||||||
|
|
||||||
|
//! @brief プリインストール情報を取得するためのXMLを構築します
|
||||||
|
//! @param[in] deviceId デバイスID
|
||||||
|
//! @param[in] serialNo シリアルNo.
|
||||||
|
void Exec(bit64 deviceId, u8* serialNo);
|
||||||
|
|
||||||
|
//! @brief 構築したXMLデータを取得します
|
||||||
|
std::string GetData();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_Xml;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace ConsoleRestore */
|
||||||
|
#endif /* XMLCREATOR_H_ */
|
||||||
@ -1 +1 @@
|
|||||||
.SUBDIRS: RegionIdModifier BgsCommunicator
|
.SUBDIRS: RegionIdModifier XmlCreator
|
||||||
|
|||||||
@ -4,21 +4,23 @@ INCLUDES[] +=
|
|||||||
../../../ConsoleRestore
|
../../../ConsoleRestore
|
||||||
|
|
||||||
TARGET = testRegionIdModifier
|
TARGET = testRegionIdModifier
|
||||||
|
TEST_TARGET = RegionIdModifier
|
||||||
|
|
||||||
SRC_FILES[] =
|
SRC_FILES[] =
|
||||||
testRegionIdModifier
|
testRegionIdModifier
|
||||||
testUtil
|
testUtil
|
||||||
RegionIdModifier
|
RegionIdModifier
|
||||||
|
|
||||||
|
# テスト独自のスタブを使用する場合に定義する
|
||||||
CXXFLAGS += -DPCTEST_USE_STUB
|
CXXFLAGS += -DPCTEST_USE_STUB
|
||||||
|
|
||||||
# テストディレクトリ外にあるので独自ルールでビルド
|
# テストディレクトリ外にあるので独自ルールでビルド
|
||||||
RegionIdModifier$(EXT_OBJ): ../../../ConsoleRestore/RegionIdModifier.cpp
|
$(TEST_TARGET)$(EXT_OBJ): ../../../ConsoleRestore/$(TEST_TARGET).cpp
|
||||||
$(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $<
|
$(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $<
|
||||||
|
|
||||||
.DEFAULT: RegionIdModifier$(EXT_OBJ) $(TARGET)$(EXE)
|
.DEFAULT: $(TEST_TARGET)$(EXT_OBJ) $(TARGET)$(EXE)
|
||||||
|
|
||||||
CXXProgram(testRegionIdModifier, $(SRC_FILES))
|
CXXProgram($(TARGET), $(SRC_FILES))
|
||||||
|
|
||||||
.PHONY: clean test
|
.PHONY: clean test
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@ -3,19 +3,20 @@ INCLUDES[] +=
|
|||||||
../common
|
../common
|
||||||
../../../ConsoleRestore
|
../../../ConsoleRestore
|
||||||
|
|
||||||
TARGET = testBgsCommunicator
|
TARGET = testXmlCreator
|
||||||
|
TEST_TARGET = XmlCreator
|
||||||
|
|
||||||
SRC_FILES[] =
|
SRC_FILES[] =
|
||||||
testBgsCommunicator
|
testXmlCreator
|
||||||
BgsCommunicator
|
XmlCreator
|
||||||
|
|
||||||
# テストディレクトリ外にあるので独自ルールでビルド
|
# テストディレクトリ外にあるので独自ルールでビルド
|
||||||
BgsCommunicator$(EXT_OBJ): ../../../ConsoleRestore/BgsCommunicator.cpp
|
$(TEST_TARGET)$(EXT_OBJ): ../../../ConsoleRestore/$(TEST_TARGET).cpp
|
||||||
$(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $<
|
$(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $<
|
||||||
|
|
||||||
.DEFAULT: BgsCommunicator$(EXT_OBJ) $(TARGET)$(EXE)
|
.DEFAULT: $(TEST_TARGET)$(EXT_OBJ) $(TARGET)$(EXE)
|
||||||
|
|
||||||
CXXProgram(testBgsCommunicator, $(SRC_FILES))
|
CXXProgram($(TARGET), $(SRC_FILES))
|
||||||
|
|
||||||
.PHONY: clean test
|
.PHONY: clean test
|
||||||
clean:
|
clean:
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "BgsCommunicator.h"
|
#include "XmlCreator.h"
|
||||||
|
|
||||||
using namespace ConsoleRestore;
|
using namespace ConsoleRestore;
|
||||||
|
|
||||||
@ -25,9 +25,9 @@ const char testStr[] = \
|
|||||||
</SOAP-ENV:Envelope>";
|
</SOAP-ENV:Envelope>";
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(testBgsCommunicator, CreateXml)
|
TEST(testXmlCreator, Exec)
|
||||||
{
|
{
|
||||||
BgsCommunicator comm;
|
XmlCreator xml;
|
||||||
comm.CreateXml(17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940")));
|
xml.Exec(17179924184, reinterpret_cast<u8*>(const_cast<char*>("EJA20305940")));
|
||||||
ASSERT_STREQ(testStr, comm.GetXml().c_str());
|
ASSERT_STREQ(testStr, xml.GetData().c_str());
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user