mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
マスタエディタ:各バージョン間でのソース共通化に対応。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2470 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
48b043c7ad
commit
54fc4f5c22
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "srl.h"
|
||||
#include "deliverable.h"
|
||||
@ -648,15 +649,21 @@ private: System::Windows::Forms::Label^ labProductNameLimitForeign;
|
||||
#endif
|
||||
|
||||
// アプリ種別をつける
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
this->Text += " [FOR SYSTEM APPLICATION]";
|
||||
System::String ^appstr = nullptr;
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
appstr += "Launcher/";
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
this->Text += " [FOR SECURE APPLICATION]";
|
||||
appstr += "Secure/";
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
this->Text += " [FOR LAUNCHER APPLICATION]";
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
appstr += "System/";
|
||||
#endif
|
||||
if( appstr != nullptr)
|
||||
{
|
||||
this->Text += " [Supported App: " + appstr + "User ]";
|
||||
}
|
||||
|
||||
// 複数行表示したいが初期値で設定できないのでここで設定
|
||||
this->tboxGuideRomEditInfo->Text = "このタブの情報は提出確認書およびマスターROMの作成に必要です。編集してください。";
|
||||
this->tboxGuideRomEditInfo->Text += "\r\nこれらの情報はマスターROMの作成時にROMデータの中に登録されます。";
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "srl.h"
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="C:\twlsdk\build\tools\makerom.TWL;C:\twlsdk\include"
|
||||
AdditionalIncludeDirectories="C:\twlsdk\build\tools\makerom.TWL;C:\twlsdk\include;"C:\Documents and Settings\nishikawa_takeshi\My Documents\Visual Studio 2008\Projects\MasterEditorTWL_Common\user""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
@ -62,7 +62,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libacsign_X86.a libaes_X86.a libdigest_X86.a libflags_X86.a $(NOINHERIT)"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\flags\lib\X86;C:\twlsdk\build\tools\makerom.TWL\digest\lib\X86;C:\twlsdk\build\tools\makerom.TWL\aes\lib\X86;C:\twlsdk\build\tools\makerom.TWL\acsign\lib\X86"
|
||||
AdditionalLibraryDirectories=""C:\Documents and Settings\nishikawa_takeshi\My Documents\Visual Studio 2008\Projects\MasterEditorTWL_Common\flags\lib\X86";C:\twlsdk\build\tools\makerom.TWL\digest\lib\X86;C:\twlsdk\build\tools\makerom.TWL\aes\lib\X86;C:\twlsdk\build\tools\makerom.TWL\acsign\lib\X86"
|
||||
GenerateDebugInformation="true"
|
||||
AssemblyDebug="1"
|
||||
SubSystem="2"
|
||||
@ -117,7 +117,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="C:\twlsdk\build\tools\makerom.TWL;C:\twlsdk\include"
|
||||
AdditionalIncludeDirectories=""C:\Documents and Settings\nishikawa_takeshi\My Documents\Visual Studio 2008\Projects\MasterEditorTWL_Common\user";C:\twlsdk\build\tools\makerom.TWL;C:\twlsdk\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="2"
|
||||
@ -137,7 +137,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libacsign_X86.a libaes_X86.a libdigest_X86.a libflags_X86.a $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\flags\lib\X86;C:\twlsdk\build\tools\makerom.TWL\digest\lib\X86;C:\twlsdk\build\tools\makerom.TWL\aes\lib\X86;C:\twlsdk\build\tools\makerom.TWL\acsign\lib\X86"
|
||||
AdditionalLibraryDirectories=""C:\Documents and Settings\nishikawa_takeshi\My Documents\Visual Studio 2008\Projects\MasterEditorTWL_Common\flags\lib\X86";C:\twlsdk\build\tools\makerom.TWL\digest\lib\X86;C:\twlsdk\build\tools\makerom.TWL\aes\lib\X86;C:\twlsdk\build\tools\makerom.TWL\acsign\lib\X86"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
EntryPointSymbol="main"
|
||||
|
||||
Binary file not shown.
@ -1,11 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// ビルドスイッチ
|
||||
//#define METWL_VER_APPTYPE_USER
|
||||
#define METWL_VER_APPTYPE_SYSTEM
|
||||
//#define METWL_VER_APPTYPE_SECURE
|
||||
//#define METWL_VER_APPTYPE_LAUNCHER
|
||||
|
||||
//#define METWL_WHETHER_PLATFORM_CHECK // プラットフォームがTWL対応以外かどうかをチェックする
|
||||
//#define METWL_WHETHER_SIGN_DECRYPT // 署名を外してダイジェストをベリファイする
|
||||
#define METWL_WHETHER_MRC // MRC機能を含めるか
|
||||
@ -24,4 +18,4 @@
|
||||
#define METWL_MASK_REGION_CHINA 0x00000010
|
||||
#define METWL_MASK_REGION_KOREA 0x00000020
|
||||
#define METWL_MASK_REGION_ALL 0xffffffff
|
||||
#define METWL_NUMOF_SHARED2FILES 6
|
||||
#define METWL_NUMOF_SHARED2FILES 6
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// crc_whole.h の実装
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "crc_whole.h"
|
||||
#include <cstring>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// deliverable.h のクラス実装
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "srl.h"
|
||||
#include "deliverable.h"
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
|
||||
// 書類クラスの宣言
|
||||
|
||||
#include "common.h"
|
||||
#include <apptype.h>
|
||||
#include <twl/types.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "srl.h"
|
||||
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <twl/types.h>
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "keys.h"
|
||||
|
||||
namespace MasterEditorTWL
|
||||
{
|
||||
// ユーザアプリ用
|
||||
|
||||
#ifdef METWL_VER_APPTYPE_USER
|
||||
// 開発機用ROMヘッダ署名公開鍵
|
||||
@ -70,7 +70,7 @@ namespace MasterEditorTWL
|
||||
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
// 開発用システムアプリ ROMヘッダ署名用公開鍵
|
||||
const u8 g_devPubKey_DER[ 0xa2 ] = {
|
||||
const u8 g_devPubKey_DER_system[ 0xa2 ] = {
|
||||
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
|
||||
0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE9, 0x9E, 0xA7,
|
||||
0x9F, 0x59, 0x4D, 0xF4, 0xA7, 0x60, 0x04, 0xBD, 0x47, 0xF2, 0xB3, 0x64, 0xCD, 0x16, 0x79, 0xC1,
|
||||
@ -85,7 +85,7 @@ namespace MasterEditorTWL
|
||||
};
|
||||
|
||||
// 開発用システムアプリ ROMヘッダ署名用秘密鍵
|
||||
const u8 g_devPrivKey_DER[ 0x263 ] = {
|
||||
const u8 g_devPrivKey_DER_system[ 0x263 ] = {
|
||||
0x30, 0x82, 0x02, 0x5E, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xE9, 0x9E, 0xA7, 0x9F, 0x59,
|
||||
0x4D, 0xF4, 0xA7, 0x60, 0x04, 0xBD, 0x47, 0xF2, 0xB3, 0x64, 0xCD, 0x16, 0x79, 0xC1, 0x47, 0x39,
|
||||
0xF6, 0xA9, 0xF8, 0xEE, 0x1A, 0xD0, 0x72, 0xCF, 0x43, 0x97, 0x0C, 0x93, 0xA1, 0x38, 0x4E, 0x13,
|
||||
@ -130,7 +130,7 @@ namespace MasterEditorTWL
|
||||
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
// 開発用ショップアプリ ROMヘッダ署名用公開鍵
|
||||
const u8 g_devPubKey_DER[ 0xa2 ] = {
|
||||
const u8 g_devPubKey_DER_secure[ 0xa2 ] = {
|
||||
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
|
||||
0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xA7, 0x9F, 0x54,
|
||||
0xA0, 0xC7, 0x45, 0xAE, 0xF6, 0x63, 0xA7, 0x53, 0xB7, 0x0A, 0xCC, 0x0B, 0xCB, 0x65, 0xE1, 0x11,
|
||||
@ -145,7 +145,7 @@ namespace MasterEditorTWL
|
||||
};
|
||||
|
||||
// 開発用ショップアプリ ROMヘッダ署名用秘密鍵
|
||||
const u8 g_devPrivKey_DER[ 0x263 ] = {
|
||||
const u8 g_devPrivKey_DER_secure[ 0x263 ] = {
|
||||
0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xA7, 0x9F, 0x54, 0xA0, 0xC7,
|
||||
0x45, 0xAE, 0xF6, 0x63, 0xA7, 0x53, 0xB7, 0x0A, 0xCC, 0x0B, 0xCB, 0x65, 0xE1, 0x11, 0xC6, 0x05,
|
||||
0x15, 0xB5, 0x6E, 0xBD, 0xAC, 0x0C, 0xCA, 0xF4, 0x7C, 0x68, 0x7A, 0xF9, 0x0E, 0x5D, 0x98, 0x5B,
|
||||
@ -190,7 +190,7 @@ namespace MasterEditorTWL
|
||||
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
// 開発用システムアプリ ROMヘッダ署名用公開鍵
|
||||
const u8 g_devPubKey_DER[ 0xa2 ] = {
|
||||
const u8 g_devPubKey_DER_launcher[ 0xa2 ] = {
|
||||
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
|
||||
0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xBC, 0xFD, 0xA1,
|
||||
0xFF, 0x1F, 0x66, 0xDF, 0xEC, 0xB4, 0x69, 0xF8, 0xF7, 0x43, 0x0C, 0x5D, 0x0F, 0x00, 0xD7, 0x20,
|
||||
@ -205,7 +205,7 @@ namespace MasterEditorTWL
|
||||
};
|
||||
|
||||
// 開発用システムアプリ ROMヘッダ署名用秘密鍵
|
||||
const u8 g_devPrivKey_DER[ 0x263 ] = {
|
||||
const u8 g_devPrivKey_DER_launcher[ 0x263 ] = {
|
||||
0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xBC, 0xFD, 0xA1, 0xFF, 0x1F,
|
||||
0x66, 0xDF, 0xEC, 0xB4, 0x69, 0xF8, 0xF7, 0x43, 0x0C, 0x5D, 0x0F, 0x00, 0xD7, 0x20, 0x49, 0x42,
|
||||
0x06, 0x03, 0x29, 0x85, 0x0B, 0x99, 0x59, 0x61, 0x98, 0x70, 0x6E, 0xFF, 0xF6, 0xB4, 0x70, 0x66,
|
||||
|
||||
@ -3,11 +3,27 @@
|
||||
// 署名用の鍵データの宣言
|
||||
|
||||
#include <twl/types.h>
|
||||
#include <apptype.h>
|
||||
|
||||
namespace MasterEditorTWL
|
||||
{
|
||||
// 開発機用ROMヘッダ署名鍵
|
||||
|
||||
#ifdef METWL_VER_APPTYPE_USER
|
||||
extern const u8 g_devPubKey_DER[ 0xa2 ];
|
||||
extern const u8 g_devPrivKey_DER[ 0x263 ];
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
extern const u8 g_devPubKey_DER_system[ 0xa2 ];
|
||||
extern const u8 g_devPrivKey_DER_system[ 0x263 ];
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
extern const u8 g_devPubKey_DER_secure[ 0xa2 ];
|
||||
extern const u8 g_devPrivKey_DER_secure[ 0x263 ];
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
extern const u8 g_devPubKey_DER_launcher[ 0xa2 ];
|
||||
extern const u8 g_devPrivKey_DER_launcher[ 0x263 ];
|
||||
#endif
|
||||
|
||||
} // end of namespace MasterEditorTWL
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// srl.h のクラス実装
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "srl.h"
|
||||
#include "utility.h"
|
||||
@ -42,6 +43,7 @@ ECSrlResult RCSrl::readFromFile( System::String ^filename )
|
||||
FILE *fp = NULL;
|
||||
const char *pchFilename =
|
||||
(const char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi( filename ).ToPointer();
|
||||
ECSrlResult r;
|
||||
|
||||
// ファイルを開いてROMヘッダのみ読み出す
|
||||
if( fopen_s( &fp, pchFilename, "rb" ) != NULL )
|
||||
@ -56,18 +58,6 @@ ECSrlResult RCSrl::readFromFile( System::String ^filename )
|
||||
return (ECSrlResult::ERROR_FILE_READ);
|
||||
}
|
||||
{
|
||||
ECSrlResult r;
|
||||
|
||||
#ifdef METWL_WHETHER_SIGN_DECRYPT
|
||||
// 署名チェック
|
||||
r = this->decryptRomHeader();
|
||||
if( r != ECSrlResult::NOERROR )
|
||||
{
|
||||
(void)fclose(fp);
|
||||
return r;
|
||||
}
|
||||
#endif //#ifdef METWL_WHETHER_SIGN_DECRYPT
|
||||
|
||||
// ファイルを閉じる前にROMヘッダ以外の領域から設定を取り出す
|
||||
(void)this->hasDSDLPlaySign( fp );
|
||||
r = this->searchSDKVersion( fp );
|
||||
@ -87,6 +77,16 @@ ECSrlResult RCSrl::readFromFile( System::String ^filename )
|
||||
// ROMヘッダの値をROM固有情報フィールドに反映させる
|
||||
(void)this->setRomInfo();
|
||||
|
||||
#ifdef METWL_WHETHER_SIGN_DECRYPT
|
||||
// ひととおり読んだあとに署名チェック
|
||||
r = this->decryptRomHeader();
|
||||
if( r != ECSrlResult::NOERROR )
|
||||
{
|
||||
(void)fclose(fp);
|
||||
return r;
|
||||
}
|
||||
#endif //#ifdef METWL_WHETHER_SIGN_DECRYPT
|
||||
|
||||
// すべて設定したあとにMRC
|
||||
{
|
||||
ECSrlResult r;
|
||||
@ -429,9 +429,11 @@ ECSrlResult RCSrl::signRomHeader(void)
|
||||
SignatureData signSrc; // 署名のもととなるダイジェスト値
|
||||
u8 signDst[ RSA_KEY_LENGTH ]; // 署名の格納先Tmpバッファ
|
||||
u8 decryptBlock[ RSA_KEY_LENGTH ]; // 署名を解除後ブロックバッファ
|
||||
BOOL result;
|
||||
BOOL result = false;
|
||||
ROM_Header rh;
|
||||
int pos;
|
||||
u8 *privateKey = (u8*)g_devPrivKey_DER;
|
||||
u8 *publicKey = (u8*)g_devPubKey_DER;
|
||||
|
||||
// ROMヘッダのダイジェストを算出(先頭から証明書領域の直前までが対象)
|
||||
ACSign_DigestUnit(
|
||||
@ -440,15 +442,47 @@ ECSrlResult RCSrl::signRomHeader(void)
|
||||
(u32)&(rh.certificate) - (u32)&(rh) // this->pRomHeader はマネージヒープ上にあるので実アドレスを取得できない
|
||||
);
|
||||
|
||||
// 鍵を選ぶ
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
if( *this->hIsAppLauncher )
|
||||
{
|
||||
privateKey = (u8*)g_devPrivKey_DER_launcher;
|
||||
publicKey = (u8*)g_devPubKey_DER_launcher;
|
||||
}
|
||||
else
|
||||
#endif //METWL_VER_APPTYPE_LAUNCHER
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
if( *this->hIsAppSecure )
|
||||
{
|
||||
privateKey = (u8*)g_devPrivKey_DER_secure;
|
||||
publicKey = (u8*)g_devPubKey_DER_secure;
|
||||
}
|
||||
else
|
||||
#endif //METWL_VER_APPTYPE_SECURE
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
if( *this->hIsAppSystem )
|
||||
{
|
||||
privateKey = (u8*)g_devPrivKey_DER_system;
|
||||
publicKey = (u8*)g_devPubKey_DER_system;
|
||||
}
|
||||
else
|
||||
#endif //METWL_VER_APPTYPE_SYSTEM
|
||||
#ifdef METWL_VER_APPTYPE_USER
|
||||
{
|
||||
privateKey = (u8*)g_devPrivKey_DER;
|
||||
publicKey = (u8*)g_devPubKey_DER;
|
||||
}
|
||||
#endif //METWL_VER_APPTYPE_USER
|
||||
|
||||
// ダイジェストに署名をかける
|
||||
result = ACSign_Encrypto( signDst, g_devPrivKey_DER, &signSrc, sizeof(SignatureData) );
|
||||
result = ACSign_Encrypto( signDst, privateKey, &signSrc, sizeof(SignatureData) );
|
||||
if( !result )
|
||||
{
|
||||
return (ECSrlResult::ERROR_SIGN_ENCRYPT);
|
||||
}
|
||||
|
||||
// 署名を解除してダイジェストと一致するかベリファイする
|
||||
result = ACSign_Decrypto( decryptBlock, g_devPubKey_DER, signDst, RSA_KEY_LENGTH );
|
||||
result = ACSign_Decrypto( decryptBlock, publicKey, signDst, RSA_KEY_LENGTH );
|
||||
for( pos=0; pos < RSA_KEY_LENGTH; pos++ )
|
||||
{
|
||||
if( decryptBlock[pos] == 0x0 ) // 解除後ブロックから実データをサーチ
|
||||
@ -473,14 +507,43 @@ ECSrlResult RCSrl::decryptRomHeader(void)
|
||||
u8 original[ RSA_KEY_LENGTH ]; // 署名外した後のデータ格納先
|
||||
s32 pos = 0; // ブロックの先頭アドレス
|
||||
u8 digest[ DIGEST_SIZE_SHA1 ]; // ROMヘッダのダイジェスト
|
||||
u8 *publicKey = (u8*)g_devPubKey_DER;
|
||||
ROM_Header rh;
|
||||
|
||||
// <データの流れ>
|
||||
// (1) 公開鍵で復号した結果(ブロック)をローカル変数(original)に格納
|
||||
// (2) ブロックから余分な部分を取り除いて引数(pDst)にコピー
|
||||
|
||||
// 鍵を選ぶ
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
if( *this->hIsAppLauncher )
|
||||
{
|
||||
publicKey = (u8*)g_devPubKey_DER_launcher;
|
||||
}
|
||||
else
|
||||
#endif //METWL_VER_APPTYPE_LAUNCHER
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
if( *this->hIsAppSecure )
|
||||
{
|
||||
publicKey = (u8*)g_devPubKey_DER_secure;
|
||||
}
|
||||
else
|
||||
#endif //METWL_VER_APPTYPE_SECURE
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
if( *this->hIsAppSystem )
|
||||
{
|
||||
publicKey = (u8*)g_devPubKey_DER_system;
|
||||
}
|
||||
else
|
||||
#endif //METWL_VER_APPTYPE_SYSTEM
|
||||
#ifdef METWL_VER_APPTYPE_USER
|
||||
{
|
||||
publicKey = (u8*)g_devPubKey_DER;
|
||||
}
|
||||
#endif //METWL_VER_APPTYPE_USER
|
||||
|
||||
// 署名の解除 = 公開鍵で復号
|
||||
if( !ACSign_Decrypto( original, g_devPubKey_DER, this->pRomHeader->signature, RSA_KEY_LENGTH ) )
|
||||
if( !ACSign_Decrypto( original, publicKey, this->pRomHeader->signature, RSA_KEY_LENGTH ) )
|
||||
{
|
||||
return ECSrlResult::ERROR_SIGN_DECRYPT;
|
||||
}
|
||||
@ -991,6 +1054,8 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp )
|
||||
const int appSystem = 1;
|
||||
const int appSecure = 2;
|
||||
const int appLauncher = 3;
|
||||
System::String ^appstrJ = gcnew System::String("");
|
||||
System::String ^appstrE = gcnew System::String("");
|
||||
|
||||
idH = this->pRomHeader->s.titleID_Hi;
|
||||
memcpy( idL, &(this->pRomHeader->s.titleID_Lo[0]), 4 );
|
||||
@ -998,18 +1063,26 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp )
|
||||
if( (idL[3]=='H') && (idL[2]=='N') && (idL[1]=='A') ) // ランチャアプリかどうかはTitleID_Loの値で決定
|
||||
{
|
||||
apptype = appLauncher;
|
||||
appstrJ = "ランチャーアプリ";
|
||||
appstrE = "Launcher-App.";
|
||||
}
|
||||
else if( idH & TITLE_ID_HI_SECURE_FLAG_MASK ) // 立ってたらセキュアアプリ
|
||||
{
|
||||
apptype = appSecure;
|
||||
appstrJ = "セキュアアプリ";
|
||||
appstrE = "Secure-App.";
|
||||
}
|
||||
else if( (idH & TITLE_ID_HI_APP_TYPE_MASK) == 1 ) // 立ってたらシステムアプリ
|
||||
{
|
||||
apptype = appSystem;
|
||||
appstrJ = "システムアプリ";
|
||||
appstrE = "System-App.";
|
||||
}
|
||||
else if( (idH & TITLE_ID_HI_APP_TYPE_MASK) == 0 ) // 残るはユーザアプリ
|
||||
{
|
||||
apptype = appUser;
|
||||
appstrJ = "ユーザアプリ";
|
||||
appstrE = "User-App.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1022,38 +1095,43 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp )
|
||||
"アプリ種別", 0x230, 0x237, "不正な値です。",
|
||||
"Application Type", "Illigal type.", false, true ) );
|
||||
}
|
||||
#ifdef METWL_VER_APPTYPE_USER
|
||||
if( apptype != appUser )
|
||||
{
|
||||
this->hWarnList->Add( gcnew RCMrcError(
|
||||
"アプリ種別", 0x230, 0x237, "ユーザアプリではありません。",
|
||||
"Application Type", "Not USER application.", false, true ) );
|
||||
}
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
if( apptype != appSystem )
|
||||
{
|
||||
this->hWarnList->Add( gcnew RCMrcError(
|
||||
"アプリ種別", 0x230, 0x237, "システムアプリではありません。",
|
||||
"Application Type", "Not SYSTEM application.", false, true ) );
|
||||
}
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
if( apptype != appSecure )
|
||||
{
|
||||
this->hWarnList->Add( gcnew RCMrcError(
|
||||
"アプリ種別", 0x230, 0x237, "セキュアアプリではありません。",
|
||||
"Application Type", "Not SECURE application.", false, true ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
System::Boolean bApp = false;
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
if( apptype != appLauncher )
|
||||
if( apptype == appLauncher )
|
||||
{
|
||||
bApp = true;
|
||||
}
|
||||
else
|
||||
#endif //#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
if( apptype == appSecure )
|
||||
{
|
||||
bApp = true;
|
||||
}
|
||||
else
|
||||
#endif //#ifdef METWL_VER_APPTYPE_SECURE
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
if( apptype == appSystem )
|
||||
{
|
||||
bApp = true;
|
||||
}
|
||||
else
|
||||
#endif //#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
#ifdef METWL_VER_APPTYPE_USER
|
||||
if( apptype == appUser )
|
||||
{
|
||||
bApp = true;
|
||||
}
|
||||
#endif //#ifdef METWL_VER_APPTYPE_USER
|
||||
|
||||
if( !bApp )
|
||||
{
|
||||
this->hWarnList->Add( gcnew RCMrcError(
|
||||
"アプリ種別", 0x230, 0x237, "ランチャーアプリではありません。",
|
||||
"Application Type", "Not LAUNCHER application.", false, true ) );
|
||||
"アプリ種別", 0x230, 0x237, "このROMデータは" + appstrJ + "です。本プログラムでは非対応です。",
|
||||
"Application Type", "This ROM is " + appstrE + " which is unsurpported by this editor.", false, true ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
} // アプリ種別のチェック
|
||||
|
||||
if( (this->pRomHeader->s.access_control.game_card_on != 0) &&
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
// ROMデータ(SRL)クラスと関連クラスの宣言
|
||||
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include <twl/types.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// utility.h の実装
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "utility.h"
|
||||
#include <cstring>
|
||||
|
||||
@ -1,73 +0,0 @@
|
||||
#! make -f
|
||||
#---------------------------------------------------------------------------
|
||||
# Project: TwlSDK - tools - makerom.TWL
|
||||
# File: Makefile
|
||||
#
|
||||
# Copyright 2007 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.
|
||||
#
|
||||
# $Date:: $
|
||||
# $Rev$
|
||||
# $Author$
|
||||
#---------------------------------------------------------------------------
|
||||
TARGET_PLATFORM = TWL
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
TARGET_LIB = libflags_x86.a
|
||||
TARGETS = $(LIBDIR)/$(TARGET_LIB)
|
||||
|
||||
SRCS = flags.c
|
||||
|
||||
INCDIR = include \
|
||||
../
|
||||
|
||||
OBJDIR = obj/X86
|
||||
LIBDIR = lib/X86
|
||||
|
||||
MACROS += $(addprefix -I,$(INCDIR)) \
|
||||
-DSTANDALONE \
|
||||
-DOPT_32_BIT \
|
||||
-DNO_SPLIT \
|
||||
-DNO_FP_API \
|
||||
-DNO_R_DIAG \
|
||||
-DNO_STDIO_H \
|
||||
-DNO_STDLIB_H
|
||||
|
||||
VPATH = $(SRCDIR) $(INCDIR)
|
||||
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.c=.o))
|
||||
|
||||
#INSTALL_TARGETS = $(TARGETS)
|
||||
#INSTALL_DIR = .
|
||||
|
||||
NEWDIRS = $(OBJDIR) $(LIBDIR)
|
||||
LDIRT_CLEAN = $(OBJDIR) $(LIBDIR)
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# build
|
||||
#----------------------------------------------------------------------------
|
||||
do-build: $(TARGETS)
|
||||
|
||||
$(TARGETS): $(OBJS)
|
||||
$(AR_X86) $@ $(OBJS)
|
||||
|
||||
$(OBJS):%.o:
|
||||
$(COMPILE_C)
|
||||
|
||||
$(OBJDIR)/flags.o: flags.c
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
||||
@ -1,21 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - tools - makerom.TWL
|
||||
File: acsign.c
|
||||
|
||||
Copyright 2007 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.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
#include "types.h"
|
||||
|
||||
BOOL DebugMode = TRUE;
|
||||
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - tools - makerom.TWL
|
||||
File: types.h
|
||||
|
||||
Copyright 2007 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.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TYPES_H_
|
||||
#define TYPES_H_
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FALSE = 0,
|
||||
TRUE = 1
|
||||
}
|
||||
BOOL;
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short int u16;
|
||||
typedef unsigned long int u32;
|
||||
typedef signed char s8;
|
||||
typedef signed short int s16;
|
||||
typedef signed long int s32;
|
||||
|
||||
#endif //TYPES_H_
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user