What's new

limiting emu speed in c++

refraction

PCSX2 Coder
what code do i need to detect the speed of a processor an limit the speed of emulation, for instance chip 8 runs WELL too fast on todays pcs, wanted to know what code i could use to slow it down so its a playable speed.

cheers
 

-//zAe\\-

New member
refraction said:
what code do i need to detect the speed of a processor an limit the speed of emulation, for instance chip 8 runs WELL too fast on todays pcs, wanted to know what code i could use to slow it down so its a playable speed.

cheers
Yo!
You need to write an FPS (Frames Per Second) counter. For example take a look at the GStaris code.
To limit your speed, you need to write an FPS limit code :)
EDIT:
Or you need the code itself?
 

bjz

New member
DWORD lt = GetTickCount();
for(;cpurunning;)
{
if(GetTickCount() - lt >= 1000/60)
{
lt=GetTickCount();
//execute 1 op here
}
}

a similar method to this i used to slow down mine.
 
OP
refraction

refraction

PCSX2 Coder
bjz said:
DWORD lt = GetTickCount();
for(;cpurunning;)
{
if(GetTickCount() - lt >= 1000/60)
{
lt=GetTickCount();
//execute 1 op here
}
}

a similar method to this i used to slow down mine.


cheers pal! sort of think i was looking for! i have the emu running so it does the op codes while execute = 1, so ill put it within that and put it so it doesnt do more than 60 op's a second!!

Thanks muchley :)
 

Top