⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainunit.pas

📁 游戏克星江湖行游戏修改工具全部源码,功能很强的。
💻 PAS
📖 第 1 页 / 共 4 页
字号:
end;





///////////////////////////////////////////////////////////////////////

procedure TMainForm.Scan_bnClick(Sender: TObject);
begin
if TaskNum=0 then
begin
if MessageBox(Application.Handle,pchar(String_Addtask),pchar(String_Addtasktitle),
           MB_YESNO or MB_ICONINFORMATION)=IDYES then

 NewTask_TB.Click;
 Exit;
end;

with theTask[CurrenttaskIndex] do
begin
  if InSearchProcess then
   begin
  MessageBox(Application.Handle,pchar(String_InScan),pchar(String_InScanTitle),
           MB_OK or MB_ICONINFORMATION);
  exit;
   end;///防止搜索过程中不断点击

  ScanType:=GetScanTypeAndTempVar(Value_Edit.text,CurrentTaskIndex);
  if  ScanType=-999 then begin RaiseInputError;exit;end;
  /////Vartype必须考虑Combobox的选择
  theTask[CurrentTaskIndex].VarType:=VarType_cb.ItemIndex;
  varType:=GetVarTypeAndVarValue(ScanValue,CurrentTaskIndex);
  if  varType=-999 then begin RaiseInputError;exit;end;

  if not CheckForScan then exit;



if SearchTimes=0 then
begin
TFirstScanThread.Create(CurrentTaskIndex);
end  else
begin
TNextScanThread.Create(CurrentTaskIndex);
end;

end;///with end;

end;

procedure TMainForm.InputHelp_SBClick(Sender: TObject);
begin
if not assigned(InputhelpForm)then  InputhelpForm:=TInputhelpForm.Create(self);
InputhelpForm.Showmodal;
InputhelpForm.Free;
InputhelpForm:=nil;
end;

procedure TMainForm.VarType_CBChange(Sender: TObject);
begin
if (TaskNUm=0) or (theTask[CurrentTaskIndex].InSearchProcess) then exit;
theTask[CurrentTaskIndex].VarType:=VarType_cb.ItemIndex;

end;

procedure TMainForm.tasks_LVClick(Sender: TObject);
var selListIndex:Integer;
begin
if tasks_LV.Selected=nil then  exit;

selListIndex:=Tasks_LV.Selected.Index+1;
CurrentTaskIndex:=ListTotaskIndex[selListIndex];
CurrentProcessID:=theTask[CurrentTaskIndex].ProcessID;
Scan_Gauge.MaxValue:=theTask[CurrentTaskIndex].TotalProcess;
Value_Edit.Text:=theTask[CurrentTaskIndex].ScanValue;
if theTask[CurrentTaskIndex].ScanType=String_Scan then
 Value_Edit.Text:=''''+theTask[CurrentTaskIndex].ScanValue+'''';
UpdateTaskInfo(CurrentTaskIndex);
VarType_cb.ItemIndex:=0; /////theTask[CurrentTaskIndex].VarType;
AddFoundToListView(CurrentTaskIndex);
  Task_name:=theTask[CurrentTaskIndex].Name;
  MemRecordForm.FormRefresh;
end;

procedure TMainForm.Value_EditKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then Scan_bn.Click;
end;

procedure TMainForm.SelMemEdit_TBClick(Sender: TObject);
var tempAddress:Dword;
    Ecode:integer;
begin
if tasknum=0 then exit;
if (Found_LV.Selected=nil) and (Lock_LV.Selected=nil) then
begin
MemReadStartAddress:=$400000;
MemEditForm.Address_Edit.Text:='00400000';
   MemEditUnit.Myrect.Left:=1; //得到最后一位
  MemEditUnit.Myrect.Top:=1;
  MemEditUnit.Myrect.Right:=MemEditUnit.Myrect.Left;
  MemEditUnit.Myrect.Bottom:=1;
  MemEditUnit.MemEditForm.MEM_sg.Selection:=MemEditUnit.Myrect;
end
 else
begin
MemEditForm.Caption:=String_MemEditTitle +'<'+thetask[CurrenttaskIndex].Name+'>';
if (Found_LV.Selected<>nil) then Val('$'+Found_lv.Selected.Caption,tempAddress,Ecode);
if (Lock_LV.Selected<>nil) then Val('$'+Lock_lv.Selected.SubItems[0],tempAddress,Ecode);
 MemReadStartAddress:=(TempAddress and $FFFFFFF0);//去掉最后一位s
MemEditForm.Address_Edit.Text:=intToHex(MemReadStartAddress,8);

   MemEditUnit.Myrect.Left:=(TempAddress and $F)+1; //得到最后一位
  MemEditUnit.Myrect.Top:=1;
  MemEditUnit.Myrect.Right:=MemEditUnit.Myrect.Left;
  MemEditUnit.Myrect.Bottom:=1;
  MemEditUnit.MemEditForm.MEM_sg.Selection:=MemEditUnit.Myrect;
end;

MemEditForm.show;

end;

procedure TMainForm.tasks_LVEdited(Sender: TObject; Item: TListItem;
  var S: String);
begin
theTask[CurrenttaskIndex].Name:=S;
UpdateTaskInfo(CurrenttaskIndex);
end;

procedure TMainForm.ClearAlltasks_menuClick(Sender: TObject);
var i,SelListIndex,theIndex:integer;
begin


if tasknum=0 then Exit;
for i:=1 to Tasks_LV.Items.Count do  
begin
SelListIndex:=i;
theIndex:=ListToTaskIndex[SelListIndex];
if theTask[theindex].InSearchProcess  then
 begin
 MessageBox(Application.Handle,pchar(String_InScan),pchar(String_InScanTitle),
           MB_OK or MB_ICONINFORMATION);

  exit;
 end;
end;

for i:=1 to Tasks_LV.Items.Count do
begin
SelListIndex:=i;
theIndex:=ListToTaskIndex[SelListIndex];
theTask[theIndex].Applyed:=False;
theTask[theIndex].AddressMemStream.Clear;
theTask[theIndex].AdvancedAddressMemStream.Clear;
DeleteFile(theTask[theIndex].MemoryFileName);
DeleteFile(theTask[theIndex].MemoryFileNameNew);
end;

TaskNum:=0;
Tasks_LV.Items.Clear;
UpdateTaskInfo(theTask[theIndex].Index);

end;

procedure TMainForm.EditAddress_tbClick(Sender: TObject);
begin
memRecordForm.Show;
end;

procedure TMainForm.FoundMem_MemuClick(Sender: TObject);
var tempAddress:Dword;
    Ecode:integer;
begin
if (tasknum<>0)and(Found_lv.Selected<>nil) then
 begin
 Val('$'+Found_lv.Selected.Caption,tempAddress,Ecode);
 MemReadStartAddress:=(TempAddress and $FFFFFFF0);//去掉最后一位s
 MemEditForm.Caption:=String_MemEditTitle+thetask[CurrenttaskIndex].Name;
 memeditForm.Address_Edit.Text:=intToHex(MemReadStartAddress,8);
   MemEditUnit.Myrect.Left:=(TempAddress and $F)+1; //得到最后一位
  MemEditUnit.Myrect.Top:=1;
  MemEditUnit.Myrect.Right:=MemEditUnit.Myrect.Left;
  MemEditUnit.Myrect.Bottom:=1;
  MemEditUnit.MemEditForm.MEM_sg.Selection:=MemEditUnit.Myrect;
  MemEditForm.Show;
 end;

end;

procedure TMainForm.Found_LVDblClick(Sender: TObject);
begin
if Found_LV.Selected<>nil then  MemRecordForm.Show;
end;

procedure TMainForm.EditLock_MemuClick(Sender: TObject);
begin
if Found_LV.Selected<>nil then
 MemRecordForm.Show;
end;

procedure TMainForm.New1_menuClick(Sender: TObject);
var Temphandle:Thandle;
    i:integer;
begin
 if (taskNum=0)then
 begin
 ProcessListForm.Refresh_BN.Click;
 ProcessListForm.Show;
 end else
 if tasks_LV.Selected<>nil then
 begin
 Temphandle:=OpenProcess(PROCESS_ALL_ACCESS,False,CurrentProcessID);
 if  Temphandle>0 then
   begin
    ///判断是否超出任务数极限
    if TaskNum>=MaxTaskNum then
    begin
    showmessage(Format(String_Maxtask,[Maxtasknum]));
    Exit;
    end;
    INC(TaskNum);
    ///找到对应顺序
    for i:=1 to MaxTaskNum do   if thetask[i].Applyed=False then  Break;
    ///新任务付值,最主要的 为ID;
    GPKernel.Initthetask(i);
    TheTask[i].Applyed:=True;
    ListToTaskindex[TaskNum]:=i;
    
    With Thetask[i] do
    begin
    TheTask[i].Index:=i;
    TheTask[i].Name:=TheTask[CurrentTaskIndex].Name;
    TheTask[i].ProcessID:=TheTask[CurrentTaskIndex].ProcessID;     ///极为重要!!!!!!
    TheTask[i].ProcessHandle:=TheTask[CurrentTaskIndex].ProcessHandle;            //可有可无
    TheTask[i].MemoryFileName:=AppPAth+'temp\Memory'+intToStr(i)+'.TMP1';
    TheTask[i].MemoryFileNameNew:=AppPAth+'temp\Memory'+intToStr(i)+'.TMP2';
    end;

    CurrentTaskIndex:=TheTask[i].Index;
    CurrentProcessID:=TheTask[i].ProcessID;
    
    AddTasktoList(i);
    UpdateTaskInfo(i);
   end else
   begin
   Showmessage(String_Taskinvalid);
   ProcessListForm.Refresh_BN.Click;
   ProcessListForm.Show;
   end;
 CloseHandle(Temphandle);
 end else showmessage(String_NeedSeletedtask);
end;
{
procedure ttreLock_LVDblClick(Sender: TObject);
var tempAddress:Dword;
    Ecode:integer;
begin
if Found_lv.Selected<>nil then
 begin
 Val('$'+Found_lv.Selected.Caption,tempAddress,Ecode);
 MemReadStartAddress:=(TempAddress and $FFFFFFF0);//去掉最后一位s
 MemEditForm.Caption:='内存查看与修改 '+thetask[CurrenttaskIndex].Name;
 memeditForm.Address_Edit.Text:=intToHex(MemReadStartAddress,8);
 end;
MemEditForm.Show;
end;
 }
procedure TMainForm.Lock_LVDblClick(Sender: TObject);
begin
if (Lock_LV.Selected<>nil)and (lockNum>0) then MemRecordForm.Show;
end;


procedure TMainForm.Found_LVMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var tempAddress:Dword;
    Ecode:integer;
    TempByte:Byte;
    TempWord:Word;
    TempDword:Dword;
    Tempint64:int64;
    TempSingle:Single;
    TempDouble:Double;
    TempString:String[16];
begin
if taskNum=0 then exit;
if Found_LV.Selected<>nil then
begin
Val('$'+Found_lv.Selected.Caption,tempAddress,Ecode);
Lock_Name:='Money';
Lock_Address:=tempAddress;
if (theTask[CurrenttaskIndex].ScanType<>Number_Scan) and
   (theTask[CurrenttaskIndex].ScanType<>String_Scan) then
Lock_ValueType:=Word_Value else
Lock_ValueType:=theTask[CurrenttaskIndex].VarType;
case Lock_ValueType of
Byte_value:  begin
             ReadMemory(CurrentProcessID,tempAddress,@tempByte,Byte_value);
             Lock_value:=IntToStr(tempByte);
             end ;
Word_value:  begin
             ReadMemory(CurrentProcessID,tempAddress,@TempWord,Word_value);
             Lock_value:=IntToStr(TempWord);
             end ;
Dword_value:  begin
             ReadMemory(CurrentProcessID,tempAddress,@TempDword,Dword_value);
             Lock_value:=IntToStr(TempDword);
             end ;
Int64_value:  begin
             ReadMemory(CurrentProcessID,tempAddress,@Tempint64,Int64_value);
             Lock_value:=IntToStr(Tempint64);
             end ;
Single_value:  begin
             ReadMemory(CurrentProcessID,tempAddress,@TempSingle,Single_value);
             Lock_value:=FloatToStr(TempSingle);
             end ;
Double_value:  begin
             ReadMemory(CurrentProcessID,tempAddress,@TempDouble,Double_value);
             Lock_value:=FloatToStr(tempDouble);
             end ;
String_value:  begin
             ReadMemory(CurrentProcessID,tempAddress-1,@TempString,String_value);
             Lock_value:=tempString;
             end ;
end;
 Lock_Type:=0;
 Lock_Info:=1;
end;
Task_name:=theTask[CurrentTaskIndex].Name;
MemRecordForm.FormRefresh;
end;

procedure TMainForm.LockRemove_menuClick(Sender: TObject);
var i,SelListIndex,theIndex:integer;
begin
if (Lock_LV.Selected=nil)or (lockNum=0) then Exit;
Lock_Enable:=False;
SelListIndex:=Lock_LV.Selected.Index+1;
theIndex:=ListToLockIndex[SelListIndex];
MemlockRecord[theindex].Applyed:=False;
Dec(LockNUm);
  for i:=SelListIndex to LockNum do
   begin
    ListToLockIndex[i]:=ListToLockIndex[i+1];
   end;
Lock_lv.selected.Delete;

   for i:=1 to LockNum do
   begin
   theIndex:=ListToLockIndex[i];
   UpdateLockInfo(theIndex,i-1);
   end;
Lock_Enable:=true;
end;

procedure TMainForm.FoundAdd_memuClick(Sender: TObject);
var i:integer;
begin
if Found_LV.Selected<>nil then
 begin
   if LockNum>=MaxLockNum then
   begin
   Showmessage(Format(String_maxLockNum,[MaxLockNum]));
   Exit;
   end;
   
  for i:=1 to MaxLockNum do
   if memLockRecord[i].Applyed=False then  Break;

   
  Inc(LockNum);
  MemLockRecord[i].Applyed:=True;
  ListToLockIndex[LockNum]:=i;


  with memLockRecord[i] do
  begin
        Description:='Addr '+intToStr(i);
        Address:=StrToint('$'+Found_lv.Selected.Caption);
        valueStr:=Lock_value;
        VarType:=Lock_ValueType;            ///这些都在 Found_LVMouseDown
        ProcessID:=CurrentProcessID;
        Frozen :=True;
        Applyed:=true;      //运用/闲置标志
  end;

 with Lock_LV.Items.add do
 begin
  Caption:='';
  Subitems.Add('');
  Subitems.Add('');
  Subitems.Add('');
  Subitems.Add('');
  Subitems.Add('');
 end;

 UpdateLockInfo(i,LockNum-1);
 
 end;
end;

procedure TMainForm.Lock_ClearClick(Sender: TObject);
var i:integer;
begin
Lock_Enable:=False;
Lock_lV.Items.Clear;
LockNum:=0;
 for i:=1 to maxLockNum do
 begin
  MemLockRecord[i].Applyed:=False;
 end;
Lock_Enable:=true;
end;

procedure TMainForm.LockAddress_menuClick(Sender: TObject);
var tempAddress:Dword;
    Ecode:integer;
begin

if (tasknum<>0) and( Lock_lv.Selected<>nil) then
 begin
 Val('$'+Lock_lv.Selected.SubItems[0],tempAddress,Ecode);
 MemReadStartAddress:=(TempAddress and $FFFFFFF0);//去掉最后一位s
 memeditForm.Address_Edit.Text:=intToHex(MemReadStartAddress,8);
   MemEditUnit.Myrect.Left:=(TempAddress and $F)+1; //得到最后一位
  MemEditUnit.Myrect.Top:=1;
  MemEditUnit.Myrect.Right:=MemEditUnit.Myrect.Left;
  MemEditUnit.Myrect.Bottom:=1;
  MemEditUnit.MemEditForm.MEM_sg.Selection:=MemEditUnit.Myrect;
  MemEditForm.Show;
 end;

end;

procedure TMainForm.Lock_LVEdited(Sender: TObject; Item: TListItem;
  var S: String);
var theIndex:integer;
begin
theIndex:=ListToLockIndex[Item.Index+1];
MemLockRecord[theIndex].Description:=S;
end;

procedure TMainForm.Lock_LVMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var theIndex:integer;
begin
if (Lock_LV.Selected<>nil)and (lockNum>0) then
begin
theIndex:=ListToLockIndex[Lock_LV.Selected.Index+1];
Lock_Address:=MemLockRecord[theIndex].Address;
Lock_Name:=MemLockRecord[theIndex].Description;
Lock_ValueType:=MemLockRecord[theIndex].VarType;
Lock_value:=MemLockRecord[theIndex].valueStr;
if MemLockRecord[theIndex].Frozen then Lock_Type:=0 else Lock_Type:=1;
Lock_Info:=2;
Task_name:=Lock_Name;
MemRecordForm.FormRefresh;
end; 
end;

procedure TMainForm.SaveLockRecord_TBClick(Sender: TObject);
var SaveStream:TFileStream;
    theIndex,I:Integer;
    
begin
if LockNum=0 then Exit;
if SaveLockRecordDialog.Execute then
begin
 try
  SaveStream:=TFileStream.Create(SaveLockRecordDialog.FileName,fmCreate or fmShareDenyNOne);
  SaveStream.WriteBuffer(String_GPSAVE,sizeof(String_GPSAVE));
  for i:=1 to LockNum do
  begin
   theIndex:=ListToLockIndex[i];
   SaveStream.WriteBuffer(MemLockRecord[theIndex],sizeof(MemLockRecord[theIndex]));
  end;
  finally
   FreeAndNil(SaveStream);
  end;
end;

end;

procedure TMainForm.OpenLockRecord_TBClick(Sender: TObject);
var I,J:Integer;
    OpenStream:TFileStream;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -