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 


Game requiring specific name length

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

Joined: 13 Aug 2024
Posts: 1

PostPosted: Tue Aug 13, 2024 12:22 pm    Post subject: Game requiring specific name length Reply with quote

I'm having the game, where I'm messing with changing textures for my character. As soon as the new texture's name has the same amount of characters as the initial one, everything is okay and the texture loads after a minute or so.

Unfortunately, when the new texture's name is longer, the game will only read the same, specified amount of characters (for example if I change "TextureName" to "TextureNameee", the game will still only read "TextureName"). In the memory region, I found the address that was responsible for it, but here comes another problem.

That's how the situation looks in memory view:
Code:
TextureName . . . . . . . .

The fifth "dot" (I guess you can call it like it?) is the address specifying the name's length in 4 bytes. If my new texture's name is too long, it simply overwrites this address and the game crashes.

Is there any way to walk around this? Any replies are greatly appreciated.[/code]

_________________
I'm a huge Cheat Engine noob, which requires simple explanation . _ .
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4706

PostPosted: Tue Aug 13, 2024 1:08 pm    Post subject: Reply with quote

Nothing simple. This is less about the typical "find and change values" that CE is most often used for and more about reverse engineering- e.g. knowing various string data structure implementations (including short string optimizations). You might have to work with the game's memory allocator too.
If that's static memory, you're kind of screwed. The "easiest" solution is to recompile the game from source. Assuming you don't have that, you'd have to go through every static memory access in the entire game and adjust it if necessary to account for one string value taking up more memory. CE can analyze code and find most static memory references, but it can't get everything for certain.

Work around that issue instead. Don't try to increase the length of a string.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Emya
Newbie cheater
Reputation: 0

Joined: 28 Jul 2024
Posts: 14

PostPosted: Wed Aug 14, 2024 8:18 am    Post subject: u can use asm meow~ Reply with quote

In the game I'm modifying, if a string starts at address 0x00001000, then its length will be stored at 0x00001000+0x10, and its alignment at 0x00001000+0x14 (which is always a multiple of 15, meow~). By observing its byte array, you can see this, meow meow~

I had the exact same issue as you before! It bothered me for months until I finally figured it out, meow~ So now, when I modify a string, I make sure to update its length as well, meow! If the length isn't less than 15, you'll need to turn the first four bytes into a pointer (it’s a must, meow!).

At this point:

The string content is at [0x00001000]
The string length is at 0x00001010
The string alignment is at 0x00001014
(I have a low education level and poor expression skills, so this is the best way I can explain it, meow meow~)

Here’s the code I wrote a few days ago to calculate the length of a string and automatically determine if it needs to be turned into a pointer, meow~:

// eax = string_input
// esi = string_output
// edx = size

pushad

xor edx,edx // mov edx,0

code:

inc edx // get size
cmp byte [eax+edx],00
jne code

cmp edx,0F

mov [esi+00],eax // ptr
ja code1 // if size >15 then jmp

mov ecx,[eax+00] // no ptr
mov [esi+00],ecx
mov ecx,[eax+04]
mov [esi+04],ecx
mov ecx,[eax+08]
mov [esi+08],ecx
mov ecx,[eax+0C]
mov [esi+0C],ecx

code1:

mov [esi+10],edx // mov size
mov [esi+14],edx

popad

I didn’t write the alignment code because I found out that even if its value is the same as the length, it still runs fine, meow~ Maybe I’m wrong, and I shouldn't be lazy. When I encounter an issue, I’ll write the alignment calculation code, meow meow!
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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