マスタエディタ:

・Shared2ファイルとノーマルジャンプのアクセス許可を設定ファイルで設定させる仕様に変更。
・Shared2ファイルのアクセスチェックとサイズチェックをファイルごとに変更。
・Shared2ファイルサイズの指定を追加設定ファイルから設定ファイルに変更。
・resource以下のファイルの参照をカレント相対からバイナリを格納するフォルダ相対に変更。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@102 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-01-06 11:40:02 +00:00
parent 9fe7377bad
commit ffb5d834a5
15 changed files with 1336 additions and 1069 deletions

View File

@ -31,7 +31,7 @@ using namespace System::Security::Permissions;
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
// 既定値にすることができます:
[assembly:AssemblyVersionAttribute("1.2.*")];
[assembly:AssemblyVersionAttribute("1.3.*")];
[assembly:ComVisible(false)];

View File

@ -723,12 +723,12 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
this->labAssemblyVersion->Text = "ver." + this->getVersion();
// TAD読み込みの際に作成される一時ファイルと同名ファイルがあった場合には削除してよいか確認
System::Diagnostics::Debug::WriteLine( this->getSplitTadTmpFilename() );
if( System::IO::File::Exists( this->getSplitTadTmpFilename() ) )
System::Diagnostics::Debug::WriteLine( this->getSplitTadTmpFile() );
if( System::IO::File::Exists( this->getSplitTadTmpFile() ) )
{
this->sucMsg( "本プログラムで作成する一時ファイルと同名のファイルが存在します。このファイルを削除します。",
"There is the file which has same name as temporary file made by this program. That file is deleted." );
System::IO::File::Delete( this->getSplitTadTmpFilename() );
System::IO::File::Delete( this->getSplitTadTmpFile() );
}
// デフォルト値
@ -787,7 +787,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
~Form1()
{
// TAD読み出しの際に作成される一時SRLファイルを削除(書き出しをせずに終了したときに起こりうる)
System::String ^srlfile = this->getSplitTadTmpFilename();
System::String ^srlfile = this->getSplitTadTmpFile();
if( System::IO::File::Exists( srlfile ) )
{
System::IO::File::Delete( srlfile ); // すでに存在する場合は削除
@ -2857,18 +2857,6 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
// tadの読み込み
System::Boolean loadTad( System::String ^tadfile );
// tadの読み込みで生成する一時SRLファイル名を返す
System::String ^getSplitTadTmpFilename(void)
{
System::String ^dir = System::IO::Path::GetDirectoryName( System::Reflection::Assembly::GetEntryAssembly()->Location );
if( !dir->EndsWith("\\") )
{
dir = dir + "\\";
}
System::String ^tmpfile = dir + METWL_TAD_TMP_FILENAME;
return tmpfile;
}
// 提出ファイル名をゲームコードなどから決定
System::String^ getSubmitFilePrefix(void)
{
@ -2929,7 +2917,21 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
void changeVisibleForms( System::Boolean visible )
{
this->gboxShared2Size->Visible = visible;
this->cboxIsShared2->Visible = visible;
this->tboxShared2Size0->Visible = visible;
this->labShared2Size0->Visible = visible;
this->tboxShared2Size1->Visible = visible;
this->labShared2Size1->Visible = visible;
this->tboxShared2Size2->Visible = visible;
this->labShared2Size2->Visible = visible;
this->tboxShared2Size3->Visible = visible;
this->labShared2Size3->Visible = visible;
this->tboxShared2Size4->Visible = visible;
this->labShared2Size4->Visible = visible;
this->tboxShared2Size5->Visible = visible;
this->labShared2Size5->Visible = visible;
this->cboxIsNormalJump->Visible = visible;
this->tboxIsGameCardOn->Visible = visible;
this->labIsGameCardOn->Visible = visible;
this->labIsGameCardOn2->Visible = visible;
@ -2960,7 +2962,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
{
System::Reflection::Assembly ^ass = System::Reflection::Assembly::GetEntryAssembly();
System::Version ^ver = ass->GetName()->Version;
return ( ver->Major.ToString() + "." + ver->Minor.ToString() + "a" );
return ( ver->Major.ToString() + "." + ver->Minor.ToString() );
}
// SRLに登録されないROM仕様のフォーム入力を
@ -2998,6 +3000,66 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
}
}
private:
// ----------------------------------------------
// 固定ファイル名の取得
// ----------------------------------------------
// バイナリがあるディレクトリ
System::String^ getBinDir(void)
{
System::String ^dir = System::IO::Path::GetDirectoryName( System::Reflection::Assembly::GetEntryAssembly()->Location );
if( !dir->EndsWith("\\") )
{
dir = dir + "\\";
}
return dir;
}
// リソースファイルがあるディレクトリ
System::String^ getResDir(void)
{
System::String ^dir = System::IO::Directory::GetParent( this->getBinDir() )->Parent->FullName;
if( !dir->EndsWith("\\") )
{
dir = dir + "\\";
}
dir = dir + "resource\\";
return dir;
}
// 設定ファイル
System::String^ getIniFile(void)
{
return (this->getResDir() + "ini.xml");
}
System::String^ getAppendIniFile(void)
{
return (this->getResDir() + "append_ini.xml");
}
// 提出確認書テンプレート
System::String^ getSheetTemplateFile(void)
{
return (this->getResDir() + "sheet_templete.xml");
}
// ミドルウェアリスト作成用のXSL
System::String^ getMiddlewareListStyleFile(void)
{
return (this->getResDir() + "middleware.xsl");
}
System::String^ getMiddlewareListStyleFileEmbedded(void)
{
return (this->getResDir() + "middleware_e.xsl");
}
// ミドルウェアリスト作成時の一時ファイル
System::String^ getMiddlewareListTmpFile(void)
{
return (this->getBinDir() + "middleware-tmp.xml");
}
// tadの読み込みで生成する一時SRLファイル
System::String^ getSplitTadTmpFile(void)
{
return (this->getBinDir() + "tmp.srl");
}
private:
// ----------------------------------------------
// フォームとSRL内情報を矛盾なく一致させる
@ -3442,7 +3504,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
// 書類作成
srlfile = System::IO::Path::GetFileName( srlfile );
//result = this->hDeliv->write( delivfile, this->hSrl, hcrc, srlfile, !this->isJapanese() );
result = this->hDeliv->writeSpreadsheet( delivfile, this->hSrl, crc, srlfile, !this->isJapanese() );
result = this->hDeliv->writeSpreadsheet( delivfile, this->getSheetTemplateFile(), this->hSrl, crc, srlfile, !this->isJapanese() );
if( result != ECDeliverableResult::NOERROR )
{
switch( result )

View File

@ -44,7 +44,7 @@ System::Boolean Form1::loadRom( System::String ^infile )
if( result )
{
this->IsLoadTad = false;
System::String ^tmpsrl = this->getSplitTadTmpFilename();
System::String ^tmpsrl = this->getSplitTadTmpFile();
if( System::IO::File::Exists( tmpsrl ) )
{
System::IO::File::Delete( tmpsrl ); // SRLの読み込みが成功したら以前のTAD読み込みで使用した一時ファイルは不要
@ -63,7 +63,7 @@ System::Boolean Form1::saveRom( System::String ^outfile )
if( this->IsLoadTad )
{
// 一時ファイルにSRLを書き出しているのでその一時ファイルから出力ファイルを作成
System::String ^tmpsrl = this->getSplitTadTmpFilename();
System::String ^tmpsrl = this->getSplitTadTmpFile();
result = this->saveSrl( tmpsrl, outfile );
if( result )
{
@ -84,7 +84,7 @@ System::Boolean Form1::saveRom( System::String ^outfile )
System::Boolean Form1::loadTad( System::String ^tadfile )
{
// tadファイルを変換したSRLを一時ファイルに保存
System::String ^srlfile = this->getSplitTadTmpFilename();
System::String ^srlfile = this->getSplitTadTmpFile();
if( splitTad( tadfile, srlfile ) != 0 ) // 上書きで保存
{
this->errMsg( "TADファイルの読み込みに失敗しました。", "Reading TAD file failed." );

View File

@ -34,7 +34,7 @@ void Form1::loadInit(void)
// xmlファイルの読み込み
try
{
doc->Load( "../resource/ini.xml" );
doc->Load( this->getIniFile() );
}
catch( System::IO::FileNotFoundException ^s )
{
@ -59,6 +59,104 @@ void Form1::loadInit(void)
{
this->readOnly();
}
// <access>タグ
{
// Shared2ファイルのアクセス許可(ファイルごとに指定)
System::String ^shared2 = MasterEditorTWL::getXPathText( root, "/init/access/shared2" );
if( shared2 )
{
cli::array<System::String^> ^list = shared2->Split( ',' );
if( list )
{
for each( System::String ^item in list )
{
//System::Diagnostics::Debug::WriteLine( "access permit shared2 file: " + item );
System::Int32 number = System::Int32::Parse( item );
this->hSrl->hMrcExternalCheckItems->hIsPermitShared2Array[ number ] = true; // 設定ファイルで指定されている番号のみ許可
}
}
}
// ノーマルジャンプのアクセス許可
System::String ^isNJ = MasterEditorTWL::getXPathText( root, "/init/access/normalJump" );
if( isNJ && isNJ->Equals( "Permit" ) )
{
this->hSrl->hMrcExternalCheckItems->IsPermitNormalJump = true;
}
}
// <access>タグに付随して非表示項目を表示するかどうかを決める
{
// Shared2ファイル
System::Boolean bVisible;
for each( System::Boolean permit in this->hSrl->hMrcExternalCheckItems->hIsPermitShared2Array )
{
if( permit && !this->gboxShared2Size->Visible )
{
bVisible = true; // どれかひとつでもtrueならグループボックス全体を表示する
}
}
this->gboxShared2Size->Visible = bVisible;
this->cboxIsShared2->Visible = bVisible;
if( bVisible )
{
int i;
for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ )
{
// グループボックス全体が表示されていたら全ファイルの項目が表示されるので
// アクセス許可されていないファイルのみ非表示にする
if( this->hSrl->hMrcExternalCheckItems->hIsPermitShared2Array[i] )
{
switch(i)
{
case 0: this->tboxShared2Size0->Visible = true; this->labShared2Size0->Visible = true; break;
case 1: this->tboxShared2Size1->Visible = true; this->labShared2Size1->Visible = true; break;
case 2: this->tboxShared2Size2->Visible = true; this->labShared2Size2->Visible = true; break;
case 3: this->tboxShared2Size3->Visible = true; this->labShared2Size3->Visible = true; break;
case 4: this->tboxShared2Size4->Visible = true; this->labShared2Size4->Visible = true; break;
case 5: this->tboxShared2Size5->Visible = true; this->labShared2Size5->Visible = true; break;
default: break;
}
}
}
}
// ノーマルジャンプ
this->cboxIsNormalJump->Visible = this->hSrl->hMrcExternalCheckItems->IsPermitNormalJump;
}
// <shared2>タグ : Shared2ファイルサイズの真値(アクセス許可されているファイルのみ記載)
System::Int32 i;
for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ )
{
System::String ^str = MasterEditorTWL::getXPathText( root, "/init/shared2/size" + i.ToString() );
if( str )
{
this->hSrl->hMrcExternalCheckItems->hShared2SizeArray[i] = System::UInt32::Parse( str );
}
else // アクセス許可されていないファイルは非公開なのでサイズが設定ファイルに記載されない
{
this->hSrl->hMrcExternalCheckItems->hShared2SizeArray[i] = 0;
}
}
// <reserved-area>タグ : 予約領域の範囲を記載
System::Xml::XmlNodeList ^list = root->SelectNodes( "/init/reserved-list/reserved" );
System::Collections::IEnumerator^ iter = list->GetEnumerator();
while( iter->MoveNext() )
{
System::Xml::XmlNode ^area = safe_cast<System::Xml::XmlNode^>(iter->Current);
System::Xml::XmlNode ^begin = area->SelectSingleNode( "begin" ); // 相対パス
System::Xml::XmlNode ^end = area->SelectSingleNode( "end" );
if( begin && begin->FirstChild && begin->FirstChild->Value &&
end && end->FirstChild && end->FirstChild->Value )
{
System::UInt32 ibeg = System::UInt32::Parse( begin->FirstChild->Value, System::Globalization::NumberStyles::AllowHexSpecifier );
System::UInt32 iend = System::UInt32::Parse( end->FirstChild->Value, System::Globalization::NumberStyles::AllowHexSpecifier );
MasterEditorTWL::VCReservedArea iarea(ibeg, iend);
this->hSrl->hMrcExternalCheckItems->hReservedAreaList->Add( iarea );
}
}
} // loadInit()
@ -68,7 +166,7 @@ void Form1::loadInit(void)
void Form1::loadAppendInit(void)
{
System::String ^initfile = "../resource/append_ini.xml";
System::String ^initfile = this->getAppendIniFile();
// 通常は存在しない
if( !System::IO::File::Exists( initfile ) )
@ -105,7 +203,7 @@ void Form1::loadAppendInit(void)
if( bCheck ) // チェックするときのみ追加チェック項目を設定
{
// チェックするかどうか
this->hSrl->hMrcSpecialList->IsCheck = true;
this->hSrl->hMrcExternalCheckItems->IsAppendCheck = true;
// SDK
try
@ -114,37 +212,16 @@ void Form1::loadAppendInit(void)
u32 minor = System::UInt32::Parse( MasterEditorTWL::getXPathText( root, "/init/sdk/minor" ) );
u32 relstep = System::UInt32::Parse( MasterEditorTWL::getXPathText( root, "/init/sdk/relstep" ) );
u32 sdkver = (major << 24) | (minor << 16) | (relstep & 0xFFFF);
this->hSrl->hMrcSpecialList->SDKVer = sdkver;
this->hSrl->hMrcExternalCheckItems->SDKVer = sdkver;
}
catch ( System::Exception ^ex )
{
(void)ex;
this->errMsg( "設定ファイル中のSDKバージョンが読み込めませんでした。バージョンは0とみなされます。",
"SDK ver. can't be read from setting file. Therefore it is set by 0." );
this->hSrl->hMrcSpecialList->SDKVer = 0;
this->hSrl->hMrcExternalCheckItems->SDKVer = 0;
}
// Shared2File
try
{
System::Int32 i;
for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ )
{
u32 size = System::UInt32::Parse( MasterEditorTWL::getXPathText( root, "/init/shared2/size" + i.ToString() ) );
this->hSrl->hMrcSpecialList->hShared2SizeArray[i] = size;
}
}
catch ( System::Exception ^ex )
{
(void)ex;
this->errMsg( "設定ファイル中のShared2ファイルサイズが読み込めませんでした。サイズはすべて0とみなされます。",
"One of shared2 file sizes can't be read from setting file. Therefore they are set by 0." );
System::Int32 i;
for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ )
{
this->hSrl->hMrcSpecialList->hShared2SizeArray[i] = 0;
}
}
} //if( bCheck )
} // loadAppendInit()

View File

@ -106,7 +106,7 @@ System::Boolean Form1::saveMiddlewareListXmlEmbeddedXsl( System::String ^filenam
System::Xml::XmlElement ^root = doc->DocumentElement;
try
{
xsl->Load("../resource/middleware_e.xsl");
xsl->Load( this->getMiddlewareListStyleFileEmbedded() );
root->AppendChild( doc->ImportNode(xsl->DocumentElement, true) );
}
catch ( System::Exception ^ex )
@ -133,7 +133,7 @@ System::Boolean Form1::saveMiddlewareListXmlEmbeddedXsl( System::String ^filenam
System::Boolean Form1::saveMiddlewareListHtml( System::String ^filename )
{
System::Xml::Xsl::XslCompiledTransform ^xslt = gcnew System::Xml::Xsl::XslCompiledTransform;
System::String ^tmpxml = gcnew System::String( "middleware-tmp.xml" );
System::String ^tmpxml = gcnew System::String( this->getMiddlewareListTmpFile() );
if( !saveMiddlewareListXml(tmpxml) )
{
@ -142,7 +142,7 @@ System::Boolean Form1::saveMiddlewareListHtml( System::String ^filename )
try
{
xslt->Load("../resource/middleware.xsl");
xslt->Load( this->getMiddlewareListStyleFile() );
xslt->Transform( tmpxml, filename );
}
catch (System::Exception ^s)

View File

@ -267,6 +267,10 @@
RelativePath=".\srl.cpp"
>
</File>
<File
RelativePath=".\srl_mrc.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>

View File

@ -25,13 +25,14 @@ using namespace MasterEditorTWL;
// @arg [in] 英語フラグ
//
ECDeliverableResult RCDeliverable::writeSpreadsheet(
System::String ^hFilename, MasterEditorTWL::RCSrl ^hSrl, System::UInt16 CRC, System::String ^hSrlFilename, System::Boolean english )
System::String ^hFilename, System::String ^hSheetTemplateFilename,
MasterEditorTWL::RCSrl ^hSrl, System::UInt16 CRC, System::String ^hSrlFilename, System::Boolean english )
{
// テンプレートを読み込む
System::Xml::XmlDocument ^doc = gcnew System::Xml::XmlDocument();
try
{
doc->Load( "../resource/sheet_templete.xml" );
doc->Load( hSheetTemplateFilename );
}
catch ( System::Exception ^ex )
{

View File

@ -108,16 +108,18 @@ namespace MasterEditorTWL
public:
//
// <EFBFBD>—Þ<EFBFBD>o—Í
// 提出確認書出力
//
// @arg [out] 出力ファイル名
// @arg [in] 提出確認書のテンプレート
// @arg [in] ROMバイナリ(SRL)固有情報
// @arg [in] ファイル全体のCRC
// @arg [in] SRLのファイル名(書類に記述するために使用)
// @arg [in] 英語フラグ
//
ECDeliverableResult writeSpreadsheet(
System::String ^hFilename, RCSrl ^hSrl, System::UInt16 CRC, System::String ^hSrlFilename, System::Boolean english );
System::String ^hFilename, System::String ^hSheetTemplateFilename,
RCSrl ^hSrl, System::UInt16 CRC, System::String ^hSrlFilename, System::Boolean english );
}; // end of ref class RCDeliverable

View File

@ -217,32 +217,68 @@ namespace MasterEditorTWL
};
// -------------------------------------------------------------------
// Type : ref class
// Name : RCMrcSpecialList
// Type : value class
// Name : VCReservedArea
//
// Description : MRCの追加エラー項目クラス
// Description : 予約領域の範囲クラス
//
// Role : 構造体としてデータをまとめておく
// -------------------------------------------------------------------
ref class RCMrcSpecialList
value class VCReservedArea
{
private:
System::UInt32 begin;
System::UInt32 end;
public:
VCReservedArea( System::UInt32 begin, System::UInt32 end )
{
this->begin = begin;
this->end = end;
}
public:
property System::UInt32 Begin // read only
{
System::UInt32 get(){ return this->begin; }
}
property System::UInt32 End
{
System::UInt32 get(){ return this->end; }
}
};
// -------------------------------------------------------------------
// Type : ref class
// Name : RCMrcExternalCheckItems
//
// Description : MRCチェック項目の外部パラメータクラス
//
// Role : 構造体としてデータをまとめておく
// -------------------------------------------------------------------
ref class RCMrcExternalCheckItems
{
public:
property System::Boolean IsCheck;
property System::UInt32 SDKVer;
property System::Byte EULAVer;
property cli::array<System::UInt32> ^hShared2SizeArray;
property System::Boolean IsAppendCheck; // 追加チェックをするかどうか(すべての項目が追加チェックとは限らない)
property System::UInt32 SDKVer; // SDKのバージョン
property System::Boolean IsPermitNormalJump; // ノーマルジャンプがアクセス許可されているか
property cli::array<System::Boolean> ^hIsPermitShared2Array; // Shared2ファイルアクセスが許可されているか
property cli::array<System::UInt32> ^hShared2SizeArray; // Shared2ファイルサイズ
property System::Collections::Generic::List<VCReservedArea> ^hReservedAreaList; // 予約領域の範囲
public:
RCMrcSpecialList()
RCMrcExternalCheckItems()
{
this->IsCheck = false;
this->SDKVer = 0;
this->EULAVer = 0;
this->hShared2SizeArray = gcnew cli::array<System::UInt32>(METWL_NUMOF_SHARED2FILES); // ファイルサイズの数に合わせる
this->IsAppendCheck = false;
this->SDKVer = 0;
this->IsPermitNormalJump = false;
this->hIsPermitShared2Array = gcnew cli::array<System::Boolean>(METWL_NUMOF_SHARED2FILES);
this->hShared2SizeArray = gcnew cli::array<System::UInt32>(METWL_NUMOF_SHARED2FILES);
System::Int32 i;
for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ )
{
this->hShared2SizeArray[i] = 0;
this->hIsPermitShared2Array[i] = false;
this->hShared2SizeArray[i] = 0;
}
this->hReservedAreaList = gcnew System::Collections::Generic::List<VCReservedArea>;
this->hReservedAreaList->Clear();
}
};
@ -340,7 +376,7 @@ namespace MasterEditorTWL
property System::Collections::Generic::List<RCMrcError^> ^hParentalErrorList; // ペアレンタルコントロールのチェックはsetと同時に行なう
// MRC追加項目
property RCMrcSpecialList ^hMrcSpecialList;
property RCMrcExternalCheckItems ^hMrcExternalCheckItems;
// constructor / destructor / finalizer
public:
@ -389,9 +425,13 @@ namespace MasterEditorTWL
ECSrlResult mrc( FILE *fp );
ECSrlResult mrcNTR( FILE *fp );
ECSrlResult mrcTWL( FILE *fp );
void mrcAppType( FILE *fp );
void mrcAccessControl( FILE *fp );
void mrcPadding( FILE *fp );
void mrcBanner( FILE *fp );
void mrcReservedArea( FILE *fp );
void mrcShared2( FILE *fp );
void mrcSDKVersion( FILE *fp );
}; // end of ref class RCSrl

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<init>
<rw>w</rw>
<access>
<!-- <shared2>0,1</shared2> -->
<!-- <normalJump>Permit</normalJump> -->
</access>
<shared2>
<size0>2097152</size0>
</shared2>
<reserved-list>
<reserved><begin>78</begin><end>7f</end></reserved>
<reserved><begin>160</begin><end>17f</end></reserved>