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 


String replacing function

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

Joined: 16 Nov 2016
Posts: 27

PostPosted: Sun Sep 03, 2017 2:56 am    Post subject: String replacing function Reply with quote

Hello, I wanted to change my name in a game using Cheat engine. I found the value, I could change it and everything is working but..
When I change the string value, the new one shouldn't be longer or shorter (length) than the old value.

When the new value is longer, it replaces only limited letters depending on the length.
Example: (Old value is 123456, new value is abcdefgh, but the new value turns out only abcdef, same length as the old one)

When the new value is shorter, it replaces with my new value + some last letters of old value to make length equal.
Example: (Old value is 123456789, new value is abcdef, but the new value turns out abcdef789, same length as the old one)

So how can I get rid of both of these issues? I want to make the text the one I wish.
Thanks.

Update: Okay, I figured out how to play with changing longer string to shorter by AOB, still need to know how to do the opposite though.
Back to top
View user's profile Send private message
Death GOD 7
Expert Cheater
Reputation: 0

Joined: 21 Jan 2017
Posts: 105
Location: Heaven and Hell

PostPosted: Sun Sep 03, 2017 3:26 am    Post subject: Reply with quote

If you use hex editing then you may know that the value length should be same.
The length of old value = the length of new value.
If you have value 1234 which length is 4 .changed value length should also be 4
Its all about hex editing

_________________

"If you are good at something,never do it for free"-The Joker
I know you are looking at this post, Hitler
Back to top
View user's profile Send private message
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Sun Sep 03, 2017 7:42 pm    Post subject: Reply with quote

So basically there's no way to get rid of the length limit?
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun Sep 03, 2017 10:11 pm    Post subject: Reply with quote

If it's just a basic C string, aka a pointer to memory where the characters are followed by a 0 byte (or 2 for a wide string) to mark the end, then you should be able to change the pointers that the game uses to point at the string to some allocated memory of whatever size you like instead of the original string.

If the string has memory allocated inside of a structure instead of a pointer then you'd have to find every place that the code could ever reference it and change the code to use it the way you want instead, eg. treating the first 4 bytes as a pointer to a string instead of the actual string... not usually practical.

Outside of that... I really haven't tried to mess with object-ified strings like C++ / C# have that "normally" would dynamically allocate memory as needed and have vtable pointers etc. so I can't really give any reliable info.
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 Gamehacking 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