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 


Symbol/Label placement

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

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Tue Sep 12, 2023 9:07 am    Post subject: Symbol/Label placement Reply with quote

Hey everyone.
I tried an old game again and wanted to have some fun with CE

I made a damage multiplier script and it works when i place the label/symbol where i wouldnt think it would work. Someone please explain this to me.

Code:

[ENABLE]
...some labels and allocs...
label(originalcode)
label(exit)
alloc(Multi,4)
registersymbol(Multi)

Multi:                              //Script doesnt work with Multi symbol here
dd (float)1.0

newmem:
fld dword ptr [esp+6C]      //hit damage
fmul dword [Multi]
fstp dword ptr [esp+6C]    //new hit damage
jmp originalcode

originalcode:

fld dword ptr [eax+68]      //loads health
fsub dword ptr [esp+6C]   //subs new hitdamage from health

exit:
jmp returnhere

Multi:                              //Script works with Multi symbol here
dd (float)1.0

"bo2.exe"+7575E:
jmp newmem
nop 2
returnhere:

 
[DISABLE]
..some dealocs..
dealloc(Multi)
unregistersymbol(Multi)
"bo2.exe"+7575E:
fld dword ptr [eax+68]
fsub dword ptr [esp+6C]
//Alt: db D9 40 68 D8 64 24 6C



i thought i should write assembly top to bottom, but when i declare the value before Newmem the application just crashes and i dont know why.

Thanks in advance!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Tue Sep 12, 2023 10:15 am    Post subject: Reply with quote

Whatever is wrong with your script is in the part you omitted. Post the full script.

There's no point to `jmp originalcode`, but it won't cause any significant harm by being there.

_________________
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
Diambro
Newbie cheater
Reputation: 0

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Tue Sep 12, 2023 10:47 am    Post subject: Reply with quote

Thanks for the reply!
Oh i thought i leave the originalcode so i remember what it was

Fullcode:
Code:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
alloc(Multi,4)
registersymbol(Multi)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here
fld dword ptr [esp+6C]
fmul dword [Multi]
fstp dword ptr [esp+6C]
jmp originalcode

originalcode:

//fld dword ptr [esp+6C]
//fmul dword [Multi]
//fstp dword ptr [esp+6C]
fld dword ptr [eax+68]
fsub dword ptr [esp+6C]

exit:
jmp returnhere

Multi:
dd (float)1.0

"bo2.exe"+7575E:
jmp newmem
nop 2
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
dealloc(Multi)
unregistersymbol(Multi)
"bo2.exe"+7575E:
fld dword ptr [eax+68]
fsub dword ptr [esp+6C]
//Alt: db D9 40 68 D8 64 24 6C


thats all there is to it
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Tue Sep 12, 2023 11:16 am    Post subject: Reply with quote

There doesn't seem to be anything wrong. It should work fine if you place `Multi:` / `dd (float)1.0` before `newmem:`.
Note that you aren't required to. It'll work fine even if it's placed after the code in newmem.
Also you can't define it in two points at the same time. If you place it before newmem, remove the definition after newmem.

I'd use the full injection template and reorganize the code a little bit:
Code:
define(address,"bo2.exe"+7575E)
define(bytes,D9 40 68 D8 64 24 6C)

[ENABLE]
assert(address,bytes)

alloc(newmem,2048)
alloc(Multi,4)
label(returnhere)

// should work fine here too
//Multi:
//  dd (float)1.0

newmem:
  fld dword ptr [esp+6C]
  fmul dword [Multi]
  fstp dword ptr [esp+6C]
//originalcode:
  fld dword ptr [eax+68]
  fsub dword ptr [esp+6C]
  jmp returnhere

Multi:
  dd (float)1.0

address:
  jmp newmem
  nop 2
returnhere:
 
registersymbol(Multi)

[DISABLE]
address:
  db bytes
  // fld dword ptr [eax+68]
  // fsub dword ptr [esp+6C]

unregistersymbol(Multi)
dealloc(Multi)
dealloc(newmem)

_________________
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
Diambro
Newbie cheater
Reputation: 0

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Tue Sep 12, 2023 12:35 pm    Post subject: Reply with quote

Hey thanks! So you dont need to define labels? Thats good to know.
Ill try to use the full injection in the future.

Thanks again!
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