diff --git a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.ncb b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.ncb index 053b234..0710ce2 100644 Binary files a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.ncb and b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.ncb differ diff --git a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.suo b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.suo index 4f58fe3..9620a8d 100644 Binary files a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.suo and b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL.suo differ diff --git a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/FingerPrinterTWL.vcproj b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/FingerPrinterTWL.vcproj index eb30221..054d5f8 100644 --- a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/FingerPrinterTWL.vcproj +++ b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/FingerPrinterTWL.vcproj @@ -2,7 +2,7 @@ rTad->Checked && !(this->rh->s.titleID_Hi && TITLE_ID_MEDIA_MASK) ) - { - throw gcnew Exception("Cannot make TAD file from the software intended for Game Card."); - } - this->fingerprintRomHeader(); OverwriteRomHeader( this->srlbin, this->rh ); @@ -188,6 +183,10 @@ void Form1::procSaveRomButton() { throw gcnew Exception("The input ROM file has not read yet."); } + if( this->rTad->Checked && !(this->rh->s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK) ) + { + throw gcnew Exception("Cannot make TAD file from the software intended for Game Card."); + } System::String ^format = nullptr; System::String ^ext = nullptr; if( this->rTad->Checked ) @@ -200,8 +199,11 @@ void Form1::procSaveRomButton() format = "rom format (*.srl)|*.srl|All files (*.*)|*.*"; ext = ".srl"; } + // デフォルトのファイル名を決める + System::String ^defname = System::IO::Path::GetFileNameWithoutExtension( this->tboxFile->Text ) + + ".fp" + ext; - System::String ^rompath = SaveFileUsingDialog( this->prevDir, format, ext ); + System::String ^rompath = SaveFileUsingDialog( this->prevDir, defname, format, ext ); if( !rompath ) { return; @@ -222,9 +224,10 @@ void Form1::procDragDrop( System::String ^rompath ) { this->commonOpenRom( rompath ); this->tboxFile->Text = rompath; - this->tboxFile->SelectionStart = rompath->Length; // 入りきらないときに右端を表示する + this->tboxFile->SelectionStart = rompath->Length; this->rSrl->Checked = true; this->rTad->Checked = false; + this->prevDir = System::IO::Path::GetDirectoryName( rompath ); } catch( System::Exception ^ex ) { diff --git a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_console.cpp b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_console.cpp index 943ada7..d8b260c 100644 --- a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_console.cpp +++ b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_console.cpp @@ -87,7 +87,7 @@ void fingerprintConsole( cli::array ^args ) { throw gcnew System::Exception( "Arguments error." ); } - + // 入出力ファイルのパス System::String ^srcpath = args[0]; System::Console::WriteLine( "Input file: {0}", srcpath ); @@ -210,6 +210,12 @@ void fingerprintConsole( cli::array ^args ) System::Console::WriteLine(); } + // ありえないオプション + if( isTad && !(rh.s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK) ) + { + throw gcnew Exception("Cannot make TAD file from the software intended for Game Card."); + } + // maketad if( isTad ) { diff --git a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_util.h b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_util.h index 1b24f89..3054803 100644 --- a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_util.h +++ b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprint_util.h @@ -71,6 +71,14 @@ System::String^ OpenFileUsingDialog( System::String ^defdir, System::String ^fil // @ret 取得したファイル名 エラーのとき nullptr System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^filter, System::String ^extension ); +// セーブするファイルをダイアログで取得 +// @arg [in] デフォルトのディレクトリ +// @arg [in] デフォルトのファイル名 +// @arg [in] 拡張子フィルタ +// @arg [in] ファイルの拡張子が不正なときに追加するときの正しい拡張子 +// @ret 取得したファイル名 エラーのとき nullptr +System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^defname, System::String ^filter, System::String ^extension ); + // ---------------------------------------------------------------------- // 外部プログラムの実行 // ---------------------------------------------------------------------- diff --git a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprinter_util.cpp b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprinter_util.cpp index de50146..8856e11 100644 --- a/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprinter_util.cpp +++ b/build/tools/MasterEditor/FingerPrinterTWL/FingerPrinterTWL/fingerprinter_util.cpp @@ -490,6 +490,17 @@ System::String^ OpenFileUsingDialog( System::String ^defdir, System::String ^fil // @arg [in] ファイルの拡張子が不正なときに追加するときの正しい拡張子 // @ret 取得したファイル名 エラーのとき nullptr System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^filter, System::String ^extension ) +{ + return (SaveFileUsingDialog( defdir, nullptr, filter, extension )); +} + +// セーブするファイルをダイアログで取得 +// @arg [in] デフォルトのディレクトリ +// @arg [in] デフォルトのファイル名 +// @arg [in] 拡張子フィルタ +// @arg [in] ファイルの拡張子が不正なときに追加するときの正しい拡張子 +// @ret 取得したファイル名 エラーのとき nullptr +System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^defname, System::String ^filter, System::String ^extension ) { System::String ^retfile; System::Windows::Forms::SaveFileDialog ^dlg = gcnew (System::Windows::Forms::SaveFileDialog); @@ -505,6 +516,10 @@ System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^fil dlg->Filter = filter; dlg->FilterIndex = 1; dlg->RestoreDirectory = true; + if( defname ) + { + dlg->FileName = defname; + } if( dlg->ShowDialog() != System::Windows::Forms::DialogResult::OK ) {