マスタエディタ:SRLクラスを「レーティング表示不要」に対応させた。提出確認書とGUIはまだ。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@70 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2008-12-11 12:49:21 +00:00
parent 61b246553b
commit 61479059f3
7 changed files with 167 additions and 71 deletions

View File

@ -312,79 +312,100 @@ ECSrlResult RCSrl::setRomInfo(void)
this->hShared2SizeArray[5] = (this->pRomHeader->s.shared2_file5_size * unit) + unit; this->hShared2SizeArray[5] = (this->pRomHeader->s.shared2_file5_size * unit) + unit;
} }
// カードリージョン // ペアレンタルコントロール情報の取得
const u32 map = this->pRomHeader->s.card_region_bitmap;
this->IsRegionJapan = ((map & METWL_MASK_REGION_JAPAN) != 0)?true:false;
this->IsRegionAmerica = ((map & METWL_MASK_REGION_AMERICA) != 0)?true:false;
this->IsRegionEurope = ((map & METWL_MASK_REGION_EUROPE) != 0)?true:false;
this->IsRegionAustralia = ((map & METWL_MASK_REGION_AUSTRALIA) != 0)?true:false;
// ペアレンタルコントロール const u32 region = this->pRomHeader->s.card_region_bitmap;
this->setParentalControlInfo();
return ECSrlResult::NOERROR; // すべての団体を「不可」に初期化
} // ECSrlResult RCSrl::setRomInfo(void)
// ROMヘッダ内のペアレンタルコントロール情報をフィールドに反映させる
void RCSrl::setParentalControlInfo(void)
{
// リージョンに含まれていないものは読み込まない
this->hArrayParentalIndex = gcnew cli::array<int>(PARENTAL_CONTROL_INFO_SIZE); this->hArrayParentalIndex = gcnew cli::array<int>(PARENTAL_CONTROL_INFO_SIZE);
int i;
for( i=0; i < PARENTAL_CONTROL_INFO_SIZE; i++ ) for( i=0; i < PARENTAL_CONTROL_INFO_SIZE; i++ )
{ {
this->hArrayParentalIndex[i] = -1; this->hArrayParentalIndex[i] = -1;
} }
// リージョンに含まれている団体をリストアップ // リージョンとレーティングを取得
u32 region = this->pRomHeader->s.card_region_bitmap; if( this->setRegionInfo( region ) )
switch( region )
{ {
case METWL_MASK_REGION_JAPAN: this->setUnnecessaryRatingInfo( region ); // レーティング表示が不要かどうかを調べる(これがないと全年齢と区別できない)
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_CERO ); // リージョンに含まれない団体の情報は読み込まない if( !this->IsUnnecessaryRating )
break; {
this->setRatingInfo( region ); // リージョンに含まれる団体のレーティング情報を取得
}
}
case METWL_MASK_REGION_AMERICA: return ECSrlResult::NOERROR;
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_ESRB ); } // ECSrlResult RCSrl::setRomInfo(void)
break;
case METWL_MASK_REGION_EUROPE: // ROMヘッダ内のリージョン情報をフィールドに反映させる
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_USK ); bool RCSrl::setRegionInfo( u32 region )
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_GEN ); {
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_PRT ); this->IsRegionJapan = ((region & METWL_MASK_REGION_JAPAN) != 0)?true:false;
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_BBFC ); this->IsRegionAmerica = ((region & METWL_MASK_REGION_AMERICA) != 0)?true:false;
break; this->IsRegionEurope = ((region & METWL_MASK_REGION_EUROPE) != 0)?true:false;
this->IsRegionAustralia = ((region & METWL_MASK_REGION_AUSTRALIA) != 0)?true:false;
case METWL_MASK_REGION_AUSTRALIA: // リージョンに含まれる団体がなかったらリージョンは不正
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_OFLC ); if( MasterEditorTWL::getOgnListInRegion( region ) == nullptr )
break; {
this->hParentalErrorList->Add( gcnew RCMrcError(
"カードリージョン", 0x1b0, 0x1b3, "仕向地の組み合わせが不正です。ペアレンタルコントロール情報は無視して読み込まれました。",
"Card Region", "Illigal Region. Parental Control Information is ignored in reading.", true, true ) );
return false;
}
return true;
}
case (METWL_MASK_REGION_EUROPE|METWL_MASK_REGION_AUSTRALIA): // ROMヘッダ内のレーティング表示不要フラグを調べてフィールドに反映させる
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_USK ); void RCSrl::setUnnecessaryRatingInfo( u32 region )
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_GEN ); {
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_PRT ); System::Collections::Generic::List<int> ^ognlist = MasterEditorTWL::getOgnListInRegion( region );
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_BBFC ); if( ognlist == nullptr ) // リストがnullptrなら不正
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_OFLC ); {
break; return;
}
#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER) // ROMヘッダのフラグを調べる
case METWL_MASK_REGION_ALL: this->IsUnnecessaryRating = (this->pRomHeader->s.unnecessary_rating_display != 0)?true:false;
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_CERO ); if( !this->IsUnnecessaryRating )
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_ESRB ); {
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_USK ); return; // 不要でないならこれ以降のチェックは必要ない(レーティング情報の取得に移る)
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_GEN ); }
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_PRT );
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_PEGI_BBFC );
this->setOneRatingOrgInfo( OS_TWL_PCTL_OGN_OFLC );
break;
#endif //#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
default: // リージョンに含まれる団体のレーティング情報に余計なデータが登録されていないかチェック
this->hParentalErrorList->Add( gcnew RCMrcError( bool noerror = false;
"カードリージョン", 0x1b0, 0x1b3, "仕向地の組み合わせが不正です。ペアレンタルコントロール情報は無視して読み込まれました。", for each( int ogn in ognlist )
"Card Region", "Illigal Region. Parental Control Information is ignored in reading.", true, true ) ); {
break; bool b = false;
if( this->pRomHeader->s.parental_control_rating_info[ ogn ] == (OS_TWL_PCTL_OGNINFO_ENABLE_MASK | 0) ) // 全年齢しか許さない
{
b = true;
}
noerror = noerror | b; // すべて全年齢となっていないときはエラーとみなす
}
if( !noerror )
{
this->IsUnnecessaryRating = false; // エラーのときはROMヘッダに不要と登録されていても無視する
this->hParentalErrorList->Add( gcnew RCMrcError(
"ペアレンタルコントロール情報", 0x1b0, 0x1b3, "レーティング表示が不要かどうかを判断できません。再設定してください。",
"Parental Control Info.", "Can't judge wheather rating display is unnecessary.", true, true ) );
}
}
// ROMヘッダ内のペアレンタルコントロール情報をフィールドに反映させる
void RCSrl::setRatingInfo( u32 region )
{
// リージョンに含まれている団体をリストアップ
// (含まれていない団体のレーティングを読み込まない)
System::Collections::Generic::List<int> ^ognlist = MasterEditorTWL::getOgnListInRegion( region );
if( ognlist == nullptr ) // リストがnullptrなら不正
{
return;
}
// リージョンに含まれる団体のレーティング情報を調べる
for each( int ogn in ognlist )
{
this->setOneRatingOrgInfo( ogn );
} }
} }
@ -504,23 +525,30 @@ void RCSrl::setParentalControlHeader(void)
int i; int i;
for( i=0; i < PARENTAL_CONTROL_INFO_SIZE; i++ ) for( i=0; i < PARENTAL_CONTROL_INFO_SIZE; i++ )
{ {
cli::array<System::Byte> ^ages = MasterEditorTWL::getOgnRatingAges( i ); // 設定可能年齢リストを取得
u8 rating; u8 rating;
if( this->hArrayParentalIndex[i] < 0 ) // 未定義 if( this->IsUnnecessaryRating )
{ {
rating = 0x00; rating = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | 0; // レーティング表示が不要のときは「全年齢」と同じ値にする
} }
else else
{ {
int index = this->hArrayParentalIndex[i]; cli::array<System::Byte> ^ages = MasterEditorTWL::getOgnRatingAges( i ); // 設定可能年齢リストを取得
if( index == ages->Length ) // 審査中
if( this->hArrayParentalIndex[i] < 0 ) // 未定義
{ {
rating = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | OS_TWL_PCTL_OGNINFO_ALWAYS_MASK; rating = 0x00;
} }
else // レーティング年齢を設定 else
{ {
rating = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | ages[ index ]; int index = this->hArrayParentalIndex[i];
if( index == ages->Length ) // 審査中
{
rating = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | OS_TWL_PCTL_OGNINFO_ALWAYS_MASK;
}
else // レーティング年齢を設定
{
rating = OS_TWL_PCTL_OGNINFO_ENABLE_MASK | ages[ index ];
}
} }
} }
this->pRomHeader->s.parental_control_rating_info[i] = rating; this->pRomHeader->s.parental_control_rating_info[i] = rating;

View File

@ -275,7 +275,8 @@ namespace MasterEditorTWL
property System::String ^hLatency; // MROM/1TROM/Illegal property System::String ^hLatency; // MROM/1TROM/Illegal
// ペアレンタルコントロール // ペアレンタルコントロール
property cli::array<System::Int32> ^hArrayParentalIndex; // 表示用のコンボボックスのインデックス property cli::array<System::Int32> ^hArrayParentalIndex; // 表示用のコンボボックスのインデックス
property System::Boolean IsUnnecessaryRating; // レーティング表示不要フラグ
// TWL専用情報 一部編集可能 // TWL専用情報 一部編集可能
property System::UInt32 NormalRomOffset; property System::UInt32 NormalRomOffset;
@ -364,9 +365,11 @@ namespace MasterEditorTWL
ECSrlResult setRomHeader(void); // ROMヘッダにROM固有情報フィールドの値を反映させる ECSrlResult setRomHeader(void); // ROMヘッダにROM固有情報フィールドの値を反映させる
// ペアレンタルコントロールの設定 // ペアレンタルコントロールの設定
void setParentalControlInfo(void); bool setRegionInfo( u32 region ); // リージョンを取得(エラー情報も登録) @ret リージョンが正しいかどうか
void setOneRatingOrgInfo( int ogn ); void setUnnecessaryRatingInfo( u32 region ); // レーティング情報が不要かどうかを取得(エラー情報も登録)
void setParentalControlHeader(void); void setRatingInfo( u32 region ); // リージョンに含まれる団体のレーティングを取得
void setOneRatingOrgInfo( int ogn ); // 1つの団体のレーティングを取得(エラー情報も登録)
void setParentalControlHeader(void); // ROMヘッダにフィールドの値を反映させる
// ROMヘッダの更新 // ROMヘッダの更新
ECSrlResult calcRomHeaderCRC(void); // ROMヘッダのCRCを再計算 ECSrlResult calcRomHeaderCRC(void); // ROMヘッダのCRCを再計算

View File

@ -181,6 +181,64 @@ System::String^ MasterEditorTWL::getOgnName( int ogn )
return name; return name;
} }
//
// リージョンに含まれる団体のリストを返す(不正なリージョンのときはnullptr)
//
// @arg [in] リージョン
//
System::Collections::Generic::List<int>^ MasterEditorTWL::getOgnListInRegion( u32 region )
{
System::Collections::Generic::List<int> ^list = gcnew System::Collections::Generic::List<int>;
switch( region )
{
case METWL_MASK_REGION_JAPAN:
list->Add( OS_TWL_PCTL_OGN_CERO ); // リージョンに含まれない団体の情報は読み込まない
break;
case METWL_MASK_REGION_AMERICA:
list->Add( OS_TWL_PCTL_OGN_ESRB );
break;
case METWL_MASK_REGION_EUROPE:
list->Add( OS_TWL_PCTL_OGN_USK );
list->Add( OS_TWL_PCTL_OGN_PEGI_GEN );
list->Add( OS_TWL_PCTL_OGN_PEGI_PRT );
list->Add( OS_TWL_PCTL_OGN_PEGI_BBFC );
break;
case METWL_MASK_REGION_AUSTRALIA:
list->Add( OS_TWL_PCTL_OGN_OFLC );
break;
case (METWL_MASK_REGION_EUROPE|METWL_MASK_REGION_AUSTRALIA):
list->Add( OS_TWL_PCTL_OGN_USK );
list->Add( OS_TWL_PCTL_OGN_PEGI_GEN );
list->Add( OS_TWL_PCTL_OGN_PEGI_PRT );
list->Add( OS_TWL_PCTL_OGN_PEGI_BBFC );
list->Add( OS_TWL_PCTL_OGN_OFLC );
break;
#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
case METWL_MASK_REGION_ALL:
list->Add( OS_TWL_PCTL_OGN_CERO );
list->Add( OS_TWL_PCTL_OGN_ESRB );
list->Add( OS_TWL_PCTL_OGN_USK );
list->Add( OS_TWL_PCTL_OGN_PEGI_GEN );
list->Add( OS_TWL_PCTL_OGN_PEGI_PRT );
list->Add( OS_TWL_PCTL_OGN_PEGI_BBFC );
list->Add( OS_TWL_PCTL_OGN_OFLC );
break;
#endif //#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
default:
list = nullptr;
break;
}
return list;
}
// //
// バイト列に特定のパターンが含まれるかどうかマッチングする // バイト列に特定のパターンが含まれるかどうかマッチングする
// //

View File

@ -55,6 +55,13 @@ namespace MasterEditorTWL
// //
System::String^ getOgnName( int ogn ); System::String^ getOgnName( int ogn );
//
// リージョンに含まれる団体のリストを返す(不正なリージョンのときはnullptr)
//
// @arg [in] リージョン
//
System::Collections::Generic::List<int>^ getOgnListInRegion( u32 region );
// //
// バイト列に特定のパターンが含まれるかどうかマッチングする // バイト列に特定のパターンが含まれるかどうかマッチングする
// //