マスタエディタ:システムアプリ版、セキュアアプリ版、ランチャアプリ版にするためのビルドスイッチ追加。アプリ種別でMRCのチェック項目を変更。GUIの変更はまだ。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2300 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
nishikawa_takeshi 2008-08-28 02:57:03 +00:00
parent c93cac4d55
commit db16714301
9 changed files with 109 additions and 49 deletions

View File

@ -3187,12 +3187,25 @@ private: System::Windows::Forms::GroupBox^ gboxMakeMaster;
// SRLのオープン // SRLのオープン
System::Void loadSrl( System::String ^filename ) System::Void loadSrl( System::String ^filename )
{ {
if( this->hSrl->readFromFile( filename ) != ECSrlResult::NOERROR ) ECSrlResult result = this->hSrl->readFromFile( filename );
if( result != ECSrlResult::NOERROR )
{ {
if( this->rSelectJ->Checked == true ) switch( result )
this->errMsg( "リードに失敗しました。" ); {
else case ECSrlResult::ERROR_PLATFORM:
this->errMsg( "Reading the file failed." ); if( this->rSelectJ->Checked == true )
this->errMsg( "本ツールはTWL対応ROM専用です。NTR専用ROMなどのTWL対応ROM以外を読み込むことはできません。" );
else
this->errMsg( "This tool can only read TWL ROM. This can't read Other data e.g. NTR limited ROM." );
break;
default:
if( this->rSelectJ->Checked == true )
this->errMsg( "リードに失敗しました。" );
else
this->errMsg( "Reading the file failed." );
break;
}
return; // 前のファイルが正常である保証なしなので前のファイルも上書き保存できないようにする return; // 前のファイルが正常である保証なしなので前のファイルも上書き保存できないようにする
} }
this->tboxFile->Text = filename; this->tboxFile->Text = filename;
@ -3391,12 +3404,6 @@ private: System::Windows::Forms::GroupBox^ gboxMakeMaster;
{ {
this->tboxIsCodec->Text = gcnew System::String( "NTR" ); this->tboxIsCodec->Text = gcnew System::String( "NTR" );
} }
//this->cboxIsRegionJapan->Checked = *(this->hSrl->hIsRegionJapan);
//this->cboxIsRegionAmerica->Checked = *(this->hSrl->hIsRegionAmerica);
//this->cboxIsRegionEurope->Checked = *(this->hSrl->hIsRegionEurope);
//this->cboxIsRegionAustralia->Checked = *(this->hSrl->hIsRegionAustralia);
//this->cboxIsRegionChina->Checked = *(this->hSrl->hIsRegionChina);
//this->cboxIsRegionKorea->Checked = *(this->hSrl->hIsRegionKorea);
this->cboxIsSD->Checked = *(this->hSrl->hIsSD); this->cboxIsSD->Checked = *(this->hSrl->hIsSD);
this->cboxIsNAND->Checked = *(this->hSrl->hIsNAND); this->cboxIsNAND->Checked = *(this->hSrl->hIsNAND);
if( *(this->hSrl->hIsGameCardNitro) == true ) if( *(this->hSrl->hIsGameCardNitro) == true )

View File

@ -8,7 +8,7 @@ namespace MasterEditorTWL
{ {
// ƒ†<C692>[ƒUƒAƒvƒŠ—p // ƒ†<C692>[ƒUƒAƒvƒŠ—p
// 開発アプリROMヘッダ署名用公開鍵 // 開発機用ROMヘッダ署名公開鍵
const u8 g_devPubKey_DER[ 0xa2 ] = { const u8 g_devPubKey_DER[ 0xa2 ] = {
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 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, 0xAC, 0x93, 0xBB, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xAC, 0x93, 0xBB,
@ -22,8 +22,7 @@ namespace MasterEditorTWL
0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11, 0x02, 0x03, 0x01, 0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11, 0x02, 0x03, 0x01,
0x00, 0x01, 0x00, 0x01,
}; };
// 開発機用アプリROMヘッダ署名秘密鍵
// 開発アプリROMヘッダ署名用秘密鍵
const u8 g_devPrivKey_DER[ 0x263 ] = { const u8 g_devPrivKey_DER[ 0x263 ] = {
0x30, 0x82, 0x02, 0x5F, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xAC, 0x93, 0xBB, 0x3C, 0x15, 0x30, 0x82, 0x02, 0x5F, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xAC, 0x93, 0xBB, 0x3C, 0x15,
0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, 0xD5, 0x79, 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, 0xD5, 0x79,

View File

@ -6,9 +6,7 @@
namespace MasterEditorTWL namespace MasterEditorTWL
{ {
// 開発機用ROMヘッダ署名鍵
// 開発アプリROMヘッダ署名用秘密鍵
extern const u8 g_devPubKey_DER[ 0xa2 ]; extern const u8 g_devPubKey_DER[ 0xa2 ];
extern const u8 g_devPrivKey_DER[ 0x263 ]; extern const u8 g_devPrivKey_DER[ 0x263 ];

View File

@ -286,19 +286,11 @@ ECSrlResult RCSrl::setRomInfo(void)
} }
// カードリージョン // カードリージョン
const u32 maskJapan = 0x00000001;
const u32 maskAmerica = 0x00000002;
const u32 maskEurope = 0x00000004;
const u32 maskAustralia = 0x00000008;
const u32 maskChina = 0x00000010;
const u32 maskKorea = 0x00000020;
const u32 map = this->pRomHeader->s.card_region_bitmap; const u32 map = this->pRomHeader->s.card_region_bitmap;
this->hIsRegionJapan = gcnew System::Boolean( ((map & maskJapan) != 0)?true:false ); this->hIsRegionJapan = gcnew System::Boolean( ((map & METWL_MASK_REGION_JAPAN) != 0)?true:false );
this->hIsRegionAmerica = gcnew System::Boolean( ((map & maskAmerica) != 0)?true:false ); this->hIsRegionAmerica = gcnew System::Boolean( ((map & METWL_MASK_REGION_AMERICA) != 0)?true:false );
this->hIsRegionEurope = gcnew System::Boolean( ((map & maskEurope) != 0)?true:false ); this->hIsRegionEurope = gcnew System::Boolean( ((map & METWL_MASK_REGION_EUROPE) != 0)?true:false );
this->hIsRegionAustralia = gcnew System::Boolean( ((map & maskAustralia) != 0)?true:false ); this->hIsRegionAustralia = gcnew System::Boolean( ((map & METWL_MASK_REGION_AUSTRALIA) != 0)?true:false );
//this->hIsRegionChina = gcnew System::Boolean( ((map & maskChina) != 0)?true:false );
//this->hIsRegionKorea = gcnew System::Boolean( ((map & maskKorea) != 0)?true:false );
return ECSrlResult::NOERROR; return ECSrlResult::NOERROR;
} // ECSrlResult RCSrl::setRomInfo(void) } // ECSrlResult RCSrl::setRomInfo(void)
@ -320,19 +312,19 @@ ECSrlResult RCSrl::setRomHeader(void)
this->pRomHeader->s.exFlags.DSWirelessIcon = (*(this->hIsWirelessIcon) == true)?1:0; this->pRomHeader->s.exFlags.DSWirelessIcon = (*(this->hIsWirelessIcon) == true)?1:0;
// レーティング // レーティング
const u32 maskJapan = 0x00000001;
const u32 maskAmerica = 0x00000002;
const u32 maskEurope = 0x00000004;
const u32 maskAustralia = 0x00000008;
//const u32 maskChina = 0x00000010;
//const u32 maskKorea = 0x00000020;
u32 map = 0; u32 map = 0;
if( *(this->hIsRegionJapan) == true ) { map |= maskJapan; } if( *(this->hIsRegionJapan) == true ) { map |= METWL_MASK_REGION_JAPAN; }
if( *(this->hIsRegionAmerica) == true ) { map |= maskAmerica; } if( *(this->hIsRegionAmerica) == true ) { map |= METWL_MASK_REGION_AMERICA; }
if( *(this->hIsRegionEurope) == true ) { map |= maskEurope; } if( *(this->hIsRegionEurope) == true ) { map |= METWL_MASK_REGION_EUROPE; }
if( *(this->hIsRegionAustralia) == true ){ map |= maskAustralia; } if( *(this->hIsRegionAustralia) == true ){ map |= METWL_MASK_REGION_AUSTRALIA; }
//if( *(this->hIsRegionChina) == true ) { map |= maskChina; } #if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
//if( *(this->hIsRegionKorea) == true ) { map |= maskKorea; } if( (*(this->hIsRegionJapan) == true ) && (*(this->hIsRegionAmerica) == true)
&& (*(this->hIsRegionEurope) == true ) && (*(this->hIsRegionAustralia) == true)
)
{
map |= METWL_MASK_REGION_ALL; // オールリージョンを許す
}
#endif
this->pRomHeader->s.card_region_bitmap = map; this->pRomHeader->s.card_region_bitmap = map;
// ペアレンタルコントロール // ペアレンタルコントロール
@ -835,7 +827,16 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp )
{ {
System::Int32 i; System::Int32 i;
// ROMƒwƒbƒ_̃`ƒFƒbƒN // ROMヘッダのチェック (NTR互換領域)
#ifdef METWL_WHETHER_PLATFORM_CHECK
// プラットフォームのチェック
if( (this->pRomHeader->s.platform_code != PLATFORM_CODE_TWL_HYBLID) &&
(this->pRomHeader->s.platform_code != PLATFORM_CODE_TWL_LIMITED) )
{
return ECSrlResult::ERROR_PLATFORM;
}
#endif
// 値チェック // 値チェック
u32 romsize = 1 << (this->pRomHeader->s.rom_size); // ROM容量 u32 romsize = 1 << (this->pRomHeader->s.rom_size); // ROM容量
@ -845,6 +846,12 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp )
"デバイス容量", 0x14, 0x14, "指定可能な容量ではありません。", "デバイス容量", 0x14, 0x14, "指定可能な容量ではありません。",
"Device Capacity", "Invalid capacity.", false ) ); "Device Capacity", "Invalid capacity.", false ) );
} }
if( (this->pRomHeader->s.game_cmd_param & CARD_LATENCY_MASK) != CARD_1TROM_GAME_LATENCY )
{
this->hErrorList->Add( gcnew RCMRCError(
"ROMコントロール情報", 0x60, 0x67, "TWLではマスクROMは用意されていません。ワンタイムPROM設定にしてください。",
"ROM Control Info.", "Mask ROM can be set. Please set One-time PROM.", false ) );
}
// 予約領域 // 予約領域
for( i=0; i < 7; i++ ) for( i=0; i < 7; i++ )
@ -856,6 +863,40 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp )
"Reserved Area A", "Invalid data is included. Please set 0 into this area.", false ) ); "Reserved Area A", "Invalid data is included. Please set 0 into this area.", false ) );
} }
} }
for( i=0; i < 39; i++ )
{
if( this->pRomHeader->s.reserved_B[i] != 0 )
{
this->hErrorList->Add( gcnew RCMRCError(
"予約領域B", 0x099, 0x0bf, "不正な値が含まれています。この領域をすべて0で埋めてください。",
"Reserved Area B", "Invalid data is included. Please set 0 into this area.", false ) );
}
}
// ROMヘッダのチェック (TWL専用領域)
// 値チェック
u32 region = this->pRomHeader->s.card_region_bitmap;
if( (region != METWL_MASK_REGION_JAPAN) &&
(region != METWL_MASK_REGION_AMERICA) &&
(region != METWL_MASK_REGION_EUROPE) &&
(region != (METWL_MASK_REGION_EUROPE | METWL_MASK_REGION_AUSTRALIA)) )
{
#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
if( region != METWL_MASK_REGION_ALL ) // オールリージョンを許す
{
this->hErrorList->Add( gcnew RCMRCError(
"カードリージョン", 0x1b0, 0x1b3, "仕向地の組み合わせが不正です。本ツールを用いて修正できます。",
"Card Region", "Illigal Region. This tool can modify this information.", true ) );
}
#else
{
this->hErrorList->Add( gcnew RCMRCError(
"カードリージョン", 0x1b0, 0x1b3, "仕向地の組み合わせが不正です。本ツールを用いて修正できます。",
"Card Region", "Illigal Region. This tool can modify this information.", true ) );
}
#endif
}
// ROMヘッダ以外の領域のチェック // ROMヘッダ以外の領域のチェック

View File

@ -6,11 +6,6 @@
#include <twl/os/common/format_rom.h> #include <twl/os/common/format_rom.h>
#include <twl/os/common/ownerInfoEx.h> #include <twl/os/common/ownerInfoEx.h>
// 宣言
#define METWL_ERRLIST_NORANGE 0 // エラーのアドレス範囲を指定しないことを表す特別な値
#define METWL_ROMSIZE_MIN 256 // 最小のデバイス容量 256Mbit
#define METWL_ROMSIZE_MAX 4096 // 最大の.. 4Gbit
namespace MasterEditorTWL namespace MasterEditorTWL
{ {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -36,6 +31,8 @@ namespace MasterEditorTWL
ERROR_SIGN_CRC, ERROR_SIGN_CRC,
// SDKバージョン取得でのエラー // SDKバージョン取得でのエラー
ERROR_SDK, ERROR_SDK,
// プラットフォームがNTR専用 or 不正バイナリ
ERROR_PLATFORM,
}; };
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -264,8 +261,6 @@ namespace MasterEditorTWL
property System::Boolean ^hIsRegionAmerica; property System::Boolean ^hIsRegionAmerica;
property System::Boolean ^hIsRegionEurope; property System::Boolean ^hIsRegionEurope;
property System::Boolean ^hIsRegionAustralia; property System::Boolean ^hIsRegionAustralia;
//property System::Boolean ^hRegionChina;
//property System::Boolean ^hRegionKorea;
// SDKバージョンと使用ライブラリのリスト // SDKバージョンと使用ライブラリのリスト
property System::Collections::Generic::List<RCSDKVersion^> ^hSDKList; property System::Collections::Generic::List<RCSDKVersion^> ^hSDKList;

View File

@ -4,3 +4,23 @@
#pragma once #pragma once
// TODO: プログラムに必要な追加ヘッダーをここで参照してください。 // TODO: プログラムに必要な追加ヘッダーをここで参照してください。
// ビルドオプション
#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_ERRLIST_NORANGE 0 // エラーのアドレス範囲を指定しないことを表す特別な値
#define METWL_ROMSIZE_MIN 256 // 最小のデバイス容量 256Mbit
#define METWL_ROMSIZE_MAX 4096 // 最大の.. 4Gbit
#define METWL_MASK_REGION_JAPAN 0x00000001
#define METWL_MASK_REGION_AMERICA 0x00000002
#define METWL_MASK_REGION_EUROPE 0x00000004
#define METWL_MASK_REGION_AUSTRALIA 0x00000008
#define METWL_MASK_REGION_CHINA 0x00000010
#define METWL_MASK_REGION_KOREA 0x00000020
#define METWL_MASK_REGION_ALL 0xffffffff