出力ファイルチェッカ:SRLのチェックで「レーティング表示不要」のときの処理を追加。表示形式を統一。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@170 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-02-24 02:47:24 +00:00
parent a4817c9425
commit 73705283bf
6 changed files with 87 additions and 30 deletions

View File

@ -47,6 +47,7 @@ int main(array<System::String ^> ^args)
System::String ^sheet = args[1];
DebugPrint( "Sheet file : " + sheet );
Console::Write( System::IO::Path::GetFileName( sheet ) + "\t" );
DebugPrint( "\n" );
FilenameItem ^fItem = gcnew FilenameItem;
fItem->parseFilename( sheet );
@ -61,6 +62,7 @@ int main(array<System::String ^> ^args)
DebugPrint( "Original file : " + original );
DebugPrint( "Target file : " + target );
Console::Write( System::IO::Path::GetFileName( target ) + "\t" );
DebugPrint( "\n" );
FilenameItem ^fItem = gcnew FilenameItem;
fItem->parseFilename( target );

View File

@ -46,37 +46,78 @@ System::Void checkRom( FilenameItem ^fItem, System::String ^orgSrl, System::Stri
checkRomHeaderSign( &rh );
DebugPrint( "--------------------------------------------------------" );
DebugPrint( "{0,-10} {1,-20}", nullptr, "RomHeader" );
DebugPrint( "{0,-10} {1,-20} {2,-20}", nullptr, "TrueValue", "RomHeader" );
DebugPrint( "--" );
// リージョンのチェック
u32 region = fItem->getRegionBitmap(); // ファイル名に対応する真値を取得
DebugPrint( "{0,-10} {1,-20:X04}", "Region", rh.s.card_region_bitmap );
DebugPrint( "{0,-10} {1,-20:X04} {2,-20:X04}", "Region", region, rh.s.card_region_bitmap );
DebugPrint( "--" );
if( rh.s.card_region_bitmap != region )
{
throw (gcnew System::Exception("Illegal Region in the ROM Header."));
throw (gcnew System::Exception("In Rom Header, illegal region in the ROM Header."));
return;
}
// リージョンに含まれる団体のレーティングenableフラグが立っているかチェック
System::Collections::Generic::List<int> ^ognlist = MasterEditorTWL::getOgnListInRegion( region );
for each ( int ogn in ognlist )
{
if( (rh.s.parental_control_rating_info[ogn] & OS_TWL_PCTL_OGNINFO_ENABLE_MASK) == 0 )
{
throw (gcnew System::Exception("Rating Ogn " + ogn.ToString() + " is not enabled."));
return;
}
}
// 設定したレーティングが正しいかどうかをチェック
int ogn = fItem->getOgnNumber(); // ファイル名に対応する真値を取得
u8 rating = fItem->getRatingValue();
if( rh.s.parental_control_rating_info[ ogn ] != rating )
System::Collections::Generic::List<int> ^ognlist = MasterEditorTWL::getOgnListInRegion( region );
if( fItem->getOgnNumber() >= 0 )
{
throw (gcnew System::Exception("mismatch Rating Ogn " + ogn.ToString() + "."));
return;
// 「レーティング表示不要」でないとき
int ogn = fItem->getOgnNumber(); // ファイル名に対応する真値を取得
u8 rating = fItem->getRatingValue();
DebugPrint( "{0,-10} {1,-20:X02} {2,-20:X02}", fItem->getOgnString(ogn), rating, rh.s.parental_control_rating_info[ogn] );
if( rh.s.parental_control_rating_info[ ogn ] != rating )
{
throw (gcnew System::Exception("In Rom Header, mismatch Rating Ogn " + ogn.ToString() + "."));
return;
}
// リージョンに含まれるその他の団体が「全年齢」になっているかチェック
for each ( int ogn in ognlist )
{
if( ogn != fItem->getOgnNumber() )
{
u8 zero = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | 0;
DebugPrint( "{0,-10} {1,-20:X02} {2,-20:X02}", fItem->getOgnString(ogn), zero, rh.s.parental_control_rating_info[ogn] );
if( rh.s.parental_control_rating_info[ogn] != zero )
{
throw (gcnew System::Exception("In Rom Header, Rating Ogn " + ogn.ToString() + " is not enabled."));
return;
}
}
}
// 「レーティング不要」フラグが立っていてはいけない
if( rh.s.unnecessary_rating_display != 0 )
{
throw (gcnew System::Exception("In Rom Header, \"Unnecessary\" flag is asserted."));
return;
}
}
else
{
// 「レーティング表示不要」のとき
// リージョンに含まれるすべての団体が「全年齢」になっているかチェック
for each ( int ogn in ognlist )
{
u8 zero = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | 0;
DebugPrint( "{0,-10} {1,-20:X02} {2,-20:X02}", fItem->getOgnString(ogn), zero, rh.s.parental_control_rating_info[ogn] );
if( rh.s.parental_control_rating_info[ogn] != zero )
{
throw (gcnew System::Exception("In Rom Header, Rating Ogn " + ogn.ToString() + " is not enabled."));
return;
}
}
// フラグチェック
if( rh.s.unnecessary_rating_display == 0 )
{
throw (gcnew System::Exception("In Rom Header, \"Unnecessary\" flag is negated."));
return;
}
}
// 表示
@ -90,19 +131,26 @@ System::Void checkRom( FilenameItem ^fItem, System::String ^orgSrl, System::Stri
alllist->Add( OS_TWL_PCTL_OGN_PEGI_BBFC );
alllist->Add( OS_TWL_PCTL_OGN_OFLC );
//alllist->Add( OS_TWL_PCTL_OGN_GRB );
for each ( int ogn in alllist )
{
DebugPrint( "{0,-10} {1,-20:X02}", fItem->getOgnString(ogn), rh.s.parental_control_rating_info[ogn] );
}
// リージョンに含まれない団体のレーティングがクリアされているかチェック
int i;
for( i=0; i < PARENTAL_CONTROL_INFO_SIZE; i++ )
{
if( (ognlist->IndexOf(i) < 0) && (rh.s.parental_control_rating_info[i] != 0) )
if( ognlist->IndexOf(i) < 0 )
{
throw (gcnew System::Exception("Rating Ogn " + i.ToString() + " is not cleared in ROM Header."));
return;
if( alllist->IndexOf(i) >= 0 )
{
DebugPrint( "{0,-10} {1,-20:X02} {2,-20:X02}", fItem->getOgnString(i), (u8)0, rh.s.parental_control_rating_info[i] );
}
else
{
DebugPrint( "{0,-10} {1,-20:X02} {2,-20:X02}", "Ogn" + i.ToString("D2") + "(rsv)", (u8)0, rh.s.parental_control_rating_info[i] );
}
if( rh.s.parental_control_rating_info[i] != 0 )
{
throw (gcnew System::Exception("In Rom Header, Rating Ogn " + i.ToString() + " is not cleared in ROM Header."));
return;
}
}
}
DebugPrint( "--------------------------------------------------------" );

View File

@ -96,7 +96,7 @@ System::Void checkSheet( FilenameItem ^fItem, SheetItem ^sItem )
System::Xml::XmlElement ^root = doc->DocumentElement;
DebugPrint( "--------------------------------------------------------" );
DebugPrint( "{0,-10} {1,-20} {2,-20}", nullptr, "Config", "Sheet" );
DebugPrint( "{0,-10} {1,-20} {2,-20}", nullptr, "TrueValue", "Sheet" );
DebugPrint( "--" );
// 設定ファイル中の真値と提出確認書の記述を比較
@ -116,7 +116,7 @@ System::Void checkSheet( FilenameItem ^fItem, SheetItem ^sItem )
// レーティングの文字列のチェック
System::Collections::Generic::List<int> ^ognlist = MasterEditorTWL::getOgnListInRegion( fItem->getRegionBitmap() );
if( fItem->ogn != fItem->getOgnString(-1) )
if( fItem->getOgnNumber() >= 0 )
{
// 「レーティング表示不要」でないとき
@ -129,7 +129,7 @@ System::Void checkSheet( FilenameItem ^fItem, SheetItem ^sItem )
return;
}
// その他のリージョンに含まれる団体が「全年齢」になっているかチェック
// リージョンに含まれるその他の団体が「全年齢」になっているかチェック
for each ( int ogn in ognlist )
{
if( ogn != fItem->getOgnNumber() )
@ -148,6 +148,13 @@ System::Void checkSheet( FilenameItem ^fItem, SheetItem ^sItem )
}
}
}
// 「レーティング不要」フラグが立っていてはいけない
if( !sItem->IsUnnecessaryRating )
{
throw (gcnew System::Exception("In Sheet, \"Unnecessary\" flag is asserted."));
return;
}
}
else
{
@ -173,7 +180,7 @@ System::Void checkSheet( FilenameItem ^fItem, SheetItem ^sItem )
// フラグをチェック
if( !sItem->IsUnnecessaryRating )
{
throw (gcnew System::Exception("In Sheet, \"Unnecessary\" Flag is Negated."));
throw (gcnew System::Exception("In Sheet, \"Unnecessary\" flag is negated."));
return;
}
}