diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditorTWL/MasterEditorTWL.ncb index 012c4c93..7ea024dd 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 53c4d216..7786ceac 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 e0cb2d97..6441522d 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/Form1.h b/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.h index ffefd509..65a449ac 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.h @@ -925,7 +925,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; // labTitleName // this->labTitleName->AutoSize = true; - this->labTitleName->Location = System::Drawing::Point(16, 24); + this->labTitleName->Location = System::Drawing::Point(14, 24); this->labTitleName->Name = L"labTitleName"; this->labTitleName->Size = System::Drawing::Size(65, 12); this->labTitleName->TabIndex = 1; @@ -965,19 +965,19 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->combBackup->FormattingEnabled = true; this->combBackup->Items->AddRange(gcnew cli::array< System::Object^ >(9) {L"4Kbit EEPROM", L"64Kbit EEPROM", L"512Kbit EEPROM", L"256Kbit FRAM", L"2Mbit FLASH", L"4Mbit FLASH", L"8Mbit FLASH", L"なし", L"その他"}); - this->combBackup->Location = System::Drawing::Point(105, 18); + this->combBackup->Location = System::Drawing::Point(105, 17); this->combBackup->MaxDropDownItems = 9; this->combBackup->Name = L"combBackup"; - this->combBackup->Size = System::Drawing::Size(100, 20); + this->combBackup->Size = System::Drawing::Size(113, 20); this->combBackup->TabIndex = 5; this->combBackup->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::combBackup_SelectedIndexChanged); // // tboxBackupOther // this->tboxBackupOther->Enabled = false; - this->tboxBackupOther->Location = System::Drawing::Point(211, 19); + this->tboxBackupOther->Location = System::Drawing::Point(224, 17); this->tboxBackupOther->Name = L"tboxBackupOther"; - this->tboxBackupOther->Size = System::Drawing::Size(93, 19); + this->tboxBackupOther->Size = System::Drawing::Size(97, 19); this->tboxBackupOther->TabIndex = 6; // // gboxCRC @@ -1458,7 +1458,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->gboxTWLInfoWritable->Size = System::Drawing::Size(451, 313); this->gboxTWLInfoWritable->TabIndex = 30; this->gboxTWLInfoWritable->TabStop = false; - this->gboxTWLInfoWritable->Text = L"ROMデータ編集可能情報(必要がであれば変更してください)"; + this->gboxTWLInfoWritable->Text = L"ROMデータ編集可能情報(必要があれば変更してください)"; // // labRegion // @@ -2533,7 +2533,8 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->tboxLib->Multiline = true; this->tboxLib->Name = L"tboxLib"; this->tboxLib->ReadOnly = true; - this->tboxLib->Size = System::Drawing::Size(337, 80); + this->tboxLib->ScrollBars = System::Windows::Forms::ScrollBars::Both; + this->tboxLib->Size = System::Drawing::Size(337, 91); this->tboxLib->TabIndex = 32; // // labLib @@ -2551,6 +2552,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->tboxSDK->Multiline = true; this->tboxSDK->Name = L"tboxSDK"; this->tboxSDK->ReadOnly = true; + this->tboxSDK->ScrollBars = System::Windows::Forms::ScrollBars::Both; this->tboxSDK->Size = System::Drawing::Size(337, 65); this->tboxSDK->TabIndex = 10; // @@ -2884,7 +2886,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->gboxTitleID->Controls->Add(this->tboxTitleIDHi); this->gboxTitleID->Controls->Add(this->tboxAppType); this->gboxTitleID->Controls->Add(this->labAppType); - this->gboxTitleID->Location = System::Drawing::Point(17, 37); + this->gboxTitleID->Location = System::Drawing::Point(18, 34); this->gboxTitleID->Name = L"gboxTitleID"; this->gboxTitleID->Size = System::Drawing::Size(348, 151); this->gboxTitleID->TabIndex = 23; @@ -2894,7 +2896,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; // labHex2 // this->labHex2->AutoSize = true; - this->labHex2->Location = System::Drawing::Point(209, 51); + this->labHex2->Location = System::Drawing::Point(206, 51); this->labHex2->Name = L"labHex2"; this->labHex2->Size = System::Drawing::Size(11, 12); this->labHex2->TabIndex = 7; @@ -2903,7 +2905,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; // labHex1 // this->labHex1->AutoSize = true; - this->labHex1->Location = System::Drawing::Point(209, 23); + this->labHex1->Location = System::Drawing::Point(206, 23); this->labHex1->Name = L"labHex1"; this->labHex1->Size = System::Drawing::Size(11, 12); this->labHex1->TabIndex = 6; @@ -2966,7 +2968,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; // labCaptionEx // this->labCaptionEx->AutoSize = true; - this->labCaptionEx->Location = System::Drawing::Point(28, 195); + this->labCaptionEx->Location = System::Drawing::Point(29, 195); this->labCaptionEx->Name = L"labCaptionEx"; this->labCaptionEx->Size = System::Drawing::Size(53, 12); this->labCaptionEx->TabIndex = 11; @@ -3349,9 +3351,20 @@ private: System::Windows::Forms::GroupBox^ gboxProd; if( this->hSrl->hSDKList != nullptr ) { this->tboxSDK->Clear(); - for each( System::String ^str in this->hSrl->hSDKList ) + for each( RCSDKVersion ^ver in this->hSrl->hSDKList ) { - this->tboxSDK->Text += str + "\r\n"; + if( ver->IsStatic ) + this->tboxSDK->Text += ver->Version + " (main static)\r\n"; + else + this->tboxSDK->Text += ver->Version + "\r\n"; + } + } + if( this->hSrl->hLicenseList != nullptr ) + { + this->tboxLib->Clear(); + for each( RCLicense ^lic in this->hSrl->hLicenseList ) + { + this->tboxLib->Text += lic->Publisher + " " + lic->Name + "\r\n"; } } @@ -3363,18 +3376,22 @@ private: System::Windows::Forms::GroupBox^ gboxProd; System::Boolean checkSrlForms(void) { // 不正な場合はダイアログで注意してreturn - if( this->checkTextForm( this->tboxTitleName->Text, this->labTitleName->Text ) == false ) - return false; - if( this->checkTextForm( this->tboxGameCode->Text, this->labGameCode->Text ) == false ) - return false; - if( this->checkTextForm( this->tboxMakerCode->Text, this->labMakerCode->Text ) == false ) - return false; - if( this->checkTextForm( this->tboxPlatform->Text, this->labPlatform->Text ) == false ) - return false; - if( this->checkTextForm( this->tboxRomSize->Text, this->labPlatform->Text ) == false ) + //if( this->checkTextForm( this->tboxTitleName->Text, this->labTitleName->Text ) == false ) + // return false; + //if( this->checkTextForm( this->tboxGameCode->Text, this->labGameCode->Text ) == false ) + // return false; + //if( this->checkTextForm( this->tboxMakerCode->Text, this->labMakerCode->Text ) == false ) + // return false; + //if( this->checkTextForm( this->tboxPlatform->Text, this->labPlatform->Text ) == false ) + // return false; + //if( this->checkTextForm( this->tboxRomSize->Text, this->labPlatform->Text ) == false ) + // return false; + + // リージョン + if( this->checkBoxIndex( this->combRegion, this->labRegion->Text ) == false ) return false; - // 反映する前にフォームが正しいかどうかチェック + // ペアレンタルコントロール if( this->checkParentalForms( this->combCERO, this->cboxCERO, this->labCERO->Text ) == false ) return false; if( this->checkParentalForms( this->combESRB, this->cboxESRB, this->labESRB->Text ) == false) @@ -3412,6 +3429,34 @@ private: System::Windows::Forms::GroupBox^ gboxProd; // ペアレンタルコントロール関連の情報をフォームから取得してSRLに反映させる void setParentalSrlPropaties(void) { + // リージョン + this->hSrl->hIsRegionJapan = gcnew System::Boolean(false); + this->hSrl->hIsRegionAmerica = gcnew System::Boolean(false); + this->hSrl->hIsRegionEurope = gcnew System::Boolean(false); + this->hSrl->hIsRegionAustralia = gcnew System::Boolean(false); + switch( this->combRegion->SelectedIndex ) + { + case 0: + this->hSrl->hIsRegionJapan = gcnew System::Boolean(true); + break; + + case 1: + this->hSrl->hIsRegionAmerica = gcnew System::Boolean(true); + break; + + case 2: + this->hSrl->hIsRegionEurope = gcnew System::Boolean(true); + break; + + case 4: + this->hSrl->hIsRegionEurope = gcnew System::Boolean(true); + this->hSrl->hIsRegionAustralia = gcnew System::Boolean(true); + break; + + default: + break; + } + System::Byte rating; // CERO switch( this->combCERO->SelectedIndex ) @@ -3551,6 +3596,24 @@ private: System::Windows::Forms::GroupBox^ gboxProd; { System::Int32 index; + // リージョン + System::Boolean isJapan = *(this->hSrl->hIsRegionJapan); + System::Boolean isAmerica = *(this->hSrl->hIsRegionAmerica); + System::Boolean isEurope = *(this->hSrl->hIsRegionEurope); + System::Boolean isAustralia = *(this->hSrl->hIsRegionAustralia); + if( isJapan && !isAmerica && !isEurope && !isAustralia ) + index = 0; + else if( !isJapan && isAmerica && !isEurope && !isAustralia ) + index = 1; + else if( !isJapan && !isAmerica && isEurope && !isAustralia ) + index = 2; + else if( !isJapan && !isAmerica && isEurope && isAustralia ) + index = 3; + else + index = -1; // 不正 + this->combRegion->SelectedIndex = index; + this->maskParentalForms(); + // CERO switch( *(hSrl->hArrayParentalRating[ OS_TWL_PCTL_OGN_CERO ]) ) { @@ -3686,6 +3749,79 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->cboxAlwaysOFLC->Checked = *(hSrl->hArrayParentalAlways[ OS_TWL_PCTL_OGN_OFLC ]); } + // リージョン情報からペアレンタルコントロールの編集可能団体をマスクする + void maskParentalForms(void) + { + this->enableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); + this->enableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); + this->enableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); + this->enableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); + this->enableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); + this->enableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); + this->enableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); + switch( this->combRegion->SelectedIndex ) + { + case 0: + // 日本 + this->enableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); + + this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); + this->disableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); + this->disableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); + this->disableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); + this->disableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); + this->disableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); + break; + + case 1: + // 米国 + this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); + this->enableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); + this->disableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); + this->disableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); + this->disableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); + this->disableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); + this->disableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); + break; + + case 2: + // 欧州 + this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); + this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); + this->enableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); + this->enableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); + this->enableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); + this->enableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); + this->disableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); + break; + + case 3: + // 豪州 + this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); + this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); + this->disableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); + this->disableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); + this->disableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); + this->disableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); + this->enableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); + break; + + case 4: + // 欧州と豪州 + this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); + this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); + this->enableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); + this->enableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); + this->enableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); + this->enableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); + this->enableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); + break; + + default: + break; + } + } + // ペアレンタルコントロール関連情報専用のダイアログメッセージ void parentalMsg( const System::Int32 type, const System::String ^msg ) { @@ -3748,7 +3884,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; } if( !System::String::IsNullOrEmpty( this->tboxProductCode2Foreign2->Text ) ) { - this->hDeliv->hProductCode2Foreign += ("/" + this->tboxProductCode2Foreign2->Text); + this->hDeliv->hProductCode2Foreign += ("/" + this->tboxProductCode2Foreign3->Text); } } else @@ -3764,7 +3900,20 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->hDeliv->hSubmitMonth = gcnew System::Int32( this->dateSubmit->Value.Month ); this->hDeliv->hSubmitDay = gcnew System::Int32( this->dateSubmit->Value.Day ); this->hDeliv->hSubmitVersion = gcnew System::Int32( System::Decimal::ToInt32( this->numSubmitVersion->Value ) ); - this->hDeliv->hSDK = this->tboxSDK->Text; + // SDK + this->hDeliv->hSDK = nullptr; + if( this->hSrl->hSDKList ) + { + for each( RCSDKVersion ^sdk in this->hSrl->hSDKList ) // 書類には ARM9 static のバージョン情報を記入する + { + if( sdk->IsStatic ) + this->hDeliv->hSDK = sdk->Version; + } + } + if( this->hDeliv->hSDK == nullptr ) + { + this->hDeliv->hSDK = gcnew System::String( "Undefined" ); + } // 提出方法 if( this->rSubmitPost->Checked == true ) { @@ -4149,7 +4298,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; this->labCaptionEx->Text = gcnew System::String( "特記事項" ); // ROMデータ編集可能情報 - this->gboxTWLInfoWritable->Text = gcnew System::String( "ROM編集可能情報(必要であれば変更してください)" ); + this->gboxTWLInfoWritable->Text = gcnew System::String( "ROM編集可能情報(必要があれば変更してください)" ); this->labEULA->Text = gcnew System::String( "EULA同意バージョン" ); this->cboxIsEULA->Text = gcnew System::String( "EULA同意" ); this->cboxIsWirelessIcon->Text = gcnew System::String( "DSワイヤレス通信アイコン表示" ); @@ -4423,12 +4572,6 @@ private: System::Windows::Forms::GroupBox^ gboxProd; // SRLの保存 System::Void saveSrl( System::String ^filename ) { - // SRL関連フォーム入力をチェックする - if( this->checkSrlForms() == false ) - { - return; - } - // ROM情報をフォームから取得してSRLバイナリに反映させる this->setSrlPropaties(); // マスタ書類情報をフォームから取得して書類に反映させる -> 必要なし @@ -4498,6 +4641,22 @@ private: System::Windows::Forms::GroupBox^ gboxProd; { System::String^ filename; + // SRLが読み込まれていないときにはリードさせない + if( System::String::IsNullOrEmpty( this->tboxFile->Text ) ) + { + if( this->rSelectJ->Checked == true ) + this->errMsg( "ROMデータファイルがオープンされていません。" ); + else + this->errMsg( "ROM file has not opened yet." ); + return; + } + + // SRL関連フォーム入力をチェックする + if( this->checkSrlForms() == false ) + { + return; + } + // ダイアログで決めたファイルにSRLを保存 { System::Windows::Forms::SaveFileDialog ^dlg = gcnew (SaveFileDialog); @@ -4563,6 +4722,16 @@ private: System::Windows::Forms::GroupBox^ gboxProd; System::UInt16 ^hcrc; cli::array ^paths; + // SRLが読み込まれていないときにはリードさせない + if( System::String::IsNullOrEmpty( this->tboxFile->Text ) ) + { + if( this->rSelectJ->Checked == true ) + this->errMsg( "ROMデータファイルがオープンされていません。" ); + else + this->errMsg( "ROM file has not opened yet." ); + return; + } + // SRLと書類の両方のフォーム入力をチェックする if( this->checkSrlForms() == false ) { @@ -4768,67 +4937,7 @@ private: System::Windows::Forms::GroupBox^ gboxProd; private: System::Void combRegion_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { - switch( this->combRegion->SelectedIndex ) - { - case 0: - // 日本 - this->enableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); - - this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); - this->disableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); - this->disableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); - this->disableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); - this->disableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); - this->disableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); - break; - - case 1: - // 米国 - this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); - this->enableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); - this->disableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); - this->disableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); - this->disableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); - this->disableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); - this->disableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); - break; - - case 2: - // 欧州 - this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); - this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); - this->enableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); - this->enableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); - this->enableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); - this->enableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); - this->disableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); - break; - - case 3: - // 豪州 - this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); - this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); - this->disableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); - this->disableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); - this->disableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); - this->disableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); - this->enableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); - break; - - case 4: - // 欧州と豪州 - this->disableParental( this->combCERO, this->cboxCERO, this->cboxAlwaysCERO ); - this->disableParental( this->combESRB, this->cboxESRB, this->cboxAlwaysESRB ); - this->enableParental( this->combUSK, this->cboxUSK, this->cboxAlwaysUSK ); - this->enableParental( this->combPEGI, this->cboxPEGI, this->cboxAlwaysPEGI ); - this->enableParental( this->combPEGIPRT, this->cboxPEGIPRT, this->cboxAlwaysPEGIPRT ); - this->enableParental( this->combPEGIBBFC, this->cboxPEGIBBFC, this->cboxAlwaysPEGIBBFC ); - this->enableParental( this->combOFLC, this->cboxOFLC, this->cboxAlwaysOFLC ); - break; - - default: - break; - } + this->maskParentalForms(); } private: diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp index 692f8827..2ac63b4e 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp @@ -62,6 +62,12 @@ ECSrlResult RCSrl::readFromFile( System::String ^filename ) (void)fclose(fp); return r; } + r = this->searchLicenses( fp ); + if( r != ECSrlResult::NOERROR ) + { + (void)fclose(fp); + return r; + } } (void)fclose( fp ); @@ -481,15 +487,17 @@ ECSrlResult RCSrl::hasDSDLPlaySign( FILE *fp ) // ECSrlResult RCSrl::searchSDKVersion( FILE *fp ) { + // SDKバージョンはSRLバイナリ中に以下のマジックナンバとともに埋められている const u8 pattern[8] = {0x21, 0x06, 0xc0, 0xde, 0xde, 0xc0, 0x06, 0x21}; System::Collections::Generic::List ^list; - this->hSDKList = gcnew System::Collections::Generic::List; + + this->hSDKList = gcnew System::Collections::Generic::List; this->hSDKList->Clear(); list = MasterEditorTWL::patternMatch( fp, pattern , 8 ); if( list == nullptr ) { - System::Diagnostics::Debug::WriteLine( "no list" ); + //System::Diagnostics::Debug::WriteLine( "no list" ); return ECSrlResult::ERROR_SDK; } for each( u32 item in list ) @@ -531,9 +539,63 @@ ECSrlResult RCSrl::searchSDKVersion( FILE *fp ) case 3: str += ("RELEASE " + patch.ToString()); break; default: break; } - this->hSDKList->Add( str ); + u32 statbegin = this->pRomHeader->s.main_rom_offset; + u32 statend = this->pRomHeader->s.main_rom_offset + this->pRomHeader->s.main_size - 1; + System::Boolean isstat = ((statbegin <= offset) && (offset <= statend))?true:false; + this->hSDKList->Add( gcnew RCSDKVersion(str, isstat) ); //System::Diagnostics::Debug::WriteLine( "SDK " + str ); } } return ECSrlResult::NOERROR; } + +// +// 使用ライセンスを取得する +// +#define LICENSE_LEN_MAX 1024 // これよりもライセンスの文字列が長いとき正しく取得できない +ECSrlResult RCSrl::searchLicenses(FILE *fp) +{ + // ライセンスはSRLバイナリ中に[SDK+(配布元):(ライブラリ名)]のフォーマットで埋められている + const u8 pattern[5] = { '[', 'S', 'D', 'K', '+' }; + System::Collections::Generic::List ^list; + + this->hLicenseList = gcnew System::Collections::Generic::List; + this->hLicenseList->Clear(); + + fseek( fp, 0, SEEK_END ); + const u32 filesize = ftell( fp ); + + list = MasterEditorTWL::patternMatch( fp, pattern, 5 ); + if( list == nullptr ) + { + return ECSrlResult::NOERROR; // ライセンスがない場合も存在するのでOKとする + } + for each( u32 item in list ) + { + char buf[ LICENSE_LEN_MAX + 1 ]; // '\0'の分だけ多めにとっておく + u32 offset = item + 5; // "[SDK+"の後からリードする + u32 len = ((filesize - offset) < LICENSE_LEN_MAX)?(filesize - offset):LICENSE_LEN_MAX; + + // "(配布元):(ライブラリ名)]"を余分な部分を含めてひとまずバッファに格納 + fseek( fp, offset, SEEK_SET ); + if( len != fread( buf, 1, len, fp ) ) + { + return ECSrlResult::ERROR; + } + buf[ len ] = '\0'; // 後のstrlenの成功を保証するため + + // "(配布元):(ライブラリ名)]"を取り出してから(配布元)と(ライブラリ名)に分割 + System::Text::UTF8Encoding^ utf8 = gcnew System::Text::UTF8Encoding( true ); // char->String変換に必要 + System::String ^str = gcnew System::String( buf, 0, strlen(buf), utf8 ); // 探索や分割はStringメソッドに用意されている + str = (str->Split( ']' ))[0]; // ']'よりも前を取り出す + cli::array ^spl = str->Split( ':' ); // (配布元):(ライブラリ名)を分割する + + if( spl->Length >= 2 ) // 念のため + { + this->hLicenseList->Add( gcnew RCLicense( spl[0], spl[1] ) ); + //System::Diagnostics::Debug::WriteLine( "license " + spl[0] + " " + spl[1] ); + } + } + + return ECSrlResult::NOERROR; +} \ No newline at end of file diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h index 46cab881..b1bea424 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h @@ -33,6 +33,82 @@ namespace MasterEditorTWL ERROR_SDK, }; + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCSDKVersion + // + // Description : RCSrlクラスに持たせるSDKバージョン情報クラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + ref class RCSDKVersion + { + private: + System::String ^hVersion; + System::Boolean ^hIsStatic; + private: + RCSDKVersion(){} // 封じる + public: + RCSDKVersion( System::String ^ver, System::Boolean isStatic ) // 生成時にのみフィールドを設定可能 + { + if( ver == nullptr ) + this->hVersion = gcnew System::String(""); // NULL参照バグを避ける + else + this->hVersion = ver; + this->hIsStatic = gcnew System::Boolean( isStatic ); + } + public: + property System::String ^Version // 生成後にはフィールドはRead Only + { + System::String^ get(){ return this->hVersion; } + } + public: + property System::Boolean IsStatic + { + System::Boolean get(){ return *(this->hIsStatic); } + } + }; + + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCLicense + // + // Description : RCSrlクラスに持たせるライセンス情報クラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + ref class RCLicense + { + private: + System::String ^hPublisher; + System::String ^hName; + private: + RCLicense(){} // 封じる + public: + RCLicense( System::String ^pub, System::String ^name ) // 生成時にのみフィールドを設定可能 + { + if( pub == nullptr ) + this->hPublisher = gcnew System::String(""); + else + this->hPublisher = pub; + + if( name == nullptr ) + this->hName = gcnew System::String(""); + else + this->hName = name; + } + public: + property System::String ^Name // 生成後にはフィールドはRead Only + { + System::String^ get(){ return this->hName; } + } + public: + property System::String ^Publisher + { + System::String^ get(){ return this->hPublisher; } + } + }; + // ------------------------------------------------------------------- // Type : ref class // Name : RCSrl @@ -126,7 +202,8 @@ namespace MasterEditorTWL //property System::Boolean ^hRegionKorea; // SDKバージョンリスト - property System::Collections::Generic::List ^hSDKList; + property System::Collections::Generic::List ^hSDKList; + property System::Collections::Generic::List ^hLicenseList; // constructor and destructor public: @@ -158,9 +235,8 @@ namespace MasterEditorTWL ECSrlResult hasDSDLPlaySign( FILE *fp ); // DSダウンロード署名がSRLに格納されているか調べる // @arg [in] 入力ファイルのFP (->SRL読み込み時に実行されるべき)] - - // SRLバイナリ中のSDKバージョンを取得する - ECSrlResult searchSDKVersion( FILE *fp ); + ECSrlResult searchSDKVersion( FILE *fp ); // SDKバージョンを取得する + ECSrlResult searchLicenses( FILE *fp ); // 使用ライセンスを取得する }; // end of ref class RCSrl diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp b/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp index 58ad6f92..25ea1d62 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp @@ -305,15 +305,18 @@ System::Collections::Generic::List^ MasterEditorTWL::patternMatch( for( first=0; first < textLen; first++ ) { len = (patternLen < (textLen-first))?patternLen:(textLen-first); // 最後のほうは途中までしかマッチングしない - if( memcmp( text+first, pattern, len ) == 0 ) + if( *(text+first) == pattern[0] ) // 高速化のため最初の文字が一致したときのみ全文マッチング { - if( (enableLast == true) ) + if( memcmp( text+first, pattern, len ) == 0 ) { - list->Add( first ); - } - else if( len == patternLen ) // 完全一致しないとダメ - { - list->Add( first ); + if( (enableLast == true) ) + { + list->Add( first ); + } + else if( len == patternLen ) // 完全一致しないとダメ + { + list->Add( first ); + } } } }