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 


Cant get this script to work. Help needed...

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

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Sat Mar 25, 2017 7:47 am    Post subject: Cant get this script to work. Help needed... Reply with quote

Hi. I am making a item ID editor for Minecraft but I cant seam to get the script to work.

Here is the script:
Code:

aobscanmodule(Magic_Chest,Minecraft.Windows.exe,48 8B 48 10 48 89 5C 24 20)
alloc(newmem,$1000,"Minecraft.Windows.exe"+75FCAC)

label(code)
label(return)

globalalloc(_ID_Container,10)

newmem:
  push edx
  mov edx,[rax+10]
  mov [_ID_Container],edx
  pause
  mov edx,[_ID_Container]
  mov [rax+10],edx
  pop edx

code:
  mov rcx,[rax+10]
  mov [rsp+20],rbx
  jmp return

Magic_Chest:
  jmp newmem
  nop
  nop
  nop
  nop
return:
registersymbol(Magic_Chest)

[DISABLE]

Magic_Chest:
  db 48 8B 48 10 48 89 5C 24 20

unregistersymbol(Magic_Chest)
dealloc(newmem)


The game is only 148 MB big.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4299

PostPosted: Sat Mar 25, 2017 9:38 am    Post subject: Reply with quote

The pause instruction is pretty much useless. It's meant to avoid a memory order violation when exiting from a spinlock. It also delays execution of the next instruction for a little bit, but that doesn't mean you can feasibly change the value of [_ID_Container] between the write to it and the read from it.

What exactly are you trying to do with that code?

_________________
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
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Sat Mar 25, 2017 11:17 am    Post subject: Reply with quote

All I am trying to do is store all the item ids in [_ID_Container] so lets say 7C54ED70 so afterwards I can just make pointers and then edit them when I wanna so I can change diamonds into pickaxes or saddles into skeleton spawners etc. But for some reason
Code:
mov [_ID_Container],edx
and
Code:
mov edx,[_ID_Container]
don't work.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4299

PostPosted: Sat Mar 25, 2017 11:52 am    Post subject: Reply with quote

If you put a green marble in your hand, close your hand, and then open it, what color marble will you find? Obviously green. It's not going to magically change to some other color.

After you move edx into [_ID_Container], [_ID_Container] has the value of edx. Therefore, the second mov which reads from [_ID_Container] will almost always read the value it just stored to that address: edx.
Code:
-- say edx is 12 and [_ID_Container] is 7
mov [_ID_Container],edx  -- after this, both edx and [_ID_Container] are 12
mov edx,[_ID_Container]  -- same thing: both edx and [_ID_Container] are 12


Create a flag and check it to see if you should read from [_ID_Container] into edx or vise versa. Trying to do both at once is generally impossible as described above.

_________________
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
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Sat Mar 25, 2017 11:58 am    Post subject: Reply with quote

"Trying to do both at once is generally impossible as described above" ya I get that but I cant even activate the script. let it be just:
Code:

push ecx
mov ecx,[rax+10]
mov [_ID_Container],ecx
pop ecx
mov rcx,[rax+10]
mov [rsp+20],rbx


It doesn't activate. If I remove the line "mov [_ID_Container],ecx" then it will activate but there is no point of it doing that because well nothing has changed. Its the original code.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4299

PostPosted: Sat Mar 25, 2017 12:15 pm    Post subject: Reply with quote

Oh, right. There is no addressing mode which allows for a 64-bit displacement. This means you can't address memory directly by its address:
Code:
mov [_ID_Container],ecx  // [_ID_Container] is an illegal way to specify an address

(there is RIP-relative addressing which does allow this if _ID_Container is within a signed 32-bit displacement of the next instruction)

Move _ID_Container into a register and address the memory region using the register instead.
Code:
mov rdi,_ID_Container  // mov r64,imm64 is a valid instruction
mov [rdi],ecx

_________________
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
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