Hello,
in my current bot I hook EndScene to get my codecave executed by the main thread.
My ASM is checking if a certain address is equal 1. If this case occurs the injected code get called and the adress will be set to 0 after execution.
Finally I can use the construction like this:
Code:
inject(asm, address) // inject code
write<uint>(codeCaveEnabled, 1) // let the code get executed
while (read<uint>codecaveEnabled == 1); //wait for execution to end
I wonder if there is any more performant way to do this? I talked with a mate a few days ago and he said using the while loop is pretty bad and referred me to Thread.WaitOne and Thread.Set however I cant figure out where the benefit is using this.
In general I am using many while loops in combinisation with timers were I need to wait a bit but dont want to sleep the thread (other thread would work and maybe take to long etc).
Thanks in advance