- Added an option to the makefile to specify the number of CPU's to use

with 'make -jN' when compiling on SMP or distcc-based machines.  Defaults
to 1 CPU, and most people won't need to touch it.

 - Cleaned up some sound related build options in the makefile.  Now
there is only one sound option (SDL, since the codebase is standardizing
on SDL), and the OSS and ALSA drivers are being discontinued.

 - Moved the settings that were specific to Linux SDL port to the emucore
Settings class, since they are now relevant to all SDL ports (including
Windows).

 - Reworked the sound selection code in mainSDL.  Now the '-sound'
commandline and ini-file argument is a boolean, representing whether
sound is enabled or disabled.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@231 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-04-03 18:54:23 +00:00
parent b6325d98a0
commit 7c5ebdddf3
5 changed files with 65 additions and 126 deletions

View File

@ -13,7 +13,7 @@
## See the file "license" for information on usage and redistribution of ## See the file "license" for information on usage and redistribution of
## this file, and for a DISCLAIMER OF ALL WARRANTIES. ## this file, and for a DISCLAIMER OF ALL WARRANTIES.
## ##
## $Id: makefile,v 1.48 2004-04-03 03:06:45 stephena Exp $ ## $Id: makefile,v 1.49 2004-04-03 18:54:21 stephena Exp $
##============================================================================ ##============================================================================
##============================================================================ ##============================================================================
@ -32,13 +32,17 @@ OPTIMIZATIONS =
### to include support for saving snapshots in png format ### to include support for saving snapshots in png format
### (requires PNG library) ### (requires PNG library)
# SNAPSHOT_SUPPORT = 1 SNAPSHOT_SUPPORT = 1
### to include support for game developers ### to include support for game developers
### enables some extra commandline options that allow the user ### enables some extra commandline options that allow the user
### to override some emulation defaults ### to override some emulation defaults
DEVELOPER_SUPPORT = 1 DEVELOPER_SUPPORT = 1
### to build on SMP (or distcc-based) machines
### change to number of CPU's you have
NUMBER_CPU = 1
### you want a 6507 trace written to stdout ### you want a 6507 trace written to stdout
# DEBUG = 1 # DEBUG = 1
@ -52,9 +56,10 @@ LD = g++
LDFLAGS = `sdl-config --cflags` LDFLAGS = `sdl-config --cflags`
LDLIBS = `sdl-config --libs` LDLIBS = `sdl-config --libs`
OBJECTS = mainSDL.o FrameBufferSDL.o FrameBufferSoft.o OBJECTS = mainSDL.o SoundSDL.o FrameBufferSDL.o FrameBufferSoft.o
OPTIONS = OPTIONS =
EXE_NAME = EXE_NAME =
SMP =
SRC = .. SRC = ..
CORE = $(SRC)/emucore CORE = $(SRC)/emucore
@ -72,6 +77,12 @@ ifndef OPTIMIZATIONS
endif endif
endif endif
ifndef NUMBER_CPU
SMP = -j1
else
SMP = -j$(NUMBER_CPU)
endif
FLAGS = $(OPTIMIZATIONS) -Wall -Wunused $(INCLUDES) $(SYS_INCLUDES) FLAGS = $(OPTIMIZATIONS) -Wall -Wunused $(INCLUDES) $(SYS_INCLUDES)
## set the user-defined options ## set the user-defined options
@ -111,13 +122,13 @@ default:
@echo "" @echo ""
linux: linux:
make stella \ make $(SMP) stella \
EXE_NAME="stella" \ EXE_NAME="stella" \
OPTIONS="$(OPTIONS) -DBSPF_UNIX -DUNIX -DHAVE_GETTIMEOFDAY" \ OPTIONS="$(OPTIONS) -DBSPF_UNIX -DUNIX -DHAVE_GETTIMEOFDAY" \
OBJS="$(OBJECTS) SettingsUNIX.o" OBJS="$(OBJECTS) SettingsUNIX.o"
linux-gl: linux-gl:
make stella \ make $(SMP) stella \
EXE_NAME="stella" \ EXE_NAME="stella" \
LDFLAGS="$(LDFLAGS) -L/usr/X11R6/lib" \ LDFLAGS="$(LDFLAGS) -L/usr/X11R6/lib" \
LDLIBS="$(LDLIBS) -lGL" \ LDLIBS="$(LDLIBS) -lGL" \
@ -125,13 +136,13 @@ linux-gl:
OBJS="$(OBJECTS) FrameBufferGL.o SettingsUNIX.o" OBJS="$(OBJECTS) FrameBufferGL.o SettingsUNIX.o"
win32: win32:
make stella \ make $(SMP) stella \
EXE_NAME="stella.exe" \ EXE_NAME="stella.exe" \
OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32" \ OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32" \
OBJS="$(OBJECTS) SettingsWin32.o" OBJS="$(OBJECTS) SettingsWin32.o"
win32-gl: win32-gl:
make stella \ make $(SMP) stella \
EXE_NAME="stella.exe" \ EXE_NAME="stella.exe" \
LDLIBS="$(LDLIBS) -lopengl32" \ LDLIBS="$(LDLIBS) -lopengl32" \
OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32 -DDISPLAY_OPENGL -DTEXTURES_ARE_LOST" \ OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32 -DDISPLAY_OPENGL -DTEXTURES_ARE_LOST" \

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Settings.cxx,v 1.16 2003-12-05 19:51:09 stephena Exp $ // $Id: Settings.cxx,v 1.17 2004-04-03 18:54:22 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -40,6 +40,19 @@ Settings::Settings()
mySize = 0; mySize = 0;
// Now fill it with options that are common to all versions of Stella // Now fill it with options that are common to all versions of Stella
set("video", "soft");
#ifdef DISPLAY_OPENGL
set("gl_filter", "nearest");
set("gl_aspect", "2");
#endif
set("sound", "true");
set("fullscreen", "false");
set("grabmouse", "false");
set("hidecursor", "false");
set("volume", "-1");
set("accurate", "true");
set("joyleft", "0");
set("joyright", "1");
set("framerate", "60"); set("framerate", "60");
set("keymap", ""); set("keymap", "");
set("joymap", ""); set("joymap", "");

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SettingsUNIX.cxx,v 1.6 2003-12-05 19:51:09 stephena Exp $ // $Id: SettingsUNIX.cxx,v 1.7 2004-04-03 18:54:23 stephena Exp $
//============================================================================ //============================================================================
#include <cstdlib> #include <cstdlib>
@ -60,21 +60,6 @@ SettingsUNIX::SettingsUNIX()
mySnapshotFile = ""; mySnapshotFile = "";
myStateFile = ""; myStateFile = "";
// Now create UNIX specific settings
set("video", "soft");
#ifdef DISPLAY_OPENGL
set("gl_filter", "nearest");
set("gl_aspect", "2");
#endif
set("sound", "oss");
set("fullscreen", "false");
set("grabmouse", "false");
set("hidecursor", "false");
set("volume", "-1");
set("accurate", "true");
set("joyleft", "0");
set("joyright", "1");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -92,7 +77,7 @@ void SettingsUNIX::usage(string& message)
<< endl << endl
<< " -video <type> Type is one of the following:\n" << " -video <type> Type is one of the following:\n"
<< " soft SDL software mode\n" << " soft SDL software mode\n"
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
<< " gl SDL OpenGL mode\n" << " gl SDL OpenGL mode\n"
<< endl << endl
<< " -gl_filter <type> Type is one of the following:\n" << " -gl_filter <type> Type is one of the following:\n"
@ -100,33 +85,22 @@ void SettingsUNIX::usage(string& message)
<< " linear Blurred scaling (GL_LINEAR)\n" << " linear Blurred scaling (GL_LINEAR)\n"
<< " -gl_aspect <number> Scale the width by the given amount\n" << " -gl_aspect <number> Scale the width by the given amount\n"
<< endl << endl
#endif
<< " -sound <type> Type is one of the following:\n"
<< " 0 Disables all sound generation\n"
#ifdef SOUND_ALSA
<< " alsa ALSA version 0.9 driver\n"
#endif #endif
#ifdef SOUND_OSS << " -sound <0|1> Enable sound generation\n"
<< " oss Open Sound System driver\n"
#endif
#ifdef SOUND_SDL
<< " sdl Native SDL driver\n"
#endif
<< endl
<< " -framerate <number> Display the given number of frames per second\n" << " -framerate <number> Display the given number of frames per second\n"
<< " -zoom <size> Makes window be 'size' times normal\n" << " -zoom <size> Makes window be 'size' times normal\n"
<< " -fullscreen <0|1> Play the game in fullscreen mode\n" << " -fullscreen <0|1> Play the game in fullscreen mode\n"
<< " -grabmouse <0|1> Keeps the mouse in the game window\n" << " -grabmouse <0|1> Keeps the mouse in the game window\n"
<< " -hidecursor <0|1> Hides the mouse cursor in the game window\n" << " -hidecursor <0|1> Hides the mouse cursor in the game window\n"
<< " -volume <number> Set the volume (0 - 100)\n" << " -volume <number> Set the volume (0 - 100)\n"
#ifdef HAVE_JOYSTICK #ifdef JOYSTICK_SUPPORT
<< " -paddle <0|1|2|3|real> Indicates which paddle the mouse should emulate\n" << " -paddle <0|1|2|3|real> Indicates which paddle the mouse should emulate\n"
<< " or that real Atari 2600 paddles are being used\n" << " or that real Atari 2600 paddles are being used\n"
<< " -joyleft <number> The joystick number representing the left controller\n" << " -joyleft <number> The joystick number representing the left controller\n"
<< " -joyright <number> The joystick number representing the right controller\n" << " -joyright <number> The joystick number representing the right controller\n"
#else #else
<< " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n" << " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n"
#endif #endif
<< " -altpro <props file> Use the given properties file instead of stella.pro\n" << " -altpro <props file> Use the given properties file instead of stella.pro\n"
<< " -showinfo <0|1> Shows some game info\n" << " -showinfo <0|1> Shows some game info\n"
<< " -accurate <0|1> Accurate game timing (uses more CPU)\n" << " -accurate <0|1> Accurate game timing (uses more CPU)\n"

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SettingsWin32.cxx,v 1.1 2003-12-04 22:22:53 stephena Exp $ // $Id: SettingsWin32.cxx,v 1.2 2004-04-03 18:54:23 stephena Exp $
//============================================================================ //============================================================================
#include <cstdlib> #include <cstdlib>
@ -61,25 +61,11 @@ SettingsWin32::SettingsWin32()
mySnapshotFile = ""; mySnapshotFile = "";
myStateFile = ""; myStateFile = "";
// Now create UNIX specific settings // Now create Win32 specific settings
set("video", "soft");
#ifdef DISPLAY_OPENGL
set("gl_filter", "nearest");
set("gl_aspect", "2");
#endif
set("sound", "sdl");
set("fullscreen", "false");
set("grabmouse", "false");
set("hidecursor", "false");
set("volume", "-1");
set("accurate", "false"); // Don't change this, or the sound will skip set("accurate", "false"); // Don't change this, or the sound will skip
#ifdef SNAPSHOT_SUPPORT #ifdef SNAPSHOT_SUPPORT
set("ssname", "romname");
set("ssdir", ".\\"); set("ssdir", ".\\");
set("ssingle", "false");
#endif #endif
set("joyleft", "0");
set("joyright", "1");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -97,7 +83,7 @@ void SettingsWin32::usage(string& message)
<< endl << endl
<< " -video <type> Type is one of the following:\n" << " -video <type> Type is one of the following:\n"
<< " soft SDL software mode\n" << " soft SDL software mode\n"
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
<< " gl SDL OpenGL mode\n" << " gl SDL OpenGL mode\n"
<< endl << endl
<< " -gl_filter <type> Type is one of the following:\n" << " -gl_filter <type> Type is one of the following:\n"
@ -105,33 +91,22 @@ void SettingsWin32::usage(string& message)
<< " linear Blurred scaling (GL_LINEAR)\n" << " linear Blurred scaling (GL_LINEAR)\n"
<< " -gl_aspect <number> Scale the width by the given amount\n" << " -gl_aspect <number> Scale the width by the given amount\n"
<< endl << endl
#endif
<< " -sound <type> Type is one of the following:\n"
<< " 0 Disables all sound generation\n"
#ifdef SOUND_ALSA
<< " alsa ALSA version 0.9 driver\n"
#endif #endif
#ifdef SOUND_OSS << " -sound <0|1> Enable sound generation\n"
<< " oss Open Sound System driver\n"
#endif
#ifdef SOUND_SDL
<< " sdl Native SDL driver\n"
#endif
<< endl
<< " -framerate <number> Display the given number of frames per second\n" << " -framerate <number> Display the given number of frames per second\n"
<< " -zoom <size> Makes window be 'size' times normal\n" << " -zoom <size> Makes window be 'size' times normal\n"
<< " -fullscreen <0|1> Play the game in fullscreen mode\n" << " -fullscreen <0|1> Play the game in fullscreen mode\n"
<< " -grabmouse <0|1> Keeps the mouse in the game window\n" << " -grabmouse <0|1> Keeps the mouse in the game window\n"
<< " -hidecursor <0|1> Hides the mouse cursor in the game window\n" << " -hidecursor <0|1> Hides the mouse cursor in the game window\n"
<< " -volume <number> Set the volume (0 - 100)\n" << " -volume <number> Set the volume (0 - 100)\n"
#ifdef HAVE_JOYSTICK #ifdef JOYSTICK_SUPPORT
<< " -paddle <0|1|2|3|real> Indicates which paddle the mouse should emulate\n" << " -paddle <0|1|2|3|real> Indicates which paddle the mouse should emulate\n"
<< " or that real Atari 2600 paddles are being used\n" << " or that real Atari 2600 paddles are being used\n"
<< " -joyleft <number> The joystick number representing the left controller\n" << " -joyleft <number> The joystick number representing the left controller\n"
<< " -joyright <number> The joystick number representing the right controller\n" << " -joyright <number> The joystick number representing the right controller\n"
#else #else
<< " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n" << " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n"
#endif #endif
<< " -altpro <props file> Use the given properties file instead of stella.pro\n" << " -altpro <props file> Use the given properties file instead of stella.pro\n"
<< " -showinfo <0|1> Shows some game info\n" << " -showinfo <0|1> Shows some game info\n"
<< " -accurate <0|1> Accurate game timing (uses more CPU)\n" << " -accurate <0|1> Accurate game timing (uses more CPU)\n"
@ -179,9 +154,9 @@ string SettingsWin32::snapshotFilename()
string theSnapshotName = getString("ssname"); string theSnapshotName = getString("ssname");
if(theSnapshotName == "romname") if(theSnapshotName == "romname")
path = path + "/" + myConsole->properties().get("Cartridge.Name"); path = path + "\\" + myConsole->properties().get("Cartridge.Name");
else if(theSnapshotName == "md5sum") else if(theSnapshotName == "md5sum")
path = path + "/" + myConsole->properties().get("Cartridge.MD5"); path = path + "\\" + myConsole->properties().get("Cartridge.MD5");
// Replace all spaces in name with underscores // Replace all spaces in name with underscores
replace(path.begin(), path.end(), ' ', '_'); replace(path.begin(), path.end(), ' ', '_');

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: mainSDL.cxx,v 1.67 2003-12-10 18:58:56 stephena Exp $ // $Id: mainSDL.cxx,v 1.68 2004-04-03 18:54:23 stephena Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -39,6 +39,7 @@
#include "FrameBufferSoft.hxx" #include "FrameBufferSoft.hxx"
#include "PropsSet.hxx" #include "PropsSet.hxx"
#include "Sound.hxx" #include "Sound.hxx"
#include "SoundSDL.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
@ -48,22 +49,12 @@
static bool theUseOpenGLFlag; static bool theUseOpenGLFlag;
#endif #endif
#ifdef SOUND_ALSA
#include "SoundALSA.hxx"
#endif
#ifdef SOUND_OSS
#include "SoundOSS.hxx"
#endif
#ifdef SOUND_SDL
#include "SoundSDL.hxx"
#endif
#if defined(UNIX) #if defined(UNIX)
#include "SettingsUNIX.hxx" #include "SettingsUNIX.hxx"
#elif defined(WIN32) #elif defined(WIN32)
#include "SettingsWin32.hxx" #include "SettingsWin32.hxx"
#else
#error Unsupported platform!
#endif #endif
static void cleanup(); static void cleanup();
@ -72,13 +63,12 @@ static void handleEvents();
static uInt32 getTicks(); static uInt32 getTicks();
static bool setupProperties(PropertiesSet& set); static bool setupProperties(PropertiesSet& set);
#ifdef HAVE_JOYSTICK #ifdef JOYSTICK_SUPPORT
static SDL_Joystick* theLeftJoystick = (SDL_Joystick*) NULL; static SDL_Joystick* theLeftJoystick = (SDL_Joystick*) NULL;
static SDL_Joystick* theRightJoystick = (SDL_Joystick*) NULL; static SDL_Joystick* theRightJoystick = (SDL_Joystick*) NULL;
static uInt32 theLeftJoystickNumber; static uInt32 theLeftJoystickNumber;
static uInt32 theRightJoystickNumber; static uInt32 theRightJoystickNumber;
// static uInt32 thePaddleNumber; // static uInt32 thePaddleNumber;
#endif #endif
// Pointer to the console object or the null pointer // Pointer to the console object or the null pointer
@ -269,7 +259,7 @@ inline uInt32 getTicks()
*/ */
bool setupJoystick() bool setupJoystick()
{ {
#ifdef HAVE_JOYSTICK #ifdef JOYSTICK_SUPPORT
// Initialize the joystick subsystem // Initialize the joystick subsystem
if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) || (SDL_NumJoysticks() <= 0)) if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) || (SDL_NumJoysticks() <= 0))
{ {
@ -541,7 +531,7 @@ void handleEvents()
theDisplay->refresh(); theDisplay->refresh();
} }
#ifdef HAVE_JOYSTICK #ifdef JOYSTICK_SUPPORT
// Read joystick events and modify event states // Read joystick events and modify event states
StellaEvent::JoyStick stick; StellaEvent::JoyStick stick;
StellaEvent::JoyCode code; StellaEvent::JoyCode code;
@ -657,7 +647,7 @@ void cleanup()
if(SDL_WasInit(SDL_INIT_EVERYTHING)) if(SDL_WasInit(SDL_INIT_EVERYTHING))
{ {
#ifdef HAVE_JOYSTICK #ifdef JOYSTICK_SUPPORT
if(SDL_JoystickOpened(theLeftJoystickNumber)) if(SDL_JoystickOpened(theLeftJoystickNumber))
SDL_JoystickClose(theLeftJoystick); SDL_JoystickClose(theLeftJoystick);
if(SDL_JoystickOpened(theRightJoystickNumber)) if(SDL_JoystickOpened(theRightJoystickNumber))
@ -676,6 +666,8 @@ int main(int argc, char* argv[])
theSettings = new SettingsUNIX(); theSettings = new SettingsUNIX();
#elif defined(WIN32) #elif defined(WIN32)
theSettings = new SettingsWin32(); theSettings = new SettingsWin32();
#else
#error Unsupported platform!
#endif #endif
if(!theSettings) if(!theSettings)
{ {
@ -687,7 +679,7 @@ int main(int argc, char* argv[])
// Take care of commandline arguments // Take care of commandline arguments
if(!theSettings->loadCommandLine(argc, argv)) if(!theSettings->loadCommandLine(argc, argv))
{ {
string message = "Stella for SDL version 1.4\n\nUsage: stella.sdl [option ...] file"; string message = "Stella for SDL version 1.4\n\nUsage: stella [options ...] romfile";
theSettings->usage(message); theSettings->usage(message);
cleanup(); cleanup();
return 0; return 0;
@ -762,44 +754,18 @@ int main(int argc, char* argv[])
} }
// Create a sound object for playing audio // Create a sound object for playing audio
string sounddriver = theSettings->getString("sound"); if(theSettings->getBool("sound"))
if(sounddriver == "0") {
theSound = new SoundSDL();
if(theShowInfoFlag)
cout << "Sound enabled.\n";
}
else // even if sound has been disabled, we still need a sound object
{ {
// even if sound has been disabled, we still need a sound object
theSound = new Sound(); theSound = new Sound();
if(theShowInfoFlag) if(theShowInfoFlag)
cout << "Sound disabled.\n"; cout << "Sound disabled.\n";
} }
#ifdef SOUND_ALSA
else if(sounddriver == "alsa")
{
theSound = new SoundALSA();
if(theShowInfoFlag)
cout << "Using ALSA for sound.\n";
}
#endif
#ifdef SOUND_OSS
else if(sounddriver == "oss")
{
theSound = new SoundOSS();
if(theShowInfoFlag)
cout << "Using OSS for sound.\n";
}
#endif
#ifdef SOUND_SDL
else if(sounddriver == "sdl")
{
theSound = new SoundSDL();
if(theShowInfoFlag)
cout << "Using SDL for sound.\n";
}
#endif
else // a driver that doesn't exist was requested, so disable sound
{
cerr << "ERROR: Sound support for " << sounddriver << " not available.\n";
theSound = new Sound();
}
theSound->setVolume(theSettings->getInt("volume")); theSound->setVolume(theSettings->getInt("volume"));
// Get just the filename of the file containing the ROM image // Get just the filename of the file containing the ROM image