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 


Need check a buffer at least 20 times / second

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
HonaBerry
How do I cheat?
Reputation: 0

Joined: 04 May 2019
Posts: 3

PostPosted: Fri May 24, 2019 12:12 pm    Post subject: Need check a buffer at least 20 times / second Reply with quote

Hello,

So I have this Windows program (game client) that writes stuff to a buffer. I keep track of the buffer adr (its malloced and realeased over and over) using an injected routine that saves the buffer adr in a known location.

Im using ReadProcessMemory() to access the buffer several times / second and when something interesting turns up I handle it.

The problem is that every hour or so I miss an event. Probably because I use Sleep(1) in my readout loop.

It turns out Windows is really unreliable when it comes to allocating timeslots (and the size of a timeslot is around 10ms). Performance improved a bit when I set the process priority level to "High", but not enough. If I increase the workload on the CPU by surfing, watching a movie etc the readout really suffers.

Is there an easy way to hook my readout to something that always executes 20 times / second or more, like some vertical blank interrupt or something?

Any help or idea is appreciated!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri May 24, 2019 12:24 pm    Post subject: Reply with quote

If you're already injecting code, why not inject code at writes to the buffer as well? Copy that data somewhere else or just do the processing right 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
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri May 24, 2019 12:28 pm    Post subject: Reply with quote

HonaBerry wrote:
Im using ReadProcessMemory() to access the buffer several times / second and when something interesting turns up I handle it.


instead of letting the game write data and you read constantly, do some neat injection.

tell the game to call your function before storing data, then check if there is something interesting and grab it otherwise let it proceed.

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
HonaBerry
How do I cheat?
Reputation: 0

Joined: 04 May 2019
Posts: 3

PostPosted: Fri May 24, 2019 2:03 pm    Post subject: Reply with quote

Thanks for the replies.

Yes, it is possible to hijack either the handling routine or the 18 events I need to parse. But that is a lot of work.

The buffer consists of approximately 10kb of deserializad data (the game use a serialization package based on google protobuf and some other stuff on top of that). I need to handle at least 18 events (or the main handler which is even more complicated).

Since I have a solution that is working (almost) perfectly and I'm lazy I was hoping for the simplified approach of just executing my parsing routine 20 times / second, every second.

My plan was to (if buffer has changed since last check) copy the buffer to an "empty" bufferslot, mark the slot "full" and then have my standalone parser harvest the buffers, one by one (setting the state back to "empty"). Most of the time there will only be one buffer to harvest, but sometimes there might be two or even three events waiting.

This is exactly what my parser is doing right now, except I read directly from the buffer itself and don't have any backups, which means I miss an Event every 10 mins or every 2 hours depending on CPU load and stuff.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri May 24, 2019 3:30 pm    Post subject: Reply with quote

With what you're doing, there's no guarantee you'll get everything all the time (even if you used a busy wait loop). The only two practical methods I can think of would be to hook into the game's code or catch exceptions with a debugger (see page exception breakpoints from CE source).

Or, just be happy with what you've got and accept you'll miss data sometimes.

_________________
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