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 <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9.00"
Name="FingerPrinterTWL" Name="FingerprinterTWL"
ProjectGUID="{F41F8415-6AF1-46DF-B771-30B5AE234B89}" ProjectGUID="{F41F8415-6AF1-46DF-B771-30B5AE234B89}"
RootNamespace="FingerPrinterTWL" RootNamespace="FingerPrinterTWL"
Keyword="ManagedCProj" 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."); 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(); this->fingerprintRomHeader();
OverwriteRomHeader( this->srlbin, this->rh ); OverwriteRomHeader( this->srlbin, this->rh );
@ -188,6 +183,10 @@ void Form1::procSaveRomButton()
{ {
throw gcnew Exception("The input ROM file has not read yet."); 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 ^format = nullptr;
System::String ^ext = nullptr; System::String ^ext = nullptr;
if( this->rTad->Checked ) if( this->rTad->Checked )
@ -200,8 +199,11 @@ void Form1::procSaveRomButton()
format = "rom format (*.srl)|*.srl|All files (*.*)|*.*"; format = "rom format (*.srl)|*.srl|All files (*.*)|*.*";
ext = ".srl"; 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 ) if( !rompath )
{ {
return; return;
@ -222,9 +224,10 @@ void Form1::procDragDrop( System::String ^rompath )
{ {
this->commonOpenRom( rompath ); this->commonOpenRom( rompath );
this->tboxFile->Text = rompath; this->tboxFile->Text = rompath;
this->tboxFile->SelectionStart = rompath->Length; // 入りきらないときに右端を表示する this->tboxFile->SelectionStart = rompath->Length;
this->rSrl->Checked = true; this->rSrl->Checked = true;
this->rTad->Checked = false; this->rTad->Checked = false;
this->prevDir = System::IO::Path::GetDirectoryName( rompath );
} }
catch( System::Exception ^ex ) catch( System::Exception ^ex )
{ {

View File

@ -210,6 +210,12 @@ void fingerprintConsole( cli::array<System::String^> ^args )
System::Console::WriteLine(); 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 // maketad
if( isTad ) if( isTad )
{ {

View File

@ -71,6 +71,14 @@ System::String^ OpenFileUsingDialog( System::String ^defdir, System::String ^fil
// @ret 取得したファイル名 エラーのとき nullptr // @ret 取得したファイル名 エラーのとき nullptr
System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^filter, System::String ^extension ); 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] ファイルの拡張子が不正なときに追加するときの正しい拡張子 // @arg [in] ファイルの拡張子が不正なときに追加するときの正しい拡張子
// @ret 取得したファイル名 エラーのとき nullptr // @ret 取得したファイル名 エラーのとき nullptr
System::String^ SaveFileUsingDialog( System::String ^defdir, System::String ^filter, System::String ^extension ) 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::String ^retfile;
System::Windows::Forms::SaveFileDialog ^dlg = gcnew (System::Windows::Forms::SaveFileDialog); 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->Filter = filter;
dlg->FilterIndex = 1; dlg->FilterIndex = 1;
dlg->RestoreDirectory = true; dlg->RestoreDirectory = true;
if( defname )
{
dlg->FileName = defname;
}
if( dlg->ShowDialog() != System::Windows::Forms::DialogResult::OK ) if( dlg->ShowDialog() != System::Windows::Forms::DialogResult::OK )
{ {