diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditorTWL/MasterEditorTWL.ncb index a9329027..f3496c3e 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 785882f4..34747a97 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 7c2f13d5..02ffc2cd 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 46424df9..5fe09921 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.h @@ -362,12 +362,12 @@ private: System::Windows::Forms::Label^ labShared2Size3; private: System::Windows::Forms::Label^ labShared2Size2; private: System::Windows::Forms::Label^ labShared2Size1; private: System::Windows::Forms::Label^ labShared2Size0; -private: System::Windows::Forms::Label^ labKB5; -private: System::Windows::Forms::Label^ labKB4; -private: System::Windows::Forms::Label^ labKB3; -private: System::Windows::Forms::Label^ labKB2; -private: System::Windows::Forms::Label^ labKB1; -private: System::Windows::Forms::Label^ labKB0; + + + + + + private: System::Windows::Forms::TextBox^ tboxShared2Size5; private: System::Windows::Forms::TextBox^ tboxShared2Size4; private: System::Windows::Forms::TextBox^ tboxShared2Size3; @@ -383,7 +383,7 @@ private: System::Windows::Forms::Label^ labSDK; private: System::Windows::Forms::GroupBox^ gboxTWLExInfo; -private: System::Windows::Forms::Label^ labByte2; + private: System::Windows::Forms::Label^ labByte1; private: System::Windows::Forms::Label^ labHex4; private: System::Windows::Forms::Label^ labHex3; @@ -469,9 +469,9 @@ private: System::Windows::Forms::TabPage^ tabCompanyInfo; private: System::Windows::Forms::GroupBox^ gboxForeign; private: System::Windows::Forms::GroupBox^ gboxExFlags; -private: System::Windows::Forms::Label^ labByte3; -private: System::Windows::Forms::Label^ labByte5; -private: System::Windows::Forms::Label^ labByte4; + + + private: System::Windows::Forms::GroupBox^ gboxEULA; private: System::Windows::Forms::GroupBox^ gboxIcon; private: System::Windows::Forms::GroupBox^ gboxParental; @@ -538,6 +538,10 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colErrorBegin; private: System::Windows::Forms::DataGridViewTextBoxColumn^ colErrorEnd; private: System::Windows::Forms::DataGridViewTextBoxColumn^ colErrorCause; private: System::Windows::Forms::Label^ labAssemblyVersion; +private: System::Windows::Forms::Label^ labArbit4; +private: System::Windows::Forms::Label^ labArbit3; +private: System::Windows::Forms::Label^ labArbit2; +private: System::Windows::Forms::Label^ labArbit1; @@ -681,7 +685,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; /// void InitializeComponent(void) { - System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle2 = (gcnew System::Windows::Forms::DataGridViewCellStyle()); + System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle1 = (gcnew System::Windows::Forms::DataGridViewCellStyle()); this->tboxFile = (gcnew System::Windows::Forms::TextBox()); this->gboxSrl = (gcnew System::Windows::Forms::GroupBox()); this->tboxRemasterVer = (gcnew System::Windows::Forms::TextBox()); @@ -750,6 +754,8 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->numEULA = (gcnew System::Windows::Forms::NumericUpDown()); this->cboxIsInputPerson2 = (gcnew System::Windows::Forms::CheckBox()); this->gboxPerson2 = (gcnew System::Windows::Forms::GroupBox()); + this->labArbit4 = (gcnew System::Windows::Forms::Label()); + this->labArbit3 = (gcnew System::Windows::Forms::Label()); this->labNTSC2Sur = (gcnew System::Windows::Forms::Label()); this->tboxNTSC2 = (gcnew System::Windows::Forms::TextBox()); this->labFax2 = (gcnew System::Windows::Forms::Label()); @@ -768,6 +774,8 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->labPerson2 = (gcnew System::Windows::Forms::Label()); this->labCompany2 = (gcnew System::Windows::Forms::Label()); this->gboxPerson1 = (gcnew System::Windows::Forms::GroupBox()); + this->labArbit2 = (gcnew System::Windows::Forms::Label()); + this->labArbit1 = (gcnew System::Windows::Forms::Label()); this->labNTSC1Sur = (gcnew System::Windows::Forms::Label()); this->labFax1 = (gcnew System::Windows::Forms::Label()); this->labNTSC1Pre = (gcnew System::Windows::Forms::Label()); @@ -826,12 +834,6 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->labShared2Size2 = (gcnew System::Windows::Forms::Label()); this->labShared2Size1 = (gcnew System::Windows::Forms::Label()); this->labShared2Size0 = (gcnew System::Windows::Forms::Label()); - this->labKB5 = (gcnew System::Windows::Forms::Label()); - this->labKB4 = (gcnew System::Windows::Forms::Label()); - this->labKB3 = (gcnew System::Windows::Forms::Label()); - this->labKB2 = (gcnew System::Windows::Forms::Label()); - this->labKB1 = (gcnew System::Windows::Forms::Label()); - this->labKB0 = (gcnew System::Windows::Forms::Label()); this->tboxShared2Size5 = (gcnew System::Windows::Forms::TextBox()); this->tboxShared2Size4 = (gcnew System::Windows::Forms::TextBox()); this->tboxShared2Size3 = (gcnew System::Windows::Forms::TextBox()); @@ -843,10 +845,6 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxSDK = (gcnew System::Windows::Forms::TextBox()); this->labSDK = (gcnew System::Windows::Forms::Label()); this->gboxTWLExInfo = (gcnew System::Windows::Forms::GroupBox()); - this->labByte5 = (gcnew System::Windows::Forms::Label()); - this->labByte4 = (gcnew System::Windows::Forms::Label()); - this->labByte3 = (gcnew System::Windows::Forms::Label()); - this->labByte2 = (gcnew System::Windows::Forms::Label()); this->labByte1 = (gcnew System::Windows::Forms::Label()); this->labHex4 = (gcnew System::Windows::Forms::Label()); this->labHex3 = (gcnew System::Windows::Forms::Label()); @@ -1611,6 +1609,8 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; // // gboxPerson2 // + this->gboxPerson2->Controls->Add(this->labArbit4); + this->gboxPerson2->Controls->Add(this->labArbit3); this->gboxPerson2->Controls->Add(this->labNTSC2Sur); this->gboxPerson2->Controls->Add(this->tboxNTSC2); this->gboxPerson2->Controls->Add(this->labFax2); @@ -1636,6 +1636,24 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->gboxPerson2->TabStop = false; this->gboxPerson2->Text = L"担当者2"; // + // labArbit4 + // + this->labArbit4->AutoSize = true; + this->labArbit4->Location = System::Drawing::Point(209, 207); + this->labArbit4->Name = L"labArbit4"; + this->labArbit4->Size = System::Drawing::Size(37, 12); + this->labArbit4->TabIndex = 15; + this->labArbit4->Text = L"(任意)"; + // + // labArbit3 + // + this->labArbit3->AutoSize = true; + this->labArbit3->Location = System::Drawing::Point(210, 156); + this->labArbit3->Name = L"labArbit3"; + this->labArbit3->Size = System::Drawing::Size(37, 12); + this->labArbit3->TabIndex = 13; + this->labArbit3->Text = L"(任意)"; + // // labNTSC2Sur // this->labNTSC2Sur->AutoSize = true; @@ -1650,7 +1668,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxNTSC2->Location = System::Drawing::Point(66, 200); this->tboxNTSC2->MaxLength = 50; this->tboxNTSC2->Name = L"tboxNTSC2"; - this->tboxNTSC2->Size = System::Drawing::Size(268, 19); + this->tboxNTSC2->Size = System::Drawing::Size(140, 19); this->tboxNTSC2->TabIndex = 11; // // labFax2 @@ -1783,6 +1801,8 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; // // gboxPerson1 // + this->gboxPerson1->Controls->Add(this->labArbit2); + this->gboxPerson1->Controls->Add(this->labArbit1); this->gboxPerson1->Controls->Add(this->labNTSC1Sur); this->gboxPerson1->Controls->Add(this->labFax1); this->gboxPerson1->Controls->Add(this->labNTSC1Pre); @@ -1807,6 +1827,24 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->gboxPerson1->TabStop = false; this->gboxPerson1->Text = L"担当者1"; // + // labArbit2 + // + this->labArbit2->AutoSize = true; + this->labArbit2->Location = System::Drawing::Point(201, 207); + this->labArbit2->Name = L"labArbit2"; + this->labArbit2->Size = System::Drawing::Size(37, 12); + this->labArbit2->TabIndex = 12; + this->labArbit2->Text = L"(任意)"; + // + // labArbit1 + // + this->labArbit1->AutoSize = true; + this->labArbit1->Location = System::Drawing::Point(201, 156); + this->labArbit1->Name = L"labArbit1"; + this->labArbit1->Size = System::Drawing::Size(37, 12); + this->labArbit1->TabIndex = 11; + this->labArbit1->Text = L"(任意)"; + // // labNTSC1Sur // this->labNTSC1Sur->AutoSize = true; @@ -1839,7 +1877,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxNTSC1->Location = System::Drawing::Point(66, 200); this->tboxNTSC1->MaxLength = 50; this->tboxNTSC1->Name = L"tboxNTSC1"; - this->tboxNTSC1->Size = System::Drawing::Size(261, 19); + this->tboxNTSC1->Size = System::Drawing::Size(131, 19); this->tboxNTSC1->TabIndex = 8; // // tboxFax1 @@ -2282,12 +2320,6 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->gboxShared2Size->Controls->Add(this->labShared2Size2); this->gboxShared2Size->Controls->Add(this->labShared2Size1); this->gboxShared2Size->Controls->Add(this->labShared2Size0); - this->gboxShared2Size->Controls->Add(this->labKB5); - this->gboxShared2Size->Controls->Add(this->labKB4); - this->gboxShared2Size->Controls->Add(this->labKB3); - this->gboxShared2Size->Controls->Add(this->labKB2); - this->gboxShared2Size->Controls->Add(this->labKB1); - this->gboxShared2Size->Controls->Add(this->labKB0); this->gboxShared2Size->Controls->Add(this->tboxShared2Size5); this->gboxShared2Size->Controls->Add(this->tboxShared2Size4); this->gboxShared2Size->Controls->Add(this->tboxShared2Size3); @@ -2297,7 +2329,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->gboxShared2Size->Controls->Add(this->cboxIsShared2); this->gboxShared2Size->Location = System::Drawing::Point(547, 54); this->gboxShared2Size->Name = L"gboxShared2Size"; - this->gboxShared2Size->Size = System::Drawing::Size(175, 220); + this->gboxShared2Size->Size = System::Drawing::Size(164, 220); this->gboxShared2Size->TabIndex = 1; this->gboxShared2Size->TabStop = false; this->gboxShared2Size->Text = L"Shared2ファイルサイズ"; @@ -2356,60 +2388,6 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->labShared2Size0->TabIndex = 15; this->labShared2Size0->Text = L"File 0"; // - // labKB5 - // - this->labKB5->AutoSize = true; - this->labKB5->Location = System::Drawing::Point(142, 180); - this->labKB5->Name = L"labKB5"; - this->labKB5->Size = System::Drawing::Size(20, 12); - this->labKB5->TabIndex = 14; - this->labKB5->Text = L"KB"; - // - // labKB4 - // - this->labKB4->AutoSize = true; - this->labKB4->Location = System::Drawing::Point(142, 155); - this->labKB4->Name = L"labKB4"; - this->labKB4->Size = System::Drawing::Size(20, 12); - this->labKB4->TabIndex = 13; - this->labKB4->Text = L"KB"; - // - // labKB3 - // - this->labKB3->AutoSize = true; - this->labKB3->Location = System::Drawing::Point(142, 130); - this->labKB3->Name = L"labKB3"; - this->labKB3->Size = System::Drawing::Size(20, 12); - this->labKB3->TabIndex = 12; - this->labKB3->Text = L"KB"; - // - // labKB2 - // - this->labKB2->AutoSize = true; - this->labKB2->Location = System::Drawing::Point(142, 105); - this->labKB2->Name = L"labKB2"; - this->labKB2->Size = System::Drawing::Size(20, 12); - this->labKB2->TabIndex = 11; - this->labKB2->Text = L"KB"; - // - // labKB1 - // - this->labKB1->AutoSize = true; - this->labKB1->Location = System::Drawing::Point(142, 80); - this->labKB1->Name = L"labKB1"; - this->labKB1->Size = System::Drawing::Size(20, 12); - this->labKB1->TabIndex = 10; - this->labKB1->Text = L"KB"; - // - // labKB0 - // - this->labKB0->AutoSize = true; - this->labKB0->Location = System::Drawing::Point(142, 55); - this->labKB0->Name = L"labKB0"; - this->labKB0->Size = System::Drawing::Size(20, 12); - this->labKB0->TabIndex = 9; - this->labKB0->Text = L"KB"; - // // tboxShared2Size5 // this->tboxShared2Size5->Location = System::Drawing::Point(46, 177); @@ -2505,10 +2483,6 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; // // gboxTWLExInfo // - this->gboxTWLExInfo->Controls->Add(this->labByte5); - this->gboxTWLExInfo->Controls->Add(this->labByte4); - this->gboxTWLExInfo->Controls->Add(this->labByte3); - this->gboxTWLExInfo->Controls->Add(this->labByte2); this->gboxTWLExInfo->Controls->Add(this->labByte1); this->gboxTWLExInfo->Controls->Add(this->labHex4); this->gboxTWLExInfo->Controls->Add(this->labHex3); @@ -2529,42 +2503,6 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->gboxTWLExInfo->TabStop = false; this->gboxTWLExInfo->Text = L"TWL拡張情報"; // - // labByte5 - // - this->labByte5->AutoSize = true; - this->labByte5->Location = System::Drawing::Point(261, 121); - this->labByte5->Name = L"labByte5"; - this->labByte5->Size = System::Drawing::Size(29, 12); - this->labByte5->TabIndex = 34; - this->labByte5->Text = L"Byte"; - // - // labByte4 - // - this->labByte4->AutoSize = true; - this->labByte4->Location = System::Drawing::Point(261, 96); - this->labByte4->Name = L"labByte4"; - this->labByte4->Size = System::Drawing::Size(29, 12); - this->labByte4->TabIndex = 33; - this->labByte4->Text = L"Byte"; - // - // labByte3 - // - this->labByte3->AutoSize = true; - this->labByte3->Location = System::Drawing::Point(261, 71); - this->labByte3->Name = L"labByte3"; - this->labByte3->Size = System::Drawing::Size(29, 12); - this->labByte3->TabIndex = 32; - this->labByte3->Text = L"Byte"; - // - // labByte2 - // - this->labByte2->AutoSize = true; - this->labByte2->Location = System::Drawing::Point(585, 54); - this->labByte2->Name = L"labByte2"; - this->labByte2->Size = System::Drawing::Size(29, 12); - this->labByte2->TabIndex = 31; - this->labByte2->Text = L"Byte"; - // // labByte1 // this->labByte1->AutoSize = true; @@ -2599,6 +2537,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxIsCodec->ReadOnly = true; this->tboxIsCodec->Size = System::Drawing::Size(87, 19); this->tboxIsCodec->TabIndex = 28; + this->tboxIsCodec->TextAlign = System::Windows::Forms::HorizontalAlignment::Right; // // labIsCodec // @@ -2779,7 +2718,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; // this->cboxIsNAND->AutoSize = true; this->cboxIsNAND->Enabled = false; - this->cboxIsNAND->Location = System::Drawing::Point(8, 48); + this->cboxIsNAND->Location = System::Drawing::Point(9, 47); this->cboxIsNAND->Name = L"cboxIsNAND"; this->cboxIsNAND->Size = System::Drawing::Size(121, 16); this->cboxIsNAND->TabIndex = 1; @@ -3416,8 +3355,8 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; // // gridError // - dataGridViewCellStyle2->BackColor = System::Drawing::Color::White; - this->gridError->AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle1->BackColor = System::Drawing::Color::White; + this->gridError->AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this->gridError->BackgroundColor = System::Drawing::SystemColors::Control; this->gridError->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize; this->gridError->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(4) {this->colErrorName, @@ -3685,9 +3624,14 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; { case ECSrlResult::ERROR_PLATFORM: this->errMsg( "本ツールはTWL対応ROM専用です。NTR専用ROMなどのTWL非対応ROMを読み込むことはできません。", - "This tool can only read TWL ROM. This can't read Other data e.g. NTR limited ROM." ); + "This tool can only read TWL ROM. This can't read an other data e.g. NTR limited ROM." ); break; + case ECSrlResult::ERROR_SIGN_DECRYPT: + case ECSrlResult::ERROR_SIGN_VERIFY: + this->errMsg( "本ツールはTWL対応ROM専用です。不正なデータを読み込むことはできません。", + "This tool can only read TWL ROM. This can't read an illegal data." ); + default: this->errMsg( "ROMデータファイルの読み込みに失敗しました。", "Reading the ROM data file failed." ); break; @@ -3845,8 +3789,8 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxTitleIDHi->Text = this->hSrl->hTitleIDHi->ToString("X8"); this->tboxNormalRomOffset->Text = this->hSrl->hNormalRomOffset->ToString("X8"); this->tboxKeyTableRomOffset->Text = this->hSrl->hKeyTableRomOffset->ToString("X8"); - this->tboxPublicSize->Text = this->hSrl->hPublicSize->ToString(); - this->tboxPrivateSize->Text = this->hSrl->hPrivateSize->ToString(); + this->tboxPublicSize->Text = MasterEditorTWL::transSizeToString( this->hSrl->hPublicSize ); + this->tboxPrivateSize->Text = MasterEditorTWL::transSizeToString( this->hSrl->hPrivateSize ); this->cboxIsNormalJump->Checked = *(this->hSrl->hIsNormalJump); this->cboxIsTmpJump->Checked = *(this->hSrl->hIsTmpJump); this->cboxIsSubBanner->Checked = *(this->hSrl->hIsSubBanner); @@ -3878,12 +3822,12 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxIsGameCardOn->Text = gcnew System::String( "OFF" ); } this->cboxIsShared2->Checked = *(this->hSrl->hIsShared2); - this->tboxShared2Size0->Text = this->hSrl->hShared2SizeArray[0]->ToString(); - this->tboxShared2Size1->Text = this->hSrl->hShared2SizeArray[1]->ToString(); - this->tboxShared2Size2->Text = this->hSrl->hShared2SizeArray[2]->ToString(); - this->tboxShared2Size3->Text = this->hSrl->hShared2SizeArray[3]->ToString(); - this->tboxShared2Size4->Text = this->hSrl->hShared2SizeArray[4]->ToString(); - this->tboxShared2Size5->Text = this->hSrl->hShared2SizeArray[5]->ToString(); + this->tboxShared2Size0->Text = MasterEditorTWL::transSizeToString( this->hSrl->hShared2SizeArray[0] ); + this->tboxShared2Size1->Text = MasterEditorTWL::transSizeToString( this->hSrl->hShared2SizeArray[1] ); + this->tboxShared2Size2->Text = MasterEditorTWL::transSizeToString( this->hSrl->hShared2SizeArray[2] ); + this->tboxShared2Size3->Text = MasterEditorTWL::transSizeToString( this->hSrl->hShared2SizeArray[3] ); + this->tboxShared2Size4->Text = MasterEditorTWL::transSizeToString( this->hSrl->hShared2SizeArray[4] ); + this->tboxShared2Size5->Text = MasterEditorTWL::transSizeToString( this->hSrl->hShared2SizeArray[5] ); // アプリ種別 System::String ^app = gcnew System::String(""); @@ -3968,6 +3912,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->tboxSDK->Text += ver->Version + "\r\n"; } } + this->gridLibrary->Rows->Clear(); if( this->hSrl->hLicenseList != nullptr ) { for each( RCLicense ^lic in this->hSrl->hLicenseList ) @@ -3978,7 +3923,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; // ペアレンタルコントロール関連 this->setParentalForms(); - } + } //setSrlForms() // SRLの特殊な設定をフォームにセットする(言語切り替えで表示を変えたいので独立させる) void setSrlFormsCaptionEx() @@ -4153,7 +4098,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->hSrl->hArrayParentalRating[OS_TWL_PCTL_OGN_OFLC] = gcnew System::Byte( rating ); this->hSrl->hArrayParentalEffect[OS_TWL_PCTL_OGN_OFLC] = gcnew System::Boolean( this->cboxOFLC->Checked ); this->hSrl->hArrayParentalAlways[OS_TWL_PCTL_OGN_OFLC] = gcnew System::Boolean( this->cboxAlwaysOFLC->Checked ); - } + } //setParentalSrlProperties() // SRL内のペアレンタルコントロール情報を抜き出してフォームに反映させる void setParentalForms(void) @@ -4310,7 +4255,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->combOFLC->SelectedIndex = index; this->cboxOFLC->Checked = *(hSrl->hArrayParentalEffect[ OS_TWL_PCTL_OGN_OFLC ]); this->cboxAlwaysOFLC->Checked = *(hSrl->hArrayParentalAlways[ OS_TWL_PCTL_OGN_OFLC ]); - } + } //setParentalForms() // リージョン情報からペアレンタルコントロールの編集可能団体をマスクする void maskParentalForms(void) @@ -4383,7 +4328,7 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; default: break; } - } + } //maskParentalForms() // ---------------------------------------------- // SRL関連のフォームのチェック @@ -4945,11 +4890,22 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->labCompany2->Text = gcnew System::String( LANG_COMPANY_J ); this->labDepart2->Text = gcnew System::String( LANG_DEPART_J ); this->labPerson2->Text = gcnew System::String( LANG_PERSON_J ); + this->labArbit1->Text = gcnew System::String( "(任意)" ); + this->labArbit2->Text = gcnew System::String( "(任意)" ); + this->labArbit3->Text = gcnew System::String( "(任意)" ); + this->labArbit4->Text = gcnew System::String( "(任意)" ); // ふりがな情報を有効にする this->tboxFurigana1->Enabled = true; this->labFurigana1->Text = gcnew System::String( LANG_FURIGANA_J ); this->tboxFurigana2->Enabled = true; this->labFurigana2->Text = gcnew System::String( LANG_FURIGANA_J ); + // NTSC-UserIDも日本語版のみ + this->tboxNTSC1->Enabled = true; + this->tboxNTSC2->Enabled = true; + this->labNTSC1Pre->Text = gcnew System::String( LANG_NTSC_1_J ); + this->labNTSC1Sur->Text = gcnew System::String( LANG_NTSC_2_J ); + this->labNTSC2Pre->Text = gcnew System::String( LANG_NTSC_1_J ); + this->labNTSC2Sur->Text = gcnew System::String( LANG_NTSC_2_J ); // TWL仕様 this->gboxTWLExInfo->Text = gcnew System::String( "TWL拡張情報" ); @@ -5148,13 +5104,25 @@ private: System::Windows::Forms::Label^ labAssemblyVersion; this->labCompany2->Text = gcnew System::String( LANG_COMPANY_E ); this->labDepart2->Text = gcnew System::String( LANG_DEPART_E ); this->labPerson2->Text = gcnew System::String( LANG_PERSON_E ); + this->labArbit1->Text = gcnew System::String( "(Arbitrary)" ); + this->labArbit2->Text = gcnew System::String( "(Arbitrary)" ); + this->labArbit3->Text = gcnew System::String( "(Arbitrary)" ); + this->labArbit4->Text = gcnew System::String( "(Arbitrary)" ); // ふりがな情報を削除 this->tboxFurigana1->Clear(); this->tboxFurigana1->Enabled = false; - this->labFurigana1->Text = gcnew System::String(""); + this->labFurigana1->Text = gcnew System::String( LANG_FURIGANA_E ); this->tboxFurigana2->Clear(); this->tboxFurigana2->Enabled = false; - this->labFurigana2->Text = gcnew System::String(""); + this->labFurigana2->Text = gcnew System::String( LANG_FURIGANA_E ); + this->tboxNTSC1->Enabled = false; + this->tboxNTSC1->Text = gcnew System::String(""); + this->tboxNTSC2->Enabled = false; + this->tboxNTSC2->Text = gcnew System::String(""); + this->labNTSC1Pre->Text = gcnew System::String( LANG_NTSC_1_E ); + this->labNTSC1Sur->Text = gcnew System::String( LANG_NTSC_2_E ); + this->labNTSC2Pre->Text = gcnew System::String( LANG_NTSC_1_E ); + this->labNTSC2Sur->Text = gcnew System::String( LANG_NTSC_2_E ); // TWL仕様 this->gboxTWLExInfo->Text = gcnew System::String( "TWL Extended Info" ); diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.resX b/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.resX index 302e29f7..1f0e93fa 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.resX +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/Form1.resX @@ -126,24 +126,6 @@ True - - True - - - True - - - True - - - True - - - True - - - True - True diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm b/build/tools/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm index bf3703ae..9889b4a5 100644 Binary files a/build/tools/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm and b/build/tools/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm differ diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/common.h b/build/tools/MasterEditorTWL/MasterEditorTWL/common.h index 17c75f1f..0c9754d8 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/common.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/common.h @@ -14,6 +14,9 @@ #define METWL_ERRLIST_NORANGE 0 // エラーのアドレス範囲を指定しないことを表す特別な値 #define METWL_ROMSIZE_MIN 256 // 最小のデバイス容量 256Mbit #define METWL_ROMSIZE_MAX 4096 // 最大の.. 4Gbit +#define METWL_ROMSIZE_MIN_NAND 1 +#define METWL_ROMSIZE_MAX_NAND 256 +#define METWL_ALLSIZE_MAX_NAND (32*1024*1024) // Public/Privateセーブデータのサイズを含めたNANDアプリの容量制限(単位Byte) #define METWL_MASK_REGION_JAPAN 0x00000001 #define METWL_MASK_REGION_AMERICA 0x00000002 #define METWL_MASK_REGION_EUROPE 0x00000004 diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/lang.h b/build/tools/MasterEditorTWL/MasterEditorTWL/lang.h index 0b3f190c..6421841d 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/lang.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/lang.h @@ -75,12 +75,12 @@ #define LANG_COMPANY_E ("Company") #define LANG_DEPART_E ("Dept.") #define LANG_PERSON_E ("Name") -//#define LANG_FURIGANA_E ("ふりがな") +#define LANG_FURIGANA_E ("") #define LANG_TEL_E ("Tel") #define LANG_FAX_E ("Fax") #define LANG_MAIL_E ("e-mail") -//#define LANG_NTSC_1_E ("NTSC") -//#define LANG_NTSC_2_E ("User ID") +#define LANG_NTSC_1_E ("") +#define LANG_NTSC_2_E ("") #define LANG_EULA_E ("Agree EULA") #define LANG_EULA_VER_E ("EULA agreement ver.") diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp index 5f316b8c..9057d206 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.cpp @@ -55,9 +55,20 @@ ECSrlResult RCSrl::readFromFile( System::String ^filename ) { return (ECSrlResult::ERROR_FILE_READ); } - // ファイルを閉じる前にROMヘッダ以外の領域から設定を取り出す { ECSrlResult r; + +#ifdef METWL_WHETHER_SIGN_DECRYPT + // 署名チェック + r = this->decryptRomHeader(); + if( r != ECSrlResult::NOERROR ) + { + (void)fclose(fp); + return r; + } +#endif //#ifdef METWL_WHETHER_SIGN_DECRYPT + + // ファイルを閉じる前にROMヘッダ以外の領域から設定を取り出す (void)this->hasDSDLPlaySign( fp ); r = this->searchSDKVersion( fp ); if( r != ECSrlResult::NOERROR ) @@ -453,6 +464,45 @@ ECSrlResult RCSrl::signRomHeader(void) return (ECSrlResult::NOERROR); } // ECSrlResult RCSrl::signRomHeader(void) +// +// ROMヘッダの署名を外す +// +ECSrlResult RCSrl::decryptRomHeader(void) +{ + u8 original[ RSA_KEY_LENGTH ]; // 署名外した後のデータ格納先 + s32 pos = 0; // ブロックの先頭アドレス + u8 digest[ DIGEST_SIZE_SHA1 ]; // ROMヘッダのダイジェスト + ROM_Header rh; + + // <データの流れ> + // (1) 公開鍵で復号した結果(ブロック)をローカル変数(original)に格納 + // (2) ブロックから余分な部分を取り除いて引数(pDst)にコピー + + // 署名の解除 = 公開鍵で復号 + if( !ACSign_Decrypto( original, g_devPubKey_DER, this->pRomHeader->signature, RSA_KEY_LENGTH ) ) + { + return ECSrlResult::ERROR_SIGN_DECRYPT; + } + // 署名前データを復号後ブロックからゲット + for( pos=0; pos < (RSA_KEY_LENGTH-2); pos++ ) // 本来ブロックの先頭は0x00だが復号化の内部処理によって消える仕様 + { + // 暗号ブロック形式 = 0x00, BlockType, Padding, 0x00, 実データ + if( original[pos] == 0x00 ) // 実データの直前の0x00をサーチ + { + break; + } + } + // ベリファイ + // ROMヘッダのダイジェストを算出(先頭から証明書領域の直前までが対象) + ACSign_DigestUnit( digest, this->pRomHeader, (u32)&(rh.certificate) - (u32)&(rh) ); + // this->pRomHeader はマネージヒープ上にあるので実アドレスを取得できない + if( memcmp( &(original[pos+1]), digest, DIGEST_SIZE_SHA1 ) != 0 ) + { + return ECSrlResult::ERROR_SIGN_VERIFY; + } + return (ECSrlResult::NOERROR); +} + // // DSダウンロード署名がSRLに格納されているか調べる // @@ -611,9 +661,8 @@ ECSrlResult RCSrl::searchLicenses(FILE *fp) //System::Diagnostics::Debug::WriteLine( "license " + spl[0] + " " + spl[1] ); } } - return ECSrlResult::NOERROR; -} +} //RCSrl::searchLicenses // // MRC @@ -706,33 +755,14 @@ ECSrlResult RCSrl::mrcNTR( FILE *fp ) } // 値チェック + if( this->pRomHeader->s.rom_type != 0x00 ) { this->hErrorList->Add( gcnew RCMrcError( "デバイスタイプ", 0x13, 0x13, "不正な値です。00hを設定してください。", "Device Type", "Invalid data. Please set 00h.", false, true ) ); } - fseek( fp, 0, SEEK_END ); - u32 filesize = ftell(fp); // 実ファイルサイズ(単位Mbit) - u32 romsize = 1 << (this->pRomHeader->s.rom_size); // ROM容量 - if( (romsize*1024*1024/8) < filesize ) - { - this->hErrorList->Add( gcnew RCMrcError( - "デバイス容量", 0x14, 0x14, "実ファイルサイズよりも小さい値が指定されています。", - "Device Capacity", "Setting data is less than the actual file size.", false, true ) ); - } - else if( filesize < (romsize*1024*1024/8) ) - { - this->hWarnList->Add( gcnew RCMrcError( // 警告 - "デバイス容量", 0x14, 0x14, "実ファイルサイズに比べて無駄のある値が設定されています。", - "Device Capacity", "Setting data is larger than the actual file size.", false, true ) ); - } - if( (filesize % 2) != 0 ) - { - this->hErrorList->Add( gcnew RCMrcError( - "実ファイルサイズ", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, "中途半端な値です。通常では2のべき乗の値です。", - "Actual File Size", "Invalid size. This size is usually power of 2.", false, true ) ); - } + u8 romver = this->pRomHeader->s.rom_version; if( ((romver < 0x00) || (0x09 < romver)) && (romver != 0xE0) ) { @@ -866,13 +896,56 @@ ECSrlResult RCSrl::mrcTWL( FILE *fp ) #endif // 値チェック + + fseek( fp, 0, SEEK_END ); + u32 filesize = ftell(fp); // 実ファイルサイズ(単位Mbit) u32 romsize = 1 << (this->pRomHeader->s.rom_size); // ROM容量 - if( (romsize < METWL_ROMSIZE_MIN) || (METWL_ROMSIZE_MAX < romsize) ) + if( *(this->hIsMediaNand) == false ) // カードアプリのときのみのチェック { - this->hErrorList->Add( gcnew RCMrcError( - "デバイス容量", 0x14, 0x14, "指定可能な容量ではありません。", - "Device Capacity", "Invalid capacity.", false, true ) ); + if( (romsize*1024*1024/8) < filesize ) + { + this->hErrorList->Add( gcnew RCMrcError( + "デバイス容量", 0x14, 0x14, "実ファイルサイズよりも小さい値が指定されています。", + "Device Capacity", "Setting data is less than the actual file size.", false, true ) ); + } + else if( filesize < (romsize*1024*1024/8) ) + { + this->hWarnList->Add( gcnew RCMrcError( // 警告 + "デバイス容量", 0x14, 0x14, "実ファイルサイズに比べて無駄のある値が設定されています。", + "Device Capacity", "Setting data is larger than the actual file size.", false, true ) ); + } + if( (romsize < METWL_ROMSIZE_MIN) || (METWL_ROMSIZE_MAX < romsize) ) + { + this->hErrorList->Add( gcnew RCMrcError( + "デバイス容量", 0x14, 0x14, "指定可能な容量ではありません。", + "Device Capacity", "Invalid capacity.", false, true ) ); + } + if( (filesize % 2) != 0 ) + { + this->hErrorList->Add( gcnew RCMrcError( + "実ファイルサイズ", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, "中途半端な値です。通常では2のべき乗の値です。", + "Actual File Size", "Invalid size. This size is usually power of 2.", false, true ) ); + } + } //if( *(this->hIsNAND) == false ) + else + { + if( (romsize < METWL_ROMSIZE_MIN_NAND) || (METWL_ROMSIZE_MAX_NAND < romsize) ) + { + this->hErrorList->Add( gcnew RCMrcError( + "デバイス容量", 0x14, 0x14, "NANDアプリに対して指定可能な容量ではありません。", + "Device Capacity", "Invalid capacity.", false, true ) ); + } + u32 allsizeMB = (filesize*1024*1024/8) + this->pRomHeader->s.public_save_data_size + this->pRomHeader->s.private_save_data_size; + if( allsizeMB > METWL_ALLSIZE_MAX_NAND ) + { + this->hErrorList->Add( gcnew RCMrcError( + "実ファイルサイズ", METWL_ERRLIST_NORANGE, METWL_ERRLIST_NORANGE, + "ROMデータの実ファイルサイズとPublicセーブデータおよびPrivateセーブデータのサイズの総和が32MByteを超えています。", + "Actual File Size", + "The sum of this size, the public save data size and private save data size exceed 32MByte.", false, true ) ); + } } + if( this->pRomHeader->s.warning_no_spec_rom_speed != 0 ) { this->hWarnList->Add( gcnew RCMrcError( diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h index 51738c91..43c2647e 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/srl.h @@ -26,8 +26,9 @@ namespace MasterEditorTWL ERROR_FILE_READ, ERROR_FILE_WRITE, // 署名でのエラー - ERROR_SIGN_ENCRYPT, - ERROR_SIGN_DECRYPT, + ERROR_SIGN_ENCRYPT, // 署名できない + ERROR_SIGN_DECRYPT, // 署名解除できない + ERROR_SIGN_VERIFY, // 署名解除した後のダイジェストが合わない // CRC算出でのエラー ERROR_SIGN_CRC, // SDKバージョン取得でのエラー @@ -356,6 +357,7 @@ namespace MasterEditorTWL // ROMヘッダの更新 ECSrlResult calcRomHeaderCRC(void); // ROMヘッダのCRCを再計算 ECSrlResult signRomHeader(void); // ROMヘッダ更新後の再署名 + ECSrlResult decryptRomHeader(void); // ROMヘッダの署名を外す // SRLバイナリから特殊な設定を調べる ECSrlResult hasDSDLPlaySign( FILE *fp ); diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp b/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp index 1e23f929..4daa2676 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/utility.cpp @@ -56,6 +56,63 @@ System::String^ MasterEditorTWL::transRomSizeToString( System::Byte ^byte ) return (size.ToString() + unit); } +// +// サイズから単位つきの文字列を取得 +// +// @arg [in] バイト数 +// +// @ret 文字列(単位つき) +// +System::String^ MasterEditorTWL::transSizeToString( System::UInt32 ^size ) +{ + if( size == nullptr ) + { + return (gcnew System::String("")); + } + + System::UInt32 val = *size; + + // Byte単位 + if( val == 0 ) + { + return val.ToString(); + } + if( val < 1024 ) + { + return (val.ToString() + " Byte"); + } + + // KB単位に変換 + if( (val % 1024) != 0 ) + { + return (val.ToString() + " Byte"); // 端数のときは単位変換しない + } + val = val / 1024; + if( val < 1024 ) + { + return (val.ToString() + " KB"); + } + + // MB単位に変換 + if( (val % 1024) != 0 ) + { + return (val.ToString() + " KB"); + } + val = val / 1024; + if( val < 1024) + { + return (val.ToString() + " MB"); + } + + // GB単位に変換 + if( (val % 1024) != 0 ) + { + return (val.ToString() + " MB"); + } + val = val / 1024; + return (val.ToString() + " GB"); +} + // // ペアレンタルコントロールのレーティング値から文字列を取得 // diff --git a/build/tools/MasterEditorTWL/MasterEditorTWL/utility.h b/build/tools/MasterEditorTWL/MasterEditorTWL/utility.h index 0fb64a3e..2db96800 100644 --- a/build/tools/MasterEditorTWL/MasterEditorTWL/utility.h +++ b/build/tools/MasterEditorTWL/MasterEditorTWL/utility.h @@ -32,6 +32,15 @@ namespace MasterEditorTWL // System::String^ transRomSizeToString( System::Byte ^byte ); + // + // サイズから単位つきの文字列を取得 + // + // @arg [in] バイト数 + // + // @ret 文字列(単位つき) + // + System::String^ transSizeToString( System::UInt32 ^size ); + // // ペアレンタルコントロールのレーティング値から文字列を取得 //