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

📄 memorytrainerunit.pas.svn-base

📁 这是一段游戏修改工具的源代码.ring3功能由dephi开发,驱动是C开发.希望对大家有帮助
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
             //onclick
             trainerfile.ReadBuffer(temp,sizeof(tag));
             case temp of
               1: onclick:=button1.OnClick;
               2: onclick:=btnlaunch.onClick;
               3: onclick:=button2.onClick;
               4: onclick:=button3.OnClick;
               else
               begin
                 if temp>=5 then //it's an execute cheat
                   onclick:=executecheat;
               end;
             end;

             trainerfile.ReadBuffer(temp,4);
             getmem(x,temp+1);
             trainerfile.ReadBuffer(x^,temp);
             x[temp]:=#0;
             command:=x;
             freemem(x);

             parent:=userdefinedform;
           end;

      1:   begin //tcheatlist
             setlength(userdefinedform.cheatlist,length(userdefinedform.cheatlist)+1);
             userdefinedform.cheatlist[length(userdefinedform.cheatlist)-1]:=tcheatlist.create(nil);

             with userdefinedform.cheatlist[length(userdefinedform.cheatlist)-1] do
             begin
               trainerfile.ReadBuffer(temp,sizeof(integer));
               left:=temp;
               trainerfile.ReadBuffer(temp,sizeof(integer));
               top:=temp;
               trainerfile.ReadBuffer(temp,sizeof(integer));
               width:=temp;
               trainerfile.ReadBuffer(temp,sizeof(integer));
               height:=temp;

               trainerfile.ReadBuffer(tempc,sizeof(tcolor));
               activationcolor:=tempc;
               trainerfile.ReadBuffer(tempc,sizeof(tcolor));
               color:=tempc;
               trainerfile.ReadBuffer(tempc,sizeof(tcolor));
               textcolor:=tempc;

               trainerfile.ReadBuffer(tempi,sizeof(integer));
               hotkeyleft:=tempi;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               descriptionleft:=tempi;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               editleft:=tempi;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               editwidth:=tempi;

               trainerfile.ReadBuffer(tempbc,sizeof(tbevelcut));
               bevelinner:=tempbc;
               trainerfile.ReadBuffer(tempbc,sizeof(tbevelcut));
               bevelouter:=tempbc;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               bevelwidth:=tempi;
               trainerfile.ReadBuffer(tempbk,sizeof(tbevelkind));
               bevelkind:=tempbk;

               trainerfile.ReadBuffer(tempb,sizeof(boolean));
               hascheckbox:=tempb;
               trainerfile.ReadBuffer(tempb,sizeof(boolean));
               showhotkeys:=tempb;

               parent:=userdefinedform;
             end;
           end;

      2:   begin //tcheat
             setlength(userdefinedform.cheat,length(userdefinedform.cheat)+1);
             userdefinedform.cheat[length(userdefinedform.cheat)-1]:=tcheat.create(nil);

             with userdefinedform.cheat[length(userdefinedform.cheat)-1] do
             begin
               trainerfile.ReadBuffer(temp,sizeof(integer));
               left:=temp;
               trainerfile.ReadBuffer(temp,sizeof(integer));
               top:=temp;
               trainerfile.ReadBuffer(temp,sizeof(integer));
               width:=temp;
               trainerfile.ReadBuffer(temp,sizeof(integer));
               height:=temp;

               trainerfile.ReadBuffer(cheatnr,sizeof(integer));
               trainerfile.ReadBuffer(tempc,sizeof(tcolor));
               activationcolor:=tempc;
               trainerfile.ReadBuffer(tempc,sizeof(tcolor));
               color:=tempc;
               trainerfile.ReadBuffer(tempc,sizeof(tcolor));
               textcolor:=tempc;

               trainerfile.ReadBuffer(tempi,sizeof(integer));
               hotkeyleft:=tempi;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               descriptionleft:=tempi;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               editleft:=tempi;
               trainerfile.ReadBuffer(tempi,sizeof(integer));
               editwidth:=tempi;

               trainerfile.ReadBuffer(tempb,sizeof(boolean));
               hascheckbox:=tempb;
               trainerfile.ReadBuffer(tempb,sizeof(boolean));
               showhotkey:=tempb;

               parent:=userdefinedform;
             end;
           end;

      3:   with timage2.create(nil) do //timage
           begin
             trainerfile.ReadBuffer(temp,sizeof(integer));
             left:=temp;
             trainerfile.ReadBuffer(temp,sizeof(integer));
             top:=temp;
             trainerfile.ReadBuffer(temp,sizeof(integer));
             width:=temp;
             trainerfile.ReadBuffer(temp,sizeof(integer));
             height:=temp;

             trainerfile.ReadBuffer(tempcursor,sizeof(tcursor));
             cursor:=tempcursor;

             trainerfile.ReadBuffer(tempb,sizeof(tempb));
             stretch:=tempb;
             trainerfile.ReadBuffer(tempb,sizeof(tempb));
             transparent:=tempb;

             trainerfile.ReadBuffer(temp,sizeof(integer));
             case temp of
               1: onclick:=button1.OnClick;
               2: onclick:=btnlaunch.onClick;
               3: onclick:=button2.onClick;
               4: onclick:=button3.OnClick;
               else
               begin
                 if temp>=5 then //it's an execute cheat
                   onclick:=executecheat;
               end;
             end;

             trainerfile.ReadBuffer(temp,4);
             if temp>0 then
               picture.Bitmap.LoadFromStream(trainerfile);

             trainerfile.ReadBuffer(temp,4);
             getmem(x,temp+1);
             trainerfile.ReadBuffer(x^,temp);
             x[temp]:=#0;
             command:=x;
             freemem(x);


             parent:=userdefinedform;
           end;

      4:   with tlabel2.Create(nil) do
           begin
             trainerfile.ReadBuffer(temp,sizeof(integer));
             left:=temp;
             trainerfile.ReadBuffer(temp,sizeof(integer));
             top:=temp;
             trainerfile.ReadBuffer(temp,sizeof(integer));
             width:=temp;
             trainerfile.ReadBuffer(temp,sizeof(integer));
             height:=temp;

             //caption
             trainerfile.ReadBuffer(temp,4);
             getmem(x,temp+1);
             trainerfile.ReadBuffer(x^,temp);
             x[temp]:=#0;
             caption:=x;
             freemem(x);

             //wordwrap
             trainerfile.ReadBuffer(tempb,sizeof(tempb));
             wordwrap:=tempb;

             trainerfile.ReadBuffer(tempc,sizeof(tcolor));
             font.Color:=tempc;

             //command
             trainerfile.ReadBuffer(temp,4);
             getmem(x,temp+1);
             trainerfile.ReadBuffer(x^,temp);
             x[temp]:=#0;
             command:=x;
             freemem(x);

             //cursor
             trainerfile.ReadBuffer(tempcursor,sizeof(tcursor));
             cursor:=tempcursor;

             //tag
             trainerfile.ReadBuffer(temp,sizeof(integer));
             case temp of
               1: onclick:=button1.OnClick;
               2: onclick:=btnlaunch.onClick;
               3: onclick:=button2.onClick;
               4: onclick:=button3.OnClick;
               else
               begin
                 if temp>=5 then //it's an execute cheat
                   onclick:=executecheat;
               end;
             end;

             trainerfile.ReadBuffer(tempb,sizeof(tempb));
             if tempb then
               Font.Style:=[fsUnderline]
             else
               Font.Style:=[];

             parent:=userdefinedform;


           end;

        $ffffffff: break;
        else raise exception.Create('The trainer has been corrupted');
      end;
    end;

    userdefinedform.show;
  end;

  //fill in the list
  for i:=0 to length(trainerdata)-1 do
  begin
    tempb:=false;
    for j:=0 to length(trainerdata[i].addressentrys)-1 do
      if trainerdata[i].addressentrys[j].userinput then
      begin
        tempb:=true;
        temps:=trainerdata[i].addressentrys[j].value;
      end;


    if userdefinedform<>nil then
    begin
      for j:=0 to length(userdefinedform.cheatlist)-1 do
      begin
        with userdefinedform.cheatlist[j] do
        begin
          addcheat(trainerdata[i].hotkeytext,trainerdata[i].description,temps,tempb);
        end;
      end;

      for j:=0 to length(userdefinedform.cheat)-1 do
      begin
        with userdefinedform.cheat[j] do
        begin
          Description:=trainerdata[j].description;
          Hotkey:=trainerdata[j].hotkeytext;
          HasEditBox:=tempb;
          Editvalue:=temps;
        end;
      end;
    end;

    clist.addcheat(trainerdata[i].hotkeytext,trainerdata[i].description,temps,tempb);

    //if not registerhotkey(self.Handle,i,trainerdata[i].hotshift,trainerdata[i].hotkey) then
    if not RegisterHotKey2(self.handle,i,trainerdata[i].hotkey) then
    begin
      //couldn't assign hotkey
      //disable that hotkey
      if userdefinedform<>nil then
      for j:=0 to length(userdefinedform.cheatlist)-1 do
      begin
        with userdefinedform.cheatlist[j] do
        begin
          userdefinedform.cheatlist[j].Items[i].Description:='';
          userdefinedform.cheatlist[j].Items[i].Hotkey:='';
          userdefinedform.cheatlist[j].Items[i].HasEditBox:=false;
        end;
      end else
      begin
        clist.Items[i].Description:='';
        clist.Items[i].Hotkey:='';
        clist.Items[i].HasEditBox:=false;
      end;

      if userdefinedform<>nil then
      for j:=0 to length(userdefinedform.cheat)-1 do
      begin
        with userdefinedform.cheat[j] do
        begin
          if cheatnr=i then
          begin
            Description:='';
            Hotkey:='';
            HasEditBox:=false;
          end;
        end;
      end;
    end;

    for j:=0 to length(trainerdata[i].addressentrys)-1 do
    begin
      if trainerdata[i].addressentrys[j].setvalue then
      case trainerdata[i].addressentrys[j].memtyp of
        0,1,2,6 : begin
                      try
                        trainerdata[i].addressentrys[j].valuei:=StrToInt64(trainerdata[i].addressentrys[j].value);
                      except
                        raise exception.Create('The value of '+trainerdata[i].description+' is invalid');
                      end;
                    end;

        3,4:        begin
                      try
                        trainerdata[i].addressentrys[j].valuef:=StrToFloat(trainerdata[i].addressentrys[j].value);
                      except
                        raise exception.Create('The value of '+trainerdata[i].description+' is invalid');
                      end;
                    end;

        5:          trainerdata[i].addressentrys[j].valuelength:=length(trainerdata[i].addressentrys[j].value);

        7:          begin
                      setlength(trainerdata[i].addressentrys[j].valuea,length(trainerdata[i].addressentrys[j].value));
                      for k:=0 to length(trainerdata[i].addressentrys[j].value)-1 do
                        trainerdata[i].addressentrys[j].valuea[k]:=ord(trainerdata[i].addressentrys[j].value[k+1]);

                      trainerdata[i].addressentrys[j].valuelength:=length(trainerdata[i].addressentrys[j].valuea);
                    end;

        8:          begin
                      ConvertStringToBytes(trainerdata[i].addressentrys[j].value,true,temptb);
                      setlength(trainerdata[i].addressentrys[j].valuea,length(temptb));
                      for k:=0 to length(temptb)-1 do
                        trainerdata[i].addressentrys[j].valuea[k]:=byte(temptb[k]);

                      setlength(temptb,0);
                      trainerdata[i].addressentrys[j].valuelength:=length(trainerdata[i].addressentrys[j].valuea);
                    end;

      end;

    end;      

  end;

  

  if userdefinedform<>nil then
  begin
    for i:=0 to length(userdefinedform.cheat)-1 do
      userdefinedform.cheat[i].onmousedown:=cheatclick;

    for i:=0 to length(userdefinedform.cheatlist)-1 do
      for j:=0 to userdefinedform.cheatlist[i].Count-1 do
        userdefinedform.cheatlist[i].Items[j].OnMouseDown:=cheatclick;
  end;

  //find out if the process is open
  CheckForProcess;

  if processhandle<>0 then
  begin //check and see if the process got changed. (check the code and see if they are nopped)
    for i:=0 to length(trainerdata)-1 do
      for J:=0 to length(trainerdata[i].codeentrys)-1 do
      begin
        //check for nops
        //if yes then set it to active
        setlength(tempab,length(trainerdata[i].codeentrys[j].originalopcode));
        readprocessmemory(processhandle,pointer(trainerdata[i].codeentrys[j].address),@tempab[0],length(tempab),temp);
        if not comparemem(@trainerdata[i].codeentrys[j].originalopcode[0],@tempab[0],length(tempab)) then
        begin
          //it is not the same
          //check if tempab consists out of nops
          for k:=0 to length(tempab)-1 do
            if tempab[k]<>$90 then raise exception.Create('The version of '+process+' that is currently running, is not compatible with this trainer!');

          //if we get here then it got nopped so set it to activated
          trainerdata[i].active:=true;

          if userdefinedform<>nil then
          begin
            for k:=0 to length(userdefinedform.cheatlist)-1 do

⌨️ 快捷键说明

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