mirror of
https://github.com/rvtr/TwlToolsRED.git
synced 2025-10-31 06:41:18 -04:00
提出確認書チェッカ:引数を提出確認書のみにしたときにもオプション動作を可能にした。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@101 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
679243cc59
commit
9fe7377bad
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -107,12 +107,12 @@ namespace SheetCheckerTWL {
|
||||
this->butSrl = (gcnew System::Windows::Forms::Button());
|
||||
this->butSheet = (gcnew System::Windows::Forms::Button());
|
||||
this->gridCompare = (gcnew System::Windows::Forms::DataGridView());
|
||||
this->tboxResult = (gcnew System::Windows::Forms::TextBox());
|
||||
this->labResult = (gcnew System::Windows::Forms::Label());
|
||||
this->labVersion = (gcnew System::Windows::Forms::Label());
|
||||
this->colTitle = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
|
||||
this->colSrl = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
|
||||
this->colSheet = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
|
||||
this->tboxResult = (gcnew System::Windows::Forms::TextBox());
|
||||
this->labResult = (gcnew System::Windows::Forms::Label());
|
||||
this->labVersion = (gcnew System::Windows::Forms::Label());
|
||||
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->gridCompare))->BeginInit();
|
||||
this->SuspendLayout();
|
||||
//
|
||||
@ -176,35 +176,9 @@ namespace SheetCheckerTWL {
|
||||
this->gridCompare->Name = L"gridCompare";
|
||||
this->gridCompare->RowHeadersVisible = false;
|
||||
this->gridCompare->RowTemplate->Height = 21;
|
||||
this->gridCompare->Size = System::Drawing::Size(363, 170);
|
||||
this->gridCompare->Size = System::Drawing::Size(363, 191);
|
||||
this->gridCompare->TabIndex = 6;
|
||||
//
|
||||
// tboxResult
|
||||
//
|
||||
this->tboxResult->Location = System::Drawing::Point(294, 289);
|
||||
this->tboxResult->Name = L"tboxResult";
|
||||
this->tboxResult->ReadOnly = true;
|
||||
this->tboxResult->Size = System::Drawing::Size(100, 19);
|
||||
this->tboxResult->TabIndex = 7;
|
||||
//
|
||||
// labResult
|
||||
//
|
||||
this->labResult->AutoSize = true;
|
||||
this->labResult->Location = System::Drawing::Point(235, 292);
|
||||
this->labResult->Name = L"labResult";
|
||||
this->labResult->Size = System::Drawing::Size(53, 12);
|
||||
this->labResult->TabIndex = 8;
|
||||
this->labResult->Text = L"”»’茋‰Ê";
|
||||
//
|
||||
// labVersion
|
||||
//
|
||||
this->labVersion->AutoSize = true;
|
||||
this->labVersion->Location = System::Drawing::Point(353, 9);
|
||||
this->labVersion->Name = L"labVersion";
|
||||
this->labVersion->Size = System::Drawing::Size(41, 12);
|
||||
this->labVersion->TabIndex = 9;
|
||||
this->labVersion->Text = L"ver. 0.0";
|
||||
//
|
||||
// colTitle
|
||||
//
|
||||
dataGridViewCellStyle6->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
|
||||
@ -231,11 +205,37 @@ namespace SheetCheckerTWL {
|
||||
this->colSheet->Name = L"colSheet";
|
||||
this->colSheet->Width = 120;
|
||||
//
|
||||
// tboxResult
|
||||
//
|
||||
this->tboxResult->Location = System::Drawing::Point(294, 315);
|
||||
this->tboxResult->Name = L"tboxResult";
|
||||
this->tboxResult->ReadOnly = true;
|
||||
this->tboxResult->Size = System::Drawing::Size(100, 19);
|
||||
this->tboxResult->TabIndex = 7;
|
||||
//
|
||||
// labResult
|
||||
//
|
||||
this->labResult->AutoSize = true;
|
||||
this->labResult->Location = System::Drawing::Point(235, 318);
|
||||
this->labResult->Name = L"labResult";
|
||||
this->labResult->Size = System::Drawing::Size(53, 12);
|
||||
this->labResult->TabIndex = 8;
|
||||
this->labResult->Text = L"判定結果";
|
||||
//
|
||||
// labVersion
|
||||
//
|
||||
this->labVersion->AutoSize = true;
|
||||
this->labVersion->Location = System::Drawing::Point(353, 9);
|
||||
this->labVersion->Name = L"labVersion";
|
||||
this->labVersion->Size = System::Drawing::Size(41, 12);
|
||||
this->labVersion->TabIndex = 9;
|
||||
this->labVersion->Text = L"ver. 0.0";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
|
||||
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
|
||||
this->ClientSize = System::Drawing::Size(429, 321);
|
||||
this->ClientSize = System::Drawing::Size(429, 347);
|
||||
this->Controls->Add(this->labVersion);
|
||||
this->Controls->Add(this->labResult);
|
||||
this->Controls->Add(this->tboxResult);
|
||||
@ -311,23 +311,27 @@ private:
|
||||
this->gridCompare->Rows[ last ]->DefaultCellStyle->ForeColor = System::Drawing::Color::Red;
|
||||
}
|
||||
|
||||
tmp1 = (this->rh->s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK)?"NAND":"Game Card";
|
||||
tmp2 = this->sheet->Media;
|
||||
this->gridCompare->Rows->Add( "メディア", tmp1, tmp2 );
|
||||
|
||||
tmp2 = this->sheet->SubmitVersion.ToString() + " (" + this->sheet->SubmitVersion.ToString( "X1" ) + ")";
|
||||
this->gridCompare->Rows->Add( "提出バージョン", "-", tmp2 );
|
||||
|
||||
System::UInt16 tadver = sheet->RomVersion;
|
||||
tadver = (tadver << 8) | sheet->SubmitVersion;
|
||||
tmp2 = tadver.ToString() + " (" + tadver.ToString( "X04" ) + ")";
|
||||
this->gridCompare->Rows->Add( "TADƒo<EFBFBD>[ƒWƒ‡ƒ“", "-", tmp2);
|
||||
this->gridCompare->Rows->Add( "TADバージョン", "-", tmp2 );
|
||||
|
||||
if( this->sheet->IsUnnecessaryRating )
|
||||
{
|
||||
this->gridCompare->Rows->Add( "TITLE_TYPE", "-", "TWL_APP");
|
||||
this->gridCompare->Rows->Add( "TITLE_TYPE", "-", "TWL_APP" );
|
||||
System::Int32 last = this->gridCompare->Rows->Count - 2;
|
||||
this->gridCompare->Rows[ last ]->DefaultCellStyle->ForeColor = System::Drawing::Color::Blue; // 青色で強調
|
||||
}
|
||||
else
|
||||
{
|
||||
this->gridCompare->Rows->Add( "TITLE_TYPE", "-", "TWL_GAME");
|
||||
this->gridCompare->Rows->Add( "TITLE_TYPE", "-", "TWL_GAME" );
|
||||
}
|
||||
|
||||
if( *this->error == SheetCheckerError::NOERROR )
|
||||
|
||||
@ -14,7 +14,6 @@ using namespace SheetCheckerTWL;
|
||||
// 宣言
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
System::Int32 parseOption( array<System::String ^> ^args, SheetCheckerContext ^context );
|
||||
int consoleRun( array<System::String ^> ^args, int argc, SheetCheckerContext ^context );
|
||||
int consoleOptionRun( array<System::String ^> ^args, int argc, SheetCheckerContext ^context );
|
||||
int printResult( SheetCheckerContext ^context, ROM_Header *rh, SheetItem ^item,
|
||||
@ -77,6 +76,14 @@ int consoleRun( array<System::String ^> ^args, int argc, SheetCheckerContext ^co
|
||||
System::String ^romfile = args[0];
|
||||
System::String ^sheetfile = args[1];
|
||||
|
||||
// ’ñ<E28099>oŠm”F<E2809D>‘‚̓ǂÝ<E2809A>ž‚Ý
|
||||
if( !readSheet( sheetfile, item ) )
|
||||
{
|
||||
error = SheetCheckerError::ERROR_READ_SHEET;
|
||||
printResult( context, &rh, item, romfile, sheetfile, 0, error );
|
||||
return ((int)error);
|
||||
}
|
||||
|
||||
// ROMヘッダの読み込み
|
||||
if( !readRomHeader( romfile, &rh ) )
|
||||
{
|
||||
@ -87,14 +94,6 @@ int consoleRun( array<System::String ^> ^args, int argc, SheetCheckerContext ^co
|
||||
System::UInt16 crc;
|
||||
getWholeCRCInFile( romfile, &crc );
|
||||
|
||||
// 提出確認書の読み込み
|
||||
if( !readSheet( sheetfile, item ) )
|
||||
{
|
||||
error = SheetCheckerError::ERROR_READ_SHEET;
|
||||
printResult( context, &rh, item, romfile, sheetfile, crc, error );
|
||||
return ((int)error);
|
||||
}
|
||||
|
||||
// 一致判定
|
||||
error = checkSheet( &rh, crc, item );
|
||||
printResult( context, &rh, item, romfile, sheetfile, crc, error ); // 結果を表形式で表示
|
||||
@ -155,7 +154,7 @@ int consoleOptionRun( array<System::String ^> ^args, const int argc, SheetChecke
|
||||
// ROMヘッダの読み込み
|
||||
if( !readRomHeader( romfile, &rh ) )
|
||||
{
|
||||
error = SheetCheckerError::ERROR_READ_SHEET;
|
||||
error = SheetCheckerError::ERROR_READ_SRL;
|
||||
printf( "%d", (int)error );
|
||||
return ((int)error);
|
||||
}
|
||||
@ -167,7 +166,7 @@ int consoleOptionRun( array<System::String ^> ^args, const int argc, SheetChecke
|
||||
}//if( argc == 2 )
|
||||
|
||||
// 結果出力はオプションによって異なる(エラーのときには共通)
|
||||
if( error != SheetCheckerError::NOERROR )
|
||||
if( error == SheetCheckerError::NOERROR )
|
||||
{
|
||||
if( context->bResult )
|
||||
{
|
||||
@ -195,32 +194,6 @@ int consoleOptionRun( array<System::String ^> ^args, const int argc, SheetChecke
|
||||
return ((int)error);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// 一致判定
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
SheetCheckerError checkSheet( ROM_Header *rh, System::UInt16 crc, SheetItem ^item )
|
||||
{
|
||||
SheetCheckerError error;
|
||||
if( memcmp( rh->s.game_code, item->GameCode, 4 ) != 0 )
|
||||
{
|
||||
error = SheetCheckerError::ERROR_VERIFY_GAME_CODE;
|
||||
}
|
||||
else if( rh->s.rom_version != item->RomVersion )
|
||||
{
|
||||
error = SheetCheckerError::ERROR_VERIFY_ROM_VERSION;
|
||||
}
|
||||
else if( crc != item->FileCRC )
|
||||
{
|
||||
error = SheetCheckerError::ERROR_VERIFY_CRC;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = SheetCheckerError::NOERROR;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// 結果表示
|
||||
// ------------------------------------------------------------------
|
||||
@ -231,25 +204,36 @@ int printResult( SheetCheckerContext ^context, ROM_Header *rh, SheetItem ^item,
|
||||
System::UInt16 tadver = item->RomVersion;
|
||||
tadver = (tadver << 8) | item->SubmitVersion;
|
||||
|
||||
char media[255];
|
||||
setStringToChars( media, item->Media, 255, 0 );
|
||||
|
||||
// 通常の表示
|
||||
Console::WriteLine( "" );
|
||||
Console::WriteLine( "SRL: " + srlfile );
|
||||
Console::WriteLine( "Sheet: " + sheetfile );
|
||||
Console::WriteLine( "" );
|
||||
|
||||
printf( " SRL Sheet\n" );
|
||||
printf( "---------------------------------------\n" );
|
||||
printf( "InitialCode: %c%c%c%c %c%c%c%c\n",
|
||||
printf( " SRL Sheet\n" );
|
||||
printf( "-----------------------------------------\n" );
|
||||
printf( "InitialCode: %c%c%c%c %c%c%c%c\n",
|
||||
rh->s.game_code[0], rh->s.game_code[1], rh->s.game_code[2], rh->s.game_code[3],
|
||||
item->GameCode[0], item->GameCode[1], item->GameCode[2], item->GameCode[3] );
|
||||
printf( "RemasterVersion: %02X %02X\n", rh->s.rom_version, item->RomVersion );
|
||||
printf( "File CRC: %04X %04X\n", srlcrc, item->FileCRC );
|
||||
printf( "---------------------------------------\n" );
|
||||
printf( "Rating Display: %s\n", (item->IsUnnecessaryRating)?"Unnecessary":"Necessary" );
|
||||
printf( "---------------------------------------\n" );
|
||||
printf( "SubmitVersion: - %d (%02X)\n", item->SubmitVersion, item->SubmitVersion );
|
||||
printf( "TAD Version: %d (%04X)\n", tadver, tadver );
|
||||
printf( "---------------------------------------\n" );
|
||||
printf( "RemasterVersion: %02X %02X\n", rh->s.rom_version, item->RomVersion );
|
||||
printf( "File CRC: %04X %04X\n", srlcrc, item->FileCRC );
|
||||
if( rh->s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK )
|
||||
{
|
||||
printf( "Media: NAND %s\n", media );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Media: Game Card %s\n", media );
|
||||
}
|
||||
printf( "-----------------------------------------\n" );
|
||||
printf( "SubmitVersion: - %d (%02X)\n", item->SubmitVersion, item->SubmitVersion );
|
||||
printf( "TAD Version: - %d (%04X)\n", tadver, tadver );
|
||||
printf( "-----------------------------------------\n" );
|
||||
printf( "TITLE_TYPE: - %s\n", (item->IsUnnecessaryRating)?"TWL_APP":"TWL_GAME" );
|
||||
printf( "-----------------------------------------\n" );
|
||||
printf( "Result: " );
|
||||
if( error == SheetCheckerError::NOERROR )
|
||||
{
|
||||
|
||||
@ -94,6 +94,8 @@ public:
|
||||
System::Boolean readRomHeader( System::String ^srlfile, ROM_Header *rh );
|
||||
System::Boolean readSheet( System::String ^sheetfile, SheetItem ^item );
|
||||
System::String^ getXPathText( System::Xml::XmlElement ^root, System::String ^xpath );
|
||||
void setStringToChars( char *pDst, System::String ^hSrc, const System::Int32 nMax, const System::SByte pad );
|
||||
SheetCheckerError checkSheet( ROM_Header *rh, System::UInt16 crc, SheetItem ^item );
|
||||
System::Int32 parseOption( array<System::String ^> ^args, SheetCheckerContext ^context );
|
||||
|
||||
// eof
|
||||
Loading…
Reference in New Issue
Block a user