The code written by the OP of this thread made me want to cry it was so inefficient. Function calls are pretty expensive, and he made TONS of unnecessary ones. At the beginning of each frame, cache the result of the InGame call to a variable, and then use that.
//top of present
statusCache = InGame();
//then for accessing it
if (Hack && statusCache)
memcpy(address, PatchBytes, Size);
memcpy(address, OriginalBytes , Size);
This would save lots of resource usage over time.
I'm no good at making my code really clean. I've been working on making my coding cleaner, and more efficient for my next release. Thank you for the help! It means alot.
Last edited by cubanelite; 06-04-2012 at 11:44 PM.
If you have any questions, PM Me. I always check them.
if you want efficent code use asm
clean code is not the same as efficient code
asm is only efficient in the right hands. Someone who doesn't know what they are doing will often write an algorithm slower than one that they would have written in native C. And yes, clean != efficient. One example is packing all of your code into one main method. It looks horrible, but in the end, it saves resources due to reducing function calls.