diff --git a/build/tools/MasterEditor/SheetCheckerTWL/Debug/SheetCheckerTWL.ilk b/build/tools/MasterEditor/SheetCheckerTWL/Debug/SheetCheckerTWL.ilk
new file mode 100644
index 0000000..e69de29
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/Debug/extract_sheet.xsl b/build/tools/MasterEditor/SheetCheckerTWL/Debug/extract_sheet.xsl
new file mode 100644
index 0000000..2952996
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/Debug/extract_sheet.xsl
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/Release/extract_sheet.xsl b/build/tools/MasterEditor/SheetCheckerTWL/Release/extract_sheet.xsl
new file mode 100644
index 0000000..2952996
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/Release/extract_sheet.xsl
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.ncb b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.ncb
new file mode 100644
index 0000000..c89c053
Binary files /dev/null and b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.ncb differ
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.sln b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.sln
new file mode 100644
index 0000000..19e778b
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SheetCheckerTWL", "SheetCheckerTWL\SheetCheckerTWL.vcproj", "{43100A48-45C5-488A-AE74-0642E14043F2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {43100A48-45C5-488A-AE74-0642E14043F2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {43100A48-45C5-488A-AE74-0642E14043F2}.Debug|Win32.Build.0 = Debug|Win32
+ {43100A48-45C5-488A-AE74-0642E14043F2}.Release|Win32.ActiveCfg = Release|Win32
+ {43100A48-45C5-488A-AE74-0642E14043F2}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.suo b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.suo
new file mode 100644
index 0000000..109a82d
Binary files /dev/null and b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL.suo differ
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/AssemblyInfo.cpp b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/AssemblyInfo.cpp
new file mode 100644
index 0000000..841b355
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/AssemblyInfo.cpp
@@ -0,0 +1,40 @@
+#include "stdafx.h"
+
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// AZuɊւʏ͈ȉ̑ZbgƂĐ䂳܂B
+// AZuɊ֘AtĂύXɂ́A
+// ̑lύXĂB
+//
+[assembly:AssemblyTitleAttribute("SheetCheckerTWL")];
+[assembly:AssemblyDescriptionAttribute("")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("CV")];
+[assembly:AssemblyProductAttribute("SheetCheckerTWL")];
+[assembly:AssemblyCopyrightAttribute("Copyright (c) CV 2008")];
+[assembly:AssemblyTrademarkAttribute("")];
+[assembly:AssemblyCultureAttribute("")];
+
+//
+// AZũo[ẂAȉ 4 ̒lō\Ă܂:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// ׂĂ̒lw肷邩Â悤 '*' gărWуrhԍ
+// lɂ邱Ƃł܂:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
+
+[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Debug/BuildLog.htm b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Debug/BuildLog.htm
new file mode 100644
index 0000000..02c7101
Binary files /dev/null and b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Debug/BuildLog.htm differ
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Form1.h b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Form1.h
new file mode 100644
index 0000000..80dba94
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Form1.h
@@ -0,0 +1,479 @@
+#pragma once
+
+#include "SheetCheckerTWL.h"
+#include "crc_whole.h"
+#include
+#include
+#include
+
+namespace SheetCheckerTWL {
+
+ using namespace System;
+ using namespace System::ComponentModel;
+ using namespace System::Collections;
+ using namespace System::Windows::Forms;
+ using namespace System::Data;
+ using namespace System::Drawing;
+
+ ///
+ /// Form1 ̊Tv
+ ///
+ /// x: ̃NX̖OύXꍇÃNXˑ邷ׂĂ .resx t@CɊ֘Atꂽ
+ /// }l[W \[X RpC c[ɑ 'Resource File Name' vpeB
+ /// ύXKv܂B̕ύXsȂƁA
+ /// fUCiƁÃtH[Ɋ֘Atꂽ[JCYς݃\[XƂA
+ /// ݂ɗpłȂȂ܂B
+ ///
+ public ref class Form1 : public System::Windows::Forms::Form
+ {
+ private:
+ ROM_Header *rh;
+ SheetItem ^sheet;
+ System::UInt16 ^fileCRC;
+ SheetCheckerError ^error;
+ System::Boolean ^bReadSrl; // xłǂݍ܂ꂽtrueɂ
+ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colTitle;
+ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colSrl;
+ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colSheet;
+ System::Boolean ^bReadSheet;
+
+ public:
+ Form1(void)
+ {
+ InitializeComponent();
+ //
+ //TODO: ɃRXgN^ R[hlj܂
+ //
+ this->rh = new ROM_Header();
+ this->sheet = gcnew SheetItem();
+ this->fileCRC = gcnew System::UInt16;
+ this->error = gcnew SheetCheckerError(SheetCheckerError::NOERROR);
+ this->bReadSrl = gcnew System::Boolean(false);
+ this->bReadSheet = gcnew System::Boolean(false);
+ memset( this->rh, 0, sizeof(ROM_Header) );
+ this->labVersion->Text = "ver. " + this->getVersion();
+ }
+
+ protected:
+ ///
+ /// gp̃\[XׂăN[Abv܂B
+ ///
+ ~Form1()
+ {
+ delete this->rh; // Yꂸ
+ if (components)
+ {
+ delete components;
+ }
+ }
+
+ private: System::Windows::Forms::Label^ labVersion;
+
+
+
+ private: System::Windows::Forms::TextBox^ tboxSrl;
+ private: System::Windows::Forms::TextBox^ tboxSheet;
+ private: System::Windows::Forms::Button^ butSrl;
+ private: System::Windows::Forms::Button^ butSheet;
+ private: System::Windows::Forms::DataGridView^ gridCompare;
+ private: System::Windows::Forms::TextBox^ tboxResult;
+ private: System::Windows::Forms::Label^ labResult;
+
+ private:
+ ///
+ /// KvȃfUCiϐłB
+ ///
+ System::ComponentModel::Container ^components;
+
+#pragma region Windows Form Designer generated code
+ ///
+ /// fUCi T|[gɕKvȃ\bhłB̃\bh̓e
+ /// R[h GfB^ŕύXȂłB
+ ///
+ void InitializeComponent(void)
+ {
+ System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle17 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
+ System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle18 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
+ System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle19 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
+ System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle20 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
+ this->tboxSrl = (gcnew System::Windows::Forms::TextBox());
+ this->tboxSheet = (gcnew System::Windows::Forms::TextBox());
+ 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());
+ (cli::safe_cast(this->gridCompare))->BeginInit();
+ this->SuspendLayout();
+ //
+ // tboxSrl
+ //
+ this->tboxSrl->AllowDrop = true;
+ this->tboxSrl->Location = System::Drawing::Point(31, 32);
+ this->tboxSrl->Name = L"tboxSrl";
+ this->tboxSrl->ReadOnly = true;
+ this->tboxSrl->Size = System::Drawing::Size(250, 19);
+ this->tboxSrl->TabIndex = 0;
+ this->tboxSrl->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::tboxSrl_DragDrop);
+ this->tboxSrl->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::tboxSrl_DragEnter);
+ //
+ // tboxSheet
+ //
+ this->tboxSheet->AllowDrop = true;
+ this->tboxSheet->Location = System::Drawing::Point(31, 66);
+ this->tboxSheet->Name = L"tboxSheet";
+ this->tboxSheet->ReadOnly = true;
+ this->tboxSheet->Size = System::Drawing::Size(250, 19);
+ this->tboxSheet->TabIndex = 1;
+ this->tboxSheet->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::tboxSheet_DragDrop);
+ this->tboxSheet->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::tboxSheet_DragEnter);
+ //
+ // butSrl
+ //
+ this->butSrl->Location = System::Drawing::Point(287, 30);
+ this->butSrl->Name = L"butSrl";
+ this->butSrl->Size = System::Drawing::Size(107, 23);
+ this->butSrl->TabIndex = 4;
+ this->butSrl->Text = L"SRLJ";
+ this->butSrl->UseVisualStyleBackColor = true;
+ this->butSrl->Click += gcnew System::EventHandler(this, &Form1::butSrl_Click);
+ //
+ // butSheet
+ //
+ this->butSheet->Location = System::Drawing::Point(287, 64);
+ this->butSheet->Name = L"butSheet";
+ this->butSheet->Size = System::Drawing::Size(107, 23);
+ this->butSheet->TabIndex = 5;
+ this->butSheet->Text = L"omFJ";
+ this->butSheet->UseVisualStyleBackColor = true;
+ this->butSheet->Click += gcnew System::EventHandler(this, &Form1::butSheet_Click);
+ //
+ // gridCompare
+ //
+ dataGridViewCellStyle17->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
+ dataGridViewCellStyle17->BackColor = System::Drawing::SystemColors::Control;
+ dataGridViewCellStyle17->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
+ static_cast(128)));
+ dataGridViewCellStyle17->ForeColor = System::Drawing::SystemColors::WindowText;
+ dataGridViewCellStyle17->SelectionBackColor = System::Drawing::SystemColors::Highlight;
+ dataGridViewCellStyle17->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
+ dataGridViewCellStyle17->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
+ this->gridCompare->ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17;
+ this->gridCompare->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
+ this->gridCompare->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(3) {this->colTitle,
+ this->colSrl, this->colSheet});
+ this->gridCompare->Location = System::Drawing::Point(31, 113);
+ this->gridCompare->Name = L"gridCompare";
+ this->gridCompare->RowHeadersVisible = false;
+ this->gridCompare->RowTemplate->Height = 21;
+ this->gridCompare->Size = System::Drawing::Size(363, 148);
+ this->gridCompare->TabIndex = 6;
+ //
+ // tboxResult
+ //
+ this->tboxResult->Location = System::Drawing::Point(294, 273);
+ 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, 276);
+ 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
+ //
+ dataGridViewCellStyle18->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
+ dataGridViewCellStyle18->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(224)),
+ static_cast(static_cast(224)), static_cast(static_cast(224)));
+ this->colTitle->DefaultCellStyle = dataGridViewCellStyle18;
+ this->colTitle->HeaderText = L"";
+ this->colTitle->Name = L"colTitle";
+ this->colTitle->Width = 120;
+ //
+ // colSrl
+ //
+ dataGridViewCellStyle19->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
+ this->colSrl->DefaultCellStyle = dataGridViewCellStyle19;
+ this->colSrl->HeaderText = L"SRL";
+ this->colSrl->Name = L"colSrl";
+ this->colSrl->Width = 120;
+ //
+ // colSheet
+ //
+ dataGridViewCellStyle20->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
+ this->colSheet->DefaultCellStyle = dataGridViewCellStyle20;
+ this->colSheet->HeaderText = L"omF";
+ this->colSheet->Name = L"colSheet";
+ this->colSheet->Width = 120;
+ //
+ // Form1
+ //
+ this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
+ this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
+ this->ClientSize = System::Drawing::Size(428, 302);
+ this->Controls->Add(this->labVersion);
+ this->Controls->Add(this->labResult);
+ this->Controls->Add(this->tboxResult);
+ this->Controls->Add(this->gridCompare);
+ this->Controls->Add(this->butSheet);
+ this->Controls->Add(this->butSrl);
+ this->Controls->Add(this->tboxSheet);
+ this->Controls->Add(this->tboxSrl);
+ this->Name = L"Form1";
+ this->Text = L"TWLomF`FbJ[";
+ (cli::safe_cast(this->gridCompare))->EndInit();
+ this->ResumeLayout(false);
+ this->PerformLayout();
+
+ }
+#pragma endregion
+
+private:
+ // o[W擾
+ System::String^ getVersion( void )
+ {
+ System::Reflection::Assembly ^ass = System::Reflection::Assembly::GetEntryAssembly();
+ System::Version ^ver = ass->GetName()->Version;
+ return ( ver->Major.ToString() + "." + ver->Minor.ToString() );
+ }
+
+private:
+ // r\Ĉv邩
+ void updateResult()
+ {
+ if( !(*this->bReadSrl) || !(*this->bReadSheet) ) // Ƃǂݍ܂ȂƔ肵Ȃ
+ {
+ return;
+ }
+
+ // v邩
+ if( *this->error == SheetCheckerError::NOERROR )
+ {
+ *this->error = checkSheet( this->rh, *this->fileCRC, this->sheet );
+ }
+
+ // ЂƂЂƂgridɓo^
+
+ System::String ^tmp1, ^tmp2; // grid ɂ͕ŒljȂȂȂ
+
+ this->gridCompare->Rows->Clear();
+
+ System::Text::UTF8Encoding^ utf8 = gcnew System::Text::UTF8Encoding( true ); // char->StringϊɕKv
+ tmp1 = gcnew System::String( this->rh->s.game_code, 0, GAME_CODE_MAX, utf8 );
+ tmp2 = gcnew System::String( this->sheet->GameCode, 0, GAME_CODE_MAX, utf8 );
+ this->gridCompare->Rows->Add( "CjVR[h", tmp1, tmp2 );
+ if( *this->error == SheetCheckerError::ERROR_VERIFY_GAME_CODE )
+ {
+ System::Int32 last = this->gridCompare->Rows->Count - 2; // lj̍s
+ this->gridCompare->Rows[ last ]->DefaultCellStyle->ForeColor = System::Drawing::Color::Red;
+ }
+
+ tmp1 = this->rh->s.rom_version.ToString( "X02" );
+ tmp2 = this->sheet->RomVersion.ToString( "X02" );
+ this->gridCompare->Rows->Add( "}X^[o[W", tmp1, tmp2 );
+ if( *this->error == SheetCheckerError::ERROR_VERIFY_ROM_VERSION )
+ {
+ System::Int32 last = this->gridCompare->Rows->Count - 2;
+ this->gridCompare->Rows[ last ]->DefaultCellStyle->ForeColor = System::Drawing::Color::Red;
+ }
+
+ tmp1 = this->fileCRC->ToString( "X02" );
+ tmp2 = this->sheet->FileCRC.ToString( "X02" );
+ this->gridCompare->Rows->Add( "t@CŜCRC", tmp1, tmp2 );
+ if( *this->error == SheetCheckerError::ERROR_VERIFY_CRC )
+ {
+ System::Int32 last = this->gridCompare->Rows->Count - 2;
+ this->gridCompare->Rows[ last ]->DefaultCellStyle->ForeColor = System::Drawing::Color::Red;
+ }
+
+ tmp2 = this->sheet->SubmitVersion.ToString() + " (" + this->sheet->SubmitVersion.ToString( "X1" ) + ")";
+ this->gridCompare->Rows->Add( "oo[W", "-", tmp2 );
+
+ System::UInt16 tadver = sheet->RomVersion;
+ tadver = (tadver << 8) | sheet->SubmitVersion;
+ tmp2 = tadver.ToString() + " (" + tadver.ToString( "X04" ) + ")";
+ this->gridCompare->Rows->Add( "TADo[W", "-", tmp2);
+
+ if( *this->error == SheetCheckerError::NOERROR )
+ {
+ this->tboxResult->Text = "OK";
+ }
+ else
+ {
+ int code = (int)(*this->error);
+ this->tboxResult->Text = "NG" + " (" + code.ToString() + ")";
+ }
+
+ }
+
+private:
+ // t@C_CAOŎ擾
+ System::String ^prevDir; // lnullptr
+ System::String^ openFile( System::String ^filter ) // t@C̊gqtB^Ŏw
+ {
+ System::Windows::Forms::OpenFileDialog ^dlg = gcnew (OpenFileDialog);
+ if( System::String::IsNullOrEmpty( this->prevDir ) || !System::IO::Directory::Exists( this->prevDir ) )
+ {
+ dlg->InitialDirectory = System::Environment::GetFolderPath( System::Environment::SpecialFolder::Desktop );
+ }
+ else
+ {
+ dlg->InitialDirectory = this->prevDir; // OɑIfBNgftHgɂ
+ }
+ dlg->Filter = filter;
+ dlg->FilterIndex = 1;
+ dlg->RestoreDirectory = true;
+
+ if( dlg->ShowDialog() != System::Windows::Forms::DialogResult::OK )
+ {
+ return nullptr;
+ }
+ this->prevDir = System::IO::Path::GetDirectoryName( dlg->FileName );
+ return dlg->FileName;
+ }
+
+private:
+ // SRLJ {^ƃhbOAhhbv2ނ邽߃bvĂ
+ void openSrl( System::String ^filename )
+ {
+ if( !filename )
+ {
+ memset( this->rh, 0, sizeof(ROM_Header) );
+ this->tboxSrl->Text = "";
+ *this->fileCRC = 0;
+ *this->error = SheetCheckerError::ERROR_READ_SRL;
+ }
+ else
+ {
+ if( !readRomHeader( filename, this->rh ) )
+ {
+ memset( this->rh, 0, sizeof(ROM_Header) );
+ this->tboxSrl->Text = "";
+ *this->fileCRC = 0;
+ *this->error = SheetCheckerError::ERROR_READ_SRL;
+ }
+ else
+ {
+ this->tboxSrl->Text = System::IO::Path::GetFileName( filename );
+ u16 crc;
+ getWholeCRCInFile( filename, &crc );
+ *this->fileCRC = crc;
+ *this->bReadSrl = true; // xłǂݍtrue
+ *this->error = SheetCheckerError::NOERROR;
+ }
+ }
+ this->updateResult();
+ }
+
+private:
+ // omFJ
+ void openSheet( System::String ^filename )
+ {
+ if( !filename )
+ {
+ this->tboxSheet->Text = "";
+ *this->error = SheetCheckerError::ERROR_READ_SHEET;
+ }
+ else
+ {
+ if( !readSheet( filename, this->sheet ) )
+ {
+ this->tboxSheet->Text = "";
+ *this->error = SheetCheckerError::ERROR_READ_SHEET;
+ }
+ else
+ {
+ this->tboxSheet->Text = System::IO::Path::GetFileName( filename );
+ *this->error = SheetCheckerError::NOERROR;
+ *this->bReadSheet = true;
+ }
+ }
+ this->updateResult();
+ }
+
+private:
+ // SRL̓ǂݍ݃{^
+ System::Void butSrl_Click(System::Object^ sender, System::EventArgs^ e)
+ {
+ System::String ^filename = openFile( "srl format (*.srl)|*.srl|All files (*.*)|*.*" );
+ this->openSrl( filename );
+ }
+
+private:
+ // omF̓ǂݍ݃{^
+ System::Void butSheet_Click(System::Object^ sender, System::EventArgs^ e)
+ {
+ System::String ^filename = openFile( "xml format (*.xml)|*.xml|All files (*.*)|*.*" );
+ this->openSheet( filename );
+ }
+
+private:
+ // eLXg{bNXɃhbOꂽƂ
+ System::Void tboxSrl_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e)
+ {
+ if( e->Data->GetDataPresent( DataFormats::FileDrop ) )
+ {
+ e->Effect = DragDropEffects::All;
+ }
+ }
+private:
+ // hbOă{^ꂽƂ
+ System::Void tboxSrl_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e)
+ {
+ array ^files = dynamic_cast< array ^>(e->Data->GetData( DataFormats::FileDrop ));
+ System::String ^filename = files[0];
+
+ if( System::IO::File::Exists(filename) == false )
+ {
+ this->openSrl( nullptr ); // sƂ̏͌Ăяo\bhŎs
+ }
+ else
+ {
+ this->openSrl( filename );
+ }
+ }
+private:
+ System::Void tboxSheet_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e)
+ {
+ if( e->Data->GetDataPresent( DataFormats::FileDrop ) )
+ {
+ e->Effect = DragDropEffects::All;
+ }
+ }
+private:
+ System::Void tboxSheet_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e)
+ {
+ array ^files = dynamic_cast< array ^>(e->Data->GetData( DataFormats::FileDrop ));
+ System::String ^filename = files[0];
+
+ if( System::IO::File::Exists(filename) == false )
+ {
+ this->openSheet( nullptr );
+ }
+ else
+ {
+ this->openSheet( filename );
+ }
+ }
+};
+}
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Form1.resx b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Form1.resx
new file mode 100644
index 0000000..e4e5bb0
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Form1.resx
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/ReadMe.txt b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/ReadMe.txt
new file mode 100644
index 0000000..3fa03fa
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/ReadMe.txt
@@ -0,0 +1,34 @@
+===============================================================================
+ AvP[V : SheetCheckerTWL vWFNg̊Tv
+===============================================================================
+
+ SheetCheckerTWL AvP[V́AAppWizard ɂč쐬܂B
+
+̃t@Cɂ́ASheetCheckerTWL AvP[V\et@C
+e̊TLqĂ܂B
+
+SheetCheckerTWL.vcproj
+ ́AAvP[V EBU[hŐ VC++ vWFNg̃C
+ vWFNg t@CłB
+ t@C Visual C++ ̃o[WƁAAvP[V EBU[
+ hőIvbgtH[A\AуvWFNg̋@\Ɋւ
+ LqĂ܂B
+
+SheetCheckerTWL.cpp
+ ́AC̃AvP[V \[X t@CłB
+ tH[\R[h܂܂Ă܂B
+
+Form1.h
+ [U[̃tH[ NX̎ƁAInitializeComponent() ܂܂Ă܂B
+
+AssemblyInfo.cpp
+ AZu ^f[^ύX邽߂̃JX^܂܂Ă܂B
+
+///////////////////////////////////////////////////////////////////////////////
+̑̕Wt@C :
+
+StdAfx.h, StdAfx.cpp
+ ̃t@ĆARpCς݃wb_[ (PCH) t@C SheetCheckerTWL.pch
+ ƃvRpCς^t@C StdAfx.obj rh邽߂Ɏgp܂B
+
+///////////////////////////////////////////////////////////////////////////////
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Release/BuildLog.htm b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Release/BuildLog.htm
new file mode 100644
index 0000000..e963281
Binary files /dev/null and b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/Release/BuildLog.htm differ
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.cpp b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.cpp
new file mode 100644
index 0000000..b490c14
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.cpp
@@ -0,0 +1,377 @@
+// SheetCheckerTWL.cpp : C vWFNg t@CłB
+
+#include "stdafx.h"
+#include "SheetCheckerTWL.h"
+#include "crc_whole.h"
+#include
+#include
+#include
+#include "Form1.h"
+
+using namespace SheetCheckerTWL;
+
+// ------------------------------------------------------------------
+// 錾
+// ------------------------------------------------------------------
+
+System::Int32 parseOption( array ^args, SheetCheckerContext ^context );
+int printResult( SheetCheckerContext ^context, ROM_Header *rh, SheetItem ^item,
+ System::String ^srlfile, System::String ^sheetfile, System::UInt16 srlcrc );
+int consoleRun( array ^args, int argc, SheetCheckerContext ^hContext );
+
+[STAThreadAttribute]
+int main(array ^args)
+{
+ SheetCheckerContext ^hContext = gcnew SheetCheckerContext;
+
+ // getopt
+ int argc = parseOption( args, hContext );
+
+ if( argc > 0 )
+ {
+ int ret = consoleRun( args, argc, hContext );
+ return ret;
+ }
+
+ // Rg[쐬OɁAWindows XP rWAʂLɂ܂
+ Application::EnableVisualStyles();
+ Application::SetCompatibleTextRenderingDefault(false);
+
+ // C EBhE쐬āAs܂
+ Application::Run(gcnew Form1());
+ return 0;
+}
+
+// ------------------------------------------------------------------
+// R\[
+// ------------------------------------------------------------------
+
+int consoleRun( array ^args, int argc, SheetCheckerContext ^hContext )
+{
+ ROM_Header rh;
+ memset( (void*)&rh, 0, sizeof(ROM_Header) );
+ SheetItem ^hItem = gcnew SheetItem;
+
+ //
+ if( argc != 2 )
+ {
+ hContext->ErrorCode = SheetCheckerError::ERROR_ARG;
+ printResult( hContext, &rh, hItem, nullptr, nullptr, 0 );
+ return -1;
+ }
+ System::String ^hSrlFile = args[0];
+ System::String ^hSheetFile = args[1];
+
+ // ROMwb_̓ǂݍ
+ if( !readRomHeader( hSrlFile, &rh ) )
+ {
+ hContext->ErrorCode = SheetCheckerError::ERROR_READ_SRL;
+ printResult( hContext, &rh, hItem, hSrlFile, hSheetFile, 0 );
+ return -1;
+ }
+ System::UInt16 crc;
+ getWholeCRCInFile( hSrlFile, &crc );
+
+ // omF̓ǂݍ
+ if( !readSheet( hSheetFile, hItem ) )
+ {
+ hContext->ErrorCode = SheetCheckerError::ERROR_READ_SHEET;
+ printResult( hContext, &rh, hItem, hSrlFile, hSheetFile, crc );
+ return -1;
+ }
+
+ // v
+ hContext->ErrorCode = checkSheet( &rh, crc, hItem );
+
+ // ʕ\
+ int ret = printResult( hContext, &rh, hItem, hSrlFile, hSheetFile, crc );
+ return ret;
+}
+
+// ------------------------------------------------------------------
+// v
+// ------------------------------------------------------------------
+
+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;
+}
+
+// ------------------------------------------------------------------
+// ʕ\
+// ------------------------------------------------------------------
+
+int printResult( SheetCheckerContext ^context, ROM_Header *rh, SheetItem ^item,
+ System::String ^srlfile, System::String ^sheetfile, System::UInt16 srlcrc )
+{
+ System::UInt16 tadver = item->RomVersion;
+ tadver = (tadver << 8) | item->SubmitVersion;
+
+ // ʏ̕\
+ if( !context->bSubmitVersion && !context->bResult && !context->bTadVersion )
+ {
+ 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",
+ 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( "SubmitVersion: - %d (%02X)\n", item->SubmitVersion, item->SubmitVersion );
+ printf( "TAD Version: %d (%04X)\n", tadver, tadver );
+ printf( "---------------------------------------\n" );
+ printf( "Result: " );
+ if( context->ErrorCode == SheetCheckerError::NOERROR )
+ {
+ printf( "OK\n" );
+ }
+ else
+ {
+ printf( "NG (%d)\n", context->ErrorCode );
+ }
+ }
+
+ // IvV̂Ƃ̕\
+ if( context->bSubmitVersion )
+ {
+ if( context->ErrorCode == SheetCheckerError::NOERROR )
+ {
+ printf( "%d", item->SubmitVersion );
+ }
+ else
+ {
+ printf( "%d", context->ErrorCode ); // G[̂Ƃ̓G[R[h
+ }
+ }
+ if( context->bTadVersion )
+ {
+ if( context->ErrorCode == SheetCheckerError::NOERROR )
+ {
+ printf( "%d", tadver );
+ }
+ else
+ {
+ printf( "%d", context->ErrorCode );
+ }
+ }
+ if( context->bResult )
+ {
+ printf( "%d", context->ErrorCode );
+ }
+
+ if( context->ErrorCode != SheetCheckerError::NOERROR )
+ {
+ return -1;
+ }
+ return 0;
+}
+
+
+// ------------------------------------------------------------------
+// ROMwb_̓ǂݍ
+// ------------------------------------------------------------------
+
+System::Boolean readRomHeader( System::String ^srlfile, ROM_Header *rh )
+{
+ FILE *fp = NULL;
+ const char *pchFilename =
+ (const char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi( srlfile ).ToPointer();
+
+ // t@CJROMwb_̂ݓǂݏo
+ if( fopen_s( &fp, pchFilename, "rb" ) != NULL )
+ {
+ return false;
+ }
+ (void)fseek( fp, 0, SEEK_SET ); // ROMwb_srl̐擪
+
+ // 1oCgsizeof(~)[h (tƕԂlsizeof(~)ɂȂȂ̂Œ)
+ if( fread( (void*)rh, 1, sizeof(ROM_Header), fp ) != sizeof(ROM_Header) )
+ {
+ fclose( fp );
+ return false;
+ }
+ fclose( fp );
+ return true;
+}
+
+// ------------------------------------------------------------------
+// omF̓ǂݍ
+// ------------------------------------------------------------------
+
+System::Boolean readSheet( System::String ^sheetfile, SheetItem ^item )
+{
+ // XSLɂXMLϊ
+ System::String ^tmpfile = ".\\temp" + System::DateTime::Now.ToString("yyyyMMddHHmmss") + ".xml";
+ System::Xml::Xsl::XslCompiledTransform ^xslt = gcnew System::Xml::Xsl::XslCompiledTransform;
+ System::String ^xslpath = System::IO::Path::GetDirectoryName( System::Reflection::Assembly::GetEntryAssembly()->Location )
+ + "\\extract_sheet.xsl";
+ try
+ {
+ //Console::WriteLine( "xslpath: " + xslpath );
+ xslt->Load( xslpath );
+ xslt->Transform( sheetfile, tmpfile );
+ }
+ catch( System::Exception ^ex )
+ {
+ (void)ex;
+ //Console::WriteLine( "XSLT Error" );
+ return false;
+ }
+ // ϊXMLǂݍ
+ System::Xml::XmlDocument ^doc = gcnew System::Xml::XmlDocument;
+ try
+ {
+ doc->Load( tmpfile );
+ }
+ catch( System::Exception ^ex )
+ {
+ (void)ex;
+ //Console::WriteLine( "Load error" );
+ return false;
+ }
+
+ // XMLf[^𒊏o
+ System::Xml::XmlElement ^root = doc->DocumentElement;
+ System::String ^text;
+ try
+ {
+ item->Media = getXPathText( root, "/Sheet/Media" );
+
+ text = getXPathText( root, "/Sheet/GameCode" );
+ char code[4];
+ int i;
+ for(i=0; i<4; i++ )
+ {
+ code[i] = (char)text[i];
+ }
+ item->GameCode = code; // Rs[悤 property `Ă
+
+ text = getXPathText( root, "/Sheet/RomVersion" );
+ if( text->Contains( "(" ) ) // Oł̂Ƃɂ"(O)"
+ {
+ text = text->Remove( text->IndexOf("(") );
+ }
+ text = text->Trim();
+ item->RomVersion = System::Byte::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier );
+
+ text = getXPathText( root, "/Sheet/CRC" );
+ if( text->Contains( "0x" ) )
+ {
+ text = text->Substring( text->IndexOf("x")+1 );
+ }
+ item->FileCRC = System::UInt16::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier );
+
+ text = getXPathText( root, "/Sheet/SubmitVersion" );
+ char c = (char)text[0];
+ if( ('G' <= c) && (c <= 'Z') ) // FG..Zŕ\Ă(\)
+ {
+ item->SubmitVersion = c - 'G' + 16;
+ }
+ else if( ('g' <= c) && (c <= 'z') )
+ {
+ item->SubmitVersion = c - 'g' + 16;
+ }
+ else
+ {
+ item->SubmitVersion = System::Byte::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier );
+ }
+ }
+ catch( System::Exception ^ex )
+ {
+ (void)ex;
+ return false;
+ }
+
+ // ԃt@C폜
+ if( System::IO::File::Exists( tmpfile ) )
+ {
+ System::IO::File::Delete( tmpfile );
+ }
+ return true;
+}
+
+// ------------------------------------------------------------------
+// getopt
+// ------------------------------------------------------------------
+
+// @ret IvVƂargc
+System::Int32 parseOption( array ^args, SheetCheckerContext ^context )
+{
+ System::Collections::Generic::List ^indexList
+ = gcnew System::Collections::Generic::List;
+
+ int numopt = 0;
+ int i;
+ for( i=0; i < args->Length; i++ )
+ {
+ if( args[i]->StartsWith( "-s" ) )
+ {
+ context->bSubmitVersion = true;
+ numopt++;
+ }
+ else if( args[i]->StartsWith( "-r" ) )
+ {
+ context->bResult = true;
+ numopt++;
+ }
+ else if( args[i]->StartsWith( "-t" ) )
+ {
+ context->bTadVersion = true;
+ numopt++;
+ }
+ else if( args[i]->StartsWith( "-c" ) )
+ {
+ context->bConsole = true;
+ numopt++;
+ }
+ else if( !args[i]->StartsWith( "-" ) ) // IvVłȂindexL^
+ {
+ indexList->Add(i);
+ }
+ }
+ i=0;
+ for each( System::Int32 index in indexList ) // IvVłȂOɂ߂Ă
+ {
+ args[i] = args[index];
+ i++;
+ }
+ return (args->Length - numopt);
+}
+
+// ------------------------------------------------------------------
+// XML^O
+// ------------------------------------------------------------------
+
+// @ret eLXg݂Ƃ̃eLXgԂB݂ȂƂnullptrB
+System::String^ getXPathText( System::Xml::XmlElement ^root, System::String ^xpath )
+{
+ System::Xml::XmlNode ^tmp = root->SelectSingleNode( xpath );
+ if( tmp && tmp->FirstChild && tmp->FirstChild->Value )
+ {
+ return tmp->FirstChild->Value;
+ }
+ return nullptr;
+}
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.h b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.h
new file mode 100644
index 0000000..b31ff08
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.h
@@ -0,0 +1,135 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+
+// ------------------------------------------------------------------
+// \
+// ------------------------------------------------------------------
+
+// G[R[h
+enum class SheetCheckerError
+{
+ NOERROR = 0,
+ ERROR_VERIFY_GAME_CODE = -1,
+ ERROR_VERIFY_ROM_VERSION = -2,
+ ERROR_VERIFY_CRC = -3,
+ ERROR_READ_SRL = -8,
+ ERROR_READ_SHEET = -9,
+ ERROR_ARG = -10,
+};
+
+// sContext
+ref class SheetCheckerContext
+{
+private:
+ System::Boolean ^hbSubmitVersion; // IvVtO
+ System::Boolean ^hbResult;
+ System::Boolean ^hbTadVersion;
+ System::Boolean ^hbConsole;
+ SheetCheckerError ^hErrorCode; // G[
+public:
+ SheetCheckerContext()
+ {
+ this->hbSubmitVersion = gcnew System::Boolean(false);
+ this->hbResult = gcnew System::Boolean(false);
+ this->hbTadVersion = gcnew System::Boolean(false);
+ this->hbConsole = gcnew System::Boolean(false);
+ this->hErrorCode = gcnew SheetCheckerError( SheetCheckerError::NOERROR );
+ }
+ property System::Boolean bSubmitVersion
+ {
+ void set( System::Boolean flg ){ this->hbSubmitVersion = gcnew System::Boolean(flg); }
+ System::Boolean get(){ return *this->hbSubmitVersion; }
+ };
+ property System::Boolean bResult
+ {
+ void set( System::Boolean flg ){ this->hbResult = gcnew System::Boolean(flg); }
+ System::Boolean get(){ return *this->hbResult; }
+ };
+ property System::Boolean bTadVersion
+ {
+ void set( System::Boolean flg ){ this->hbTadVersion = gcnew System::Boolean(flg); }
+ System::Boolean get(){ return *this->hbTadVersion; }
+ };
+ property System::Boolean bConsole
+ {
+ void set( System::Boolean flg ){ this->hbConsole = gcnew System::Boolean(flg); }
+ System::Boolean get(){ return *this->hbConsole; }
+ };
+ property SheetCheckerError ErrorCode
+ {
+ void set( SheetCheckerError code ){ this->hErrorCode = gcnew SheetCheckerError(code); }
+ SheetCheckerError get(){ return *this->hErrorCode; }
+ };
+};
+
+// omF̏
+ref class SheetItem
+{
+private:
+ char *pGameCode;
+ System::Byte ^hRomVersion;
+ System::UInt16 ^hFileCRC;
+ System::Byte ^hSubmitVersion;
+public:
+ System::String ^hMedia;
+public:
+ SheetItem()
+ {
+ this->pGameCode = new char[4];
+ std::memset( this->pGameCode, 0, 4 );
+ this->hRomVersion = gcnew System::Byte(0);
+ this->hFileCRC = gcnew System::UInt16(0);
+ this->hSubmitVersion = gcnew System::Byte(0);
+ this->hMedia = gcnew System::String("");
+ }
+ ~SheetItem()
+ {
+ delete []this->pGameCode;
+ }
+ property char* GameCode
+ {
+ void set( char* p ){ memcpy( this->pGameCode, p, 4 ); }
+ char* get(){ return this->pGameCode; }
+ }
+ property System::Byte RomVersion
+ {
+ void set( System::Byte v ){ *this->hRomVersion = v; }
+ System::Byte get(){ return *this->hRomVersion; }
+ }
+ property System::UInt16 FileCRC
+ {
+ void set( System::UInt16 v ){ *this->hFileCRC = v; }
+ System::UInt16 get(){ return *this->hFileCRC; }
+ }
+ property System::Byte SubmitVersion
+ {
+ void set( System::Byte v ){ *this->hSubmitVersion = v; }
+ System::Byte get(){ return *this->hSubmitVersion; }
+ }
+ property System::String ^Media
+ {
+ void set( System::String ^str )
+ {
+ if( str != nullptr )
+ this->hMedia = System::String::Copy(str);
+ else
+ this->hMedia = gcnew System::String("");
+ }
+ System::String^ get(){ return System::String::Copy( this->hMedia ); }
+ }
+};
+
+
+// ------------------------------------------------------------------
+// utlity functions
+// ------------------------------------------------------------------
+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 );
+SheetCheckerError checkSheet( ROM_Header *rh, System::UInt16 crc, SheetItem ^item );
+
+// eof
\ No newline at end of file
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.vcproj b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.vcproj
new file mode 100644
index 0000000..5cfb462
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.vcproj
@@ -0,0 +1,286 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.vcproj.RED.nishikawa_takeshi.user b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.vcproj.RED.nishikawa_takeshi.user
new file mode 100644
index 0000000..7963a7f
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/SheetCheckerTWL.vcproj.RED.nishikawa_takeshi.user
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/app.ico b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/app.ico
new file mode 100644
index 0000000..3a5525f
Binary files /dev/null and b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/app.ico differ
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/app.rc b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/app.rc
new file mode 100644
index 0000000..2ad8e34
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/app.rc
@@ -0,0 +1,63 @@
+// Microsoft Visual C++ Őꂽ\[X XNvgłB
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// p (č) \[X
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// ACR
+//
+
+// ŏɔzuꂽACRA܂ ID lłႢACRAAvP[V ACRɂȂ܂B
+
+LANGUAGE 17, 1
+#pragma code_page(932)
+1 ICON "app.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+ "\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 3 \[X琶܂B
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // APSTUDIO_INVOKED łȂꍇ
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/crc_whole.cpp b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/crc_whole.cpp
new file mode 100644
index 0000000..a270787
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/crc_whole.cpp
@@ -0,0 +1,179 @@
+// crc_whole.h ̎
+
+#include "stdafx.h"
+#include "crc_whole.h"
+#include
+#include
+
+#define CRCPOLY 0x1021
+#define BUFLEN 0x1000
+
+u16 crc_table[0x100];
+
+/*----------------------------------------------------------------------------
+
+ inittable - initialize table
+
+ `
+ static void inittable(unsigned short *table);
+
+
+ CRCZo邽߂̎Qƃe[u쐬B
+----------------------------------------------------------------------------*/
+static void inittable(unsigned short *table)
+{
+ unsigned short i, j, r;
+
+ for(i = 0; i < 0x100; i++) {
+ r = i << 8;
+ for(j = 0; j < 8; j++) {
+ if(r & 0x8000U)
+ r = (r << 1) ^ CRCPOLY;
+ else
+ r <<= 1;
+ }
+ *table++ = r;
+ }
+}
+
+/*============================================================================*
+ CRCvZ
+ iZpCRCe[ugCRCvZ
+
+ oCgƊoCgւĂvZB
+ *============================================================================*/
+static u16 newGetCRC
+ (
+ u16 start, // CRCliݐϒlj
+ u16 *datap, // f[^̐擪w|C^ÂƈႢAu8
+ u32 size // oCgPʂł̃f[^TCY
+ )
+{
+ u32 i;
+ u16 crc;
+ u8* byte;
+
+ crc = start;
+ byte = (u8 *)datap;
+
+ for (i=0; i> 8) ^ byte1];
+ crc = (crc << 8) ^ crc_table[(crc >> 8) ^ byte0];
+ }
+
+ return crc;
+}
+
+/*---------------------------------------------------------------------------*
+
+ Name: getSeg3CRCInFp
+
+ Description: Segment3(0x3000-0x3fff)CRCZo
+
+ Arguments: [in] srlt@C̃t@C|C^
+ [out] CRCi[
+
+ Return: ȂTRUE.
+
+ *---------------------------------------------------------------------------*/
+BOOL getSeg3CRCInFp( FILE *fp, u16 *pCRC )
+{
+ u16 crc;
+ u16 data[ 0x1000 / 2 ]; // 64KoCg(512Krbg)
+
+ if( !fp )
+ {
+ return FALSE;
+ }
+
+ // CRCe[uiiZp̃R[hj
+ inittable(crc_table);
+
+ // 0x3000 0x3fff ܂ł CRC Ƃ
+ fseek( fp, 0x3000, SEEK_SET );
+ fread( (void*)data, sizeof(data), 1, fp );
+ crc = newGetCRC( 0, data, sizeof(data) );
+ *pCRC = crc;
+
+ return TRUE;
+}
+
+/*---------------------------------------------------------------------------*
+
+ Name: getWholeCRCInFp
+
+ Description: srlt@CŜCRCZo
+
+ Arguments: [in] srlt@C̃t@C|C^
+ [out] CRCi[
+
+ Return: ȂTRUE.
+
+ *---------------------------------------------------------------------------*/
+BOOL getWholeCRCInFp( FILE *fp, u16 *pCRC )
+{
+ u32 file_size;
+ u16 crc;
+ u32 i;
+ u16 data[ 0x1000 / 2 ]; // 64KoCg(512Krbg)
+
+ if( !fp )
+ {
+ return FALSE;
+ }
+
+ // t@CTCY`FbN
+ fseek( fp, 0, SEEK_END );
+ file_size = ftell( fp );
+
+ // CRCe[uiiZp̃R[hj
+ inittable(crc_table);
+
+ // t@CŜCRC Ƃ
+ fseek( fp, 0, SEEK_SET );
+ crc = 0;
+ for ( i=0; i
+#include
+
+/*---------------------------------------------------------------------------*
+
+ Name: getSeg3CRCInFp
+
+ Description: Segment3(0x3000-0x3fff)CRCZo
+
+ Arguments: [in] srlt@C̃t@C|C^
+ [out] CRCi[
+
+ Return: ȂTRUE.
+
+ *---------------------------------------------------------------------------*/
+BOOL getSeg3CRCInFp( FILE *fp, u16 *pCRC );
+
+/*---------------------------------------------------------------------------*
+
+ Name: getWholeCRCInFp
+
+ Description: srlt@CŜCRCZo
+
+ Arguments: [in] srlt@C̃t@C|C^
+ [out] CRCi[
+
+ Return: ȂTRUE.
+
+ *---------------------------------------------------------------------------*/
+BOOL getWholeCRCInFp( FILE *fp, u16 *pCRC );
+
+/*---------------------------------------------------------------------------*
+
+ Name: getWholeCRCInFile
+
+ Description: srlt@CŜCRCZo
+
+ Arguments: [in] srlt@C(ĂяoOɕĂ)
+ [out] CRCi[
+
+ Return: None.
+
+ *---------------------------------------------------------------------------*/
+BOOL getWholeCRCInFile( System::String ^filename, u16 *pCRC );
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/resource.h b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/resource.h
new file mode 100644
index 0000000..1f2251c
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/resource.h
@@ -0,0 +1,3 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by app.rc
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/stdafx.cpp b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/stdafx.cpp
new file mode 100644
index 0000000..325ceb4
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : WCN[h SheetCheckerTWL.pch ݂̂
+// ܂ރ\[X t@ĆAvRpCς݃wb_[ɂȂ܂B
+// stdafx.obj ɂ̓vRpCς^܂܂܂B
+
+#include "stdafx.h"
+
+
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/stdafx.h b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/stdafx.h
new file mode 100644
index 0000000..6c1fb4b
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/SheetCheckerTWL/stdafx.h
@@ -0,0 +1,6 @@
+// stdafx.h : W̃VXe CN[h t@C̃CN[h t@CA܂
+// QƉA܂ύXȂAvWFNgp̃CN[h t@C
+// Lq܂B
+#pragma once
+
+// TODO: vOɕKvȒljwb_[ŎQƂĂB
diff --git a/build/tools/MasterEditor/SheetCheckerTWL/extract_sheet.xsl b/build/tools/MasterEditor/SheetCheckerTWL/extract_sheet.xsl
new file mode 100644
index 0000000..2952996
--- /dev/null
+++ b/build/tools/MasterEditor/SheetCheckerTWL/extract_sheet.xsl
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+