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 


Setting a value to 1 in Auto-Assembler

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

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Fri Sep 11, 2015 8:01 pm    Post subject: Setting a value to 1 in Auto-Assembler Reply with quote

I made a Lua script in the previous version of Minecraft simply by nopping the line "comiss xmm6,[rbx+0C]" which accessed some sort of function that decided how close a block was to breaking.
This method no longer works in the newest version but I have a solution (not 100% how to implement it though).
Basically there's a FLOAT value that's "0" when the block isn't touched, and as you start smacking it that value counts up. When it reaches "1" it breaks.

How exactly can I set that value equal to 1 using a Lua script?
I've tried to use the mov register on [rdi+0C] but it always seems to crash the game or not do anything. Also, what's this about getting the correct amount of bytes? Do I always have to count how much each register takes up? It's a little confusing.


Thanks!


Last edited by user5594 on Sat Sep 12, 2015 10:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Sep 11, 2015 9:41 pm    Post subject: Reply with quote

Not entirely sure why you're using Lua to NOP or change assembly bytes...
You want to replace both the instruction and the one before it.
Those currently contain the bytes: F3 0F 58 5F 0C F3 0F 11 5F 0C
You should replace those bytes with: C7 47 0C 00 00 80 3F 90 90 90
In case you're wondering, those bytes represent:
Code:
mov [rdi+0C],(float)1.0
nop
nop
nop

And yes, you always need to replace the existing bytes with the same number of bytes.
Otherwise, the instruction at that code and every instruction after becomes something completely different.
Back to top
View user's profile Send private message
user5594
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Sat Sep 12, 2015 12:11 am    Post subject: Reply with quote

Zanzer wrote:
Not entirely sure why you're using Lua to NOP or change assembly bytes...
You want to replace both the instruction and the one before it.
Those currently contain the bytes: F3 0F 58 5F 0C F3 0F 11 5F 0C
You should replace those bytes with: C7 47 0C 00 00 80 3F 90 90 90
In case you're wondering, those bytes represent:
Code:
mov [rdi+0C],(float)1.0
nop
nop
nop

And yes, you always need to replace the existing bytes with the same number of bytes.
Otherwise, the instruction at that code and every instruction after becomes something completely different.


I could manually change this value to 1 and freeze it, but it kind of depends on the Freeze speed (in ms) that the user is using. I figured setting it to one in the actual code that modifies the value would be more effective. I'll try your code when I on my PC. Thanks Smile
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Sep 12, 2015 1:28 am    Post subject: Reply with quote

So that movss [rdi++0C],xmm3, do an AOB injection template on it.

Then in the script, have it do this.

movss [rdi++0C],xmm3 //Original move, which is untouched.
mov [rdi++0C] (Float)1.0 //Overwrite the result with 1.0.

CE will understand (Float)1.0 and convert it to the hex equivalent for you, so you'll be moving that hardcoded float into that address every time right after the block's damage value is added.

I still haven't upgraded to W10, but that should work and it's how I'd approach it nowadays. You may need to set it to like, 0.999 instead depending on how the engine works though. Not sure.

_________________
Back to top
View user's profile Send private message
user5594
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Sat Sep 12, 2015 2:34 am    Post subject: Reply with quote

Rydian wrote:
So that movss [rdi++0C],xmm3, do an AOB injection template on it.

Then in the script, have it do this.

movss [rdi++0C],xmm3 //Original move, which is untouched.
mov [rdi++0C] (Float)1.0 //Overwrite the result with 1.0.

CE will understand (Float)1.0 and convert it to the hex equivalent for you, so you'll be moving that hardcoded float into that address every time right after the block's damage value is added.

I still haven't upgraded to W10, but that should work and it's how I'd approach it nowadays. You may need to set it to like, 0.999 instead depending on how the engine works though. Not sure.


Any reason behind leaving the original code? Wouldn't it be the same to nop it and add the mov? I'm fairly certain that 1.0 will work because I can manually set this value to anything greater than 1 and it works. I still can't get on my main PC so I will have to test the code it the morning Sad
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Sep 12, 2015 2:50 am    Post subject: Reply with quote

In this case you can do that since movss doesn't modify the stack, it won't really matter anyways since even though the address will be set to the normal value, it will get overwritten before anything can check on it.

(I just can't make a template for it since I'm not on W10 yet.)

_________________
Back to top
View user's profile Send private message
user5594
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Sat Sep 12, 2015 1:12 pm    Post subject: Reply with quote

OK, Instant Dig is working with that code (thanks guys) however when the script is disabled, it doesn't replace with the original code (the line with (float)1.0 remains under the 1st line in the disassembler)

Code:
[ENABLE]
aobscanmodule(instantdignew,Minecraft.Win10.DX11.exe,F3 0F 11 5F 0C 48)
alloc(newmem,$1000,"Minecraft.Win10.DX11.exe"+20C5A)
registersymbol(instantdignew)

instantdignew:
  movss [rdi+0C],xmm3
  mov [rdi+0C],(float)1.0

[DISABLE]
instantdignew:
  db F3 0F 11 5F 0C

unregistersymbol(instantdignew)
dealloc(newmem)


I've tried some variations of this like adding nops after the line in the disable code but it always crashes the game.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Sep 12, 2015 1:32 pm    Post subject: Reply with quote

Did you give mine a go?
Code:
[ENABLE]
aobscanmodule(instantdignew,Minecraft.Win10.DX11.exe,F3 0F 58 5F 0C F3 0F 11 5F 0C)
registersymbol(instantdignew)
instantdignew:
  db C7 47 0C 00 00 80 3F 90 90 90
[DISABLE]
instantdignew:
  db F3 0F 58 5F 0C F3 0F 11 5F 0C
unregistersymbol(instantdignew)

I'd also like to point out that this is not Lua.
Back to top
View user's profile Send private message
user5594
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Sat Sep 12, 2015 2:38 pm    Post subject: Reply with quote

Zanzer wrote:
Did you give mine a go?
Code:
[ENABLE]
aobscanmodule(instantdignew,Minecraft.Win10.DX11.exe,F3 0F 58 5F 0C F3 0F 11 5F 0C)
registersymbol(instantdignew)
instantdignew:
  db C7 47 0C 00 00 80 3F 90 90 90
[DISABLE]
instantdignew:
  db F3 0F 58 5F 0C F3 0F 11 5F 0C
unregistersymbol(instantdignew)

I'd also like to point out that this is not Lua.


OK, nice that is working! I must have messed up something because I did try your 1st code and it didn't work. Smile

Thanks again. Now I have to work on "targeting unique reads" because there's a function in this game that controls A TON of stuff that I want to edit.
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Sep 12, 2015 9:28 pm    Post subject: Reply with quote

Are your sure yours was using the template correctly?

As in start from the cheat table and then AOB injection templates and then insert the line I said for ease of use.

_________________
Back to top
View user's profile Send private message
user5594
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Sat Sep 12, 2015 9:42 pm    Post subject: Reply with quote

Rydian wrote:
Are your sure yours was using the template correctly?

As in start from the cheat table and then AOB injection templates and then insert the line I said for ease of use.


Yes I was doing that...I think I just messed up the order of something somewhere or added too many nops.

I still don't quite understand the byte counting and how you know how many bytes each instruction uses.
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Sep 12, 2015 10:31 pm    Post subject: Reply with quote

With the AOB injection template you don't need to count nops or anything.

it really looks like you didn't use the AOB injection template, because it includes more than you had there.

With the AOB injection template it puts a copy of the original code at the injected location (code:) and you can add/remove as you see fit without worrying about counting bytes because the template takes care of that in the injection section for you.

_________________
Back to top
View user's profile Send private message
user5594
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 72
Location: ::1

PostPosted: Sat Sep 12, 2015 10:34 pm    Post subject: Reply with quote

Rydian wrote:
With the AOB injection template you don't need to count nops or anything.

it really looks like you didn't use the AOB injection template, because it includes more than you had there.

With the AOB injection template it puts a copy of the original code at the injected location (code:) and you can add/remove as you see fit without worrying about counting bytes because the template takes care of that in the injection section for you.


Oh OK I see what you mean. I actually did use the template but it's kind of a (bad) habit of mine to delete some stuff and move the registersymbol line up Wink

So basically I can make all edits in the "code:" section and ignore "INJECT"?
That would really makes things easier. I'm guess you need to leave the jmp return as is.

Example code of what I was talking about below.
Code:
newmem:

code:
  mov eax,40
  movzx ecx,al
  jmp return

INJECT:
  jmp code
  nop
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Sep 12, 2015 11:18 pm    Post subject: Reply with quote

Sometimes the code: section will have more than what you targeted because it needs a certain number of bytes for the jump, so it may need to copy a few shorter instructions instead of just one longer one.
_________________
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