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 


Use Label, Get inital Value, allow change and use

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

Joined: 09 Mar 2011
Posts: 131
Location: USA, FL

PostPosted: Fri Nov 18, 2016 3:07 pm    Post subject: Use Label, Get inital Value, allow change and use Reply with quote

index is a value from 0-255, that can be collected from the assembly. Instead of saying it starts at 0, I want to get the initial value of edx, store it in index, and then allow the user to change index after that to any number he wishes. Problem is this code keeps the number permanently and won't allow change. I need to fix that somehow, How would I go about getting the initial value and store it, but let it be changed afterwards?

Code:
index:
db 0

originalcode:
mov [index], edx
push edx
mov edx,[index]
lea ebx,[eax+edx*4+08]
mov [cPlayer],ebx
pop edx
mov eax,[eax+edx*4+08]
mov eax,[eax+000000bC]
jmp returnhere
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Nov 18, 2016 3:35 pm    Post subject: Reply with quote

Start index off as -1. Do a check to see if it equals -1.
Only then should you move EDX into its value.
Otherwise, write your value into EDX.
Back to top
View user's profile Send private message
Marcus101RR
Expert Cheater
Reputation: 2

Joined: 09 Mar 2011
Posts: 131
Location: USA, FL

PostPosted: Sat Nov 19, 2016 12:26 pm    Post subject: Reply with quote

Zanzer wrote:
Start index off as -1. Do a check to see if it equals -1.
Only then should you move EDX into its value.
Otherwise, write your value into EDX.


Doesn't work, causes crashes.

Code:
[ENABLE]
//assert(Terraria.Main::Update+4236,8B 44 90 0C 8B 80 AC 00 00 00)
assert(Terraria.Main::DoUpdate+4CC5,8B 44 90 08 8B 80 BC 00 00 00)
alloc(cPlayer,1024)
registersymbol(cPlayer)
label(returnhere)
label(originalcode)
label(failed)

cPlayer:
dd 0

alloc(index,64)
registersymbol(index)

index:
db -1

originalcode:
test [index], -1
jz failed
mov [index], edx
jmp failed

failed:
push edx
mov edx,[index]
lea ebx,[eax+edx*4+08]
mov [cPlayer],ebx
pop edx
mov eax,[eax+edx*4+08]
mov eax,[eax+000000bC]
jmp returnhere

Terraria.Main::DoUpdate+4CC5:
jmp originalcode
db 90 90 90 90 90
returnhere:

[DISABLE]
dealloc(cPlayer)
Terraria.Main::DoUpdate+4CC5:
mov eax,[eax+edx*4+08]
mov eax,[eax+000000bC]
//Alt: db 8B 44 90 0C 8B 80 AC 00 00 00
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Sat Nov 19, 2016 4:48 pm    Post subject: Reply with quote

Put the code under originalCode below the cPlayer label instead of the index label, give index more memory, or define index using label instead of alloc. It shouldn't cause a problem in this case, but index barely has enough memory to store all that data.

Replace db with dd. You're treating it as a 4-byte value in your code, so it should take up 4 bytes in memory.

Replace test with cmp. test won't do what you hope it will do.

Remove jmp failed. It won't do any harm, but it's not needed.

Replace ebx with edx. You aren't backing it up which could cause problems later on, and edx is fine to use as a replacement in this case.

Either remove or change the comments. The AoB at the bottom not matching up with the code just above it can confuse readers.

_________________
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