Download Assault Cube ESP Table Version 2 Without Flicker - Safe Eyes

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
Never ever use sleep in a loop/callback/renderfunc !

Here a propper and stable way:

TimeManager.h
C++:
#pragma once
#include <Windows.h>
#include <time.h>

class TimeManager
{
public:
	TimeManager(DWORD IdleTime);
	~TimeManager();

private:
	DWORD _timeFactor;
	DWORD _idleTime;

public:
	void SetIdleHere();
	bool IsIdleOver();

	DWORD ReturnIdleTime();
	void SetIdleTime(DWORD IdleTime);
};
TimeManager.cpp
C++:
#include "TimeManager.h"


TimeManager::TimeManager(DWORD IdleTime)
{
	_timeFactor = IdleTime;
	_idleTime = 0;
}


TimeManager::~TimeManager()
{
}

void TimeManager::SetIdleHere()
{
	_idleTime = GetTickCount();
	_idleTime = _idleTime + _timeFactor;
}

bool TimeManager::IsIdleOver()
{
	DWORD temp = GetTickCount();
	
	if (temp >= _idleTime)
		return true;

	return false;
}

DWORD TimeManager::ReturnIdleTime()
{
	return _timeFactor;
}

void TimeManager::SetIdleTime(DWORD IdleTime)
{
	_timeFactor = IdleTime;
}

Usage:
C++:
TimeManager mnr(500);

//....

if(mnr.IsIdleOver()
{
    //do shit
    mnr.SetIdleHere();
}

Its very important to not block anything with sleep, my university teachers always complain about "why sleep was invented" but well my TimeManager provides a better way
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,164
78,998
2,399
VISUAL STUDIO 2008? mother of Zeus!
 

bYt3_w4LK3r

Jr.Coder
Full Member
Nobleman
Nov 20, 2014
58
283
1
Never ever use sleep in a loop/callback/renderfunc !

Here a propper and stable way:

TimeManager.h
C++:
#pragma once
#include <Windows.h>
#include <time.h>

class TimeManager
{
public:
	TimeManager(DWORD IdleTime);
	~TimeManager();

private:
	DWORD _timeFactor;
	DWORD _idleTime;

public:
	void SetIdleHere();
	bool IsIdleOver();

	DWORD ReturnIdleTime();
	void SetIdleTime(DWORD IdleTime);
};
TimeManager.cpp
C++:
#include "TimeManager.h"


TimeManager::TimeManager(DWORD IdleTime)
{
	_timeFactor = IdleTime;
	_idleTime = 0;
}


TimeManager::~TimeManager()
{
}

void TimeManager::SetIdleHere()
{
	_idleTime = GetTickCount();
	_idleTime = _idleTime + _timeFactor;
}

bool TimeManager::IsIdleOver()
{
	DWORD temp = GetTickCount();
	
	if (temp >= _idleTime)
		return true;

	return false;
}

DWORD TimeManager::ReturnIdleTime()
{
	return _timeFactor;
}

void TimeManager::SetIdleTime(DWORD IdleTime)
{
	_timeFactor = IdleTime;
}

Usage:
C++:
TimeManager mnr(500);

//....

if(mnr.IsIdleOver()
{
    //do shit
    mnr.SetIdleHere();
}

Its very important to not block anything with sleep, my university teachers always complain about "why sleep was invented" but well my TimeManager provides a better way
thanks for the tip, but why not use sleep? does that eat cpu, or something?
 

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
Im at 0 increasement after injecting my whole gui .
And more importanly it doesnt block anything, you can do other stuff in the thread and it will just ignore the idle'd part without stopping the whole thing.
That means for you that you can put the reading code into the gl render hook and have even less CPU usage , instead of using a simple thread + loop + sleep because the render threads are coordinated by the drawing engine, in this case gl.
 

lukaluka

Coder
Meme Tier VIP
Jul 6, 2015
285
1,213
3
Im at 0 increasement after injecting my whole gui .
And more importanly it doesnt block anything, you can do other stuff in the thread and it will just ignore the idle'd part without stopping the whole thing.
That means for you that you can put the reading code into the gl render hook and have even less CPU usage , instead of using a simple thread + loop + sleep because the render threads are coordinated by the drawing engine, in this case gl.
Yeh, In D3D I Always Use Endscene For Loops, But it's Open GL Game And I Never Hook Render For This Game
 

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
Yeh, In D3D I Always Use Endscene For Loops, But it's Open GL Game And I Never Hook Render For This Game
C++:
typedef BOOL(CALLBACK *glSwapBuffers_t)(HDC);
glSwapBuffers_t oglSwapBuffers;


BOOL CALLBACK Hooked_glSwapBuffers(HDC hDc)
{
  // ...

 return (oglSwapBuffers)(hDc);
}
DWORD WINAPI		SetUpHook()
{
	HMODULE hOpenGL = GetModuleHandle("opengl32.dll");
	oglSwapBuffers = (glSwapBuffers_t)DetourFunction((PBYTE)GetProcAddress(hOpenGL, "wglSwapBuffers"), (PBYTE)Hooked_glSwapBuffers);

	return 0xDEADBEEF;
}
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,164
78,998
2,399
C++:
typedef BOOL(CALLBACK *glSwapBuffers_t)(HDC);
glSwapBuffers_t oglSwapBuffers;


BOOL CALLBACK Hooked_glSwapBuffers(HDC hDc)
{
  // ...

 return (oglSwapBuffers)(hDc);
}
DWORD WINAPI		SetUpHook()
{
	HMODULE hOpenGL = GetModuleHandle("opengl32.dll");
	oglSwapBuffers = (glSwapBuffers_t)DetourFunction((PBYTE)GetProcAddress(hOpenGL, "wglSwapBuffers"), (PBYTE)Hooked_glSwapBuffers);

	return 0xDEADBEEF;
}
-rep no credits :p
 

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
Rake;42987 said:
-rep no credits :p
hm ? "wglSwapBuffers" string and "typedef BOOL(CALLBACK *glSwapBuffers_t)(HDC)" prototype from rake ^^
Rest is common from other hooks xD
 

lukaluka

Coder
Meme Tier VIP
Jul 6, 2015
285
1,213
3
Give Length In Hook , I'm Confuse

World To Screen Too, Assault Cube For Learn
 
Last edited:
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods