mirror of
https://github.com/rvtr/TwlToolsRED.git
synced 2025-10-31 06:41:18 -04:00
マスタエディタ:SRL関連のクラスをファイル分割して整理。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@136 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
4fd5164de2
commit
d406d8bbef
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -370,6 +370,14 @@
|
||||
RelativePath=".\srl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\srl_const.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\srl_element.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,398 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
// ROMデータ(SRL)クラスと関連クラスの宣言
|
||||
// ROMデータ(SRL)クラスの宣言
|
||||
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include <twl/types.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <twl/os/common/ownerInfoEx.h>
|
||||
#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<System::Object^>^ getAll( System::Boolean isJapanese )
|
||||
{
|
||||
if( (this->begin == METWL_ERRLIST_NORANGE) && (this->end == METWL_ERRLIST_NORANGE) )
|
||||
{
|
||||
if( isJapanese )
|
||||
return (gcnew array<System::Object^>{this->hName, "-", "-", this->hMsg});
|
||||
else
|
||||
return (gcnew array<System::Object^>{this->hNameE, "-", "-", this->hMsgE});
|
||||
}
|
||||
|
||||
if( isJapanese )
|
||||
return (gcnew array<System::Object^>{this->hName, this->begin.ToString("X04")+"h", this->end.ToString("X04")+"h", this->hMsg});
|
||||
else
|
||||
return (gcnew array<System::Object^>{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<System::Boolean> ^hIsPermitShared2Array; // Shared2ファイルアクセスが許可されているか
|
||||
property cli::array<System::UInt32> ^hShared2SizeArray; // Shared2ファイルサイズ
|
||||
property System::Collections::Generic::List<VCReservedArea> ^hReservedAreaList; // 予約領域の範囲
|
||||
public:
|
||||
RCMrcExternalCheckItems()
|
||||
{
|
||||
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->hIsPermitShared2Array[i] = false;
|
||||
this->hShared2SizeArray[i] = 0;
|
||||
}
|
||||
this->hReservedAreaList = gcnew System::Collections::Generic::List<VCReservedArea>;
|
||||
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
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
// ROMデータ(SRL)クラス関連の定数宣言
|
||||
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include <twl/types.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <twl/os/common/ownerInfoEx.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
|
||||
|
||||
} // end of namespace MasterEditorTWL
|
||||
@ -0,0 +1,352 @@
|
||||
#pragma once
|
||||
|
||||
// ROMデータ(SRL)クラスの関連クラスの宣言と定義
|
||||
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include <twl/types.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <twl/os/common/ownerInfoEx.h>
|
||||
#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<System::Object^>^ getAll( System::Boolean isJapanese )
|
||||
{
|
||||
if( (this->begin == METWL_ERRLIST_NORANGE) && (this->end == METWL_ERRLIST_NORANGE) )
|
||||
{
|
||||
if( isJapanese )
|
||||
return (gcnew array<System::Object^>{this->hName, "-", "-", this->hMsg});
|
||||
else
|
||||
return (gcnew array<System::Object^>{this->hNameE, "-", "-", this->hMsgE});
|
||||
}
|
||||
|
||||
if( isJapanese )
|
||||
return (gcnew array<System::Object^>{this->hName, this->begin.ToString("X04")+"h", this->end.ToString("X04")+"h", this->hMsg});
|
||||
else
|
||||
return (gcnew array<System::Object^>{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<System::Boolean> ^hIsPermitShared2Array; // Shared2ファイルアクセスが許可されているか
|
||||
property cli::array<System::UInt32> ^hShared2SizeArray; // Shared2ファイルサイズ
|
||||
property System::Collections::Generic::List<VCReservedArea> ^hReservedAreaList; // 予約領域の範囲
|
||||
public:
|
||||
RCMrcExternalCheckItems()
|
||||
{
|
||||
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->hIsPermitShared2Array[i] = false;
|
||||
this->hShared2SizeArray[i] = 0;
|
||||
}
|
||||
this->hReservedAreaList = gcnew System::Collections::Generic::List<VCReservedArea>;
|
||||
this->hReservedAreaList->Clear();
|
||||
}
|
||||
}; //RCMrcExternalCheckItems
|
||||
|
||||
} // end of namespace MasterEditorTWL
|
||||
@ -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バージョンの大小判定をする
|
||||
//
|
||||
|
||||
@ -167,6 +167,11 @@ namespace MasterEditorTWL
|
||||
//
|
||||
u32 countBits( const u32 val );
|
||||
|
||||
//
|
||||
// SDKバージョンを解読する(例 10203 -> "PR2 plus3")
|
||||
//
|
||||
System::String^ analyzeSDKVersion( System::UInt32 code );
|
||||
|
||||
//
|
||||
// SDKバージョンの大小判定をする
|
||||
//
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -366,6 +366,14 @@
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl_const.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl_element.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -366,6 +366,14 @@
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl_const.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl_element.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -366,6 +366,14 @@
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl_const.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\MasterEditorTWL\MasterEditorTWL\srl_element.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user