Для меня vb основной язык программирования и хотелось бы попробовать слепить сие на vb. Далее выложу как это делается на C
- Код: Выделить всё
DWORD last_real=0;
DWORD last_fake=0;
DWORD last_ticks=0;
DWORD speed_ticks_left=0;
DWORD phase_ticks_left=0;
//DWORD speed_runtime=0;
DWORD qp_orig_offset;
//=========================================================
typedef BOOL (WINAPI *QueryPerformanceCounterFunc)(LARGE_INTEGER*);
QueryPerformanceCounterFunc QueryPerformanceCounterPtr=NULL;
BOOL WINAPI newQueryPerformanceCounter(LARGE_INTEGER *lp)
{
BOOL ret = (*QueryPerformanceCounterPtr)(lp);
DWORD cur_ticks = timeGetTime();
DWORD new_real = lp->LowPart;
if(!last_real){ last_real = last_fake = new_real; return ret; }
// determine wether we are allowed to use speed hack (speed_ticks_left)
DWORD ticks_passed = cur_ticks-last_ticks; last_ticks = cur_ticks;
if (phase_ticks_left>ticks_passed) // phase running
{
phase_ticks_left -= ticks_passed;
if(cvar.speed>1)
{
// consume speed ticks
if(speed_ticks_left>ticks_passed) { speed_ticks_left -= ticks_passed; }
else { speed_ticks_left =0; }
}
} else { // phase not running or just timed out
if(cvar.speed>1)
{ // setup a new phase
speed_ticks_left = cvar.speedon;
phase_ticks_left = cvar.speedon+cvar.speedoff;
} else {
phase_ticks_left = 0;
}
}
//===================
double factor = (cvar.speed<1 ? 1:cvar.speed);
if(!speed_ticks_left) { factor = 1.0; }
DWORD diff_real = (DWORD)(new_real-last_real);
DWORD diff_fake = (DWORD)(factor * double(diff_real));
lp->LowPart = last_fake + diff_fake;
last_fake += diff_fake;
last_real += diff_real;
return ret;
}
гуру, помогите