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] address + string

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
bosman88
How do I cheat?
Reputation: 0

Joined: 06 Oct 2015
Posts: 9

PostPosted: Sun Nov 08, 2015 5:56 pm    Post subject: [Delphi] address + string Reply with quote

Hello

I'm trying to find solution to change value of address as string

for example this is my value ( I want to write in Edit "abc123" )

Code:
 
var
myval9: string;
begin
myval9 := sEdit14.Text;


then I have address
Code:
 pdword(pdword($00AB1914)^+$182c)^


and now I just want to connect my address with value from Edit
and get value from my project same like I would write in CE,
Can someone help me with this procedure?



ScreenHunter_275 Nov. 09 00.10.jpg
 Description:
 Filesize:  2.46 KB
 Viewed:  6758 Time(s)

ScreenHunter_275 Nov. 09 00.10.jpg


Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Nov 08, 2015 7:44 pm    Post subject: Reply with quote

The address of myval9 and sEdit14.Text are both inside your trainer.
You need to create a new memory address inside of the game and assign it the string value.
Then change the in-game string to point to your new address instead.
Or if the existing in-game string has enough space, directly write to that address.
Back to top
View user's profile Send private message
bosman88
How do I cheat?
Reputation: 0

Joined: 06 Oct 2015
Posts: 9

PostPosted: Mon Nov 09, 2015 5:30 am    Post subject: Reply with quote

Yes but it is a DLL trainer which uses game memory

for example for only for integer value which I used for example for RANGE was something like this

Code:
procedure TForm1.sButton8Click(Sender: TObject);
var
  I, Code: Integer;
  myval1: string;
begin
  myval1 := sEdit3.Text;
  Val(myval1, I, Code);
  if Code = 0 then
begin
  Pbyte($00f5715f)^:= I;
 end;
end;


this code allows to write only numbers and it works well for my range address


Well to write string I think I have to convert the value maybe cuz I want to give string for address PDword or maybe is way to use something other than PDword, My game allows to write 14 chars
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Nov 09, 2015 7:22 am    Post subject: Reply with quote

Have you tried pchar or pansichar instead?
Or loop through each character and write one pbyte at a time?
Sorry, I've never actually used delphi. Smile
Code:
var
  myval9 : string;
  myCharPtr : pchar;
  i : integer;
  addr : integer;
begin
  i := 1;
  myCharPtr := Addr(myval9);
  addr := pdword(pdword($00AB1914)^+$182c)^;

  while i <= Length(myval9) do
  begin
    pchar(addr)^ := myCharPtr^;
    Inc(i);
    Inc(addr);
    Inc(myCharPtr);
  end;
end;
Back to top
View user's profile Send private message
bosman88
How do I cheat?
Reputation: 0

Joined: 06 Oct 2015
Posts: 9

PostPosted: Mon Nov 09, 2015 8:23 am    Post subject: Reply with quote

I'm working with delphi 2-3 weeks only ;p as my new hobby before I worked a bit with lua, Your code looks good ;p but missing something,



Here I have other code I thought maybe to edit it to make this, But dunno I use it for change AOB, but my experience isn't enough to change it to edit string
Code:

var
  NoMinPChar : PChar;
begin
if  sCheckBox25.Checked then
begin
  NoMinPChar := #$31#$C0#$C3;
  MoveMemory(Pointer($0077884A),NoMinPChar,3);



ScreenHunter_277 Nov. 09 14.38.jpg
 Description:
 Filesize:  57 KB
 Viewed:  6656 Time(s)

ScreenHunter_277 Nov. 09 14.38.jpg


Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Nov 09, 2015 9:29 am    Post subject: Reply with quote

Oops, that was my fault, I named a variable addr when that's also the name of the function.
Combining the code you provided, try something like the following:
Code:
var
  mychar : PChar;
  myval9 : string;
begin
  mychar := Addr(myval9)
  MoveMemory(Pointer($0077884A), mychar, Length(myval9));
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