📄 unit2.pas.svn-base
字号:
// 'CETables-' //now extract the info. for i:=1 to l do begin if textform[i]=chr(13) then begin if j=0 then //decription begin setlength(temprec,k+1); temprec[k].Description:=copy(textform,last,i-last); inc(j); end else if j=1 then //address begin temprec[k].Address:=StrToInt(copy(textform,last,i-last)); inc(j); end else if j=2 then //type begin temprec[k].VarType:=StrToInt(copy(textform,last,i-last)); j:=0; inc(k); end; last:=i+1; end; end; inc(NumberOfRecords,k); setlength(memrec,mainform.NumberOfRecords); setlength(selected,mainform.NumberOfRecords); if lastselected=-1 then lastselected:=numberofrecords-k-1; if lastselected=-1 then lastselected:=0; for i:=numberofrecords-k-1 downto lastselected do begin memrec[i+k]:=memrec[i]; selected[i+k]:=selected[i]; end; for i:=lastselected to lastselected+k-1 do begin memrec[i]:=temprec[i-lastselected]; selected[i]:=false; end; if numberofrecords>6 then scrollbar1.max:=numberofrecords-6; if lastselected<scrollbar1.position then scrollbar1.Position:=lastselected; if lastselected>scrollbar1.position+5 then scrollbar1.Position:=lastselected-5; mainform.updatelist; mainform.UpdateScreen; freemem(textform2); resync; //wtf, i'm just to lazy to make an insert record on the server end;function TMainForm.CheckIfSaved: boolean;var help :word; i: Integer;begin if numberofrecords=0 then begin result:=true; exit; end; result:=true; if (OldNumberOfRecords=NumberOfRecords) then begin i:=0; while (result) and (i<numberofrecords) do begin if oldmemrec[i].Description<>memrec[i].Description then result:=false; if oldmemrec[i].Address<>memrec[i].Address then result:=false; if oldmemrec[i].VarType<>memrec[i].VarType then result:=false; if oldmemrec[i].Bit<>memrec[i].Bit then result:=false; if oldmemrec[i].Group<>memrec[i].Group then result:=false; inc(i); end; end else result:=false; if result=false then begin help:=messagedlg('You havn''t saved your last changes yet. Save Now?',mtConfirmation,mbYesNoCancel,0); case help of mrCancel : result:=false; mrYes : begin result:=true; SaveButton.click; end; else result:=true; end; end;end;procedure TMainform.UpdateList;begin //request a updated list for the current records // scrollbar1.Position to scrollbar1.Position+numberoflines output[0]:=4; pword(@output[1])^:=scrollbar1.Position; pword(@output[3])^:=scrollbar1.Position+numberoflines; sendbuf(5);end;procedure TMainform.Deletegroups(groups: grouptype);var i: integer;begin for i:=0 to numberofrecords-1 do begin if groups[1] and (memrec[i].Group=1) then selected[i]:=true else if groups[2] and (memrec[i].Group=2) then selected[i]:=true else if groups[3] and (memrec[i].Group=3) then selected[i]:=true else if groups[4] and (memrec[i].Group=4) then selected[i]:=true else selected[i]:=false; end; deleterecords;end;procedure TMainForm.DeleteRecords;var i,j: Integer; count: integer;begin //fird out if there are more than 1 selected items i:=0; count:=0; while (i<numberofrecords) and (count<2) do begin if selected[i] then inc(count); inc(count); end; i:=0; while i<numberofrecords do begin if selected[i] then begin for j:=i to numberofrecords-2 do begin memrec[j]:=memrec[j+1]; selected[j]:=selected[j+1]; end; output[0]:=CS_DELETEADDRESS; pword(@output[1])^:=i; sendbuf(3); inc(count); // if count=70 then sleep(lag*3); dec(numberofrecords); dec(i); setlength(memrec,numberofrecords); setlength(selected,numberofrecords); if firstshiftselected>numberofrecords-1 then firstshiftselected:=-1; end; inc(i); end; If lastselected>numberofrecords-1 then lastselected:=numberofrecords-1; if lastselected>-1 then selected[lastselected]:=true; Updatescreen;// Updatelist;end;procedure TMainform.LoadDefaultSkin;var default: Tfilestream; i: Integer;beginend;procedure TMainForm.UpdateSkin;beginend;procedure TMainform.Updatescreen;var rec,i: Integer;begin if numberofrecords>=numberoflines then begin scrollbar1.enabled:=true; scrollbar1.max:=numberofrecords-1; scrollbar1.pagesize:=numberoflines-1; scrollbar1.LargeChange:=numberoflines-1; end else begin scrollbar1.enabled:=false; scrollbar1.position:=0; end; for i:=0 to numberoflines-1 do begin rec:=scrollbar1.Position+i; if rec<numberofrecords then begin if hotkeys[rec]<>-1 then begin frozenbox[i].Checked:=false; frozenbox[i].Enabled:=false; end else begin frozenbox[i].checked:=memrec[rec].frozen; frozenbox[i].Enabled:=true; end; description[i].Caption:=memrec[rec].Description; address[i].caption:=IntTohex(memrec[rec].address,8); if not frozenbox[i].visible then //if it's not yet visible, make it visible begin frozenbox[i].visible:=true; description[i].visible:=true; address[i].visible:=true; valtype[i].visible:=true; value[i].visible:=true; end; case memrec[rec].vartype of 0 : valtype[i].Caption:='Byte'; 1 : valtype[i].Caption:='2 Bytes'; 2 : valtype[i].Caption:='4 Bytes'; 3 : valtype[i].caption:='Float'; 4 : valtype[i].caption:='Double'; 5 : begin valtype[i].Caption:='Binary['+IntToStr(memrec[rec].Bitlength)+']'; address[i].caption:=address[i].caption+'^'+IntToStr(memrec[rec].Bit); end; 6 : valtype[i].caption:='8 Bytes'; 7 : valtype[i].Caption:='Text['+inttostr(memrec[rec].Bit)+']'; 8 : valtype[i].Caption:='Bytes['+inttostr(memrec[rec].Bit)+']'; else valtype[i].caption:='BUG!'; end; if selected[rec] then begin if lastselected=rec then begin select[i].Color:=clActiveCaption; select[i].Font.Color:=clActiveCaption; Frozenbox[i].Color:=clActiveCaption; end else begin select[i].Color:=clGradientActiveCaption; select[i].Font.Color:=clGradientActiveCaption; Frozenbox[i].Color:=clGradientActiveCaption; end; description[i].Font.Color:=clHighlightText; address[i].Font.Color:=clHighlightText; valtype[i].Font.Color:=clHighlightText; value[i].Font.Color:=clHighlightText; end else begin case memrec[rec].Group of 0 : begin description[i].Font.Color:=clWindowText; address[i].Font.Color:=clWindowText; valtype[i].Font.Color:=clWindowText; value[i].Font.Color:=clWindowText; end; 1 : begin description[i].Font.Color:=clRed; address[i].Font.Color:=clRed; valtype[i].Font.Color:=clRed; value[i].Font.Color:=clRed; end; 2 : begin description[i].Font.Color:=clBlue; address[i].Font.Color:=clBlue; valtype[i].Font.Color:=clBlue; value[i].Font.Color:=clBlue; end; 3 : begin description[i].Font.Color:=clYellow; address[i].Font.Color:=clYellow; valtype[i].Font.Color:=clYellow; value[i].Font.Color:=clYellow; end; 4 : begin description[i].Font.Color:=clGreen; address[i].Font.Color:=clGreen; valtype[i].Font.Color:=clGreen; value[i].Font.Color:=clGreen; end; end; select[i].Color:=clBtnFace; select[i].Font.Color:=clBtnFace; Frozenbox[i].Color:=clBtnFace; end; end else begin description[i].Font.Color:=clBtnFace; select[i].Color:=clBtnFace; select[i].Font.Color:=clBtnFace; description[i].Font.Color:=clBtnFace; Frozenbox[i].Color:=clBtnFace; address[i].Font.Color:=clBtnFace; valtype[i].Font.Color:=clBtnFace; value[i].Font.Color:=clBtnFace; if frozenbox[i].visible then begin frozenbox[i].visible:=false; description[i].visible:=false; address[i].visible:=false; valtype[i].visible:=false; value[i].visible:=false; end; end; end;end;procedure TMainForm.UpdateScanType;var OldText: String; OldIndex: Integer; hexvis: boolean;resourcestring strexact='Exact'; strexactvalue='Exact Value'; strbiggerThan='Bigger than...'; strSmallerThan='Smaller than...'; strIncreasedValue='Increased value'; strIncreasedValueBy='Increased value by ...'; strDecreasedValue='Decreased value'; strDecreasedValueBy='Decreased value by ...'; strChangedValue='Changed value'; strUnchangedValue='Unchanged value'; strUnknownInitialValue='Unknown initial value'; strScantextcaptiontotext='Text:'; strScantextcaptiontoValue='Value:'; strsearchForText='Search for text'; strSearchForArray='Search for this array';begin OldIndex:=Scantype.itemindex; OldText:=Scantype.text; hexvis:=true; ScanType.Items.Clear; ScanText.Caption:=strScantextcaptiontoValue; case varType.ItemIndex of 0 : begin ScanType.Items.Add(strExact); ScanType.DropDownCount:=1; end; 1,2,3,4,5,6:begin //byte-word-dword--8bytes-float-double if vartype.itemindex in [5,6] then hexvis:=false; ScanType.Items.Add(strExactValue); ScanType.Items.Add(strBiggerThan); ScanType.Items.Add(strsmallerThan); if NextScanbutton.Enabled then begin scantype.Items.Add(strIncreasedValue); Scantype.Items.Add(strIncreasedValueBy); ScanType.Items.Add(strDecreasedValue); ScanType.Items.Add(strDecreasedValueBy); ScanType.Items.add(strChangedValue); ScanType.Items.Add(strUnchangedValue); Scantype.DropDownCount:=9; end else begin ScanType.Items.Add(strUnknownInitialValue); ScanType.DropDownCount:=4; end; end; 7: begin //text ScanText.caption:=strScanTextCaptionToText; ScanType.Items.Add(strSearchForText); //perhaps also a changed value and unchanged value scan ScanType.DropDownCount:=1; hexvis:=false; end; 8: begin //array of bytes ScanText.caption:=vartype.Items[8]; ScanType.Items.Add(strSearchforarray); ScanType.DropDownCount:=1; end; end; if (oldtext=strUnknownInitialValue) and (NextScanButton.enabled) then scantype.itemindex:=0 else scantype.itemindex:=oldindex; if (scantype.Text=strIncreasedValue) or (scantype.text=strDecreasedValue) or (scantype.Text=strChangedValue) or (scantype.Text=strUnchangedValue) or (scantype.Text=strUnknownInitialValue) then begin Scantext.Visible:=false; Scanvalue.visible:=false; HexadecimalCheckbox.visible:=false; end else begin Scantext.Visible:=true; Scanvalue.visible:=true; HexadecimalCheckbox.visible:=hexvis; end;end;procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);begin Connectform.close;end;procedure TMainForm.SpeedButton1Click(Sender: TObject);var FName: String; expectedFilename: String; i: integer;begin proceswindow:=TProceswindow.Create(self); if ProcesWindow.ShowModal=mrOk then begin if numberofrecords>0 then begin if messagedlg('Keep the current address list?', mtConfirmation, [mbYes, mbNo], 0)=mrNo then begin Comments.Memo1.Lines.Text:=''; Numberofrecords:=0; Updatescreen; end else updatelist; end; if (copy(processlabel.caption,length(processlabel.caption)-11,12)='WINOA386.MOD') or (copy(processlabel.caption,pos('-',processlabel.caption)+1,13)='MS-DOS Prompt') then begin fromaddress.text:='80000000';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -