Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Delphi Game Trainer Help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
thstrrthtrh
Cheater
Reputation: 0

Joined: 08 Sep 2008
Posts: 49

PostPosted: Sun Nov 30, 2008 8:07 pm    Post subject: Delphi Game Trainer Help Reply with quote

I know there are other posts out there like this but none of them seem to work for me.
=-=
I am trying to make a standalone trainer and I am just testing if I can make one for pinball...
here is my code that I got from some site.
Code:
unit a;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ShellApi;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  WindowName : integer;
  ProcessId : integer;
  ThreadId : integer;
  buf : PChar;
  HandleWindow : Integer;
  write : cardinal;
   
Const WindowTitle = '3D Pinball for Windows - Space Cadet';
      Address = $00A80C62;
      PokeValue = $00003039;
      NumberOfBytes = 4;

implementation

{$R *.dfm}



procedure TForm1.FormCreate(Sender: TObject);
begin
//
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  WindowName := FindWindow(nil,WindowTitle);
  If WindowName = 0 then
  begin
    MessageDlg('The game must be running in the background.Run it now, and then try again.', mtwarning,[mbOK],0);
  end;

  ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);

  GetMem(buf,1);
  buf^ := Chr(PokeValue);
  WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);
  FreeMem(buf);
  closehandle(HandleWindow);
end;


end.

but when I run it it does not change the value that I can tell.
I just need to know if there is a better way to do it.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Nov 30, 2008 9:15 pm    Post subject: Reply with quote

The address is probably wrong.

Pinball uses pointers, and thus it will change. You have to take care of that
Back to top
View user's profile Send private message
thstrrthtrh
Cheater
Reputation: 0

Joined: 08 Sep 2008
Posts: 49

PostPosted: Sun Nov 30, 2008 9:40 pm    Post subject: Reply with quote

Yes I know that...
but I was just testing to see if it would work.
I had TSearch up and I had the value that worked at the time and still worked through out my debugging of the code.
=-=
Edit:Sorry I figured out what I was doing wrong, I had to add a @ at the beginning of the buf.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites