mirror of https://github.com/stella-emu/stella.git
Removed "Experimental timing" as an option from the Makefile. Option is
now always compiled into the SDL and X11 versions. Default is to use the CPU-intensive (normal) timing code. The less CPU- intensive timing can be selected with the commandline argument '-nohog', or by setting 'nohog = 1' in the rc file. Note that the nohog setting works much better in SDL vs. X11, since SDL_Delay() seems to have a finer granularity than usleep(). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@105 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
457b1edfab
commit
a6d330fa2c
|
@ -13,7 +13,7 @@
|
|||
## See the file "license" for information on usage and redistribution of
|
||||
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
##
|
||||
## $Id: makefile,v 1.18 2002-08-03 22:52:39 stephena Exp $
|
||||
## $Id: makefile,v 1.19 2002-08-04 00:28:18 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -35,8 +35,8 @@ OPTIMIZATIONS =
|
|||
# -malign-functions=2 -malign-jumps=2 -malign-loops=2
|
||||
### to get full optimization under gcc/x Athlon based OS's..
|
||||
# OPTIMIZATIONS = -O3 -mcpu=athlon -march=athlon -Wall -Wno-unused \
|
||||
-funroll-loops -fstrength-reduce -fomit-frame-pointer -ffast-math \
|
||||
-falign-functions=2 -falign-jumps=2 -falign-loops=2
|
||||
# -funroll-loops -fstrength-reduce -fomit-frame-pointer -ffast-math \
|
||||
# -falign-functions=2 -falign-jumps=2 -falign-loops=2
|
||||
|
||||
### if your C++ compiler doesn't support the bool type
|
||||
# BSPF_BOOL = 1
|
||||
|
@ -55,10 +55,10 @@ OPTIMIZATIONS =
|
|||
### Only X11 and SDL ports supported for now
|
||||
# SNAPSHOT_SUPPORT = 1
|
||||
|
||||
### to enable EXPERIMENTAL TIMING code
|
||||
### Enables emulator to not use 100% CPU
|
||||
### Only X11 and SDL ports supported for now
|
||||
# EXPERIMENTAL_TIMING = 1
|
||||
### comment this out if your system doesn't
|
||||
### have the gettimeofday function
|
||||
### Currently, the X11 version won't compile without it
|
||||
HAVE_GETTIMEOFDAY = 1
|
||||
|
||||
##============================================================================
|
||||
## All done, type make to get a list of frontends
|
||||
|
@ -124,9 +124,9 @@ OPTS.SDL += -DHAVE_PNG=1
|
|||
LIBS.SDL += -lpng
|
||||
endif
|
||||
|
||||
ifdef EXPERIMENTAL_TIMING
|
||||
OPTS.X11 += -DEXPERIMENTAL_TIMING=1
|
||||
OPTS.SDL += -DEXPERIMENTAL_TIMING=1
|
||||
ifdef HAVE_GETTIMEOFDAY
|
||||
OPTS.X11 += -DHAVE_GETTIMEOFDAY=1
|
||||
OPTS.SDL += -DHAVE_GETTIMEOFDAY=1
|
||||
endif
|
||||
|
||||
default:
|
||||
|
|
|
@ -27,3 +27,4 @@
|
|||
;ssdir = <pathname>
|
||||
;ssname = <romname|md5sum>
|
||||
;sssingle = <0|1>
|
||||
;nohog = <0|1>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Settings.cxx,v 1.1 2002-03-21 22:47:00 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.2 2002-08-04 00:28:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Settings.hxx"
|
||||
|
@ -28,6 +28,7 @@ Settings::Settings()
|
|||
theHideCursorFlag = false;
|
||||
theUsePrivateColormapFlag = false;
|
||||
theMultipleSnapShotFlag = true;
|
||||
theHogCPUFlag = true;
|
||||
theDesiredVolume = 75;
|
||||
theDesiredFrameRate = 60;
|
||||
thePaddleMode = 0;
|
||||
|
@ -106,6 +107,10 @@ bool Settings::handleCommandLineArgs(int argc, char* argv[])
|
|||
{
|
||||
theShowInfoFlag = true;
|
||||
}
|
||||
else if(string(argv[i]) == "-nohog")
|
||||
{
|
||||
theHogCPUFlag = false;
|
||||
}
|
||||
else if(string(argv[i]) == "-zoom")
|
||||
{
|
||||
uInt32 size = atoi(argv[++i]);
|
||||
|
@ -251,6 +256,14 @@ void Settings::handleRCFile(istream& in)
|
|||
else if(option == 0)
|
||||
theShowInfoFlag = false;
|
||||
}
|
||||
else if(key == "nohog")
|
||||
{
|
||||
uInt32 option = atoi(value.c_str());
|
||||
if(option == 1)
|
||||
theHogCPUFlag = false;
|
||||
else if(option == 0)
|
||||
theShowInfoFlag = true;
|
||||
}
|
||||
else if(key == "zoom")
|
||||
{
|
||||
// They're setting the initial window size
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Settings.hxx,v 1.1 2002-03-21 22:47:00 stephena Exp $
|
||||
// $Id: Settings.hxx,v 1.2 2002-08-04 00:28:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_HXX
|
||||
|
@ -53,6 +53,10 @@ class Settings
|
|||
// overwriting the same file. Set to true by default.
|
||||
bool theMultipleSnapShotFlag;
|
||||
|
||||
// Indicates whether to use more/less accurate emulation,
|
||||
// resulting in more/less CPU usage.
|
||||
bool theHogCPUFlag;
|
||||
|
||||
// Indicates what the desired volume is
|
||||
uInt32 theDesiredVolume;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: mainSDL.cxx,v 1.24 2002-05-14 18:29:44 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.25 2002-08-04 00:28:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -52,7 +52,6 @@
|
|||
#define SDL_DISABLE 0
|
||||
#endif
|
||||
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define MESSAGE_INTERVAL 2
|
||||
|
||||
// function prototypes
|
||||
|
@ -1329,6 +1328,7 @@ void usage()
|
|||
" -sssingle Generate single snapshot instead of many",
|
||||
#endif
|
||||
" -pro <props file> Use the given properties file instead of stella.pro",
|
||||
" -nohog Don't take all the CPU (gives less accurate emulation)",
|
||||
"",
|
||||
0
|
||||
};
|
||||
|
@ -1576,48 +1576,14 @@ int main(int argc, char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_TIMING
|
||||
// Set up timing stuff
|
||||
uInt32 startTime, frameTime, virtualTime, currentTime;
|
||||
uInt32 numberOfFrames = 0;
|
||||
uInt32 timePerFrame = (uInt32) (1000000.0 / (double) settings->theDesiredFrameRate);
|
||||
// These variables are common to both timing options
|
||||
// and are needed to calculate the overall frames per second.
|
||||
uInt32 frameTime = 0, numberOfFrames = 0;
|
||||
|
||||
// Set the base for the timers
|
||||
virtualTime = getTicks();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
for(;;)
|
||||
if(settings->theHogCPUFlag) // normal, CPU-intensive timing
|
||||
{
|
||||
// Exit if the user wants to quit
|
||||
if(theQuitIndicator)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
startTime = getTicks();
|
||||
if(!thePauseIndicator)
|
||||
{
|
||||
theConsole->mediaSource().update();
|
||||
}
|
||||
updateDisplay(theConsole->mediaSource());
|
||||
handleEvents();
|
||||
|
||||
currentTime = getTicks();
|
||||
virtualTime += timePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
{
|
||||
SDL_Delay((virtualTime - currentTime)/1000);
|
||||
}
|
||||
|
||||
currentTime = getTicks() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
#else
|
||||
// Set up timing stuff
|
||||
uInt32 startTime, frameTime, delta;
|
||||
uInt32 numberOfFrames = 0;
|
||||
// Set up accurate timing stuff
|
||||
uInt32 startTime, delta;
|
||||
uInt32 timePerFrame = (uInt32) (1000000.0 / (double) settings->theDesiredFrameRate);
|
||||
|
||||
// Set the base for the timers
|
||||
|
@ -1658,7 +1624,46 @@ int main(int argc, char* argv[])
|
|||
frameTime += getTicks() - startTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // less accurate, less CPU-intensive timing
|
||||
{
|
||||
// Set up less accurate timing stuff
|
||||
uInt32 startTime, virtualTime, currentTime;
|
||||
uInt32 timePerFrame = (uInt32) (1000000.0 / (double) settings->theDesiredFrameRate);
|
||||
|
||||
// Set the base for the timers
|
||||
virtualTime = getTicks();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
for(;;)
|
||||
{
|
||||
// Exit if the user wants to quit
|
||||
if(theQuitIndicator)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
startTime = getTicks();
|
||||
if(!thePauseIndicator)
|
||||
{
|
||||
theConsole->mediaSource().update();
|
||||
}
|
||||
updateDisplay(theConsole->mediaSource());
|
||||
handleEvents();
|
||||
|
||||
currentTime = getTicks();
|
||||
virtualTime += timePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
{
|
||||
SDL_Delay((virtualTime - currentTime)/1000);
|
||||
}
|
||||
|
||||
currentTime = getTicks() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
}
|
||||
|
||||
if(settings->theShowInfoFlag)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: mainX11.cxx,v 1.24 2002-05-14 18:29:45 stephena Exp $
|
||||
// $Id: mainX11.cxx,v 1.25 2002-08-04 00:28:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -53,7 +53,6 @@
|
|||
#include <linux/joystick.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define MESSAGE_INTERVAL 2
|
||||
|
||||
// A graphic context for each of the 2600's colors
|
||||
|
@ -1468,48 +1467,14 @@ int main(int argc, char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_TIMING
|
||||
// These variables are common to both timing options
|
||||
// and are needed to calculate the overall frames per second.
|
||||
uInt32 frameTime = 0, numberOfFrames = 0;
|
||||
|
||||
if(settings->theHogCPUFlag) // normal, CPU-intensive timing
|
||||
{
|
||||
// Set up timing stuff
|
||||
uInt32 startTime, frameTime, virtualTime, currentTime;
|
||||
uInt32 numberOfFrames = 0;
|
||||
uInt32 timePerFrame = (uInt32) (1000000.0 / (double) settings->theDesiredFrameRate);
|
||||
|
||||
// Set the base for the timers
|
||||
virtualTime = getTicks();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
for(;;)
|
||||
{
|
||||
// Exit if the user wants to quit
|
||||
if(theQuitIndicator)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
startTime = getTicks();
|
||||
if(!thePauseIndicator)
|
||||
{
|
||||
theConsole->mediaSource().update();
|
||||
}
|
||||
updateDisplay(theConsole->mediaSource());
|
||||
handleEvents();
|
||||
|
||||
currentTime = getTicks();
|
||||
virtualTime += timePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
{
|
||||
usleep(virtualTime - currentTime);
|
||||
}
|
||||
|
||||
currentTime = getTicks() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
#else
|
||||
// Set up timing stuff
|
||||
uInt32 startTime, frameTime, delta;
|
||||
uInt32 numberOfFrames = 0;
|
||||
uInt32 startTime, delta;
|
||||
uInt32 timePerFrame = (uInt32) (1000000.0 / (double) settings->theDesiredFrameRate);
|
||||
|
||||
// Set the base for the timers
|
||||
|
@ -1550,7 +1515,46 @@ int main(int argc, char* argv[])
|
|||
frameTime += getTicks() - startTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // less accurate, less CPU-intensive timing
|
||||
{
|
||||
// Set up timing stuff
|
||||
uInt32 startTime, virtualTime, currentTime;
|
||||
uInt32 timePerFrame = (uInt32) (1000000.0 / (double) settings->theDesiredFrameRate);
|
||||
|
||||
// Set the base for the timers
|
||||
virtualTime = getTicks();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
for(;;)
|
||||
{
|
||||
// Exit if the user wants to quit
|
||||
if(theQuitIndicator)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
startTime = getTicks();
|
||||
if(!thePauseIndicator)
|
||||
{
|
||||
theConsole->mediaSource().update();
|
||||
}
|
||||
updateDisplay(theConsole->mediaSource());
|
||||
handleEvents();
|
||||
|
||||
currentTime = getTicks();
|
||||
virtualTime += timePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
{
|
||||
usleep(virtualTime - currentTime);
|
||||
}
|
||||
|
||||
currentTime = getTicks() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
}
|
||||
|
||||
if(settings->theShowInfoFlag)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue