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 


Memory Allocation for scripts, should I do less?

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

Joined: 30 Dec 2013
Posts: 36
Location: Oklahoma, United States

PostPosted: Sat Jan 11, 2014 6:29 pm    Post subject: Memory Allocation for scripts, should I do less? Reply with quote

My question is fairly simple I think.

For smaller auto assembler scripts, should I allocate less than the default 2048kb?

I feel like this is a lot for a simple, say, infinite money script where we just move #99999999 into our money whenever the function get called.

eg.

Code:

[ENABLE]
alloc(newmem,2048)
alloc(CatzAmount,4)
label(returnhere)
label(playercode)
registersymbol(CatzAmount)

aobscan(CatzAOB,89 4A 30 B0 01 * * 32 C0)

CatzAmount:
dd #99999999

newmem:
cmp [edx+18],0
je playercode
mov [edx+30],ecx
mov al,01
jmp returnhere

playercode:
push eax
mov eax,[CatzAmount]
mov [edx+30],eax
pop eax
mov al,01
jmp returnhere

//"kenshi_STEAM.exe"+248EE6:
CatzAOB:
label(Catz_Inject)
Catz_Inject:
registersymbol(Catz_Inject)
jmp newmem
returnhere:

[DISABLE]
//"kenshi_STEAM.exe"+248EE6:
//mov [edx+30],ecx
//mov al,01
Catz_Inject:
db 89 4A 30 B0 01
unregistersymbol(Catz_Inject)
unregistersymbol(CatzAmount)
dealloc(newmem)
dealloc(CatzAmount)


Its a work in progress table, but like I asked, 2048 Kb, too much?

_________________
I like this
Hitler check out
My Tables!
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jan 11, 2014 6:55 pm    Post subject: Reply with quote

For small AA scripts you can even use
alloc(newmem,64)

For most of the AA scripts, 2048 or 4096, it doesn't matter.


You can even use bigger values:
alloc(newmem,1048576)

will allocate 1MB of RAM (you probably have over 4GB, right ?)

_________________
Back to top
View user's profile Send private message MSN Messenger
TheTornadoTitan
Cheater
Reputation: 0

Joined: 30 Dec 2013
Posts: 36
Location: Oklahoma, United States

PostPosted: Sat Jan 11, 2014 7:01 pm    Post subject: Reply with quote

Yes I have 12 lol, but my main concern is for say, efficiency, and widened usability, does lowering the amount do anything worth worry about, or does it not matter in the least?
_________________
I like this
Hitler check out
My Tables!
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jan 11, 2014 7:04 pm    Post subject: Reply with quote

alloc(newmem,524288000) versus alloc(newmem,1572864000)
yes, there will be difference. First one will allocate 500MB and second will allocate 1500MB. And this takes some time (on your machine, 0.1s up to few seconds)

alloc(newmem,32768) versus alloc(newmem,4096) - no difference
(milliseconds? microseconds?)


Anyway, very HUGE aa script (many injections, copies, saving original values), will use about 200 up to 1700 bytes.

_________________
Back to top
View user's profile Send private message MSN Messenger
TheTornadoTitan
Cheater
Reputation: 0

Joined: 30 Dec 2013
Posts: 36
Location: Oklahoma, United States

PostPosted: Sat Jan 11, 2014 7:25 pm    Post subject: Reply with quote

I see, thank you, in my smaller scripts that are only very basic cheats the 2048 default or lowering it to 512 or 64 Kb wont make much of a difference, but larger scripts with larger allocations will. (but even then, only if substantial)
_________________
I like this
Hitler check out
My Tables!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25823
Location: The netherlands

PostPosted: Sat Jan 11, 2014 7:33 pm    Post subject: Reply with quote

keep in mind it's 2048 bytes, not 2048KilloByte


Also, if you specify less it's not going to make a difference, as the smallest chunk you get is 4096 bytes anyhow. (And it actually removes 65536 bytes of allocatable memory from the target process)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
TheTornadoTitan
Cheater
Reputation: 0

Joined: 30 Dec 2013
Posts: 36
Location: Oklahoma, United States

PostPosted: Sat Jan 11, 2014 7:39 pm    Post subject: Reply with quote

oh, haha, even better then really. Thanks mgr.inz.Player and Dark Byte, I started working on a Kenshi table (as people were asking, figured I'd make a basic one), and the question came to mind. Tanks a bunch Very Happy
_________________
I like this
Hitler check out
My Tables!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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