mirror of https://github.com/stella-emu/stella.git
- Fixed some compile warnings under gcc.
- Adding better error checking to the mainSDL class (SDL_WasInit), thanks to Joshua Rodman. - Removed the bufsize argument, since it's no longer used. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@264 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f4aced6c64
commit
50767f4bb1
|
@ -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: SoundSDL.hxx,v 1.2 2004-06-13 05:03:26 bwmott Exp $
|
// $Id: SoundSDL.hxx,v 1.3 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef SOUNDSDL_HXX
|
#ifndef SOUNDSDL_HXX
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
This class implements the sound API for SDL.
|
This class implements the sound API for SDL.
|
||||||
|
|
||||||
@author Stephen Anthony and Bradford W. Mott
|
@author Stephen Anthony and Bradford W. Mott
|
||||||
@version $Id: SoundSDL.hxx,v 1.2 2004-06-13 05:03:26 bwmott Exp $
|
@version $Id: SoundSDL.hxx,v 1.3 2004-06-13 16:51:15 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class SoundSDL : public Sound
|
class SoundSDL : public Sound
|
||||||
{
|
{
|
||||||
|
|
|
@ -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.3 2004-06-13 05:09:37 bwmott Exp $
|
// $Id: mainSDL.cxx,v 1.4 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -759,10 +759,13 @@ bool setupProperties(PropertiesSet& set)
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
for(uInt32 i = 0; i < StellaEvent::LastJSTICK; i++)
|
if(SDL_WasInit(SDL_INIT_JOYSTICK) & SDL_INIT_JOYSTICK)
|
||||||
{
|
{
|
||||||
if(SDL_JoystickOpened(i))
|
for(uInt32 i = 0; i < StellaEvent::LastJSTICK; i++)
|
||||||
SDL_JoystickClose(theJoysticks[i].stick);
|
{
|
||||||
|
if(SDL_JoystickOpened(i))
|
||||||
|
SDL_JoystickClose(theJoysticks[i].stick);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -778,7 +781,9 @@ void cleanup()
|
||||||
if(theDisplay)
|
if(theDisplay)
|
||||||
delete theDisplay;
|
delete theDisplay;
|
||||||
|
|
||||||
SDL_Quit();
|
Uint32 subsystem_mask = SDL_INIT_VIDEO|SDL_INIT_AUDIO;
|
||||||
|
if(SDL_WasInit(subsystem_mask) == subsystem_mask)
|
||||||
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -825,6 +830,8 @@ int main(int argc, char* argv[])
|
||||||
if(!in)
|
if(!in)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't open " << file << "..." << endl;
|
cerr << "ERROR: Couldn't open " << file << "..." << endl;
|
||||||
|
string message = "Stella version 1.4_cvs\n\nUsage: stella [options ...] romfile";
|
||||||
|
theSettings->usage(message);
|
||||||
cleanup();
|
cleanup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -899,7 +906,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// Create the 2600 game console
|
// Create the 2600 game console
|
||||||
theConsole = new Console(image, size, filename, *theSettings, propertiesSet,
|
theConsole = new Console(image, size, filename, *theSettings, propertiesSet,
|
||||||
*theDisplay, *theSound, theSettings->getInt("framerate"));
|
*theDisplay, *theSound);
|
||||||
|
|
||||||
// Free the image since we don't need it any longer
|
// Free the image since we don't need it any longer
|
||||||
delete[] image;
|
delete[] image;
|
||||||
|
|
|
@ -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: Console.cxx,v 1.29 2004-06-13 04:59:40 bwmott Exp $
|
// $Id: Console.cxx,v 1.30 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -52,12 +52,11 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
||||||
Settings& settings, PropertiesSet& propertiesSet,
|
Settings& settings, PropertiesSet& propertiesSet,
|
||||||
FrameBuffer& framebuffer, Sound& sound, uInt32 frameRate)
|
FrameBuffer& framebuffer, Sound& sound)
|
||||||
: mySettings(settings),
|
: mySettings(settings),
|
||||||
myPropSet(propertiesSet),
|
myPropSet(propertiesSet),
|
||||||
myFrameBuffer(framebuffer),
|
myFrameBuffer(framebuffer),
|
||||||
mySound(sound),
|
mySound(sound)
|
||||||
myFrameRate(frameRate)
|
|
||||||
{
|
{
|
||||||
myControllers[0] = 0;
|
myControllers[0] = 0;
|
||||||
myControllers[1] = 0;
|
myControllers[1] = 0;
|
||||||
|
@ -66,6 +65,8 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
||||||
mySystem = 0;
|
mySystem = 0;
|
||||||
myEvent = 0;
|
myEvent = 0;
|
||||||
|
|
||||||
|
myFrameRate = mySettings.getInt("framerate");
|
||||||
|
|
||||||
// Create an event handler which will collect and dispatch events
|
// Create an event handler which will collect and dispatch events
|
||||||
myEventHandler = new EventHandler(this);
|
myEventHandler = new EventHandler(this);
|
||||||
myEvent = myEventHandler->event();
|
myEvent = myEventHandler->event();
|
||||||
|
|
|
@ -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: Console.hxx,v 1.18 2004-06-13 04:59:40 bwmott Exp $
|
// $Id: Console.hxx,v 1.19 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CONSOLE_HXX
|
#ifndef CONSOLE_HXX
|
||||||
|
@ -41,7 +41,7 @@ class FrameBuffer;
|
||||||
This class represents the entire game console.
|
This class represents the entire game console.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: Console.hxx,v 1.18 2004-06-13 04:59:40 bwmott Exp $
|
@version $Id: Console.hxx,v 1.19 2004-06-13 16:51:15 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Console
|
class Console
|
||||||
{
|
{
|
||||||
|
@ -57,11 +57,10 @@ class Console
|
||||||
@param profiles The game profiles object to use
|
@param profiles The game profiles object to use
|
||||||
@param framebuffer The framebuffer object to use
|
@param framebuffer The framebuffer object to use
|
||||||
@param sound The sound object to use
|
@param sound The sound object to use
|
||||||
@param framerate The framerate being used
|
|
||||||
*/
|
*/
|
||||||
Console(const uInt8* image, uInt32 size, const char* filename,
|
Console(const uInt8* image, uInt32 size, const char* filename,
|
||||||
Settings& settings, PropertiesSet& propertiesSet,
|
Settings& settings, PropertiesSet& propertiesSet,
|
||||||
FrameBuffer& framebuffer, Sound& sound, uInt32 frameRate);
|
FrameBuffer& framebuffer, Sound& sound);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new console object by copying another one
|
Create a new console object by copying another one
|
||||||
|
|
|
@ -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.20 2004-05-28 22:07:57 stephena Exp $
|
// $Id: Settings.cxx,v 1.21 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -44,12 +44,11 @@ Settings::Settings()
|
||||||
#endif
|
#endif
|
||||||
set("sound", "true");
|
set("sound", "true");
|
||||||
set("fragsize", "512");
|
set("fragsize", "512");
|
||||||
set("bufsize", "1536");
|
|
||||||
set("fullscreen", "false");
|
set("fullscreen", "false");
|
||||||
set("grabmouse", "false");
|
set("grabmouse", "false");
|
||||||
set("hidecursor", "false");
|
set("hidecursor", "false");
|
||||||
set("volume", "-1");
|
set("volume", "-1");
|
||||||
set("accurate", "true");
|
set("accurate", "false");
|
||||||
set("framerate", "60");
|
set("framerate", "60");
|
||||||
set("keymap", "");
|
set("keymap", "");
|
||||||
set("joymap", "");
|
set("joymap", "");
|
||||||
|
|
|
@ -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: TIA.cxx,v 1.33 2004-06-13 04:53:04 bwmott Exp $
|
// $Id: TIA.cxx,v 1.34 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -38,11 +38,11 @@ TIA::TIA(const Console& console, Sound& sound)
|
||||||
: myConsole(console),
|
: myConsole(console),
|
||||||
mySound(sound),
|
mySound(sound),
|
||||||
myColorLossEnabled(false),
|
myColorLossEnabled(false),
|
||||||
|
myMaximumNumberOfScanlines(262),
|
||||||
myCOLUBK(myColor[0]),
|
myCOLUBK(myColor[0]),
|
||||||
myCOLUPF(myColor[1]),
|
myCOLUPF(myColor[1]),
|
||||||
myCOLUP0(myColor[2]),
|
myCOLUP0(myColor[2]),
|
||||||
myCOLUP1(myColor[3]),
|
myCOLUP1(myColor[3])
|
||||||
myMaximumNumberOfScanlines(262)
|
|
||||||
{
|
{
|
||||||
// Allocate buffers for two frame buffers
|
// Allocate buffers for two frame buffers
|
||||||
myCurrentFrameBuffer = new uInt8[160 * 300];
|
myCurrentFrameBuffer = new uInt8[160 * 300];
|
||||||
|
|
|
@ -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.2 2004-05-28 22:07:57 stephena Exp $
|
// $Id: SettingsUNIX.cxx,v 1.3 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -83,8 +83,7 @@ void SettingsUNIX::usage(string& message)
|
||||||
<< endl
|
<< endl
|
||||||
#endif
|
#endif
|
||||||
<< " -sound <0|1> Enable sound generation\n"
|
<< " -sound <0|1> Enable sound generation\n"
|
||||||
<< " -fragsize <number> The size of sound fragments (should be a power of two)\n"
|
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n"
|
||||||
<< " -bufsize <number> The size of the sound buffer\n"
|
|
||||||
<< " -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"
|
||||||
|
|
|
@ -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.3 2004-05-28 23:16:26 stephena Exp $
|
// $Id: SettingsWin32.cxx,v 1.4 2004-06-13 16:51:15 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
//#include <cstdlib>
|
//#include <cstdlib>
|
||||||
|
@ -60,6 +60,7 @@ SettingsWin32::SettingsWin32()
|
||||||
// Now create Win32 specific settings
|
// Now create Win32 specific settings
|
||||||
set("romdir", "roms");
|
set("romdir", "roms");
|
||||||
set("accurate", "false"); // Don't change this, or the sound will skip
|
set("accurate", "false"); // Don't change this, or the sound will skip
|
||||||
|
set("fragsize", "2048"); // Anything less than this usually causes sound skipping
|
||||||
#ifdef SNAPSHOT_SUPPORT
|
#ifdef SNAPSHOT_SUPPORT
|
||||||
set("ssdir", ".\\");
|
set("ssdir", ".\\");
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,7 +91,7 @@ void SettingsWin32::usage(string& message)
|
||||||
<< endl
|
<< endl
|
||||||
#endif
|
#endif
|
||||||
<< " -sound <0|1> Enable sound generation\n"
|
<< " -sound <0|1> Enable sound generation\n"
|
||||||
<< " -fragsize <number> The size of sound fragments (should be a power of two)\n"
|
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n"
|
||||||
<< " -bufsize <number> The size of the sound buffer\n"
|
<< " -bufsize <number> The size of the sound buffer\n"
|
||||||
<< " -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"
|
||||||
|
|
Loading…
Reference in New Issue