38 |
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
39 |
|
procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); |
40 |
|
|
41 |
– |
procedure panel_contentResize(Sender: TObject); |
42 |
– |
|
41 |
|
function GetValue(datatype: Word; offset: LongWord): String; |
42 |
|
procedure ClearValues; |
43 |
|
procedure WriteValues; |
55 |
|
private |
56 |
|
fileid: Integer; |
57 |
|
dat_offset: LongWord; |
58 |
< |
fileid_opened, dat_offset_opened: LongWord; |
58 |
> |
fileid_opened, dat_offset_opened: Integer; |
59 |
|
public |
60 |
|
end; |
61 |
|
|
71 |
|
offsets: TRawList; |
72 |
|
i: Integer; |
73 |
|
begin |
74 |
< |
if hex.Modified then |
77 |
< |
if not Save then |
78 |
< |
Exit; |
79 |
< |
ClearValues; |
80 |
< |
hex.DataSize := 0; |
81 |
< |
fileid := fileinfo.ID; |
82 |
< |
list_offset.Enabled := False; |
83 |
< |
if fileinfo.size > 0 then |
74 |
> |
if fileinfo.ID >= 0 then |
75 |
|
begin |
76 |
< |
offsets := OniDataConnection.GetRawList(fileid); |
76 |
> |
if hex.Modified then |
77 |
> |
if not Save then |
78 |
> |
Exit; |
79 |
> |
ClearValues; |
80 |
> |
hex.DataSize := 0; |
81 |
> |
fileid := fileinfo.ID; |
82 |
> |
list_offset.Enabled := False; |
83 |
> |
if fileinfo.size > 0 then |
84 |
> |
begin |
85 |
> |
offsets := Connection.GetRawList(fileid); |
86 |
> |
list_offset.Items.Clear; |
87 |
> |
if Length(offsets) > 0 then |
88 |
> |
for i := 0 to High(offsets) do |
89 |
> |
list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) + |
90 |
> |
', ' + IntToStr(offsets[i].raw_size) + ' bytes'); |
91 |
> |
list_offset.Enabled := True; |
92 |
> |
end; |
93 |
> |
end |
94 |
> |
else |
95 |
> |
begin |
96 |
> |
ClearValues; |
97 |
> |
hex.DataSize := 0; |
98 |
> |
fileid := -1; |
99 |
|
list_offset.Items.Clear; |
87 |
– |
if Length(offsets) > 0 then |
88 |
– |
for i := 0 to High(offsets) do |
89 |
– |
list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) + |
90 |
– |
', ' + IntToStr(offsets[i].raw_size) + ' bytes'); |
91 |
– |
list_offset.Enabled := True; |
100 |
|
end; |
101 |
|
end; |
102 |
|
|
116 |
|
begin |
117 |
|
for i := 0 to filelist.Count - 1 do |
118 |
|
begin |
119 |
< |
if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then |
119 |
> |
if Connection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then |
120 |
|
begin |
121 |
|
filelist.ItemIndex := i; |
122 |
|
listClick(Self); |
133 |
|
end; |
134 |
|
end; |
135 |
|
SetLength(Data, raw_info.raw_size); |
136 |
< |
OniDataConnection.LoadRawFile(raw_info.src_id, raw_info.src_offset, @Data[0]); |
136 |
> |
Connection.LoadRawFile(raw_info.src_id, raw_info.src_offset, @Data[0]); |
137 |
|
if Length(Data) > 0 then |
138 |
|
begin |
139 |
|
hex.DataSize := 0; |
165 |
|
ClearValues; |
166 |
|
dat_offset := StrToInt('$' + MidStr( |
167 |
|
list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); |
168 |
< |
LoadRaw(OniDataConnection.GetRawInfo(fileid, dat_offset)); |
168 |
> |
LoadRaw(Connection.GetRawInfo(fileid, dat_offset)); |
169 |
|
end; |
170 |
|
|
171 |
|
|
398 |
|
value_viewer.RowCount := 8; |
399 |
|
} |
400 |
|
value_viewer.FixedRows := 1; |
401 |
+ |
value_viewer.FixedCols := 1; |
402 |
|
value_viewer.Cells[0, 0] := 'Type'; |
403 |
|
value_viewer.Cells[1, 0] := 'Value'; |
404 |
|
value_viewer.Cells[0, 1] := '1 byte, unsigned'; |
408 |
|
value_viewer.Cells[0, 5] := 'Float'; |
409 |
|
value_viewer.Cells[0, 6] := 'String'; |
410 |
|
value_viewer.Cells[0, 7] := 'Selected length'; |
411 |
< |
value_viewer.ColWidths[0] := 100; |
411 |
> |
value_viewer.ColWidths[0] := 125; |
412 |
> |
value_viewer.ColWidths[1] := 1000; |
413 |
|
// |
414 |
|
value_viewer.Font.Charset := AppSettings.CharSet; |
415 |
|
// |
425 |
|
i: LongWord; |
426 |
|
begin |
427 |
|
case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' + |
428 |
< |
OniDataConnection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), |
428 |
> |
Connection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), |
429 |
|
MB_YESNOCANCEL) of |
430 |
|
idYes: |
431 |
|
begin |
435 |
|
SetLength(Data, mem.Size); |
436 |
|
mem.Read(Data[0], mem.Size); |
437 |
|
mem.Free; |
438 |
< |
OniDataConnection.UpdateRawFile(fileid_opened, dat_offset_opened, |
438 |
> |
Connection.UpdateRawFile(fileid_opened, dat_offset_opened, |
439 |
|
Length(Data), @Data[0]); |
440 |
|
hex.Modified := False; |
441 |
|
for i := 0 to hex.Datasize - 1 do |
466 |
|
|
467 |
|
|
468 |
|
|
459 |
– |
procedure TForm_RawEdit.panel_contentResize(Sender: TObject); |
460 |
– |
begin |
461 |
– |
if fileid >= 0 then |
462 |
– |
value_viewer.ColWidths[1] := value_viewer.Width - value_viewer.ColWidths[0] - 50; |
463 |
– |
end; |
464 |
– |
|
465 |
– |
|
466 |
– |
|
467 |
– |
|
469 |
|
procedure TForm_RawEdit.hexChange(Sender: TObject); |
470 |
|
begin |
471 |
|
ClearValues; |
546 |
|
var |
547 |
|
fs: TFileStream; |
548 |
|
begin |
549 |
< |
saved.Filter := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo( |
550 |
< |
fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension + |
549 |
> |
saved.Filter := 'Files of matching extension (*.' + Connection.GetFileInfo( |
550 |
> |
fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension + |
551 |
|
'|All files|*.*'; |
552 |
< |
saved.DefaultExt := OniDataConnection.GetFileInfo(fileid).Extension; |
552 |
> |
saved.DefaultExt := Connection.GetFileInfo(fileid).Extension; |
553 |
|
if saved.Execute then |
554 |
|
begin |
555 |
|
fs := TFileStream.Create(saved.FileName, fmCreate); |
566 |
|
// Data: Tdata; |
567 |
|
fs: TFileStream; |
568 |
|
begin |
569 |
< |
opend.Filter := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo( |
570 |
< |
fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension + |
569 |
> |
opend.Filter := 'Files of matching extension (*.' + Connection.GetFileInfo( |
570 |
> |
fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension + |
571 |
|
'|All files|*.*'; |
572 |
|
if opend.Execute then |
573 |
|
begin |