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 


I have a problem with a string

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

Joined: 21 Jan 2021
Posts: 7

PostPosted: Tue Aug 10, 2021 10:46 am    Post subject: I have a problem with a string Reply with quote

Can anyone help me with a problem? I tried to do a cheat for infinite life, comparing a string with a specific name gives me error saying it can't be compiled.

Like this code:


label(code)
label(return)

newmem:

cmp [esi+A88],'zL$health'
je code

nop
nop
nop
nop
nop

jmp return


code:
movss [esi+48],xmm0
jmp return



I tried to remove $ and it no longer gives compile error, but the cheat wan't work, how can I make a code keeping the string 'zl$health' ?



In this code the string work, example:


aobscanmodule(INJECT,Blightbound.exe,F3 0F 11 96 94 00 00 00 0F 57 C9 8B CE C7 46 7C 00 00 00 00 E8 94) // should be unique
alloc(newmem,$1000)

label(code)
label(return)
label(w)
newmem:

cmp [esi+10],'gold'
jne code

addss xmm2,[w]
movss [esi+00000094],xmm2
jmp return
w:
dq (float)10000

code:
movss [esi+00000094],xmm2
jmp return

INJECT:
jmp newmem
nop 3

return:
registersymbol(INJECT)


This code add money on pick up, the string 'gold' is accepted and does not give a compilation error, how can I do the same thing for the other code?

Tanks a lot
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Tue Aug 10, 2021 11:40 am    Post subject: Reply with quote

Please use code tags when posting code.

Code:

cmp [esi+A88],'zL$health'


This is an illegal instruction i.e. it's wrong. AutoAssembler uses cmp to compare two registers or a value held in a register against another value, usually in hexadecimal notation.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Tue Aug 10, 2021 12:04 pm    Post subject: Reply with quote

The auto assembler will automatically convert an array of characters to little-endian integers in instructions that take immediate values. However, the biggest immediate value cmp can use is an imm32, meaning CE will only compare 4 characters. You'd need 2 more cmp instructions to get everything.
(or put an 8 byte value in a register and cmp the register, requiring only 2 total cmp instructions)

_________________
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
DanyDollaro
Master Cheater
Reputation: 3

Joined: 01 Aug 2019
Posts: 334

PostPosted: Tue Aug 10, 2021 12:22 pm    Post subject: Reply with quote

The instruction:
Code:
cmp [esi+10],'gold'

Is assembled as:
Code:
cmp [esi+10],646C6F67

Because it is perfectly castable to a value of 4 bytes, instead in the case of
Code:
cmp [esi+A88],'zL$health'

It is illegal because you cannot compare any operand with a value of 8 bytes directly.

If you want to compare 2 strings you have to do something like this (this is an example, it will never compile):
Code:
newmem:

  // Store in the stack the registers that we are going to use
  push esi
  push edi
  push ecx

  // Load the following values into the following registers:
  // ESI -> a pointer to the first string
  // EDI -> a pointer to the second string
  // ECX -> the length of the strings
  lea esi, [str1]
  lea edi, [str2]
  mov ecx, 9
  repe cmpsb

  // Restore the registers we used
  pop ecx
  pop edi
  pop esi

  // You know
  je equal
  jmp different
Back to top
View user's profile Send private message
SilverRabbit90
How do I cheat?
Reputation: 0

Joined: 21 Jan 2021
Posts: 7

PostPosted: Wed Aug 11, 2021 4:24 am    Post subject: Reply with quote

Thank you very much everyone, now it is a little clearer to me. I'm sorry I didn't use the tags.
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