pausing execution
Posted: Thu Jan 27, 2005 8:59 am
				
				sorry for the really basic question but what would be the best method for pausing execution for, I dont know, say 3 seconds?
			Homebrew PS2, PSP & PS3 Development Discussions
https://forums.ps2dev.org/
Code: Select all
uint32 getMillis()
{
   int* sec;
   int* usec;
   SifCallRpc(&client,0,0,(void*)(&rpcBuffer[0]),0,(void*)(&rpcBuffer[0]),128,0,0);
   sec = (int*) (&rpcBuffer[0]);
   usec = (int*) (&rpcBuffer[4]);
   msecs = (*sec)*1000+ (*usec)/1000;
   return msecs;
}
void delayMillis(uint msecs_time)
{
 uint32 i = getMillis();
 uint32 time = i;
 while (time <= i+msecs_time) {
   checkSound();
   time= getMillis();    
 }
 
}
Code: Select all
#define VSYNCS_PER_FRAME 60  // NTSC, you should really do detection...
for(wait=0;wait<3*VSYNCS_PER_FRAME;wait++)
     VSync()   //replace this with a real vsync function...