diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb index 5cd38de..4d2e9e7 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb and b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.ncb differ diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo index 1738ef1..49456bd 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo and b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL.suo differ diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm index b017dc4..4b1c4c2 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm and b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/Debug/BuildLog.htm differ diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj index 464200c..c6a0c53 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj @@ -370,6 +370,14 @@ RelativePath=".\srl.h" > + + + + diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.cpp b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.cpp index 4678f56..b090097 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.cpp +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.cpp @@ -892,56 +892,11 @@ ECSrlResult RCSrl::searchSDKVersion( FILE *fp ) return ECSrlResult::ERROR_SDK; } - // 解読 - System::Byte major = (System::Byte)(0xff & (sdkcode >> 24)); - System::Byte minor = (System::Byte)(0xff & (sdkcode >> 16)); - System::UInt16 relstep = (System::UInt16)(0xffff & sdkcode); - System::String ^str = nullptr; - str += (major.ToString() + "." + minor.ToString() + " "); - //System::Diagnostics::Debug::WriteLine( "relstep = " + relstep.ToString() ); - - // RELSTEPの解釈 - // PR1=10100 PR2=10200 ... - // RC1=20100 RC2=20200 ... - // RELEASE=30000 - System::UInt16 patch = relstep; - while( patch >= 10000 ) - { - patch -= 10000; - } - System::UInt16 rev = patch; - System::String ^revstr = gcnew System::String( "" ); - while( rev >= 100 ) - { - rev -= 100; - } - if( rev > 0 ) - { - revstr = " plus" + rev.ToString(); - } - patch = patch / 100; - switch( relstep / 10000 ) - { - case 1: str += ("PR " + patch.ToString() + revstr); break; - case 2: str += ("RC " + patch.ToString() + revstr); break; - //case 3: str += ("RELEASE " + patch.ToString() + revstr); break; - case 3: - if( patch > 0 ) - { - str += ("RELEASE " + patch.ToString() + revstr); - } - else - { - str += ("RELEASE" + revstr); - } - break; - default: break; - } // ARM9 static 内にあるか判定 u32 statbegin = this->pRomHeader->s.main_rom_offset; u32 statend = this->pRomHeader->s.main_rom_offset + this->pRomHeader->s.main_size - 1; System::Boolean isstat = ((statbegin <= offset) && (offset <= statend))?true:false; - this->hSDKList->Add( gcnew RCSDKVersion(str, sdkcode, isstat) ); + this->hSDKList->Add( gcnew RCSDKVersion(sdkcode, isstat) ); //System::Diagnostics::Debug::WriteLine( "SDK " + str ); } } diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.h b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.h index c81c563..2a49218 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.h +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl.h @@ -1,398 +1,18 @@ #pragma once -// ROMデータ(SRL)クラスと関連クラスの宣言 +// ROMデータ(SRL)クラスの宣言 #include #include "common.h" #include #include #include +#include "srl_const.h" +#include "srl_element.h" #include "utility.h" namespace MasterEditorTWL { - // ------------------------------------------------------------------- - // Type : enum class - // Name : ECSrlResult - // - // Description : RCSrlクラスの操作でのエラーを宣言 - // ------------------------------------------------------------------- - enum class ECSrlResult - { - NOERROR = 0, - // エラー特定しなくても原因がわかるときの返り値 - // (エラーが生じる可能性のある箇所が1つ etc.) - ERROR, - // ファイル操作でのエラー - ERROR_FILE_OPEN, - ERROR_FILE_READ, - ERROR_FILE_WRITE, - // 署名でのエラー - ERROR_SIGN_ENCRYPT, // 署名できない - ERROR_SIGN_DECRYPT, // 署名解除できない - ERROR_SIGN_VERIFY, // 署名解除した後のダイジェストが合わない - // CRC算出でのエラー - ERROR_SIGN_CRC, - // SDKバージョン取得でのエラー - ERROR_SDK, - // プラットフォームがNTR専用 or 不正バイナリ - ERROR_PLATFORM, - }; - - // ------------------------------------------------------------------- - // Type : enum class - // Name : ECAppType - // - // Description : RCSrlクラスのアプリ種別を宣言 - // ------------------------------------------------------------------- - enum class ECAppType - { - USER = 0, - SYSTEM, - SECURE, - LAUNCHER, - ILLEGAL, // 不定 - }; //ECAppType - - // ------------------------------------------------------------------- - // Type : ref class - // Name : RCSDKVersion - // - // Description : RCSrlクラスに持たせるSDKバージョン情報クラス - // - // Role : 構造体としてデータをまとめておく - // ------------------------------------------------------------------- - ref class RCSDKVersion - { - private: - System::String ^hVersion; - System::UInt32 code; - System::Boolean isStatic; - private: - RCSDKVersion(){} // 封じる - public: - RCSDKVersion( System::String ^ver, System::UInt32 code, System::Boolean isStatic ) // 生成時にのみフィールドを設定可能 - { - if( ver == nullptr ) - this->hVersion = gcnew System::String(""); // NULL参照バグを避ける - else - this->hVersion = ver; - this->code = code; - this->isStatic = isStatic; - } - public: - property System::String ^Version // 生成後にはフィールドはRead Only - { - System::String^ get(){ return System::String::Copy(this->hVersion); } - } - public: - property System::Boolean IsStatic - { - System::Boolean get(){ return (this->isStatic); } - } - public: - property System::UInt32 Code - { - System::UInt32 get(){ return (this->code); } - } - }; //RCSDKVersion - - // ------------------------------------------------------------------- - // Type : ref class - // Name : RCLicense - // - // Description : RCSrlクラスに持たせるライセンス情報クラス - // - // Role : 構造体としてデータをまとめておく - // ------------------------------------------------------------------- - ref class RCLicense - { - private: - System::String ^hPublisher; - System::String ^hName; - private: - RCLicense(){} // 封じる - public: - RCLicense( System::String ^pub, System::String ^name ) // 生成時にのみフィールドを設定可能 - { - if( pub == nullptr ) - this->hPublisher = gcnew System::String(""); - else - this->hPublisher = pub; - - if( name == nullptr ) - this->hName = gcnew System::String(""); - else - this->hName = name; - } - public: - property System::String ^Name // 生成後にはフィールドはRead Only - { - System::String^ get(){ return System::String::Copy(this->hName); } - } - public: - property System::String ^Publisher - { - System::String^ get(){ return System::String::Copy(this->hPublisher); } - } - }; //RCLicense - - // ------------------------------------------------------------------- - // Type : ref class - // Name : RCMrcError - // - // Description : RCSrlクラスに持たせるMRCエラー情報クラス - // - // Role : 構造体としてデータをまとめておく - // ------------------------------------------------------------------- - public ref class RCMrcError - { - private: - System::String ^hName; // 項目名 - System::UInt32 begin; // 開始アドレス - System::UInt32 end; // 終了アドレス - System::String ^hMsg; // エラーメッセージ - System::String ^hNameE; // 英語版 - System::String ^hMsgE; - System::Boolean isEnableModify; // マスタエディタで修正可能かどうか - System::Boolean isAffectRom; // 変更するとSRL(ROMバイナリ)が変更されるか - private: - RCMrcError(){} // 封じる - public: - RCMrcError( - System::String ^name, System::UInt32 beg, System::UInt32 end, System::String ^msg, - System::String ^nameE, System::String ^msgE, System::Boolean isEnableModify, System::Boolean isAffectRom ) - { - if( name == nullptr ) - this->hName = gcnew System::String(""); - else - this->hName = name; - - if( nameE == nullptr ) - this->hNameE = gcnew System::String(""); - else - this->hNameE = nameE; - - this->begin = beg; - this->end = end; - - if( msg == nullptr ) - this->hMsg = gcnew System::String(""); - else - this->hMsg = msg; - - if( msgE == nullptr ) - this->hMsgE = gcnew System::String(""); - else - this->hMsgE = msgE; - - this->isEnableModify = isEnableModify; - this->isAffectRom = isAffectRom; - } - public: - property System::Boolean IsEnableModify - { - System::Boolean get(){ return this->isEnableModify; } // Read Only - } - property System::Boolean IsAffectRom - { - System::Boolean get(){ return this->isAffectRom; } - } - public: - // gridViewの表示形式にあわせる - cli::array^ getAll( System::Boolean isJapanese ) - { - if( (this->begin == METWL_ERRLIST_NORANGE) && (this->end == METWL_ERRLIST_NORANGE) ) - { - if( isJapanese ) - return (gcnew array{this->hName, "-", "-", this->hMsg}); - else - return (gcnew array{this->hNameE, "-", "-", this->hMsgE}); - } - - if( isJapanese ) - return (gcnew array{this->hName, this->begin.ToString("X04")+"h", this->end.ToString("X04")+"h", this->hMsg}); - else - return (gcnew array{this->hNameE, this->begin.ToString("X04")+"h", this->end.ToString("X04")+"h", this->hMsgE}); - } - }; //RCMrcError - - // ------------------------------------------------------------------- - // Type : value class - // Name : VCReservedArea - // - // Description : 予約領域の範囲クラス - // - // Role : 構造体としてデータをまとめておく - // ------------------------------------------------------------------- - 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; } - } - }; //VCReservedArea - - // ------------------------------------------------------------------- - // Type : ref class - // Name : RCMrcExternalCheckItems - // - // Description : MRCチェック項目の外部パラメータクラス - // - // Role : 構造体としてデータをまとめておく - // ------------------------------------------------------------------- - ref class RCMrcExternalCheckItems - { - public: - property System::Boolean IsAppendCheck; // 追加チェックをするかどうか(すべての項目が追加チェックとは限らない) - property System::UInt32 SDKVer; // SDKのバージョン - property System::Boolean IsPermitNormalJump; // ノーマルジャンプがアクセス許可されているか - property cli::array ^hIsPermitShared2Array; // Shared2ファイルアクセスが許可されているか - property cli::array ^hShared2SizeArray; // Shared2ファイルサイズ - property System::Collections::Generic::List ^hReservedAreaList; // 予約領域の範囲 - public: - RCMrcExternalCheckItems() - { - this->IsAppendCheck = false; - this->SDKVer = 0; - this->IsPermitNormalJump = false; - this->hIsPermitShared2Array = gcnew cli::array(METWL_NUMOF_SHARED2FILES); - this->hShared2SizeArray = gcnew cli::array(METWL_NUMOF_SHARED2FILES); - System::Int32 i; - for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ ) - { - this->hIsPermitShared2Array[i] = false; - this->hShared2SizeArray[i] = 0; - } - this->hReservedAreaList = gcnew System::Collections::Generic::List; - this->hReservedAreaList->Clear(); - } - }; //RCMrcExternalCheckItems - - // ------------------------------------------------------------------- - // Type : ref class - // Name : RCNandUsedSize - // - // Description : アプリのインポート時NAND消費サイズクラス - // - // Role : 構造体としてデータをまとめておく - // ------------------------------------------------------------------- - ref class RCNandUsedSize - { - // 値へのアクセス方法 - // - 生のデータサイズ : publicメンバ変数 - // - 切り上げたサイズ : property (ReadOnlyなメンバ変数のように見える) - public: - property System::UInt32 SrlSize; - property System::UInt32 PublicSaveSize; - property System::UInt32 PrivateSaveSize; - property System::Boolean IsMediaNand; // NANDアプリかどうか - property System::Boolean IsUseSubBanner; // サブバナーを使用するかどうか - public: - static const System::UInt32 TmdSize = 16 * 1024; - private: - static const System::UInt32 cSubBannerSize = 16 * 1024; - static const System::UInt32 NandClusterSize = 16 * 1024; - static const System::UInt32 ShopBlockSize = 128 * 1024; - public: - property System::UInt32 SrlSizeRoundUp // 切り上げた値はメンバ変数としては持たず計算した値を property で提供 - { - System::UInt32 get() - { - if( !this->IsMediaNand ) - { - return 0; - } - return (MasterEditorTWL::roundUp( this->SrlSize, NandClusterSize )); - } - } - property System::UInt32 PublicSaveSizeRoundUp - { - System::UInt32 get(){ return (MasterEditorTWL::roundUp( this->PublicSaveSize, NandClusterSize )); } - } - property System::UInt32 PrivateSaveSizeRoundUp - { - System::UInt32 get(){ return (MasterEditorTWL::roundUp( this->PrivateSaveSize, NandClusterSize )); } - } - property System::UInt32 TmdSizeRoundUp - { - System::UInt32 get() - { - if( !this->IsMediaNand ) - { - return 0; - } - return (MasterEditorTWL::roundUp( this->TmdSize, NandClusterSize )); - } - } - property System::UInt32 SubBannerSize // サブバナーのサイズは使用するかしないかで異なるので計算した値を property で提供 - { - System::UInt32 get() - { - if( !this->IsUseSubBanner ) - { - return 0; - } - return this->cSubBannerSize; - } - } - property System::UInt32 SubBannerSizeRoundUp - { - System::UInt32 get() - { - if( !this->IsUseSubBanner ) - { - return 0; - } - return (MasterEditorTWL::roundUp( this->SubBannerSize, NandClusterSize )); - } - } - property System::UInt32 NandUsedSize // 全体のNAND消費サイズは変数で持たず property で提供 - { - System::UInt32 get() - { - // NAND消費量の計算式 - // 以下のファイルをNANDクラスタ単位(=16KB)に切り上げて合計する - // - // SRLの実ファイルサイズ - // Publicセーブデータサイズ - // Privateセーブデータサイズ - // TMDサイズ(=16KB固定) - // サブバナーサイズ(使用時には16KB固定 不使用時には0KB) - if( !this->IsMediaNand ) - { - return 0; // カードアプリのとき0 - } - System::UInt32 size = this->SrlSizeRoundUp + this->PublicSaveSizeRoundUp + this->PrivateSaveSizeRoundUp - + this->TmdSizeRoundUp + this->SubBannerSizeRoundUp; - return size; - } - } - property System::UInt32 NandUsedSizeBlock // ショップでのブロック数 - { - System::UInt32 get() - { - System::UInt32 blocks = MasterEditorTWL::roundUp( this->NandUsedSize, this->ShopBlockSize) - / this->ShopBlockSize; - return blocks; - } - } - }; //RCNandUsedSize - // ------------------------------------------------------------------- // Type : ref class // Name : RCSrl diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_const.h b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_const.h new file mode 100644 index 0000000..280aed7 --- /dev/null +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_const.h @@ -0,0 +1,57 @@ +#pragma once + +// ROMデータ(SRL)クラス関連の定数宣言 + +#include +#include "common.h" +#include +#include +#include +#include "utility.h" + +namespace MasterEditorTWL +{ + // ------------------------------------------------------------------- + // Type : enum class + // Name : ECSrlResult + // + // Description : RCSrlクラスの操作でのエラーを宣言 + // ------------------------------------------------------------------- + enum class ECSrlResult + { + NOERROR = 0, + // エラー特定しなくても原因がわかるときの返り値 + // (エラーが生じる可能性のある箇所が1つ etc.) + ERROR, + // ファイル操作でのエラー + ERROR_FILE_OPEN, + ERROR_FILE_READ, + ERROR_FILE_WRITE, + // 署名でのエラー + ERROR_SIGN_ENCRYPT, // 署名できない + ERROR_SIGN_DECRYPT, // 署名解除できない + ERROR_SIGN_VERIFY, // 署名解除した後のダイジェストが合わない + // CRC算出でのエラー + ERROR_SIGN_CRC, + // SDKバージョン取得でのエラー + ERROR_SDK, + // プラットフォームがNTR専用 or 不正バイナリ + ERROR_PLATFORM, + }; + + // ------------------------------------------------------------------- + // Type : enum class + // Name : ECAppType + // + // Description : RCSrlクラスのアプリ種別を宣言 + // ------------------------------------------------------------------- + enum class ECAppType + { + USER = 0, + SYSTEM, + SECURE, + LAUNCHER, + ILLEGAL, // 不定 + }; //ECAppType + +} // end of namespace MasterEditorTWL \ No newline at end of file diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_element.h b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_element.h new file mode 100644 index 0000000..0689e2b --- /dev/null +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/srl_element.h @@ -0,0 +1,352 @@ +#pragma once + +// ROMデータ(SRL)クラスの関連クラスの宣言と定義 + +#include +#include "common.h" +#include +#include +#include +#include "srl_const.h" +#include "utility.h" + +namespace MasterEditorTWL +{ + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCSDKVersion + // + // Description : RCSrlクラスに持たせるSDKバージョン情報クラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + ref class RCSDKVersion + { + private: + System::String ^hVersion; + System::UInt32 code; + System::Boolean isStatic; + private: + RCSDKVersion(){} // 封じる + public: + RCSDKVersion( System::UInt32 code, System::Boolean isStatic ) // 生成時にのみフィールドを設定可能 + { + this->code = code; + this->isStatic = isStatic; + this->hVersion = MasterEditorTWL::analyzeSDKVersion( this->code ); + } + public: + property System::String ^Version // 生成後にはフィールドは Read Only + { + System::String^ get(){ return System::String::Copy(this->hVersion); } + } + public: + property System::Boolean IsStatic + { + System::Boolean get(){ return (this->isStatic); } + } + public: + property System::UInt32 Code + { + System::UInt32 get(){ return (this->code); } + } + }; //RCSDKVersion + + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCLicense + // + // Description : RCSrlクラスに持たせるライセンス情報クラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + ref class RCLicense + { + private: + System::String ^hPublisher; + System::String ^hName; + private: + RCLicense(){} // 封じる + public: + RCLicense( System::String ^pub, System::String ^name ) // 生成時にのみフィールドを設定可能 + { + if( pub == nullptr ) + this->hPublisher = gcnew System::String(""); + else + this->hPublisher = pub; + + if( name == nullptr ) + this->hName = gcnew System::String(""); + else + this->hName = name; + } + public: + property System::String ^Name // 生成後にはフィールドはRead Only + { + System::String^ get(){ return System::String::Copy(this->hName); } + } + public: + property System::String ^Publisher + { + System::String^ get(){ return System::String::Copy(this->hPublisher); } + } + }; //RCLicense + + // ------------------------------------------------------------------- + // Type : value class + // Name : VCReservedArea + // + // Description : 予約領域の範囲クラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + value class VCReservedArea + { + private: + System::UInt32 begin; + System::UInt32 end; + // value class ではデフォルトコンストラクタを private にして封じることはできない + 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; } + } + }; //VCReservedArea + + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCNandUsedSize + // + // Description : アプリのインポート時NAND消費サイズクラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + ref class RCNandUsedSize + { + // 値へのアクセス方法 + // - 生のデータサイズ : publicメンバ変数 + // - 切り上げたサイズ : property (ReadOnlyなメンバ変数のように見える) + public: + property System::UInt32 SrlSize; + property System::UInt32 PublicSaveSize; + property System::UInt32 PrivateSaveSize; + property System::Boolean IsMediaNand; // NANDアプリかどうか + property System::Boolean IsUseSubBanner; // サブバナーを使用するかどうか + public: + static const System::UInt32 TmdSize = 16 * 1024; + private: + static const System::UInt32 cSubBannerSize = 16 * 1024; + static const System::UInt32 NandClusterSize = 16 * 1024; + static const System::UInt32 ShopBlockSize = 128 * 1024; + public: + property System::UInt32 SrlSizeRoundUp // 切り上げた値はメンバ変数としては持たず計算した値を property で提供 + { + System::UInt32 get() + { + if( !this->IsMediaNand ) + { + return 0; + } + return (MasterEditorTWL::roundUp( this->SrlSize, NandClusterSize )); + } + } + property System::UInt32 PublicSaveSizeRoundUp + { + System::UInt32 get(){ return (MasterEditorTWL::roundUp( this->PublicSaveSize, NandClusterSize )); } + } + property System::UInt32 PrivateSaveSizeRoundUp + { + System::UInt32 get(){ return (MasterEditorTWL::roundUp( this->PrivateSaveSize, NandClusterSize )); } + } + property System::UInt32 TmdSizeRoundUp + { + System::UInt32 get() + { + if( !this->IsMediaNand ) + { + return 0; + } + return (MasterEditorTWL::roundUp( this->TmdSize, NandClusterSize )); + } + } + property System::UInt32 SubBannerSize // サブバナーのサイズは使用するかしないかで異なるので計算した値を property で提供 + { + System::UInt32 get() + { + if( !this->IsUseSubBanner ) + { + return 0; + } + return this->cSubBannerSize; + } + } + property System::UInt32 SubBannerSizeRoundUp + { + System::UInt32 get() + { + if( !this->IsUseSubBanner ) + { + return 0; + } + return (MasterEditorTWL::roundUp( this->SubBannerSize, NandClusterSize )); + } + } + property System::UInt32 NandUsedSize // 全体のNAND消費サイズは変数で持たず property で提供 + { + System::UInt32 get() + { + // NAND消費量の計算式 + // 以下のファイルをNANDクラスタ単位(=16KB)に切り上げて合計する + // + // SRLの実ファイルサイズ + // Publicセーブデータサイズ + // Privateセーブデータサイズ + // TMDサイズ(=16KB固定) + // サブバナーサイズ(使用時には16KB固定 不使用時には0KB) + if( !this->IsMediaNand ) + { + return 0; // カードアプリのとき0 + } + System::UInt32 size = this->SrlSizeRoundUp + this->PublicSaveSizeRoundUp + this->PrivateSaveSizeRoundUp + + this->TmdSizeRoundUp + this->SubBannerSizeRoundUp; + return size; + } + } + property System::UInt32 NandUsedSizeBlock // ショップでのブロック数 + { + System::UInt32 get() + { + System::UInt32 blocks = MasterEditorTWL::roundUp( this->NandUsedSize, this->ShopBlockSize) + / this->ShopBlockSize; + return blocks; + } + } + }; //RCNandUsedSize + + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCMrcError + // + // Description : RCSrlクラスに持たせるMRCエラー情報クラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + public ref class RCMrcError + { + private: + System::String ^hName; // 項目名 + System::UInt32 begin; // 開始アドレス + System::UInt32 end; // 終了アドレス + System::String ^hMsg; // エラーメッセージ + System::String ^hNameE; // 英語版 + System::String ^hMsgE; + System::Boolean isEnableModify; // マスタエディタで修正可能かどうか + System::Boolean isAffectRom; // 変更するとSRL(ROMバイナリ)が変更されるか + private: + RCMrcError(){} // 封じる + public: + RCMrcError( // この形式でしかインスタンスを作成できない + System::String ^name, System::UInt32 beg, System::UInt32 end, System::String ^msg, + System::String ^nameE, System::String ^msgE, System::Boolean isEnableModify, System::Boolean isAffectRom ) + { + if( name == nullptr ) + this->hName = gcnew System::String(""); + else + this->hName = name; + + if( nameE == nullptr ) + this->hNameE = gcnew System::String(""); + else + this->hNameE = nameE; + + this->begin = beg; + this->end = end; + + if( msg == nullptr ) + this->hMsg = gcnew System::String(""); + else + this->hMsg = msg; + + if( msgE == nullptr ) + this->hMsgE = gcnew System::String(""); + else + this->hMsgE = msgE; + + this->isEnableModify = isEnableModify; + this->isAffectRom = isAffectRom; + } + public: + property System::Boolean IsEnableModify + { + System::Boolean get(){ return this->isEnableModify; } // Read Only + } + property System::Boolean IsAffectRom + { + System::Boolean get(){ return this->isAffectRom; } + } + public: + // gridViewの表示形式にあわせる + cli::array^ getAll( System::Boolean isJapanese ) + { + if( (this->begin == METWL_ERRLIST_NORANGE) && (this->end == METWL_ERRLIST_NORANGE) ) + { + if( isJapanese ) + return (gcnew array{this->hName, "-", "-", this->hMsg}); + else + return (gcnew array{this->hNameE, "-", "-", this->hMsgE}); + } + + if( isJapanese ) + return (gcnew array{this->hName, this->begin.ToString("X04")+"h", this->end.ToString("X04")+"h", this->hMsg}); + else + return (gcnew array{this->hNameE, this->begin.ToString("X04")+"h", this->end.ToString("X04")+"h", this->hMsgE}); + } + }; //RCMrcError + + // ------------------------------------------------------------------- + // Type : ref class + // Name : RCMrcExternalCheckItems + // + // Description : MRCチェック項目の外部パラメータクラス + // + // Role : 構造体としてデータをまとめておく + // ------------------------------------------------------------------- + ref class RCMrcExternalCheckItems + { + public: + property System::Boolean IsAppendCheck; // 追加チェックをするかどうか(すべての項目が追加チェックとは限らない) + property System::UInt32 SDKVer; // SDKのバージョン + property System::Boolean IsPermitNormalJump; // ノーマルジャンプがアクセス許可されているか + property cli::array ^hIsPermitShared2Array; // Shared2ファイルアクセスが許可されているか + property cli::array ^hShared2SizeArray; // Shared2ファイルサイズ + property System::Collections::Generic::List ^hReservedAreaList; // 予約領域の範囲 + public: + RCMrcExternalCheckItems() + { + this->IsAppendCheck = false; + this->SDKVer = 0; + this->IsPermitNormalJump = false; + this->hIsPermitShared2Array = gcnew cli::array(METWL_NUMOF_SHARED2FILES); + this->hShared2SizeArray = gcnew cli::array(METWL_NUMOF_SHARED2FILES); + System::Int32 i; + for( i=0; i < METWL_NUMOF_SHARED2FILES; i++ ) + { + this->hIsPermitShared2Array[i] = false; + this->hShared2SizeArray[i] = 0; + } + this->hReservedAreaList = gcnew System::Collections::Generic::List; + this->hReservedAreaList->Clear(); + } + }; //RCMrcExternalCheckItems + +} // end of namespace MasterEditorTWL diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp index 2bf5418..ad0c037 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.cpp @@ -554,6 +554,63 @@ u32 MasterEditorTWL::countBits( const u32 val ) return n; } +// ---------------------------------------------------------------------- +// SDKバージョンを解読する(例 10203 -> "PR2 plus3") +// +// @arg [in] SRL中に埋まっているSDKのバージョン情報(4バイトバイナリ) +// +// @ret 解読したSDKバージョン +// +// ---------------------------------------------------------------------- +System::String^ MasterEditorTWL::analyzeSDKVersion( System::UInt32 code ) +{ + System::Byte major = (System::Byte)(0xff & (code >> 24)); + System::Byte minor = (System::Byte)(0xff & (code >> 16)); + System::UInt16 relstep = (System::UInt16)(0xffff & code); + System::String ^str = nullptr; + str += (major.ToString() + "." + minor.ToString() + " "); + //System::Diagnostics::Debug::WriteLine( "relstep = " + relstep.ToString() ); + + // RELSTEPの解釈 + // PR1=10100 PR2=10200 ... + // RC1=20100 RC2=20200 ... + // RELEASE=30000 + System::UInt16 middle = relstep; + while( middle >= 10000 ) + { + middle -= 10000; + } + System::UInt16 plus = middle; + System::String ^plusstr = gcnew System::String( "" ); + while( plus >= 100 ) + { + plus -= 100; + } + if( plus > 0 ) + { + plusstr = " plus" + plus.ToString(); + } + middle = middle / 100; + switch( relstep / 10000 ) + { + case 1: str += ("PR " + middle.ToString() + plusstr); break; + case 2: str += ("RC " + middle.ToString() + plusstr); break; + //case 3: str += ("RELEASE " + middle.ToString() + plusstr); break; + case 3: + if( middle > 0 ) + { + str += ("RELEASE " + middle.ToString() + plusstr); + } + else + { + str += ("RELEASE" + plusstr); + } + break; + default: break; + } + return System::String::Copy(str); +} + // ---------------------------------------------------------------------- // SDKバージョンの大小判定をする // diff --git a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h index c62f47d..645b970 100644 --- a/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h +++ b/build/tools/MasterEditor/MasterEditorTWL/MasterEditorTWL/utility.h @@ -167,6 +167,11 @@ namespace MasterEditorTWL // u32 countBits( const u32 val ); + // + // SDKバージョンを解読する(例 10203 -> "PR2 plus3") + // + System::String^ analyzeSDKVersion( System::UInt32 code ); + // // SDKバージョンの大小判定をする // diff --git a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.ncb index 8cc615f..7242d06 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.ncb and b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.ncb differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.suo b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.suo index 2abb3fb..fa9efa0 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.suo and b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL.suo differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj index b76c1c9..19983ed 100644 --- a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj +++ b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj @@ -366,6 +366,14 @@ RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl.h" > + + + + diff --git a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm index 2e74a31..6a39ed8 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm and b/build/tools/MasterEditor/MasterEditorTWL_Launcher/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.ncb index fea4a27..d80c120 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.ncb and b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.ncb differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.suo b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.suo index 2a459a2..1a08442 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.suo and b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL.suo differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj index 6a8d180..9601097 100644 --- a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj +++ b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj @@ -366,6 +366,14 @@ RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl.h" > + + + + diff --git a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm index 3645d4e..4eee308 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm and b/build/tools/MasterEditor/MasterEditorTWL_Secure/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.ncb b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.ncb index ec7184d..ba6345c 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.ncb and b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.ncb differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.suo b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.suo index d4eabf6..3af1534 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.suo and b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL.suo differ diff --git a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj index 23e632a..8d25547 100644 --- a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj +++ b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/MasterEditorTWL.vcproj @@ -366,6 +366,14 @@ RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl.h" > + + + + diff --git a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm index efbbbb7..f999316 100644 Binary files a/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm and b/build/tools/MasterEditor/MasterEditorTWL_System/MasterEditorTWL/MasterEditorTWL/Release/BuildLog.htm differ