TWLフィンガープリンタ:保存時にデフォルトのファイル名を表示することにした。カードアプリでTAD出力が選択されているときのエラー判定を修正。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@265 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-04-20 08:51:53 +00:00
parent e4c12c4dc0
commit a83eb10e89
7 changed files with 41 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="FingerPrinterTWL"
Name="FingerprinterTWL"
ProjectGUID="{F41F8415-6AF1-46DF-B771-30B5AE234B89}"
RootNamespace="FingerPrinterTWL"
Keyword="ManagedCProj"

View File

@ -131,11 +131,6 @@ void Form1::commonSaveRom( System::String ^dstpath )
throw gcnew Exception("The input ROM file has not read yet.");
}
if( this->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 )
{

View File

@ -87,7 +87,7 @@ void fingerprintConsole( cli::array<System::String^> ^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<System::String^> ^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 )
{

View File

@ -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 );
// ----------------------------------------------------------------------
// 外部プログラムの実行
// ----------------------------------------------------------------------

View File

@ -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 )
{