mirror of
https://github.com/rvtr/TwlToolsRED.git
synced 2025-10-31 06:41:18 -04:00
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@590 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
9680d88721
commit
3d7f3cfeab
Binary file not shown.
Binary file not shown.
@ -57,8 +57,8 @@ object Form1: TForm1
|
|||||||
SimplePanel = True
|
SimplePanel = True
|
||||||
end
|
end
|
||||||
object StaticText3: TStaticText
|
object StaticText3: TStaticText
|
||||||
Left = 104
|
Left = 8
|
||||||
Top = 168
|
Top = 192
|
||||||
Width = 246
|
Width = 246
|
||||||
Height = 16
|
Height = 16
|
||||||
Caption = #65288#27880#24847#65289#25351#23450#12487#12451#12524#12463#12488#12522#12395'srl'#20197#22806#12399#32622#12363#12394#12356#12371#12392
|
Caption = #65288#27880#24847#65289#25351#23450#12487#12451#12524#12463#12488#12522#12395'srl'#20197#22806#12399#32622#12363#12394#12356#12371#12392
|
||||||
@ -84,4 +84,12 @@ object Form1: TForm1
|
|||||||
Panels = <>
|
Panels = <>
|
||||||
SimplePanel = True
|
SimplePanel = True
|
||||||
end
|
end
|
||||||
|
object CB_add_ovt: TCheckBox
|
||||||
|
Left = 256
|
||||||
|
Top = 160
|
||||||
|
Width = 97
|
||||||
|
Height = 17
|
||||||
|
Caption = 'Add OVT info'
|
||||||
|
TabOrder = 8
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -16,6 +16,7 @@ type
|
|||||||
StaticText3: TStaticText;
|
StaticText3: TStaticText;
|
||||||
RG_select: TRadioGroup;
|
RG_select: TRadioGroup;
|
||||||
StatusBar1: TStatusBar;
|
StatusBar1: TStatusBar;
|
||||||
|
CB_add_ovt: TCheckBox;
|
||||||
procedure Button1Click(Sender: TObject);
|
procedure Button1Click(Sender: TObject);
|
||||||
procedure DriveBoxChange(Sender: TObject);
|
procedure DriveBoxChange(Sender: TObject);
|
||||||
procedure DirListBoxChange(Sender: TObject);
|
procedure DirListBoxChange(Sender: TObject);
|
||||||
@ -23,6 +24,7 @@ type
|
|||||||
private
|
private
|
||||||
{ Private 宣言 }
|
{ Private 宣言 }
|
||||||
function CheckSrlHeader:integer;
|
function CheckSrlHeader:integer;
|
||||||
|
function fstring(s:string):string;
|
||||||
public
|
public
|
||||||
{ Public 宣言 }
|
{ Public 宣言 }
|
||||||
end;
|
end;
|
||||||
@ -32,6 +34,18 @@ type
|
|||||||
bottom:Longword; // end;
|
bottom:Longword; // end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TRom_Ovl = record
|
||||||
|
id:Longword; // Overlay ID
|
||||||
|
ram_address:Longword; // ram address
|
||||||
|
ram_size:Longword; // ram size
|
||||||
|
bss_size:Longword; // bss size
|
||||||
|
sinit_init:Longword; // static initializer start
|
||||||
|
sinit_init_end:Longword; // static initializer end
|
||||||
|
file_id:Longword; // file id in FAT
|
||||||
|
flag:Longword; // オーバーレイ情報フラ
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
TRomh = record //ROMヘッダ(nitro_romheader.hより)
|
TRomh = record //ROMヘッダ(nitro_romheader.hより)
|
||||||
title: array[1..12] of Char;
|
title: array[1..12] of Char;
|
||||||
game_code: array[1..4] of Char;
|
game_code: array[1..4] of Char;
|
||||||
@ -86,16 +100,38 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function TForm1.fstring(s:string):string;
|
||||||
|
var
|
||||||
|
s1,s2,s3:string;
|
||||||
|
n,nn:integer;
|
||||||
|
begin
|
||||||
|
//'='まで切り出す
|
||||||
|
n := pos('=',s);
|
||||||
|
s1 := copy(s,0,n-1);
|
||||||
|
while length(s1) < 16 do s1 := s1+' ';
|
||||||
|
//';'まで切り出す
|
||||||
|
nn := pos(';',s);
|
||||||
|
s2 := copy(s,n,nn-n);
|
||||||
|
while length(s2) < 16 do s2 := s2+' ';
|
||||||
|
//残り
|
||||||
|
s3 := copy(s,nn,length(s));
|
||||||
|
|
||||||
|
Result := s1+s2+s3;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TForm1.CheckSrlHeader: integer;
|
function TForm1.CheckSrlHeader: integer;
|
||||||
var
|
var
|
||||||
Rec: TSearchRec;
|
Rec: TSearchRec;
|
||||||
sf,s,ss: String;
|
sf,s,ss: String;
|
||||||
i,n,Count,err_files,ng_entry: integer;
|
i,j,n,Count,err_files,ng_entry: integer;
|
||||||
fsrl: file;
|
fsrl: file;
|
||||||
flog:TextFile;
|
flog:TextFile;
|
||||||
romh: TRomh;
|
romh: TRomh;
|
||||||
noc_size,noc_sectors,size,sectors,nums,max_sectors,total_sectors: integer;
|
noc_size,noc_sectors,size,sectors,nums,max_sectors,total_sectors: integer;
|
||||||
fat: TRom_Fat;
|
fat: TRom_Fat;
|
||||||
|
ovl: TRom_Ovl;
|
||||||
top,btm,all_sectors: Longword;
|
top,btm,all_sectors: Longword;
|
||||||
ng_flg:boolean;
|
ng_flg:boolean;
|
||||||
|
|
||||||
@ -163,7 +199,18 @@ begin
|
|||||||
nums := romh.main_ovt_size div 32;//Ovl count
|
nums := romh.main_ovt_size div 32;//Ovl count
|
||||||
noc_size :=0;//範囲外トータルsize
|
noc_size :=0;//範囲外トータルsize
|
||||||
noc_sectors := 0;// 同セクタ
|
noc_sectors := 0;// 同セクタ
|
||||||
|
j := 0;//通し番号
|
||||||
for i := 0 to nums-1 do begin
|
for i := 0 to nums-1 do begin
|
||||||
|
if CB_add_ovt.Checked then begin
|
||||||
|
//OVT
|
||||||
|
seek( fsrl,romh.main_ovt_offset+sizeof(TRom_Ovl)*i);
|
||||||
|
BlockRead( fsrl,ovl,sizeof(ovl),n);//top,bottom取得
|
||||||
|
Writeln(flog,'ovt_id = '+inttostr(ovl.id));
|
||||||
|
Writeln(flog,' address = '+inttostr(ovl.ram_address));
|
||||||
|
Writeln(flog,' file_id = '+inttostr(ovl.file_id));
|
||||||
|
Writeln(flog);//改行
|
||||||
|
end;
|
||||||
|
//FAT
|
||||||
top := 0;btm := 0;
|
top := 0;btm := 0;
|
||||||
seek( fsrl,romh.fat_offset+sizeof(TRom_Fat)*i);
|
seek( fsrl,romh.fat_offset+sizeof(TRom_Fat)*i);
|
||||||
BlockRead( fsrl,fat,sizeof(fat),n);//top,bottom取得
|
BlockRead( fsrl,fat,sizeof(fat),n);//top,bottom取得
|
||||||
@ -175,10 +222,10 @@ begin
|
|||||||
ss := '(A9 Overlay'+inttostr(i);
|
ss := '(A9 Overlay'+inttostr(i);
|
||||||
//max_sectors = (DHT_OVERLAY_MAX/512 - total_sectors) / (nums-i);
|
//max_sectors = (DHT_OVERLAY_MAX/512 - total_sectors) / (nums-i);
|
||||||
if (total_sectors < 1024)then max_sectors := (1024 - total_sectors) div (nums-i)
|
if (total_sectors < 1024)then max_sectors := (1024 - total_sectors) div (nums-i)
|
||||||
else max_sectors := 0;
|
else max_sectors := 0; //CARDブート時、マイナスはエラー(FAT Broken)になる
|
||||||
btm := fat.bottom and $fffffe00; //512単位
|
btm := fat.bottom and $fffffe00; //512単位
|
||||||
if (fat.bottom and $1ff)<>0 then inc(btm,512);//上方向に丸める
|
if (fat.bottom and $1ff)<>0 then inc(btm,512);//上方向に丸める
|
||||||
if max_sectors = 0 then begin//最大達したら丸ごと検証外
|
if max_sectors = 0 then begin//丸ごと検証外
|
||||||
top := fat.top;
|
top := fat.top;
|
||||||
sectors := (btm-top) shr 9;//div 512
|
sectors := (btm-top) shr 9;//div 512
|
||||||
if (top and $1ff)<>0 then inc(sectors);
|
if (top and $1ff)<>0 then inc(sectors);
|
||||||
@ -191,18 +238,21 @@ begin
|
|||||||
if size<>0 then begin
|
if size<>0 then begin
|
||||||
inc(top,512);////上方向に丸める
|
inc(top,512);////上方向に丸める
|
||||||
//先頭の未検証部分 .. 不要?
|
//先頭の未検証部分 .. 不要?
|
||||||
s := 'offset'+inttostr(i)+' = 0x'+ inttohex(fat.top,8)
|
s := 'offset'+inttostr(j)+' = 0x'+ inttohex(fat.top,8)
|
||||||
+' ; 0x'+ inttohex(fat.top,8)
|
+' ; 0x'+ inttohex(fat.top,8)
|
||||||
+'-0x' + inttohex(top-1,8)+ss;
|
+'-0x' + inttohex(top-1,8)+ss;
|
||||||
//ListBox_log.Items.Add(s);
|
//ListBox_log.Items.Add(s);
|
||||||
|
s := fstring(s);//整形
|
||||||
Writeln(flog,s);
|
Writeln(flog,s);
|
||||||
s := 'length'+ inttostr(i) + ' = 0x' + inttohex(size,4)
|
s := 'length'+ inttostr(j) + ' = 0x' + inttohex(size,4)
|
||||||
+ ' ; '+ inttostr(size)+' bytes';
|
+ ' ; '+ inttostr(size)+' bytes';
|
||||||
//ListBox_log.Items.Add(s);
|
//ListBox_log.Items.Add(s);
|
||||||
|
s := fstring(s);//整形
|
||||||
Writeln(flog,s);
|
Writeln(flog,s);
|
||||||
inc(noc_size,512);
|
inc(noc_size,512);
|
||||||
inc(noc_sectors);
|
inc(noc_sectors);
|
||||||
inc(all_sectors);
|
inc(all_sectors);
|
||||||
|
inc(j);
|
||||||
ng_flg:=true;
|
ng_flg:=true;
|
||||||
end;
|
end;
|
||||||
size := btm - top;
|
size := btm - top;
|
||||||
@ -220,17 +270,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
if sectors > 0 then begin//残りあり
|
if sectors > 0 then begin//残りあり
|
||||||
size := sectors shl 9;
|
size := sectors shl 9;
|
||||||
s := 'offset'+inttostr(i)+' = 0x'+ inttohex(top,8)
|
s := 'offset'+inttostr(j)+' = 0x'+ inttohex(top,8)
|
||||||
+' ; 0x'+ inttohex(top,8)
|
+' ; 0x'+ inttohex(top,8)
|
||||||
+'-0x' + inttohex(btm-1,8)+ss;
|
+'-0x' + inttohex(btm-1,8)+ss;
|
||||||
//ListBox_log.Items.Add(s);
|
//ListBox_log.Items.Add(s);
|
||||||
|
s :=fstring(s);//整形
|
||||||
Writeln(flog,s);
|
Writeln(flog,s);
|
||||||
s := 'length'+ inttostr(i) + ' = 0x' + inttohex(size,4)
|
s := 'length'+ inttostr(j) + ' = 0x' + inttohex(size,4)
|
||||||
+ ' ; '+ inttostr(size)+' bytes';
|
+ ' ; '+ inttostr(size)+' bytes';
|
||||||
//ListBox_log.Items.Add(s);
|
//ListBox_log.Items.Add(s);
|
||||||
|
s := fstring(s);//整形
|
||||||
Writeln(flog,s);
|
Writeln(flog,s);
|
||||||
inc(noc_size,size);
|
inc(noc_size,size);
|
||||||
inc(noc_sectors,sectors);
|
inc(noc_sectors,sectors);
|
||||||
|
inc(j);
|
||||||
end;
|
end;
|
||||||
if ng_flg then inc(ng_entry);
|
if ng_flg then inc(ng_entry);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -57,8 +57,8 @@ object Form1: TForm1
|
|||||||
SimplePanel = True
|
SimplePanel = True
|
||||||
end
|
end
|
||||||
object StaticText3: TStaticText
|
object StaticText3: TStaticText
|
||||||
Left = 104
|
Left = 8
|
||||||
Top = 168
|
Top = 192
|
||||||
Width = 246
|
Width = 246
|
||||||
Height = 16
|
Height = 16
|
||||||
Caption = #65288#27880#24847#65289#25351#23450#12487#12451#12524#12463#12488#12522#12395'srl'#20197#22806#12399#32622#12363#12394#12356#12371#12392
|
Caption = #65288#27880#24847#65289#25351#23450#12487#12451#12524#12463#12488#12522#12395'srl'#20197#22806#12399#32622#12363#12394#12356#12371#12392
|
||||||
@ -84,4 +84,12 @@ object Form1: TForm1
|
|||||||
Panels = <>
|
Panels = <>
|
||||||
SimplePanel = True
|
SimplePanel = True
|
||||||
end
|
end
|
||||||
|
object CB_add_ovt: TCheckBox
|
||||||
|
Left = 256
|
||||||
|
Top = 160
|
||||||
|
Width = 97
|
||||||
|
Height = 17
|
||||||
|
Caption = 'Add OVT info'
|
||||||
|
TabOrder = 8
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -16,6 +16,7 @@ type
|
|||||||
StaticText3: TStaticText;
|
StaticText3: TStaticText;
|
||||||
RG_select: TRadioGroup;
|
RG_select: TRadioGroup;
|
||||||
StatusBar1: TStatusBar;
|
StatusBar1: TStatusBar;
|
||||||
|
CB_add_ovt: TCheckBox;
|
||||||
procedure Button1Click(Sender: TObject);
|
procedure Button1Click(Sender: TObject);
|
||||||
procedure DriveBoxChange(Sender: TObject);
|
procedure DriveBoxChange(Sender: TObject);
|
||||||
procedure DirListBoxChange(Sender: TObject);
|
procedure DirListBoxChange(Sender: TObject);
|
||||||
@ -32,6 +33,18 @@ type
|
|||||||
bottom:Longword; // end;
|
bottom:Longword; // end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TRom_Ovl = record
|
||||||
|
id:Longword; // Overlay ID
|
||||||
|
ram_address:Longword; // ram address
|
||||||
|
ram_size:Longword; // ram size
|
||||||
|
bss_size:Longword; // bss size
|
||||||
|
sinit_init:Longword; // static initializer start
|
||||||
|
sinit_init_end:Longword; // static initializer end
|
||||||
|
file_id:Longword; // file id in FAT
|
||||||
|
flag:Longword; // オーバーレイ情報フラ
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
TRomh = record //ROMヘッダ(nitro_romheader.hより)
|
TRomh = record //ROMヘッダ(nitro_romheader.hより)
|
||||||
title: array[1..12] of Char;
|
title: array[1..12] of Char;
|
||||||
game_code: array[1..4] of Char;
|
game_code: array[1..4] of Char;
|
||||||
@ -96,6 +109,7 @@ var
|
|||||||
romh: TRomh;
|
romh: TRomh;
|
||||||
noc_size,noc_sectors,size,sectors,nums,max_sectors,total_sectors: integer;
|
noc_size,noc_sectors,size,sectors,nums,max_sectors,total_sectors: integer;
|
||||||
fat: TRom_Fat;
|
fat: TRom_Fat;
|
||||||
|
ovl: TRom_Ovl;
|
||||||
top,btm,all_sectors: Longword;
|
top,btm,all_sectors: Longword;
|
||||||
ng_flg:boolean;
|
ng_flg:boolean;
|
||||||
|
|
||||||
@ -103,7 +117,8 @@ begin
|
|||||||
{$I-}
|
{$I-}
|
||||||
//ログファイル作成
|
//ログファイル作成
|
||||||
ListBox_log.Items.Add('Create Log file');
|
ListBox_log.Items.Add('Create Log file');
|
||||||
s := ExtractFilePath(Application.Exename)+'log.txt';
|
//s := ExtractFilePath(Application.Exename)+'log.txt';
|
||||||
|
s := LogDir+'log.txt';
|
||||||
AssignFile (flog,s);
|
AssignFile (flog,s);
|
||||||
Rewrite(flog);
|
Rewrite(flog);
|
||||||
if IOResult <> 0 then begin
|
if IOResult <> 0 then begin
|
||||||
@ -163,6 +178,16 @@ begin
|
|||||||
noc_size :=0;//範囲外トータルsize
|
noc_size :=0;//範囲外トータルsize
|
||||||
noc_sectors := 0;// 同セクタ
|
noc_sectors := 0;// 同セクタ
|
||||||
for i := 0 to nums-1 do begin
|
for i := 0 to nums-1 do begin
|
||||||
|
if CB_add_ovt.Checked then begin
|
||||||
|
//OVT
|
||||||
|
seek( fsrl,romh.main_ovt_offset+sizeof(TRom_Ovl)*i);
|
||||||
|
BlockRead( fsrl,ovl,sizeof(ovl),n);//top,bottom取得
|
||||||
|
Writeln(flog,'ovt_id = '+inttostr(ovl.id));
|
||||||
|
Writeln(flog,' address = '+inttostr(ovl.ram_address));
|
||||||
|
Writeln(flog,' file_id = '+inttostr(ovl.file_id));
|
||||||
|
Writeln(flog);//改行
|
||||||
|
end;
|
||||||
|
//FAT
|
||||||
top := 0;btm := 0;
|
top := 0;btm := 0;
|
||||||
seek( fsrl,romh.fat_offset+sizeof(TRom_Fat)*i);
|
seek( fsrl,romh.fat_offset+sizeof(TRom_Fat)*i);
|
||||||
BlockRead( fsrl,fat,sizeof(fat),n);//top,bottom取得
|
BlockRead( fsrl,fat,sizeof(fat),n);//top,bottom取得
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user