diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditorTWL/MasterEditorTWL.ncb index ec13bf9a..0229d09b 100644 Binary files a/build/tools/MasterEditorTWL/MasterEditorTWL.ncb and b/build/tools/MasterEditorTWL/MasterEditorTWL.ncb differ diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL.suo b/build/tools/MasterEditorTWL/MasterEditorTWL.suo index ff8d7263..ee7eb72e 100644 Binary files a/build/tools/MasterEditorTWL/MasterEditorTWL.suo and b/build/tools/MasterEditorTWL/MasterEditorTWL.suo differ diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm b/build/tools/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm index 3a80e6d1..0e5c7945 100644 Binary files a/build/tools/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm and b/build/tools/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm differ diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp index 0bd0a7a5..164b10a7 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp @@ -1116,38 +1116,6 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) "ROM Header CRC.", "Calclated CRC is different from Registered one.", false, true ) ); } - // 予約領域 - System::Boolean bRsv = true; - for( i=0; i < 8; i++ ) - { - if( this->pRomHeader->s.ctrl_reserved_B[i] != 0 ) - { - bRsv = false; - break; - } - } - if( !bRsv ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x078, 0x07f, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - bRsv = true; - for( i=0; i < 32; i++ ) - { - if( this->pRomHeader->s.reserved_C[i] != 0 ) - { - bRsv = false; - break; - } - } - if( !bRsv ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x160, 0x17f, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - // ROMヘッダ以外の領域のチェック (ファイルから適宜リードする) // システムコールライブラリ @@ -1321,38 +1289,6 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) } } - // 予約領域 - System::Boolean bReserved = true; - for( i=0; i < 7; i++ ) - { - if( this->pRomHeader->s.reserved_A[i] != 0 ) - { - bReserved = false; - break; - } - } - if( !bReserved ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x015, 0x01b, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - bReserved = true; - for( i=0; i < 39; i++ ) - { - if( this->pRomHeader->s.reserved_B[i] != 0 ) - { - bReserved = false; - break; - } - } - if( !bReserved ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x099, 0x0bf, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - // ROMヘッダのチェック (TWL専用領域) // 値チェック @@ -1524,59 +1460,10 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "Title ID", "Lower 4 bytes don't match ones of Game Code.", false, true ) ); } - bReserved = true; - for( i=0; i < (0x2f0 - 0x240); i++ ) - { - if( this->pRomHeader->s.reserved_ltd_F[i] != 0 ) - { - bReserved = false; - break; - } - } - if( !bReserved ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x240, 0x2ef, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - - bReserved = true; - for( i=0; i < (0x3a0 - 0x378); i++ ) - { - u8 *p = (u8*)this->pRomHeader; - if( p[ 0x378 + i ] != 0 ) - { - bReserved = false; - break; - } - } - if( !bReserved ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x378, 0x39f, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - - bReserved = true; - for( i=0; i < (0xf80 - 0x3b4); i++ ) - { - u8 *p = (u8*)this->pRomHeader; - if( p[ 0x3b4 + i ] != 0 ) - { - bReserved = false; - break; - } - } - if( !bReserved ) - { - this->hErrorList->Add( gcnew RCMrcError( - "予約領域", 0x3b4, 0xf7f, "不正な値が含まれています。この領域をすべて0で埋めてください。", - "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); - } - // ROMヘッダ以外の領域のチェック this->mrcBanner( fp ); + this->mrcReservedArea(fp); // 追加チェック if( *(this->hMrcSpecialList->hIsCheck) == true ) @@ -1699,6 +1586,62 @@ void RCSrl::mrcPadding(FILE *fp) delete []buf; } +// 予約領域 +void RCSrl::mrcReservedArea(FILE *fp) +{ + System::Xml::XmlDocument ^doc = gcnew System::Xml::XmlDocument(); + try + { + doc->Load( "../resource/ini.xml" ); + } + catch( System::Exception ^ex ) + { + (void)ex; + this->hErrorList->Add( gcnew RCMrcError( + "予約領域", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + "設定ファイルから予約領域のリストを読み出すことができませんでした。", + "Reserved Area", + "The list of reserved areas is not found in the setting file.", + false, true ) ); + return; + } + + // 設定ファイルから予約領域の情報を読み出す + System::Xml::XmlNodeList ^list = doc->SelectNodes( "/init/reserved-list/reserved" ); + System::Collections::IEnumerator^ iter = list->GetEnumerator(); + while( iter->MoveNext() ) + { + System::Xml::XmlNode ^area = safe_cast(iter->Current); + System::Xml::XmlNode ^begin = area->SelectSingleNode( "begin" ); // 相対パス + System::Xml::XmlNode ^end = area->SelectSingleNode( "end" ); // 相対パス + if( begin && begin->FirstChild && begin->FirstChild->Value && + end && end->FirstChild && end->FirstChild->Value ) + { + System::UInt32 ibeg = System::UInt32::Parse( begin->FirstChild->Value, System::Globalization::NumberStyles::AllowHexSpecifier ); + System::UInt32 iend = System::UInt32::Parse( end->FirstChild->Value, System::Globalization::NumberStyles::AllowHexSpecifier ); + System::UInt32 size = iend - ibeg + 1; + System::UInt32 i; + System::Boolean bReserved = true; + for( i=0; i < size; i++ ) + { + u8 *p = (u8*)this->pRomHeader; + if( p[ ibeg + i ] != 0 ) + { + bReserved = false; + break; + } + } + if( !bReserved ) + { + this->hErrorList->Add( gcnew RCMrcError( + "予約領域", ibeg, iend, "不正な値が含まれています。この領域をすべて0で埋めてください。", + "Reserved Area", "Invalid data is included. Please set 0 into this area.", false, true ) ); + } + + } + } +} + // バナー void RCSrl::mrcBanner(FILE *fp) { diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h index 532f3fb7..07b4df2e 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h @@ -385,6 +385,7 @@ namespace MasterEditorTWL ECSrlResult mrcTWL( FILE *fp ); void mrcPadding( FILE *fp ); void mrcBanner( FILE *fp ); + void mrcReservedArea( FILE *fp ); }; // end of ref class RCSrl diff --git a/build/tools/MasterEditorTWL/resource/ini.xml b/build/tools/MasterEditorTWL/resource/ini.xml index b2f2db6c..60e26ef0 100644 --- a/build/tools/MasterEditorTWL/resource/ini.xml +++ b/build/tools/MasterEditorTWL/resource/ini.xml @@ -17,4 +17,13 @@ 0 0 + + 787f + 16017f + 151b + 99bf + 2402ef + 37839f + 3b4f7f + diff --git a/build/tools/MasterEditorTWL_Launcher/resource/ini.xml b/build/tools/MasterEditorTWL_Launcher/resource/ini.xml index b2f2db6c..60e26ef0 100644 --- a/build/tools/MasterEditorTWL_Launcher/resource/ini.xml +++ b/build/tools/MasterEditorTWL_Launcher/resource/ini.xml @@ -17,4 +17,13 @@ 0 0 + + 787f + 16017f + 151b + 99bf + 2402ef + 37839f + 3b4f7f + diff --git a/build/tools/MasterEditorTWL_Package/resource/ini.xml b/build/tools/MasterEditorTWL_Package/resource/ini.xml index b2f2db6c..60e26ef0 100644 --- a/build/tools/MasterEditorTWL_Package/resource/ini.xml +++ b/build/tools/MasterEditorTWL_Package/resource/ini.xml @@ -17,4 +17,13 @@ 0 0 + + 787f + 16017f + 151b + 99bf + 2402ef + 37839f + 3b4f7f + diff --git a/build/tools/MasterEditorTWL_Secure/resource/ini.xml b/build/tools/MasterEditorTWL_Secure/resource/ini.xml index b2f2db6c..60e26ef0 100644 --- a/build/tools/MasterEditorTWL_Secure/resource/ini.xml +++ b/build/tools/MasterEditorTWL_Secure/resource/ini.xml @@ -17,4 +17,13 @@ 0 0 + + 787f + 16017f + 151b + 99bf + 2402ef + 37839f + 3b4f7f + diff --git a/build/tools/MasterEditorTWL_System/resource/ini.xml b/build/tools/MasterEditorTWL_System/resource/ini.xml index b2f2db6c..60e26ef0 100644 --- a/build/tools/MasterEditorTWL_System/resource/ini.xml +++ b/build/tools/MasterEditorTWL_System/resource/ini.xml @@ -17,4 +17,13 @@ 0 0 + + 787f + 16017f + 151b + 99bf + 2402ef + 37839f + 3b4f7f +