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

📄 mainunit.pas

📁 游戏克星江湖行游戏修改工具全部源码,功能很强的。
💻 PAS
📖 第 1 页 / 共 4 页
字号:
Single_value:  begin
              val(valueStr,tempSingle,Ecode);
             theStatus:=WriteMemory(ProcessID,Address,@tempSingle,Single_value,4);
             if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
                               MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
             end ;
Double_value:  begin
              val(valueStr,tempDouble,Ecode);
             theStatus:=WriteMemory(ProcessID,Address,@tempDouble,Double_value,8);
             if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
                               MainForm.Lock_Lv.Items.Item[i].SubItems[4]:=String_noapplying;
             end ;
String_value:  begin
             tempString:=valueStr;
             theStatus:=WriteMemory(ProcessID,Address,@tempString[1],String_value,Length(tempString));
             if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
                               MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
             end ;


end; ///case

    end;  ///with

    end;//try end;
    except
    Continue;
    end;

 end; ///for

end;

Procedure TTimerThread.Execute;
begin
while (Lock_Enable)do
begin
Synchronize(ProcessLock);
sleep(GPOptions.Lock_Interval);
end;
end;

procedure TMainForm.Wmhotkeyhandle(var msg:Tmessage);
begin
 if (msg.LParamHi=GPOptions.MainHotKey_value) and (msg.lparamLo=GPOptions.MainHotKey_mode) then
 begin
  msg.Result:=1; //该消息已经处理
  SetActiveWindow(MainForm.Handle);
  DefWindowProc(MainForm.Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
  SetForegroundWindow(MainForm.Handle);
  application.BringToFront;
 end;


end;

Procedure TmainForm.RaiseInputError;
begin
with theTask[CurrenttaskIndex] do
  begin
          inc(ErrorInputNum);
          Value_Edit.SetFocus;          
          if ErrorInputNum>3 then
             begin
                Messagebeep(0);
                ErrorInputNum:=0;
                InputHelp_sb.click;
             end;

  end;    
end;


procedure TMainForm.FormCreate(Sender: TObject);
var TheOptionStream:TMemoryStream;
    OptionsFileName:String;
      Reg:TRegistry;
  //  ReadRegName:string;
  //  ReadRegCode:string;
  //  TrueRegCode:string;
  //  RegDate:Integer;
begin

Reg:=Tregistry.Create;
Reg.Rootkey:= HKEY_LOCAL_MACHINE;
////////////////////////
{
if Reg.OpenKey('SOFTWARE\XGQsoft\GamePaladin\',true) then
begin
 if not reg.ValueExists('Registration Date') then
 begin
 RegDate:=Trunc(now) xor 790726;
 Reg.WriteString('Registration Date',inttoStr(RegDate));
 end;
Reg.CloseKey;
end; 

Reg.Rootkey:= HKEY_LOCAL_MACHINE;
if Reg.OpenKey('SOFTWARE\XGQsoft\GamePaladin\',true) then
begin
ReadRegName:=Reg.ReadString('Registration Name');
ReadRegCode:=Reg.ReadString('Registration Code');
Reg.CloseKey;
end;
if (not Nametocode(ReadRegName,TrueRegCode) ) or
   (ReadRegCode<>TrueRegCode) then
begin
RegisterForm:=TregisterForm.Create(self);
RegisterForm.ShowModal;
FreeandNil(RegisterForm);
end;
}
////////////////////////

String_GPSAVE:='XuGanQuan Software of Game Paladin II';
apppath:=ExtractFilePath(Application.ExeName);
if not DirectoryExists(apppath+'temp') then CreateDirectory(pchar(apppath+'temp'),nil);
MyFavoritesForm:=TMyFavoritesForm.Create(Application,Myfavorites_TS);
MyFavoritesForm.show;
ArchiveEditForm:=TArchiveEditForm.Create(Application,ArchiveEdit_TS);
ArchiveEditForm.Show;
CapturePicForm:=TCapturePicForm.Create(Application,CapPic_TS);
CapturePicForm.Show;
GameRecordForm:=TGameRecordForm.Create(Application,GameRecord_TS);
GameRecordForm.Show;
TTimerThread.Create;

hotkeyid_Main:=GlobalAddAtom(pchar('XGQ_GamePaladin_HotKey01'))-$C000;
hotkeyid_Capture:=GlobalAddAtom(pchar('XGQ_GamePaladin_HotKey02'))-$C000;

TheOptionStream:=TMemoryStream.Create;
TheOptionStream.SetSize(0);
OptionsFileName:=Apppath+'GPOptions.dat';
if FileExists(OptionsFileName) then TheOptionStream.LoadFromFile(Apppath+'GPOptions.dat');

///读取或者还原默认值
try

if TheOptionStream.size<>sizeof(GPOptions) then
 begin
  with GpOptions do
  begin
  WhichPage:=1;
  AlphaBlend:=0;
  AlphaBlendValue:=120;
  MainHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
  MainHotKey_value:=$77; ////F8
  ScanAddressMode:=1;
  DefaultFromAddress:=$0001000;
  DefaultToAddress:=$86500000;
  CaptureSaveMode:=1;
  CaptureSavePath:=apppath+'capture\';
  CaptureHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
  CaptureHotKey_value:=$78; ///F9
  setActivePage:=1;
  Lock_Interval:=500;
  FormWidth:=650;
  FormHeigth:=460;
 end;
 SaveOptions;
 end else  TheOptionStream.ReadBuffer(GPOptions,sizeof(GPOptions));

finally
 freeandNil(TheOptionStream);
end;

////////校正/////////////////////////
 with GpOptions do
 begin
  if WhichPage>7 then WhichPage:=1;
  if AlphaBlend>1 then AlphaBlend:=0; 
  if AlphaBlendValue<=80 then AlphaBlendValue:=200;
  //MainHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
 // MainHotKey_value:=$77; ////F8
  if ScanAddressMode>4 then ScanAddressMode:=1;
  if  DefaultFromAddress>=DefaultToAddress then
  begin
  DefaultFromAddress:=$0001000;
  DefaultToAddress:=$86500000;
  end;
  if CaptureSaveMode>3 then CaptureSaveMode:=1;
  //CaptureSavePath:=apppath+'capture\';
  //CaptureHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
 // CaptureHotKey_value:=$78; ///F9
  if setActivePage>3 then setActivePage:=1;
  if Lock_Interval>5000 then Lock_Interval:=500;
 end;
/////////////显示////////////////////////////////////////////
with GpOptions do
begin

 MainForm.Width:=FormWidth;
 MainForm.Height:=FormHeigth;
 
if AlphaBlend=0 then
  begin
    MainForm.AlphaBlend:=false;
    EnabledAlphaBlend_cb.State:=cbUnChecked;
  end
  else
  begin
  EnabledAlphaBlend_cb.State:=cbChecked;
  MainForm.AlphaBlend:=true;
  end;
Alphablend_TrackBar.Position:=AlphaBlendValue;
case  WhichPage  of
1:begin MyFavorite_TB.Down:=true;MyFavorite_TB.Click; end;
2:begin MemEdit_TB.Down:=true;    MemEdit_TB.Click; end;
3:begin archiveEdit_TB.Down:=true; archiveEdit_TB.Click; end;
4:begin CapPic_tb.Down:=true;      CapPic_tb.Click; end;
5:begin GameRecord_Tb.Down:=true;  GameRecord_Tb.Click; end;
6:begin SetOptions_tb.Down:=true;  SetOptions_tb.Click; end;
7:begin Help_Tb.Down:=true;         Help_Tb.Click; end;
end;

case  ScanAddressMode of
1:Set_1_Rb1.Checked:=true;
2:Set_1_Rb2.Checked:=true;
3:Set_1_Rb3.Checked:=true;
4:Set_1_Rb4.Checked:=true;
end;

Options_PageControl.ActivePageIndex:=setActivePage-1;

set_FromEdit.Text:=inttoHex(DefaultFromAddress,8);
set_ToEdit.Text:=inttoHex(DefaultToAddress,8);
Lock_TrackBar.Position:=Lock_Interval div 100;
Main_HotKey.HotKey:=HotKeyToShortCut(MainHotKey_mode,MainHotKey_value);
UnRegisterhotkey(MainForm.handle,hotkeyid_Main);
if not RegisterHotkey(MainForm.handle,hotkeyid_Main,MainHotKey_mode,MainHotKey_value)then
    begin
    SetOptions_tb.Down:=true;
    SetOptions_tb.Click;
    Options_PageControl.ActivePageIndex:=0;
    showmessage(String_NotSethotkey1);
    end;

if CaptureSaveMode=1 then SaveMode1.Checked:=true else
if CaptureSaveMode=2 then SaveMode2.Checked:=true else
if CaptureSaveMode=3 then SaveMode3.Checked:=true;
CaptureSavepath_Edit.Text:=CaptureSavePath;
UnRegisterhotkey(CapturePicForm.handle,hotkeyid_Capture);
if not RegisterHotkey(CapturePicForm.handle,hotkeyid_Capture,CaptureHotKey_mode,CaptureHotKey_value)then
    begin
    SetOptions_tb.Down:=true;
    SetOptions_tb.Click;
    Options_PageControl.ActivePageIndex:=1;
    showmessage(String_NotSethotkey2);
    end;

    
Reg.Rootkey:= HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
if reg.ReadString('GamePaladin')=application.exename then  Set_autoRun.state:=cbchecked else
Set_autoRun.state:=cbUNchecked; 
reg.CloseKey;
Reg.Free;



end;  ////with end;
Lock_Enable:=true;
TTimerThread.Create;
end;


///////////////任务相关////////////////////////////////////////////////////////////////////////
Procedure TmainForm.AddTasktoList(theIndex:integer);
begin
  with Tasks_LV.Items.Add do
   begin
   Caption:=theTask[theIndex].Name;
  // SubItems.Add(intToStr(theTask[theIndex].Index));
  // SubItems.Add(intToStr(theTask[theIndex].ProcessID))
   end;
end;


Procedure TmainForm.UpdateTaskInfo(theIndex:integer);
begin
if taskNum=0 then
begin
  Task_info_Name_LB.Caption:=String_notask;
  Task_Info_SearchResult_LB.Caption:=String_noresult;
  Found_lv.Clear;
end else
begin
  With theTask[theIndex] do
   begin
   Task_info_Name_LB.Caption:=Name;
   Task_Info_SearchResult_LB.Caption:=Format(String_ScanResult,[SearchTimes,AttachedNum]);
   end;

end;
end;


////////将搜索到的数值加入列表////////////////////
Procedure TmainForm.AddFoundToListView(theIndex:integer);
var BufSize:Int64;
    AddressBuf:Dword;
    i,j:Integer;
    TempByte:Byte;
    TempWord:Word;
    TempDword:Dword;
    Tempint64:int64;
    TempSingle:Single;
    TempDouble:Double;
    TempStringBYTE:Array[1..16] of BYTE;
    Tempstring:string;
begin
Found_LV.Items.BeginUpdate;///防止闪烁
Found_LV.Items.Clear;
with thetask[theIndex] do
begin
AddressmemStream.Seek(0,soFrombeginning); ////低阶搜索BufSize=0;
BufSize:= AddressMemStream.Size;
if (BufSize>0) and ( not thetask[theIndex].InSearchProcess) then
begin
BufSize:=BufSize shr 2;
if BufSize>200 then BufSize:=200;  ///只显示前面200个值
  For i:=1 to BufSize do        
  begin
    try

   AddressMemStream.ReadBuffer(AddressBuf,Sizeof(AddressBuf));
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempByte,Byte_value);
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempWord,Word_value);
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempDword,Dword_value);
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempInt64,Int64_value);
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempSingle,Single_value);
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempDouble,Double_value);
   GPKernel.Readmemory(ProcessID,AddressBuf,@TempStringBYTE,String_value);
   Tempstring:='';
   for  j:=1 to 16 do
     Tempstring:=Tempstring+chr(TempstringBYTE[j]);

    with Found_LV.Items.Add do
     begin
     Caption:=intTohex(AddressBuf,8);
     SubItems.Add(intToStr(TempByte));
     SubItems.Add(intToStr(TempWord));
     SubItems.Add(intToStr(TempDword));
     SubItems.Add(intToStr(TempInt64));
     SubItems.Add(FloatToStr(TempSingle));
     SubItems.Add(FloatToStr(TempDouble));
     SubItems.Add(TempString);
     end;
   except
    Continue;   //float ofent make error
   end;

  end;//for end

end; //if end

end;///with end
Found_lv.Items.EndUpdate;
end;

Procedure TMainForm.UpdateLockInfo(theIndex,theListIndex:integer);
var TypeStr:String;
begin
if memLockRecord[theIndex].Applyed then
 begin

     case memLockRecord[theIndex].VarType of
     Byte_value:TypeStr:=String_ByteType;
     Word_value:TypeStr:=String_WordType;
     Dword_value:TypeStr:=String_DWordType;
     Int64_value:TypeStr:=String_Int64Type;
     Single_value:TypeStr:=String_SingleType;
     Double_value:TypeStr:=String_DoubleType;
     String_value:TypeStr:=String_StringType;
     else
      TypeStr:=String_WordType;
     end;

      With Lock_LV.Items.item[theListIndex] do
      begin
       Caption:=memLockRecord[theIndex].Description;
       Subitems[0]:=(intToHex(memLockRecord[theIndex].Address,8));
       Subitems[1]:=(memLockRecord[theIndex].valueStr);
       Subitems[2]:=(TypeStr);
       Subitems[3]:=(intToStr(memLockRecord[theIndex].ProcessID));
       Subitems[4]:=(String_applying);
       if memLockRecord[theIndex].Frozen then Checked:=True else  Checked:=False;
      end;

 end;
end;

procedure TMainForm.Deltask_tbClick(Sender: TObject);
var i,SelListIndex,theIndex:integer;
begin
if tasknum=0 then Exit;
if Tasks_LV.Selected<>nil then
begin
SelListIndex:=Tasks_LV.Selected.Index+1;
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;
theTask[theindex].Applyed:=False;
theTask[theIndex].AddressMemStream.Clear;
theTask[theIndex].AdvancedAddressMemStream.Clear;
Dec(taskNUm);
  for i:=SelListIndex to TaskNum do
   begin
    ListToTaskIndex[i]:=ListToTaskIndex[i+1];
   end;
Tasks_lv.selected.Delete;
DeleteFile(theTask[theIndex].MemoryFileName);
DeleteFile(theTask[theIndex].MemoryFileNameNew);
UpdateTaskInfo(theTask[theIndex].Index);
end;
end;

procedure TMainForm.newtask_TBClick(Sender: TObject);
begin
 ProcessListForm.Refresh_BN.Click;
 ProcessListForm.Show;
end;
/////////////////////////////////////////////////////////////////////////////////

/////////////////////////任务辅助/////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
function Tmainform.CheckForScan:boolean;
begin
Result:=false;
with thetask[CurrentTaskIndex] do begin

case AnalyseScan(CurrentTaskIndex) of
0: begin
   Raise Exception.Create(String_Taskinvalid);
   end;
1: begin
      if MessageBox(Application.Handle,pchar(String_AskRepeatInitLowLevel),
              pchar(String_AskRepeatInitLowLevelTitle),
              MB_YESNO or MB_ICONINFORMATION)=IDYES then
       begin
         TotalProcess:=0;
         SearchTimes:=0;
         AttachedNum:=0;
         AdvancedAddressMemStream.Clear;
         AddressMemStream.Clear;
         Result:=True;
         Exit;
      end else exit;

    end;
2: begin
     if MessageBox(Application.Handle,pchar(String_TypeNoMatch),
              pchar(String_TypeNoMatchTitle),
              MB_YESNO or MB_ICONINFORMATION)=IDYES then
     begin
        TotalProcess:=0;
         SearchTimes:=0;
         AttachedNum:=0;
         AdvancedAddressMemStream.Clear;
         AddressMemStream.Clear;
         Result:=True;
         exit;
     end else Exit;
    end;
3:  begin
      if MessageBox(Application.Handle,pchar(String_NoResultAgain),
              pchar(String_NoResultAgainTitle),
              MB_YESNO or MB_ICONINFORMATION)=IDYES then
      begin
         TotalProcess:=0;
         SearchTimes:=0;
         AttachedNum:=0;
         AdvancedAddressMemStream.Clear;
         AddressMemStream.Clear;
         Result:=True;
         Exit;
      end else Exit;

    end;
4:  Result:=True;
   end;  ///case end

 end;///with edn

⌨️ 快捷键说明

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