pausing execution

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Mak0
Posts: 36
Joined: Thu Jan 27, 2005 8:56 am

pausing execution

Post by Mak0 »

sorry for the really basic question but what would be the best method for pausing execution for, I dont know, say 3 seconds?
Lousyphreak
Posts: 6
Joined: Tue Jan 25, 2005 5:28 pm

Post by Lousyphreak »

dont know if it helps but this is taken straight from the scummvm port im working on:

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 &#40;time <= i+msecs_time&#41; &#123;
   checkSound&#40;&#41;;
   time= getMillis&#40;&#41;;    
 &#125;
 
&#125;
Mak0
Posts: 36
Joined: Thu Jan 27, 2005 8:56 am

Post by Mak0 »

wow i guess its not as simple as I hoped. theres nothing like a simple int pause() function?
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

You could also use the EE performance counters or use vsyncs...

i.e.

Code: Select all

#define VSYNCS_PER_FRAME 60  // NTSC, you should really do detection...

for&#40;wait=0;wait<3*VSYNCS_PER_FRAME;wait++&#41;
     VSync&#40;&#41;   //replace this with a real vsync function...
Shoot Pixels Not People!
Makeshift Development
Post Reply