

/*****************************************************************************

   This file is part of x2600, the Atari 2600 Emulator
   ===================================================
   
   Created by Matthew Stroup for Amiga v2600, January 27, 1997.

   The nature of the Amiga video driver allows for sync with vertical blank.
   No timing tricks needed.

******************************************************************************/

#include "config.h"
#include "options.h"
#include <unistd.h>
#include "types.h"
#include "vmachine.h"

/* Global variables. A C++ implementation would hide these */
struct timeval limiter_lastClk;
struct timeval limiter_newClk;
long limiter_fTime = 0;
long limiter_last = 0;
long limiter_new = 0;
long limiter_endSleep = 0;
int limiter_frameRate = 0;
int limiter_vRate = 0;


/* Get the currently set frame rate */
/* returns: currently set rate */
int
limiter_getFrameRate (void)
{
  if (limiter_vRate < 0)
    limiter_vRate = tv_hertz;
  return limiter_vRate;
}

/* Set the desired frame rate */
/* f: frame rate in frames per second */
void
limiter_setFrameRate (int f)
{
  limiter_frameRate = f;
  limiter_fTime = 1000000 / f;
}

/* Initialise the frame limiter */
void
limiter_init (void)
{
}

/* Perform the speed limiting syncronisation */
/* returns: number of microseconds since last call */
long
limiter_sync (void)
{
  return 0;
}
