diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb index a83fcd2..ee1aaf6 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb and b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb differ diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo index 5856c97..0d9a9e0 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo and b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo differ diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm index 1e0dac8..0b920b0 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm and b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm differ diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Form1.h b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Form1.h index 0a86caf..2035958 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Form1.h +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Form1.h @@ -3048,7 +3048,8 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; void maskRatingForms(void); // フォーム入力が正しいか書き込み前チェック - void checkRatingForms( System::Boolean inRegion, System::Windows::Forms::ComboBox ^comb, System::String ^msg ); + void checkRatingForms( System::Boolean inRegion, + System::Windows::Forms::ComboBox ^comb, System::String ^msg ); // クリアする void clearRating( System::Windows::Forms::ComboBox ^comb ); @@ -3077,16 +3078,19 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; // ---------------------------------------------- // テキスト入力がされているかチェック - System::Boolean checkTextForm( System::String ^formtext, System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); + System::Boolean checkTextForm( System::String ^formtext, + System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); // 数値入力が正常かどうかチェック System::Boolean checkNumRange( - System::Int32 val, System::Int32 min, System::Int32 max, System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); + System::Int32 val, System::Int32 min, System::Int32 max, + System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); System::Boolean checkNumRange( System::String ^strval, System::Int32 min, System::Int32 max, System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); // コンボボックスをチェック - System::Boolean checkBoxIndex( System::Windows::Forms::ComboBox ^box, System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); + System::Boolean checkBoxIndex( System::Windows::Forms::ComboBox ^box, + System::String ^labelJ, System::String ^labelE, System::Boolean affectRom ); // ----------------------------------------------------------------- // 提出情報(SRLに影響しない箇所のみ)とフォーム間のデータのやりとり @@ -3212,6 +3216,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; ///////////////////////////////////////////// private: + // -------------------------------------------------------- + // 言語切り替え + // -------------------------------------------------------- System::Void stripItemEnglish_Click(System::Object^ sender, System::EventArgs^ e) { this->stripItemEnglish->Checked = true; @@ -3219,8 +3226,6 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; this->changeEnglish(); this->updateGrid(); } - - private: System::Void stripItemJapanese_Click(System::Object^ sender, System::EventArgs^ e) { this->stripItemEnglish->Checked = false; @@ -3230,6 +3235,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } private: + // -------------------------------------------------------- + // 「ROMファイルを開く」 + // -------------------------------------------------------- System::Void stripItemOpenRom_Click(System::Object^ sender, System::EventArgs^ e) { System::String^ filename; @@ -3253,7 +3261,10 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } //stripItemOpenRom_Click() private: - System::Void stripItemMasterRom_Click(System::Object^ sender, System::EventArgs^ e) // SRLのみ出力 + // -------------------------------------------------------- + // 「SRLのみ作成する」 + // -------------------------------------------------------- + System::Void stripItemMasterRom_Click(System::Object^ sender, System::EventArgs^ e) { // SRLが読み込まれていないときにはリードさせない if( System::String::IsNullOrEmpty( this->tboxFile->Text ) ) @@ -3325,7 +3336,10 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } //stripItemMasterRom_Click() private: - System::Void stripItemSheet_Click(System::Object^ sender, System::EventArgs^ e) // 一式を出力 + // -------------------------------------------------------- + // 「提出データ一式を作成する」 + // -------------------------------------------------------- + System::Void stripItemSheet_Click(System::Object^ sender, System::EventArgs^ e) { ECDeliverableResult result; @@ -3468,6 +3482,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } //stripItemSheet_Click() private: + // -------------------------------------------------------- + // 「提出情報を一時保存する」 + // -------------------------------------------------------- System::Void stripItemSaveTemp_Click(System::Object^ sender, System::EventArgs^ e) { System::String ^filename = this->saveFileDlg( "xml format (*.xml)|*.xml", ".xml" ); @@ -3479,6 +3496,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } //stripItemSaveTemp_Click() private: + // -------------------------------------------------------- + // 「一時保存した提出情報を開く」 + // -------------------------------------------------------- System::Void stripItemLoadTemp_Click(System::Object^ sender, System::EventArgs^ e) { System::String ^filename = this->openFileDlg( "xml format (*.xml)|*.xml" ); @@ -3490,6 +3510,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } //stripItemLoadTemp_Click() private: + // -------------------------------------------------------- + // 「ミドルウェアリストのみを作成する(XML形式)」 + // -------------------------------------------------------- System::Void stripItemMiddlewareXml_Click(System::Object^ sender, System::EventArgs^ e) { if( System::String::IsNullOrEmpty(this->tboxFile->Text) ) @@ -3507,6 +3530,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } //stripItemMiddlewareXml_Click() private: + // -------------------------------------------------------- + // 「ミドルウェアリストのみを作成する(HTML形式)」 + // -------------------------------------------------------- System::Void stripItemMiddlewareHtml_Click(System::Object^ sender, System::EventArgs^ e) { if( System::String::IsNullOrEmpty(this->tboxFile->Text) ) @@ -3528,18 +3554,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; // フォーム操作メソッド ///////////////////////////////////////////// - // ファイルパス表示用テキストボックス - //private: - // // ドラッグされてまだマウスのボタンが離されていないとき - // System::Void tboxFile_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) - // { - // } - // // ドラッグされたあとマウスのボタンが離されたとき - // System::Void tboxFile_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) - // { - // } - - // ドラッグアンドドロップを受け付ける領域をフォーム全体にする + // ドラッグアンドドロップでSRLを読み込む private: // ドラッグされてまだマウスのボタンが離されていないとき System::Void Form1_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) @@ -3570,8 +3585,9 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; //this->sucMsg( "ROMデータファイルのオープンに成功しました。", "The ROM data file is opened successfully." ); } - // チェックボタンを押したときに他のフォームを有効にする + // フォームの状態に連動して他のフォームを有効/無効にする private: + // 担当者2を入力することが選択されたときに入力用のテキストボックスを有効にする System::Void cboxIsInputPerson2_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { this->gboxPerson2->Enabled = this->cboxIsInputPerson2->Checked; @@ -3579,7 +3595,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; { if( (this->tboxCompany1->Text != nullptr) && !(this->tboxCompany1->Text->Equals("")) ) { - this->tboxCompany2->Text = gcnew System::String( this->tboxCompany1->Text ); + this->tboxCompany2->Text = gcnew System::String( this->tboxCompany1->Text ); // 会社と部署は担当者1と同じにする } if( (this->tboxDepart1->Text != nullptr) && !(this->tboxDepart1->Text->Equals("")) ) { @@ -3599,6 +3615,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; } } private: + // 用途に「その他」が選択されたときに入力用のテキストボックスを有効にする System::Void rUsageOther_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { this->tboxUsageOther->Enabled = this->rUsageOther->Checked; @@ -3610,6 +3627,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; private: System::Void cboxRemasterVerE_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { + // 設定不可になったため必要なし //this->numRemasterVer->Enabled = !(this->isEngilsh()); //if( this->isEngilsh() == false ) //{ @@ -3617,6 +3635,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; //} } private: + // バックアップメモリに「その他」が選択されたときに入力用のテキストボックスを有効にする System::Void combBackup_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { if( this->combBackup->SelectedIndex == (this->combBackup->Items->Count - 1) ) @@ -3626,35 +3645,35 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; else { this->tboxBackupOther->Enabled = false; - this->tboxBackupOther->Clear(); + this->tboxBackupOther->Clear(); // 前にテキストボックスに書かれていた内容を消去 } } private: + // リージョン変更に連動して表示するレーティング団体を変更する System::Void combRegion_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { this->maskRatingForms(); this->changeUnnecessaryRatingForms(false); // 一度コンボボックスがenableになるので再設定 } - private: + // レーティング表示不要が選択されたときにレーティングを選択不可にする System::Void cboxIsUnnecessaryRating_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { this->changeUnnecessaryRatingForms(false); } - private: + // レーティング情報をSRLを読み込んだ時点の情報に戻す System::Void butSetBack_Click(System::Object^ sender, System::EventArgs^ e) { if( System::String::IsNullOrEmpty( this->tboxFile->Text ) ) return; - // 編集可能情報を読み込み時の設定に戻す - this->setRegionForms(); + this->setRegionForms(); // フォームが更新されてもSRLクラスの情報は更新されないので再度読み出すだけ this->setRatingForms(); this->loadOtherForms(); // SRLに登録されていないROM仕様のフォームも戻す } - private: + // 海外版を発売予定であると選択されたときに海外版の製品コードetc.を入力可能にする System::Void cboxReleaseForeign_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { this->tboxProductNameForeign->Enabled = this->cboxReleaseForeign->Checked; @@ -3671,23 +3690,22 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating; this->tboxProductCode2Foreign3->Clear(); } } - + // エラー情報の更新 private: System::Void rErrorReading_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { this->updateGrid(); } - private: System::Void rErrorCurrent_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { this->updateGrid(); } - + // エラー情報タブが選択されるたびにエラー情報を更新 + // (エラータブが選択されたタイミングでのみ更新することができないのでタブが切り替えられるたびに更新する) private: System::Void tabMain_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { - // エラータブを最新情報に更新 if( tabMain->SelectedIndex == 5 ) { this->updateGrid(); diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_mrc.cpp b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_mrc.cpp index 64fbd25..0cf8b7a 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_mrc.cpp +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_mrc.cpp @@ -51,9 +51,7 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) System::Int32 i; System::Boolean result; - // ROMヘッダのチェック - - // 文字コードチェック + // タイトル名の文字コードチェック result = true; for( i=0; i < TITLE_NAME_MAX; i++ ) { @@ -108,6 +106,7 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) "Game Title", "Please use 20h for an space part.", false, true ) ); } + // ゲームコードの文字コードチェック result = true; for( i=0; i < GAME_CODE_MAX; i++ ) { @@ -130,6 +129,7 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) "Game Code", "SDK default code(NTRJ) is used.", false, true ) ); } + // メーカコードの文字コードチェック result = true; for( i=0; i < MAKER_CODE_MAX; i++ ) { @@ -146,8 +146,7 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) "Maker Code", "Unusable ASCII code is used.", false, true ) ); } - // 値チェック - + // デバイスタイプは不使用なので00h固定 if( this->pRomHeader->s.rom_type != 0x00 ) { this->hErrorList->Add( gcnew RCMrcError( @@ -155,6 +154,7 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) "Device Type", "Invalid data. Please set 00h.", false, true ) ); } + // リマスターバージョンが16進2桁のときエラー u8 romver = this->pRomHeader->s.rom_version; if( ((romver < 0x00) || (0x0f < romver)) && (romver != 0xE0) ) { @@ -162,6 +162,8 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) "リマスターバージョン", 0x1e, 0x1e, "不正な値です。正式版では01h-0Fhのいずれかの値、事前版ではE0hを設定してください。", "Release Ver.", "Invalid data. Please set either one of 01h-0Fh(Regular ver.), or E0h(Preliminary ver.)", false, true ) ); } + + // 必ず設定されていなければならないパラメータ if( this->pRomHeader->s.banner_offset == 0 ) { this->hErrorList->Add( gcnew RCMrcError( @@ -180,7 +182,7 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) // セキュア領域 if( !this->IsMediaNand ) // カードアプリのときのみ { - // セキュア領域はROMヘッダ外 + // セキュア領域はROMヘッダ外なのでファイルから別途読み出してチェックする u8 *secures; s32 secure_size = SECURE_AREA_END - this->pRomHeader->s.main_rom_offset; if (secure_size > SECURE_AREA_SIZE) @@ -269,6 +271,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) } #endif + // 旧開発用暗号フラグとクローンブートの組み合わせはマスタリングで矛盾が生じる if( this->IsOldDevEncrypt && this->HasDSDLPlaySign ) { this->hErrorList->Add( gcnew RCMrcError( @@ -279,8 +282,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) false, true ) ); } - // 値チェック - + // デバイス容量と実ファイルサイズ fseek( fp, 0, SEEK_END ); u32 filesize = ftell(fp); // 実ファイルサイズ u32 romsize = 1 << (this->pRomHeader->s.rom_size); // ROM容量(単位Mbit) @@ -311,31 +313,6 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "実ファイルサイズ", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, "中途半端な値です。通常では2のべき乗[Mbit]の値です。", "Actual File Size", "Invalid size. This size is usually power of 2.", false, true ) ); } - // 1Gbit以上のときの最終領域が固定値かどうか - this->mrcPadding( fp ); - - // セグメント3のCRC - u16 crcseg3; - BOOL crcret = getSeg3CRCInFp( fp, &crcseg3 ); - if( !crcret || (crcseg3 != METWL_SEG3_CRC) ) - { - this->hErrorList->Add( gcnew RCMrcError( - "セグメント3 CRC", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, - "セグメント3領域に誤りがあります。", - "Segment-3 CRC", "Invalid data exist in Segment-3 area.", false, true ) ); - } - - u16 NA = this->pRomHeader->s.twl_card_normal_area_rom_offset & 0x7fffUL; - u16 KA = this->pRomHeader->s.twl_card_keytable_area_rom_offset; - if( (NA == 0) || (KA == 0) || (NA > KA) ) - { - this->hErrorList->Add( gcnew RCMrcError( - "TWL ROMオフセット", 0x90, 0x93, - "TWLノーマル領域ROMオフセット(NA)およびTWL専用領域ROMオフセット(KA)はともに1以上で、かつNAはKAを超えてはいけません。", - "TWL ROM Offset", - "Both TWL Normal Area ROM Offset(NA) and TWL Limited Area ROM Offset(KA) are bigger than 0. And NA must be smaller than KA, or equals to KA.", - false, true ) ); - } } //if( *(this->hIsNAND) == false ) else // NANDアプリのときのみのチェック { @@ -356,6 +333,42 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) } } + // パディング + if( !this->IsMediaNand ) + { + // 1Gbit以上のときの最終領域が固定値かどうか + this->mrcPadding( fp ); + + // セグメント3のCRC + u16 crcseg3; + BOOL crcret = getSeg3CRCInFp( fp, &crcseg3 ); + if( !crcret || (crcseg3 != METWL_SEG3_CRC) ) + { + this->hErrorList->Add( gcnew RCMrcError( + "セグメント3 CRC", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + "セグメント3領域に誤りがあります。", + "Segment-3 CRC", "Invalid data exist in Segment-3 area.", false, true ) ); + } + } + + // ROMオフセット + if( !this->IsMediaNand ) + { + u16 NA = this->pRomHeader->s.twl_card_normal_area_rom_offset & 0x7fffUL; + u16 KA = this->pRomHeader->s.twl_card_keytable_area_rom_offset; + if( (NA == 0) || (KA == 0) || (NA > KA) ) + { + this->hErrorList->Add( gcnew RCMrcError( + "TWL ROMオフセット", 0x90, 0x93, + "TWLノーマル領域ROMオフセット(NA)およびTWL専用領域ROMオフセット(KA)はともに1以上で、かつNAはKAを超えてはいけません。", + "TWL ROM Offset", + "Both TWL Normal Area ROM Offset(NA) and TWL Limited Area ROM Offset(KA) are bigger than 0. And NA must be smaller than KA, or equals to KA.", + false, true ) ); + } + } + + // デバッガ動作禁止フラグはユーザアプリでは立っていてはいけない + // システムアプリではデバッガで解析されないように通常では立っていなければならない if( this->IsAppLauncher || this->IsAppSecure || this->IsAppSystem ) { if( this->pRomHeader->s.disable_debug == 0 ) @@ -368,7 +381,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) false, true ) ); } } - else // ユーザのときのみ + else { if( this->pRomHeader->s.disable_debug != 0 ) { @@ -379,8 +392,12 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "This ROM can't be analyzed on the debugger. This setting is unavailable.", false, true ) ); } + } - u8 okbits = 0x02 | 0x40 | 0x80; + // ノーマルジャンプ + if( !(this->IsAppLauncher || this->IsAppSecure || this->IsAppSystem) ) + { + u8 okbits = 0x01 | 0x02 | 0x40 | 0x80; u8 *p = (u8*)&(this->pRomHeader->s); if( p[0x1d] & ~okbits ) { @@ -391,14 +408,27 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "Illegal bit is setting. This setting is unavailable.", false, true ) ); } + + if( (this->pRomHeader->s.permit_landing_normal_jump != 0) && + !this->hMrcExternalCheckItems->IsPermitNormalJump ) // 設定ファイルでアクセス許可されていないときにチェック + { + this->hErrorList->Add( gcnew RCMrcError( + "ノーマルアプリジャンプ", 0x1d, 0x1d, + "ノーマルアプリジャンプは許可されていません。", + "Normal App Jump", + "This setting is not permitted.", + false, true ) ); + } } - if( this->pRomHeader->s.warning_no_spec_rom_speed != 0 ) + // NANDアプリのときにはROMの種類(MROM/1TROM)が設定されていなくてもよい + if( (this->pRomHeader->s.warning_no_spec_rom_speed != 0) && !this->IsMediaNand ) { this->hWarnList->Add( gcnew RCMrcError( "諸フラグ", 0x1f, 0x1f, "rsfファイルでROMSpeedTypeが設定されていません。", "Setting Flags", "In a RSF file, the item \"ROMSpeedType\" is not set.", false, true ) ); } + // 1TROMのみ許可(ROMの種類が設定されないときデフォルトで1TROMとなる) if( (this->pRomHeader->s.game_cmd_param & CARD_LATENCY_MASK) != CARD_1TROM_GAME_LATENCY ) { this->hErrorList->Add( gcnew RCMrcError( @@ -406,6 +436,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "ROM Control Info.", "Mask ROM can be set. Please set One-time PROM.", false, true ) ); } + // AESがかかっていないとエラー if( !this->IsMediaNand ) { if( (this->pRomHeader->s.enable_aes == 0) || (this->pRomHeader->s.aes_target_size == 0) ) @@ -425,8 +456,6 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) } } - // ROMヘッダのチェック (TWL専用領域) - // アプリ種別のチェック this->mrcAppType(fp); @@ -434,6 +463,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) this->mrcAccessControl(fp); this->mrcShared2(fp); + // NTRホワイトリスト署名 if( this->IsWL ) { this->hErrorList->Add( gcnew RCMrcError( @@ -444,6 +474,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) false, true ) ); } + // 通信アイコン表示 if( this->IsWiFiIcon && this->IsWirelessIcon ) { this->hErrorList->Add( gcnew RCMrcError( @@ -454,7 +485,8 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) false, true ) ); } - if( !this->IsMediaNand ) // カードアプリのときのみ + // TWL Limited static の位置が KeyTable 領域よりも前にあってはいけない + if( !this->IsMediaNand ) { u32 ideal = (this->pRomHeader->s.twl_card_keytable_area_rom_offset * 0x80000) + 0x3000; // TWL KeyTable領域の開始 + KeyTableサイズ u32 actual = this->pRomHeader->s.main_ltd_rom_offset; @@ -469,6 +501,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) } } + // ランチャー以外はSCFGにアクセスしてはならない if( !this->IsAppLauncher && this->IsSCFGAccess ) { this->hWarnList->Add( gcnew RCMrcError( @@ -476,6 +509,7 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "SCFG Setting", "In this setting, SCFG register is accessible.", false, true ) ); } + // TitleID Lo はゲームコードの逆順 if( (this->pRomHeader->s.titleID_Lo[0] != this->pRomHeader->s.game_code[3]) || (this->pRomHeader->s.titleID_Lo[1] != this->pRomHeader->s.game_code[2]) || (this->pRomHeader->s.titleID_Lo[2] != this->pRomHeader->s.game_code[1]) || @@ -486,11 +520,13 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) "Title ID", "Lower 4 bytes don't match ones of Game Code.", false, true ) ); } - // ROMヘッダ以外の領域のチェック - + // バナーの文字コード this->mrcBanner( fp ); + + // 予約領域に余計なデータが書かれていないか this->mrcReservedArea(fp); + // FINALROMビルドでないときSDにアクセスできてしまうのでエラー for each( RCLicense ^lic in this->hLicenseList ) { if( lic->Publisher->Equals( "NINTENDO" ) && lic->Name->Equals( "DEBUG" ) ) @@ -826,21 +862,50 @@ void RCSrl::mrcShared2(FILE *fp) System::String ^filenoE = "Shared File(No." + i.ToString() + ")"; if( !this->hMrcExternalCheckItems->hIsPermitShared2Array[i] ) { - this->hErrorList->Add( gcnew RCMrcError( - filenoJ, METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, - filenoJ + "へのアクセスは許可されていません。", - filenoE, - "Access to " + filenoE + " is not permitted.", - false, true ) ); + // 一般公開されていないのにファイルを使用する場合を考慮してシステムアプリ場合のメッセージを変更する + if( this->IsAppSystem || this->IsAppSecure || this->IsAppLauncher ) + { + this->hWarnList->Add( gcnew RCMrcError( + filenoJ, METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + "一般公開されていない" + filenoJ + "へのアクセスが設定されています。" + + "アクセス許可されているかご確認ください。", + filenoE, + filenoE + " is not revealed to licencies. Please check permission of access to this file.", + false, true ) ); + } + else + { + this->hErrorList->Add( gcnew RCMrcError( + filenoJ, METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + filenoJ + "へのアクセスは許可されていません。", + filenoE, + "Access to " + filenoE + " is not permitted.", + false, true ) ); + } } if( this->hShared2SizeArray[i] != this->hMrcExternalCheckItems->hShared2SizeArray[i] ) { - this->hErrorList->Add( gcnew RCMrcError( - filenoJ, METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, - filenoJ + "のファイルサイズに不正な値が設定されています。", - filenoE, - "Illegal file size of " + filenoE + ".", - false, true ) ); + if( this->IsAppSystem || this->IsAppSecure || this->IsAppLauncher ) + { + this->hWarnList->Add( gcnew RCMrcError( + filenoJ, METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + filenoJ + "のファイルサイズが " + + MasterEditorTWL::transSizeToString(this->hShared2SizeArray[i]) + " に設定されています。" + + "正しい値かどうかをご確認ください。", + filenoE, + "File size of " + filenoE + " is " + + MasterEditorTWL::transSizeToString(this->hShared2SizeArray[i]) + "." + + " Please check validation of this size.", + false, true ) ); + } + { + this->hErrorList->Add( gcnew RCMrcError( + filenoJ, METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + filenoJ + "のファイルサイズに不正な値が設定されています。", + filenoE, + "Illegal file size of " + filenoE + ".", + false, true ) ); + } } } //if( this->hShared2SizeArray[i] > 0 ) } //for diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp index 2b4ca97..016b703 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp @@ -10,14 +10,14 @@ #include #include -// +// ---------------------------------------------------------------------- // String を char 配列に格納 // // @arg [out] 格納先 // @arg [in] 格納元 // @arg [in] 文字列長 // @arg [in] 余りを埋める padding -// +// ---------------------------------------------------------------------- void MasterEditorTWL::setStringToChars( char *pDst, System::String ^hSrc, const System::Int32 nMax, const System::SByte pad ) { @@ -30,13 +30,13 @@ void MasterEditorTWL::setStringToChars( char *pDst, System::String ^hSrc, } } -// +// ---------------------------------------------------------------------- // ROMヘッダ中のROM容量設定バイトからROM容量を表す文字列を取得 // // @arg [in] ROM容量設定バイト // // @ret 文字列(単位つき) -// +// ---------------------------------------------------------------------- System::String^ MasterEditorTWL::transRomSizeToString( System::Byte ^byte ) { System::UInt32 size; @@ -57,13 +57,13 @@ System::String^ MasterEditorTWL::transRomSizeToString( System::Byte ^byte ) return (size.ToString() + unit); } -// +// ---------------------------------------------------------------------- // サイズから単位つきの文字列を取得 // // @arg [in] バイト数 // // @ret 文字列(単位つき) -// +// ---------------------------------------------------------------------- System::String^ MasterEditorTWL::transSizeToString( const System::UInt32 size ) { System::UInt32 val = size; @@ -109,7 +109,11 @@ System::String^ MasterEditorTWL::transSizeToString( const System::UInt32 size ) return (val.ToString() + " GB"); } -// 設定可能なインデックスのリストを取得する +// ---------------------------------------------------------------------- +// 各レーティング団体の設定可能年齢を取得する +// +// @arg [in] 団体No. +// ---------------------------------------------------------------------- cli::array^ MasterEditorTWL::getOgnRatingAges( int ogn ) { cli::array ^ages = gcnew cli::array{0}; @@ -145,7 +149,11 @@ cli::array^ MasterEditorTWL::getOgnRatingAges( int ogn ) return ages; } -// 設定可能なインデックスのリストを取得する +// ---------------------------------------------------------------------- +// 各レーティング団体の団体名を取得する +// +// @arg [in] 団体No. +// ---------------------------------------------------------------------- System::String^ MasterEditorTWL::getOgnName( int ogn ) { System::String ^name = gcnew System::String(""); @@ -181,11 +189,12 @@ System::String^ MasterEditorTWL::getOgnName( int ogn ) return name; } -// -// リージョンに含まれる団体のリストを返す(不正なリージョンのときはnullptr) +// ---------------------------------------------------------------------- +// リージョンに含まれるレーティング団体のリストを返す +// (不正なリージョンのときはnullptr) // // @arg [in] リージョン -// +// ---------------------------------------------------------------------- System::Collections::Generic::List^ MasterEditorTWL::getOgnListInRegion( u32 region ) { System::Collections::Generic::List ^list = gcnew System::Collections::Generic::List; @@ -239,7 +248,7 @@ System::Collections::Generic::List^ MasterEditorTWL::getOgnListInRegion( u3 return list; } -// +// ---------------------------------------------------------------------- // バイト列に特定のパターンが含まれるかどうかマッチングする // // @arg [in] テキスト @@ -249,7 +258,7 @@ System::Collections::Generic::List^ MasterEditorTWL::getOgnListInRegion( u3 // [in] テキストの終端まで調べた時点でテキストが途中までマッチしていた場合を成功とみなすか // // @ret マッチしたテキストのオフセットをリストで返す。 -// +// ---------------------------------------------------------------------- System::Collections::Generic::List^ MasterEditorTWL::patternMatch( const u8 *text, const u32 textLen, const u8 *pattern, const u32 patternLen, const System::Boolean enableLast ) { @@ -281,7 +290,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( return list; } // MasterEditorTWL::patternMatch -//// +//// ---------------------------------------------------------------------- //// バイト列に特定のパターンが含まれるかどうかマッチングする (Boyer-Moore法) //// //// @arg [in] テキスト @@ -291,7 +300,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( //// [in] skipマップ(あらかじめ生成しておく) //// //// @ret マッチしたテキストのインデックスをリストで返す。 -//// +//// ---------------------------------------------------------------------- //System::Collections::Generic::List^ MasterEditorTWL::patternMatchBM( // const u8 *text, const int textLen, const u8 *pattern, const int patternLen, const int skip[] ) //{ @@ -316,7 +325,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( // return list; //} // -//// +//// ---------------------------------------------------------------------- //// Boyer-Moore法のskipマップの生成 //// //// @arg [in] パターン @@ -324,7 +333,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( //// [out] skipマップの格納先 //// //// @ret なし -//// +//// ---------------------------------------------------------------------- //void MasterEditorTWL::makeSkipBM( const u8 *pattern, const int patternLen, int skip[] ) //{ // int i; @@ -338,7 +347,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( // } //} -// +// ---------------------------------------------------------------------- // ファイルにバイト列のパターンが含まれるかどうかマッチングする // // @arg [in] マッチ対象となるファイルポインタ @@ -347,7 +356,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( // // @ret マッチしたテキストのオフセットをリストで返す。 // 最後までマッチした場合のみ成功したとみなす。 -// +// ---------------------------------------------------------------------- #define PATTERN_MATCH_LEN_MAX (10*1024) System::Collections::Generic::List^ MasterEditorTWL::patternMatch( FILE *fp, const u8 *pattern, const u32 patternLen ) { @@ -397,7 +406,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( FILE *fp return list; } -// +// ---------------------------------------------------------------------- // XMLのルートノードから指定した名前のタグを検索して返す // // @arg [in] XMLのルートノード @@ -405,7 +414,7 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( FILE *fp // // @ret 検索でマッチしたときノードを返す。ないときは nullptr。 // ただし、最初にマッチしたもののみ返す -// +// ---------------------------------------------------------------------- System::Xml::XmlNode^ MasterEditorTWL::searchXmlNode( System::Xml::XmlElement ^root, System::String ^tag ) { System::Xml::XmlNodeList ^list = root->GetElementsByTagName( tag ); @@ -417,7 +426,7 @@ System::Xml::XmlNode^ MasterEditorTWL::searchXmlNode( System::Xml::XmlElement ^r return item; } -// +// ---------------------------------------------------------------------- // タグを検索してそのテキストが指定したテキストと一致するか調べる // // @arg [in] XMLのルートノード @@ -425,7 +434,7 @@ System::Xml::XmlNode^ MasterEditorTWL::searchXmlNode( System::Xml::XmlElement ^r // @arg [in] 値 // // @ret 一致するときtrue。一致しないとき、タグが存在しないときはfalse。 -// +// ---------------------------------------------------------------------- System::Boolean MasterEditorTWL::isXmlEqual( System::Xml::XmlElement ^root, System::String ^tag, System::String ^val ) { System::Xml::XmlNode ^item = MasterEditorTWL::searchXmlNode( root, tag ); @@ -436,14 +445,14 @@ System::Boolean MasterEditorTWL::isXmlEqual( System::Xml::XmlElement ^root, Syst return false; } -// +// ---------------------------------------------------------------------- // タグを検索してそのテキストを返す // // @arg [in] XMLのルートノード // @arg [in] タグのXPath // // @ret テキストが存在するときそのテキストを返す。存在しないときnullptr。 -// +// ---------------------------------------------------------------------- System::String^ MasterEditorTWL::getXPathText( System::Xml::XmlElement ^root, System::String ^xpath ) { System::Xml::XmlNode ^tmp = root->SelectSingleNode( xpath ); @@ -454,14 +463,14 @@ System::String^ MasterEditorTWL::getXPathText( System::Xml::XmlElement ^root, Sy return nullptr; } -// +// ---------------------------------------------------------------------- // XMLにタグを追加する // // @arg [in] XMLドキュメント // @arg [in] 親ノード // @arg [in] タグ名 // @arg [in] テキスト -// +// ---------------------------------------------------------------------- void MasterEditorTWL::appendXmlTag( System::Xml::XmlDocument ^doc, System::Xml::XmlElement ^parent, System::String ^tag, System::String ^text ) { @@ -473,13 +482,13 @@ void MasterEditorTWL::appendXmlTag( System::Xml::XmlDocument ^doc, System::Xml:: parent->AppendChild( node ); } -// +// ---------------------------------------------------------------------- // ビット数をカウントする // // @arg [in] 値 // // @ret ビット数 -// +// ---------------------------------------------------------------------- u32 MasterEditorTWL::countBits( const u32 val ) { // 分割統治法:隣り合うかたまりごとにビット数をカウントしていく @@ -493,14 +502,14 @@ u32 MasterEditorTWL::countBits( const u32 val ) return n; } -// +// ---------------------------------------------------------------------- // SDKバージョンの大小判定をする // // @arg [in] 判定対象のSDKバージョン(SRLに含まれるもの) // @arg [in] 判定基準のSDKバージョン(設定ファイルに記述されるもの) // // @ret 判定対象が基準よりも旧バージョンのとき(認められないとき) true -// +// ---------------------------------------------------------------------- System::Boolean MasterEditorTWL::IsOldSDKVersion( u32 target, u32 criterion ) { // SDKバージョンからメジャーバージョン/マイナーバージョン/relstepを抽出 @@ -534,13 +543,13 @@ System::Boolean MasterEditorTWL::IsOldSDKVersion( u32 target, u32 criterion ) return false; } -// +// ---------------------------------------------------------------------- // SDKバージョンがPR版かどうか調べる // // @arg [in] 判定対象のSDKバージョン(SRLに含まれるもの) // // @ret PR版のとき true -// +// ---------------------------------------------------------------------- System::Boolean MasterEditorTWL::IsSDKVersionPR( u32 target ) { System::UInt16 relstep = (System::UInt16)(0xffff & target); @@ -551,13 +560,13 @@ System::Boolean MasterEditorTWL::IsSDKVersionPR( u32 target ) return false; } -// +// ---------------------------------------------------------------------- // SDKバージョンがRC版かどうか調べる // // @arg [in] 判定対象のSDKバージョン(SRLに含まれるもの) // // @ret PR版のとき true -// +// ---------------------------------------------------------------------- System::Boolean MasterEditorTWL::IsSDKVersionRC( u32 target ) { System::UInt16 relstep = (System::UInt16)(0xffff & target); diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h index e0dd408..db36f1b 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h @@ -42,14 +42,14 @@ namespace MasterEditorTWL System::String^ transSizeToString( const System::UInt32 size ); // - // ペアレンタルコントロールの各団体の設定可能年齢を取得する + // 各レーティング団体の設定可能年齢を取得する // // @arg [in] 団体 // cli::array^ getOgnRatingAges( int ogn ); // - // ペアレンタルコントロールの各団体の団体名を取得する + // 各レーティング団体の団体名を取得する // // @arg [in] 団体 //