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@587 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
f37398b865
commit
f1e889c718
Binary file not shown.
Binary file not shown.
@ -89,7 +89,7 @@ function TForm1.CheckSrlHeader: integer;
|
|||||||
var
|
var
|
||||||
Rec: TSearchRec;
|
Rec: TSearchRec;
|
||||||
sf,s,ss: String;
|
sf,s,ss: String;
|
||||||
i,n,Count: integer;
|
i,n,Count,err_count: integer;
|
||||||
fsrl: file;
|
fsrl: file;
|
||||||
flog:TextFile;
|
flog:TextFile;
|
||||||
romh: TRomh;
|
romh: TRomh;
|
||||||
@ -109,6 +109,7 @@ begin
|
|||||||
ListBox_log.Items.Add('faild')
|
ListBox_log.Items.Add('faild')
|
||||||
end else begin
|
end else begin
|
||||||
Count := 0;
|
Count := 0;
|
||||||
|
err_count := 0;
|
||||||
//指定ディレクトリからファイルを取り出す
|
//指定ディレクトリからファイルを取り出す
|
||||||
// ** 内容で判別しないので違うファイル置かないよう注意 **
|
// ** 内容で判別しないので違うファイル置かないよう注意 **
|
||||||
if FindFirst(SrlDir + '*.*', faAnyFile, Rec) = 0 then
|
if FindFirst(SrlDir + '*.*', faAnyFile, Rec) = 0 then
|
||||||
@ -118,7 +119,6 @@ begin
|
|||||||
if not((Rec.Attr and faDirectory > 0)) and
|
if not((Rec.Attr and faDirectory > 0)) and
|
||||||
(Rec.Name <> '.') and (Rec.Name <> '..') and (Rec.name<>'log.txt')then
|
(Rec.Name <> '.') and (Rec.Name <> '..') and (Rec.name<>'log.txt')then
|
||||||
begin
|
begin
|
||||||
Inc(Count);
|
|
||||||
//ListBox_log.Items.Add('**********************************');
|
//ListBox_log.Items.Add('**********************************');
|
||||||
Writeln(flog,'**********************************');
|
Writeln(flog,'**********************************');
|
||||||
sf := 'file: '+Rec.Name;
|
sf := 'file: '+Rec.Name;
|
||||||
@ -163,7 +163,7 @@ begin
|
|||||||
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取得
|
||||||
if n <> sizeof(fat) then begin
|
if n <> sizeof(fat) then begin
|
||||||
s := s+'Cannot read fat id='+ inttostr(i);
|
s := 'file error';
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
//max_sectors = (DHT_OVERLAY_MAX/512 - total_sectors) / (nums-i);
|
//max_sectors = (DHT_OVERLAY_MAX/512 - total_sectors) / (nums-i);
|
||||||
@ -171,8 +171,10 @@ begin
|
|||||||
else max_sectors := 0;
|
else max_sectors := 0;
|
||||||
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
|
||||||
|
if (top and $1ff)<>0 then inc(sectors);
|
||||||
ss := '(A9 Overlay の全部)';
|
ss := '(A9 Overlay の全部)';
|
||||||
end else begin
|
end else begin
|
||||||
top := fat.top and $fffffe00; //512単位
|
top := fat.top and $fffffe00; //512単位
|
||||||
@ -190,8 +192,8 @@ begin
|
|||||||
//ListBox_log.Items.Add(s);
|
//ListBox_log.Items.Add(s);
|
||||||
Writeln(flog,s);
|
Writeln(flog,s);
|
||||||
inc(noc_size,512);
|
inc(noc_size,512);
|
||||||
inc(noc_sectors,1);
|
inc(noc_sectors);
|
||||||
inc(all_sectors,1);
|
inc(all_sectors);
|
||||||
end;
|
end;
|
||||||
size := btm - top;
|
size := btm - top;
|
||||||
sectors := size shr 9;//div 512
|
sectors := size shr 9;//div 512
|
||||||
@ -239,7 +241,10 @@ begin
|
|||||||
end else s := ' Open Error';
|
end else s := ' Open Error';
|
||||||
CloseFile(fsrl);
|
CloseFile(fsrl);
|
||||||
Writeln(flog,s);//結果
|
Writeln(flog,s);//結果
|
||||||
if (s='OK') or (s='NG') then s := 'done';
|
if (s='OK') or (s='NG') then begin
|
||||||
|
s := 'done';
|
||||||
|
Inc(Count);
|
||||||
|
end else inc(err_count);
|
||||||
ss := sf + ' : ' + s;
|
ss := sf + ' : ' + s;
|
||||||
ListBox_log.Items.Add(ss);
|
ListBox_log.Items.Add(ss);
|
||||||
end;
|
end;
|
||||||
@ -247,6 +252,10 @@ begin
|
|||||||
finally
|
finally
|
||||||
FindClose(Rec);
|
FindClose(Rec);
|
||||||
end;
|
end;
|
||||||
|
Writeln(flog,'********************************');
|
||||||
|
Writeln(flog,'check files = '+ inttostr(Count));
|
||||||
|
Writeln(flog,'error = '+ inttostr(err_count));
|
||||||
|
|
||||||
CloseFile(flog);
|
CloseFile(flog);
|
||||||
end;
|
end;
|
||||||
{$I+}
|
{$I+}
|
||||||
@ -263,12 +272,11 @@ begin
|
|||||||
ListBox_log.Clear;
|
ListBox_log.Clear;
|
||||||
//指定ディレクトリのsrlファイルをチェック
|
//指定ディレクトリのsrlファイルをチェック
|
||||||
FileCount := CheckSrlHeader;
|
FileCount := CheckSrlHeader;
|
||||||
if FileCount>0 then begin
|
if FileCount>=0 then begin
|
||||||
ListBox_log.Items.Add(' ------------------------------ ');
|
ListBox_log.Items.Add(' ------------------------------ ');
|
||||||
s := 'total '+inttostr(FileCount)+' files';
|
s := ' '+inttostr(FileCount)+' files done';
|
||||||
end else if FileCount = 0 then s := ' file not ditect' ;
|
ListBox_log.Items.Add(s);
|
||||||
ListBox_log.Items.Add(s);
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ function TForm1.CheckSrlHeader: integer;
|
|||||||
var
|
var
|
||||||
Rec: TSearchRec;
|
Rec: TSearchRec;
|
||||||
sf,s,ss: String;
|
sf,s,ss: String;
|
||||||
i,n,Count: integer;
|
i,n,Count,err_count: integer;
|
||||||
fsrl: file;
|
fsrl: file;
|
||||||
flog:TextFile;
|
flog:TextFile;
|
||||||
romh: TRomh;
|
romh: TRomh;
|
||||||
@ -101,7 +101,7 @@ begin
|
|||||||
{$I-}
|
{$I-}
|
||||||
//ログファイル作成
|
//ログファイル作成
|
||||||
ListBox_log.Items.Add('Create Log file');
|
ListBox_log.Items.Add('Create Log file');
|
||||||
s := 'log.txt';
|
s := ExtractFilePath(Application.Exename)+'log.txt';
|
||||||
AssignFile (flog,s);
|
AssignFile (flog,s);
|
||||||
Rewrite(flog);
|
Rewrite(flog);
|
||||||
if IOResult <> 0 then begin
|
if IOResult <> 0 then begin
|
||||||
@ -109,6 +109,7 @@ begin
|
|||||||
ListBox_log.Items.Add('faild')
|
ListBox_log.Items.Add('faild')
|
||||||
end else begin
|
end else begin
|
||||||
Count := 0;
|
Count := 0;
|
||||||
|
err_count := 0;
|
||||||
//指定ディレクトリからファイルを取り出す
|
//指定ディレクトリからファイルを取り出す
|
||||||
// ** 内容で判別しないので違うファイル置かないよう注意 **
|
// ** 内容で判別しないので違うファイル置かないよう注意 **
|
||||||
if FindFirst(SrlDir + '*.*', faAnyFile, Rec) = 0 then
|
if FindFirst(SrlDir + '*.*', faAnyFile, Rec) = 0 then
|
||||||
@ -118,9 +119,8 @@ begin
|
|||||||
if not((Rec.Attr and faDirectory > 0)) and
|
if not((Rec.Attr and faDirectory > 0)) and
|
||||||
(Rec.Name <> '.') and (Rec.Name <> '..') and (Rec.name<>'log.txt')then
|
(Rec.Name <> '.') and (Rec.Name <> '..') and (Rec.name<>'log.txt')then
|
||||||
begin
|
begin
|
||||||
Inc(Count);
|
//ListBox_log.Items.Add('**********************************');
|
||||||
//ListBox_log.Items.Add(' ********************************** ');
|
Writeln(flog,'**********************************');
|
||||||
Writeln(flog,' ********************************** ');
|
|
||||||
sf := 'file: '+Rec.Name;
|
sf := 'file: '+Rec.Name;
|
||||||
//ListBox_log.Items.Add(sf);
|
//ListBox_log.Items.Add(sf);
|
||||||
Writeln(flog,sf);
|
Writeln(flog,sf);
|
||||||
@ -163,25 +163,44 @@ begin
|
|||||||
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取得
|
||||||
if n <> sizeof(fat) then begin
|
if n <> sizeof(fat) then begin
|
||||||
s := s+'Cannot read fat id='+ inttostr(i);
|
s := 'file error';
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
size := (fat.bottom - fat.top)+1;
|
|
||||||
sectors := size shr 9;//div 512
|
|
||||||
if (size and $1ff) <>0 then inc(sectors);
|
|
||||||
size := sectors shl 9;
|
|
||||||
inc(all_sectors,sectors);
|
|
||||||
//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;
|
||||||
btm := fat.bottom;
|
btm := fat.bottom and $fffffe00; //512単位
|
||||||
if max_sectors = 0 then begin//残検証サイズなければ丸ごと検証外
|
if (fat.bottom and $1ff)<>0 then inc(btm,512);//上方向に丸める
|
||||||
|
if max_sectors = 0 then begin//最大達したら丸ごと検証外
|
||||||
top := fat.top;
|
top := fat.top;
|
||||||
|
sectors := (btm-top) shr 9;//div 512
|
||||||
|
if (top and $1ff)<>0 then inc(sectors);
|
||||||
ss := '(A9 Overlay の全部)';
|
ss := '(A9 Overlay の全部)';
|
||||||
end else begin
|
end else begin
|
||||||
|
top := fat.top and $fffffe00; //512単位
|
||||||
|
size := fat.top and $01ff;
|
||||||
|
if size<>0 then begin
|
||||||
|
inc(top,512);////上方向に丸める
|
||||||
|
//先頭の未検証部分 .. 不要?
|
||||||
|
s := 'offset'+inttostr(i)+' = 0x'+ inttohex(fat.top,8)
|
||||||
|
+' ; 0x'+ inttohex(fat.top,8)
|
||||||
|
+'-0x' + inttohex(top-1,8)+ss;
|
||||||
|
//ListBox_log.Items.Add(s);
|
||||||
|
Writeln(flog,s);
|
||||||
|
s := 'length'+ inttostr(i) + ' = 0x' + inttohex(size,4)
|
||||||
|
+ ' ; '+ inttostr(size)+' bytes';
|
||||||
|
//ListBox_log.Items.Add(s);
|
||||||
|
Writeln(flog,s);
|
||||||
|
inc(noc_size,512);
|
||||||
|
inc(noc_sectors);
|
||||||
|
inc(all_sectors);
|
||||||
|
end;
|
||||||
|
size := btm - top;
|
||||||
|
sectors := size shr 9;//div 512
|
||||||
|
inc(all_sectors,sectors);
|
||||||
if sectors > max_sectors then begin //最大割当サイズ超
|
if sectors > max_sectors then begin //最大割当サイズ超
|
||||||
sectors := sectors - max_sectors;//検証されないセクタ数
|
sectors := sectors - max_sectors;//残りセクタ数
|
||||||
top := fat.top + max_sectors;
|
inc(top,max_sectors*512);//残り先頭
|
||||||
inc(total_sectors,max_sectors);
|
inc(total_sectors,max_sectors);
|
||||||
ss := '(A9 Overlay の一部)';
|
ss := '(A9 Overlay の一部)';
|
||||||
end else begin //超過なし
|
end else begin //超過なし
|
||||||
@ -189,11 +208,11 @@ begin
|
|||||||
sectors := 0;
|
sectors := 0;
|
||||||
end;
|
end;
|
||||||
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(i)+' = 0x'+ inttohex(top,8)
|
||||||
+' ; 0x'+ inttohex(top,8)
|
+' ; 0x'+ inttohex(top,8)
|
||||||
+'-0x' + inttohex(btm,8)+ss;
|
+'-0x' + inttohex(btm-1,8)+ss;
|
||||||
//ListBox_log.Items.Add(s);
|
//ListBox_log.Items.Add(s);
|
||||||
Writeln(flog,s);
|
Writeln(flog,s);
|
||||||
s := 'length'+ inttostr(i) + ' = 0x' + inttohex(size,4)
|
s := 'length'+ inttostr(i) + ' = 0x' + inttohex(size,4)
|
||||||
@ -205,12 +224,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if i = nums then begin //中断なし
|
if i = nums then begin //中断なし
|
||||||
|
//ListBox_log.Items.Add(' ');
|
||||||
//ListBox_log.Items.Add('total sectors = '+inttostr(all_sectors));
|
//ListBox_log.Items.Add('total sectors = '+inttostr(all_sectors));
|
||||||
//ListBox_log.Items.Add('no check sectors = '+inttostr(noc_sectors));
|
//ListBox_log.Items.Add('no check sectors = '+inttostr(noc_sectors));
|
||||||
//ListBox_log.Items.Add('no check size = '+inttostr(noc_size));
|
//ListBox_log.Items.Add('no check size = '+inttostr(noc_size));
|
||||||
//ListBox_log.Items.Add(' '); //間をあける
|
Writeln(flog); //改行
|
||||||
Writeln(flog); //開業
|
|
||||||
Writeln(flog,'total sectors = '+inttostr(all_sectors));
|
Writeln(flog,'total sectors = '+inttostr(all_sectors));
|
||||||
|
Writeln(flog,'check sectors = '+inttostr(total_sectors));
|
||||||
Writeln(flog,'no check sectors = '+inttostr(noc_sectors));
|
Writeln(flog,'no check sectors = '+inttostr(noc_sectors));
|
||||||
Writeln(flog,'no check size = '+inttostr(noc_size));
|
Writeln(flog,'no check size = '+inttostr(noc_size));
|
||||||
if noc_size > 0 then s:= 'NG'
|
if noc_size > 0 then s:= 'NG'
|
||||||
@ -221,14 +241,21 @@ begin
|
|||||||
end else s := ' Open Error';
|
end else s := ' Open Error';
|
||||||
CloseFile(fsrl);
|
CloseFile(fsrl);
|
||||||
Writeln(flog,s);//結果
|
Writeln(flog,s);//結果
|
||||||
if (s='OK') or (s='NG') then s := 'done';
|
if (s='OK') or (s='NG') then begin
|
||||||
|
s := 'done';
|
||||||
|
Inc(Count);
|
||||||
|
end else inc(err_count);
|
||||||
ss := sf + ' : ' + s;
|
ss := sf + ' : ' + s;
|
||||||
ListBox_log.Items.Add(ss);
|
ListBox_log.Items.Add(ss);
|
||||||
end;
|
end;
|
||||||
until (FindNext(Rec) <> 0);
|
until (FindNext(Rec) <> 0);
|
||||||
finally
|
finally
|
||||||
FindClose(Rec);
|
FindClose(Rec);
|
||||||
end;
|
end;
|
||||||
|
Writeln(flog,'********************************');
|
||||||
|
Writeln(flog,'check files = '+ inttostr(Count));
|
||||||
|
Writeln(flog,'error = '+ inttostr(err_count));
|
||||||
|
|
||||||
CloseFile(flog);
|
CloseFile(flog);
|
||||||
end;
|
end;
|
||||||
{$I+}
|
{$I+}
|
||||||
@ -245,12 +272,11 @@ begin
|
|||||||
ListBox_log.Clear;
|
ListBox_log.Clear;
|
||||||
//指定ディレクトリのsrlファイルをチェック
|
//指定ディレクトリのsrlファイルをチェック
|
||||||
FileCount := CheckSrlHeader;
|
FileCount := CheckSrlHeader;
|
||||||
if FileCount>0 then begin
|
if FileCount>=0 then begin
|
||||||
ListBox_log.Items.Add(' ------------------------------ ');
|
ListBox_log.Items.Add(' ------------------------------ ');
|
||||||
s := 'total '+inttostr(FileCount)+' files';
|
s := ' '+inttostr(FileCount)+' files done';
|
||||||
end else if FileCount = 0 then s := ' file not ditect' ;
|
ListBox_log.Items.Add(s);
|
||||||
ListBox_log.Items.Add(s);
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user