31 |
|
procedure hexSelectionChanged(Sender: TObject); |
32 |
|
procedure hexChange(Sender: TObject); |
33 |
|
|
34 |
< |
procedure LoadDat(_fileid: LongWord); |
34 |
> |
procedure LoadDat(_fileid: Integer); |
35 |
|
function Save: Boolean; |
36 |
|
function GetValue(datatype: Word; offset: LongWord): String; |
37 |
|
procedure SetNewValue(datatype: Word; offset: LongWord; Value: String); |
56 |
|
Shift: TShiftState; X, Y: Integer); |
57 |
|
procedure value_viewer_contextPopup(Sender: TObject); |
58 |
|
private |
59 |
+ |
con: TOniData; |
60 |
|
fileid: Integer; |
61 |
|
public |
62 |
|
end; |
93 |
|
value_viewer.ColCount := 2; |
94 |
|
value_viewer.RowCount := 8; |
95 |
|
value_viewer.FixedRows := 1; |
96 |
+ |
value_viewer.FixedCols := 1; |
97 |
|
value_viewer.Cells[0, 0] := 'Type'; |
98 |
|
value_viewer.Cells[1, 0] := 'Value'; |
99 |
|
value_viewer.Cells[0, 1] := '1 byte, unsigned'; |
103 |
|
value_viewer.Cells[0, 5] := 'Float'; |
104 |
|
value_viewer.Cells[0, 6] := 'String'; |
105 |
|
value_viewer.Cells[0, 7] := 'Selected length'; |
106 |
< |
// value_viewer.ColWidths[0] := 100; |
107 |
< |
// value_viewer.ColWidths[1] := value_viewer.Width - 150; |
106 |
> |
value_viewer.ColWidths[0] := 120; |
107 |
> |
value_viewer.ColWidths[1] := 1000; |
108 |
|
// hex.Height := content.Height - 215; |
109 |
|
// |
110 |
|
value_viewer.Font.Charset := AppSettings.CharSet; |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
< |
procedure TForm_BinEdit.LoadDat(_fileid: LongWord); |
139 |
> |
procedure TForm_BinEdit.LoadDat(_fileid: Integer); |
140 |
|
var |
141 |
|
mem: TMemoryStream; |
142 |
|
Data: Tdata; |
143 |
|
begin |
144 |
< |
if hex.Modified then |
144 |
> |
if con <> nil then |
145 |
|
begin |
146 |
< |
if not Save then |
146 |
> |
if hex.Modified then |
147 |
|
begin |
148 |
< |
Self.SelectFileID(fileid); |
149 |
< |
Exit; |
148 |
> |
if not Save then |
149 |
> |
begin |
150 |
> |
Self.SelectFileID(Connection, fileid); |
151 |
> |
Exit; |
152 |
> |
end; |
153 |
|
end; |
154 |
|
end; |
155 |
< |
fileid := _fileid; |
156 |
< |
if OniDataConnection.ExtractFileID( |
157 |
< |
filelist.Items.Strings[filelist.ItemIndex]) <> fileid then |
158 |
< |
Self.SelectFileID(fileid); |
159 |
< |
Self.ClearStructViewer; |
160 |
< |
Data := OniDataConnection.LoadDatFile(fileid); |
161 |
< |
if Length(Data) > 0 then |
162 |
< |
begin |
163 |
< |
mem := TMemoryStream.Create; |
164 |
< |
mem.Write(Data[0], Length(Data)); |
165 |
< |
mem.Seek(0, soFromBeginning); |
166 |
< |
hex.LoadFromStream(mem); |
167 |
< |
mem.Free; |
168 |
< |
WriteStructureInfos; |
155 |
> |
if _fileid >= 0 then |
156 |
> |
begin |
157 |
> |
fileid := _fileid; |
158 |
> |
con := Connection; |
159 |
> |
if con.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]) <> fileid then |
160 |
> |
Self.SelectFileID(Connection, fileid); |
161 |
> |
Self.ClearStructViewer; |
162 |
> |
Data := con.LoadDatFile(fileid); |
163 |
> |
if Length(Data) > 0 then |
164 |
> |
begin |
165 |
> |
mem := TMemoryStream.Create; |
166 |
> |
mem.Write(Data[0], Length(Data)); |
167 |
> |
mem.Seek(0, soFromBeginning); |
168 |
> |
hex.LoadFromStream(mem); |
169 |
> |
mem.Free; |
170 |
> |
WriteStructureInfos; |
171 |
> |
end |
172 |
> |
else |
173 |
> |
begin |
174 |
> |
ClearValues; |
175 |
> |
hex.DataSize := 0; |
176 |
> |
end; |
177 |
|
end |
178 |
|
else |
179 |
|
begin |
180 |
+ |
fileid := _fileid; |
181 |
+ |
con := nil; |
182 |
+ |
Self.ClearStructViewer; |
183 |
|
ClearValues; |
184 |
|
hex.DataSize := 0; |
185 |
|
end; |
241 |
|
10: |
242 |
|
Result := IntToBin(hex.Data[offset]); |
243 |
|
11: |
244 |
< |
Result := '0x' + IntToHex(OniDataConnection.GetRawInfo(fileid, offset).raw_addr, 8); |
244 |
> |
Result := '0x' + IntToHex(con.GetRawInfo(fileid, offset).raw_addr, 8); |
245 |
|
12: |
246 |
|
Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + |
247 |
|
hex.Data[offset + 3] * 256 * 256, 5, '0'); |
306 |
|
VST.BeginUpdate; |
307 |
|
if VST.RootNodeCount = 0 then |
308 |
|
begin |
309 |
< |
structs := LoadStructureDefinition(Connection, fileid); |
309 |
> |
structs := LoadStructureDefinition(con, fileid); |
310 |
|
if structs.Data then |
311 |
|
begin |
312 |
|
if Length(structs.Global) > 0 then |
516 |
|
i: LongWord; |
517 |
|
begin |
518 |
|
case MessageBox(Self.Handle, PChar('Save changes to file ' + |
519 |
< |
OniDataConnection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), |
519 |
> |
con.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), |
520 |
|
MB_YESNOCANCEL) of |
521 |
|
idYes: |
522 |
|
begin |
526 |
|
SetLength(Data, mem.Size); |
527 |
|
mem.Read(Data[0], mem.Size); |
528 |
|
mem.Free; |
529 |
< |
OniDataConnection.UpdateDatFile(fileid, Data); |
529 |
> |
con.UpdateDatFile(fileid, Data); |
530 |
|
hex.Modified := False; |
531 |
|
for i := 0 to hex.Datasize - 1 do |
532 |
|
hex.ByteChanged[i] := False; |
777 |
|
begin |
778 |
|
if nodedata.DataType = 11 then |
779 |
|
begin |
780 |
< |
if OniDataConnection.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then |
781 |
< |
Form_Main.open_child('rawedit', fileid); |
780 |
> |
if con.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then |
781 |
> |
Form_Main.open_child('rawedit', Connection, fileid); |
782 |
|
end; |
783 |
|
if nodedata.DataType = 12 then |
784 |
|
begin |
785 |
< |
if (StrToInt(nodedata.Value) < OniDataConnection.GetFilesCount) and |
785 |
> |
if (StrToInt(nodedata.Value) < con.GetFilesCount) and |
786 |
|
(StrToInt(nodedata.Value) > 0) and |
787 |
|
(StrToInt(nodedata.Value) <> fileid) then |
788 |
|
begin |
789 |
< |
if OniDataConnection.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then |
790 |
< |
Form_Main.open_child('binedit', StrToInt(nodedata.Value)) |
789 |
> |
if con.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then |
790 |
> |
Form_Main.open_child('binedit', Connection, StrToInt(nodedata.Value)) |
791 |
|
else |
792 |
|
ShowMessage('Linked filed is a zero-byte-file'); |
793 |
|
end; |
794 |
|
end; |
795 |
|
if (nodedata.DataType >= 100) and (nodedata.DataType <= 300) then |
796 |
|
begin |
797 |
< |
form := Form_Main.open_child('binedit', -1); |
797 |
> |
form := Form_Main.open_child('binedit', Connection, -1); |
798 |
|
if Assigned(form) then |
799 |
|
form.SetFileFilters(nodedata.Value, '', False); |
800 |
|
end; |