mirror of https://github.com/stella-emu/stella.git
More huge code reorganizations.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@368 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
c30051b0a3
commit
9c42f79392
|
@ -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.59 2005-02-21 02:23:47 stephena Exp $
|
||||
## $Id: makefile,v 1.60 2005-02-21 20:41:04 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -32,7 +32,7 @@ OPTIMIZATIONS =
|
|||
|
||||
### to include support for saving snapshots in png format
|
||||
### (requires PNG library)
|
||||
SNAPSHOT_SUPPORT = 1
|
||||
# SNAPSHOT_SUPPORT = 1
|
||||
|
||||
### to include support for game developers
|
||||
### enables some extra commandline options that allow the user
|
||||
|
@ -41,7 +41,7 @@ OPTIMIZATIONS =
|
|||
|
||||
### to build on SMP (or distcc-based) machines
|
||||
### change to number of CPU's you have
|
||||
NUMBER_CPU = 1
|
||||
NUMBER_CPU = 3
|
||||
|
||||
##============================================================================
|
||||
## All done, type make to get a list of frontends
|
||||
|
|
|
@ -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: FrameBufferSoft.cxx,v 1.7 2005-02-21 02:23:48 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.8 2005-02-21 20:41:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -28,8 +28,8 @@
|
|||
#include "OSystem.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FrameBufferSoft::FrameBufferSoft()
|
||||
: FrameBuffer()
|
||||
FrameBufferSoft::FrameBufferSoft(OSystem* osystem)
|
||||
: FrameBuffer(osystem)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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: FrameBufferSoft.hxx,v 1.5 2005-02-21 02:23:48 stephena Exp $
|
||||
// $Id: FrameBufferSoft.hxx,v 1.6 2005-02-21 20:41:19 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_SOFT_HXX
|
||||
|
@ -22,6 +22,8 @@
|
|||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
|
||||
|
@ -32,7 +34,7 @@ class RectList;
|
|||
This class implements an SDL software framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.5 2005-02-21 02:23:48 stephena Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.6 2005-02-21 20:41:19 stephena Exp $
|
||||
*/
|
||||
class FrameBufferSoft : public FrameBuffer
|
||||
{
|
||||
|
@ -40,7 +42,7 @@ class FrameBufferSoft : public FrameBuffer
|
|||
/**
|
||||
Creates a new software framebuffer
|
||||
*/
|
||||
FrameBufferSoft();
|
||||
FrameBufferSoft(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
|
|
@ -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.21 2005-02-21 02:23:48 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.22 2005-02-21 20:41:20 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -121,6 +121,9 @@ static Event::Type Paddle_Button[4] = {
|
|||
// Pointer to the main parent osystem object or the null pointer
|
||||
static OSystem* theOSystem = (OSystem*) NULL;
|
||||
|
||||
// Pointer to the display object or the null pointer
|
||||
static EventHandler* theEventHandler = (EventHandler*) NULL;
|
||||
|
||||
// Pointer to the display object or the null pointer
|
||||
static FrameBuffer* theDisplay = (FrameBuffer*) NULL;
|
||||
|
||||
|
@ -804,18 +807,21 @@ void Cleanup()
|
|||
}
|
||||
#endif
|
||||
|
||||
if(theOSystem)
|
||||
delete theOSystem;
|
||||
/*
|
||||
if(theConsole)
|
||||
delete theConsole;
|
||||
|
||||
if(theSound)
|
||||
delete theSound;
|
||||
|
||||
if(theDisplay)
|
||||
delete theDisplay;
|
||||
*/
|
||||
|
||||
if(theEventHandler)
|
||||
delete theEventHandler;
|
||||
|
||||
if(theOSystem)
|
||||
{
|
||||
theOSystem->detachConsole();
|
||||
delete theOSystem;
|
||||
}
|
||||
|
||||
if(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO)
|
||||
SDL_Quit();
|
||||
}
|
||||
|
@ -826,10 +832,13 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
uInt8* image = NULL;
|
||||
|
||||
// Create the parent OSystem object and settings
|
||||
#if defined(UNIX)
|
||||
theSettings = new SettingsUNIX();
|
||||
theOSystem = new OSystemUNIX();
|
||||
theSettings = new SettingsUNIX(theOSystem);
|
||||
#elif defined(WIN32)
|
||||
theSettings = new SettingsWin32();
|
||||
theOSystem = new OSystemWin32();
|
||||
theSettings = new SettingsWin32(theOSystem);
|
||||
#else
|
||||
#error Unsupported platform!
|
||||
#endif
|
||||
|
@ -847,6 +856,9 @@ int main(int argc, char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Create the event handler for the system
|
||||
theEventHandler = new EventHandler(theOSystem);
|
||||
|
||||
// Cache some settings so they don't have to be repeatedly searched for
|
||||
thePaddleMode = theSettings->getInt("paddle");
|
||||
theShowInfoFlag = theSettings->getBool("showinfo");
|
||||
|
@ -856,6 +868,7 @@ int main(int argc, char* argv[])
|
|||
// Create a properties set for us to use and set it up
|
||||
PropertiesSet propertiesSet;
|
||||
SetupProperties(propertiesSet);
|
||||
theOSystem->attach(&propertiesSet);
|
||||
|
||||
// Check to see if the 'listroms' argument was given
|
||||
// If so, list the roms and immediately exit
|
||||
|
@ -885,7 +898,7 @@ int main(int argc, char* argv[])
|
|||
string videodriver = theSettings->getString("video");
|
||||
if(videodriver == "soft")
|
||||
{
|
||||
theDisplay = new FrameBufferSoft();
|
||||
theDisplay = new FrameBufferSoft(theOSystem);
|
||||
}
|
||||
#ifdef DISPLAY_OPENGL
|
||||
else if(videodriver == "gl")
|
||||
|
@ -896,7 +909,7 @@ int main(int argc, char* argv[])
|
|||
#endif
|
||||
else // a driver that doesn't exist was requested, so use software mode
|
||||
{
|
||||
theDisplay = new FrameBufferSoft();
|
||||
theDisplay = new FrameBufferSoft(theOSystem);
|
||||
}
|
||||
|
||||
if(!theDisplay)
|
||||
|
@ -927,15 +940,6 @@ int main(int argc, char* argv[])
|
|||
ShowInfo("Sound disabled");
|
||||
}
|
||||
|
||||
// Create the parent OSystem object
|
||||
#if defined(UNIX)
|
||||
theOSystem = new OSystemUNIX(*theDisplay, *theSound, *theSettings, propertiesSet);
|
||||
#elif defined(WIN32)
|
||||
theSettings = new SettingsWin32();
|
||||
#else
|
||||
#error Unsupported platform!
|
||||
#endif
|
||||
|
||||
// Get a pointer to the file which contains the cartridge ROM
|
||||
const char* file = argv[argc - 1];
|
||||
|
||||
|
@ -953,12 +957,10 @@ int main(int argc, char* argv[])
|
|||
uInt32 size = in.gcount();
|
||||
in.close();
|
||||
|
||||
// Get just the filename of the file containing the ROM image
|
||||
const char* filename = (!strrchr(file, '/')) ? file : strrchr(file, '/') + 1;
|
||||
|
||||
// Create the 2600 game console
|
||||
// theConsole = new Console(image, size, filename, *theSettings, propertiesSet,
|
||||
// *theDisplay, *theSound);
|
||||
Console* theConsole = new Console(image, size, theOSystem);
|
||||
|
||||
cerr << "got here\n";
|
||||
|
||||
// Free the image since we don't need it any longer
|
||||
delete[] image;
|
||||
|
|
|
@ -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: Console.cxx,v 1.39 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.40 2005-02-21 20:41:24 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -51,8 +51,7 @@
|
|||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
||||
OSystem& osystem)
|
||||
Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
||||
: myOSystem(osystem)
|
||||
{
|
||||
myControllers[0] = 0;
|
||||
|
@ -63,16 +62,16 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
|||
myEvent = 0;
|
||||
|
||||
// Add the current console to the system
|
||||
myOSystem.addConsole(this);
|
||||
myOSystem->attach(this);
|
||||
|
||||
// Attach the event subsystem to the current console
|
||||
myEvent = myOSystem.eventHandler().event();
|
||||
myEvent = myOSystem->eventHandler().event();
|
||||
|
||||
// Get the MD5 message-digest for the ROM image
|
||||
string md5 = MD5(image, size);
|
||||
|
||||
// Search for the properties based on MD5
|
||||
myOSystem.propSet().getMD5(md5, myProperties);
|
||||
myOSystem->propSet().getMD5(md5, myProperties);
|
||||
|
||||
// Make sure the MD5 value of the cartridge is set in the properties
|
||||
if(myProperties.get("Cartridge.MD5") == "")
|
||||
|
@ -143,7 +142,7 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
|||
}
|
||||
|
||||
M6532* m6532 = new M6532(*this);
|
||||
TIA* tia = new TIA(myOSystem);
|
||||
TIA* tia = new TIA(*this, myOSystem->sound(), myOSystem->settings());
|
||||
Cartridge* cartridge = Cartridge::create(image, size, myProperties);
|
||||
|
||||
mySystem->attach(m6502);
|
||||
|
@ -160,27 +159,26 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
|||
// Set the correct framerate based on the format of the ROM
|
||||
// This can be overridden by the '-framerate' option
|
||||
myFrameRate = 60;
|
||||
if(myOSystem.settings().getInt("framerate") > 0)
|
||||
myFrameRate = myOSystem.settings().getInt("framerate");
|
||||
if(myOSystem->settings().getInt("framerate") > 0)
|
||||
myFrameRate = myOSystem->settings().getInt("framerate");
|
||||
// else if(myProperties.get("Display.Format") == "NTSC")
|
||||
// myFrameRate = 60;
|
||||
// else if(myProperties.get("Display.Format") == "PAL")
|
||||
// myFrameRate = 50;
|
||||
// mySettings.setInt("framerate", myFrameRate, false);
|
||||
myOSystem.settings().setInt("framerate", myFrameRate);
|
||||
myOSystem->settings().setInt("framerate", myFrameRate);
|
||||
|
||||
// Initialize the framebuffer interface.
|
||||
// This must be done *after* a reset, since it needs updated values.
|
||||
ostringstream title;
|
||||
title << "Stella: \"" << myProperties.get("Cartridge.Name") << "\"";
|
||||
myOSystem.frameBuffer().initialize(&myOSystem,
|
||||
title.str(),
|
||||
myOSystem->frameBuffer().initialize(title.str(),
|
||||
myMediaSource->width() << 1,
|
||||
myMediaSource->height());
|
||||
|
||||
// Initialize the sound interface.
|
||||
uInt32 soundFrameRate = (myProperties.get("Display.Format") == "PAL") ? 50 : 60;
|
||||
myOSystem.sound().initialize(&myOSystem, mySystem, soundFrameRate);
|
||||
myOSystem->sound().initialize(myOSystem, mySystem, soundFrameRate);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -224,40 +222,40 @@ void Console::toggleFormat()
|
|||
{
|
||||
myProperties.set("Display.Format", "PAL");
|
||||
mySystem->reset();
|
||||
myOSystem.frameBuffer().showMessage("PAL Mode");
|
||||
myOSystem->frameBuffer().showMessage("PAL Mode");
|
||||
}
|
||||
else if(format == "PAL")
|
||||
{
|
||||
myProperties.set("Display.Format", "NTSC");
|
||||
mySystem->reset();
|
||||
myOSystem.frameBuffer().showMessage("NTSC Mode");
|
||||
myOSystem->frameBuffer().showMessage("NTSC Mode");
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::togglePalette()
|
||||
{
|
||||
string type = myOSystem.settings().getString("palette");
|
||||
string type = myOSystem->settings().getString("palette");
|
||||
|
||||
if(type == "standard") // switch to original
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Original Stella colors");
|
||||
myOSystem.settings().setString("palette", "original");
|
||||
myOSystem->frameBuffer().showMessage("Original Stella colors");
|
||||
myOSystem->settings().setString("palette", "original");
|
||||
}
|
||||
else if(type == "original") // switch to z26
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Z26 colors");
|
||||
myOSystem.settings().setString("palette", "z26");
|
||||
myOSystem->frameBuffer().showMessage("Z26 colors");
|
||||
myOSystem->settings().setString("palette", "z26");
|
||||
}
|
||||
else if(type == "z26") // switch to standard
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Standard Stella colors");
|
||||
myOSystem.settings().setString("palette", "standard");
|
||||
myOSystem->frameBuffer().showMessage("Standard Stella colors");
|
||||
myOSystem->settings().setString("palette", "standard");
|
||||
}
|
||||
else // switch to standard mode if we get this far
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Standard Stella colors");
|
||||
myOSystem.settings().setString("palette", "standard");
|
||||
myOSystem->frameBuffer().showMessage("Standard Stella colors");
|
||||
myOSystem->settings().setString("palette", "standard");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,10 +265,10 @@ void Console::saveProperties(string filename, bool merge)
|
|||
// Merge the current properties into the PropertiesSet file
|
||||
if(merge)
|
||||
{
|
||||
if(myOSystem.propSet().merge(myProperties, filename))
|
||||
myOSystem.frameBuffer().showMessage("Properties merged");
|
||||
if(myOSystem->propSet().merge(myProperties, filename))
|
||||
myOSystem->frameBuffer().showMessage("Properties merged");
|
||||
else
|
||||
myOSystem.frameBuffer().showMessage("Properties not merged");
|
||||
myOSystem->frameBuffer().showMessage("Properties not merged");
|
||||
}
|
||||
else // Save to the specified file directly
|
||||
{
|
||||
|
@ -280,11 +278,11 @@ void Console::saveProperties(string filename, bool merge)
|
|||
{
|
||||
myProperties.save(out);
|
||||
out.close();
|
||||
myOSystem.frameBuffer().showMessage("Properties saved");
|
||||
myOSystem->frameBuffer().showMessage("Properties saved");
|
||||
}
|
||||
else
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Properties not saved");
|
||||
myOSystem->frameBuffer().showMessage("Properties not saved");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -303,12 +301,12 @@ void Console::changeXStart(const uInt32 direction)
|
|||
xstart += 4;
|
||||
if(xstart > 80)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("XStart at maximum");
|
||||
myOSystem->frameBuffer().showMessage("XStart at maximum");
|
||||
return;
|
||||
}
|
||||
else if((width + xstart) > 160)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("XStart no effect");
|
||||
myOSystem->frameBuffer().showMessage("XStart no effect");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +315,7 @@ void Console::changeXStart(const uInt32 direction)
|
|||
xstart -= 4;
|
||||
if(xstart < 0)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("XStart at minimum");
|
||||
myOSystem->frameBuffer().showMessage("XStart at minimum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +326,7 @@ void Console::changeXStart(const uInt32 direction)
|
|||
|
||||
message = "XStart ";
|
||||
message += strval.str();
|
||||
myOSystem.frameBuffer().showMessage(message);
|
||||
myOSystem->frameBuffer().showMessage(message);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -343,7 +341,7 @@ void Console::changeYStart(const uInt32 direction)
|
|||
ystart++;
|
||||
if(ystart > 64)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("YStart at maximum");
|
||||
myOSystem->frameBuffer().showMessage("YStart at maximum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +350,7 @@ void Console::changeYStart(const uInt32 direction)
|
|||
ystart--;
|
||||
if(ystart < 0)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("YStart at minimum");
|
||||
myOSystem->frameBuffer().showMessage("YStart at minimum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +361,7 @@ void Console::changeYStart(const uInt32 direction)
|
|||
|
||||
message = "YStart ";
|
||||
message += strval.str();
|
||||
myOSystem.frameBuffer().showMessage(message);
|
||||
myOSystem->frameBuffer().showMessage(message);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -379,12 +377,12 @@ void Console::changeWidth(const uInt32 direction)
|
|||
width += 4;
|
||||
if((width > 160) || ((width % 4) != 0))
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Width at maximum");
|
||||
myOSystem->frameBuffer().showMessage("Width at maximum");
|
||||
return;
|
||||
}
|
||||
else if((width + xstart) > 160)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Width no effect");
|
||||
myOSystem->frameBuffer().showMessage("Width no effect");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +391,7 @@ void Console::changeWidth(const uInt32 direction)
|
|||
width -= 4;
|
||||
if(width < 80)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Width at minimum");
|
||||
myOSystem->frameBuffer().showMessage("Width at minimum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +402,7 @@ void Console::changeWidth(const uInt32 direction)
|
|||
|
||||
message = "Width ";
|
||||
message += strval.str();
|
||||
myOSystem.frameBuffer().showMessage(message);
|
||||
myOSystem->frameBuffer().showMessage(message);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -419,7 +417,7 @@ void Console::changeHeight(const uInt32 direction)
|
|||
height++;
|
||||
if(height > 256)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Height at maximum");
|
||||
myOSystem->frameBuffer().showMessage("Height at maximum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +426,7 @@ void Console::changeHeight(const uInt32 direction)
|
|||
height--;
|
||||
if(height < 100)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Height at minimum");
|
||||
myOSystem->frameBuffer().showMessage("Height at minimum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -439,6 +437,6 @@ void Console::changeHeight(const uInt32 direction)
|
|||
|
||||
message = "Height ";
|
||||
message += strval.str();
|
||||
myOSystem.frameBuffer().showMessage(message);
|
||||
myOSystem->frameBuffer().showMessage(message);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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: Console.hxx,v 1.23 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: Console.hxx,v 1.24 2005-02-21 20:41:26 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONSOLE_HXX
|
||||
|
@ -36,7 +36,7 @@ class OSystem;
|
|||
This class represents the entire game console.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Console.hxx,v 1.23 2005-02-21 02:23:49 stephena Exp $
|
||||
@version $Id: Console.hxx,v 1.24 2005-02-21 20:41:26 stephena Exp $
|
||||
*/
|
||||
class Console
|
||||
{
|
||||
|
@ -47,11 +47,9 @@ class Console
|
|||
|
||||
@param image The ROM image of the game to emulate
|
||||
@param size The size of the ROM image
|
||||
@param filename The name of the file that contained the ROM image
|
||||
@param osystem The OSystem object to use
|
||||
*/
|
||||
Console(const uInt8* image, uInt32 size, const char* filename,
|
||||
OSystem& osystem);
|
||||
Console(const uInt8* image, uInt32 size, OSystem* osystem);
|
||||
|
||||
/**
|
||||
Create a new console object by copying another one
|
||||
|
@ -177,8 +175,8 @@ class Console
|
|||
#endif
|
||||
|
||||
private:
|
||||
// Reference to the osystem object
|
||||
OSystem& myOSystem;
|
||||
// Pointer to the osystem object
|
||||
OSystem* myOSystem;
|
||||
|
||||
// Pointers to the left and right controllers
|
||||
Controller* myControllers[2];
|
||||
|
|
|
@ -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: EventHandler.cxx,v 1.31 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.32 2005-02-21 20:42:07 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -34,7 +34,7 @@
|
|||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventHandler::EventHandler(OSystem& osystem)
|
||||
EventHandler::EventHandler(OSystem* osystem)
|
||||
: myOSystem(osystem),
|
||||
myCurrentState(0),
|
||||
myPauseStatus(false),
|
||||
|
@ -42,6 +42,10 @@ EventHandler::EventHandler(OSystem& osystem)
|
|||
myMenuStatus(false),
|
||||
myRemapEnabledFlag(true)
|
||||
{
|
||||
cerr << "EventHandler::EventHandler()\n";
|
||||
// Add this eventhandler object to the OSystem
|
||||
myOSystem->attach(this);
|
||||
|
||||
// Create the event object which will be used for this handler
|
||||
myEvent = new Event();
|
||||
|
||||
|
@ -90,14 +94,14 @@ void EventHandler::sendKeyEvent(StellaEvent::KeyCode key, Int32 state)
|
|||
if(myRemapEnabledFlag && key == StellaEvent::KCODE_TAB && state == 1 && !myPauseStatus)
|
||||
{
|
||||
myMenuStatus = !myMenuStatus;
|
||||
myOSystem.frameBuffer().showMenu(myMenuStatus);
|
||||
myOSystem.sound().mute(myMenuStatus);
|
||||
myOSystem->frameBuffer().showMenu(myMenuStatus);
|
||||
myOSystem->sound().mute(myMenuStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine where the event should be sent
|
||||
if(myMenuStatus)
|
||||
myOSystem.frameBuffer().sendKeyEvent(key, state);
|
||||
myOSystem->frameBuffer().sendKeyEvent(key, state);
|
||||
else
|
||||
sendEvent(myKeyTable[key], state);
|
||||
}
|
||||
|
@ -108,7 +112,7 @@ void EventHandler::sendJoyEvent(StellaEvent::JoyStick stick,
|
|||
{
|
||||
// Determine where the event should be sent
|
||||
if(myMenuStatus)
|
||||
myOSystem.frameBuffer().sendJoyEvent(stick, code, state);
|
||||
myOSystem->frameBuffer().sendJoyEvent(stick, code, state);
|
||||
else
|
||||
sendEvent(myJoyTable[stick*StellaEvent::LastJCODE + code], state);
|
||||
}
|
||||
|
@ -147,19 +151,19 @@ void EventHandler::sendEvent(Event::Type event, Int32 state)
|
|||
else if(event == Event::Pause)
|
||||
{
|
||||
myPauseStatus = !myPauseStatus;
|
||||
myOSystem.frameBuffer().pause(myPauseStatus);
|
||||
myOSystem.sound().mute(myPauseStatus);
|
||||
myOSystem->frameBuffer().pause(myPauseStatus);
|
||||
myOSystem->sound().mute(myPauseStatus);
|
||||
return;
|
||||
}
|
||||
else if(event == Event::Quit)
|
||||
{
|
||||
myQuitStatus = !myQuitStatus;
|
||||
myOSystem.settings().saveConfig();
|
||||
myOSystem->settings().saveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
if(ourMessageTable[event] != "")
|
||||
myOSystem.frameBuffer().showMessage(ourMessageTable[event]);
|
||||
myOSystem->frameBuffer().showMessage(ourMessageTable[event]);
|
||||
}
|
||||
|
||||
// Otherwise, pass it to the emulation core
|
||||
|
@ -171,7 +175,7 @@ void EventHandler::setKeymap()
|
|||
{
|
||||
// Since istringstream swallows whitespace, we have to make the
|
||||
// delimiters be spaces
|
||||
string list = myOSystem.settings().getString("keymap");
|
||||
string list = myOSystem->settings().getString("keymap");
|
||||
replace(list.begin(), list.end(), ':', ' ');
|
||||
|
||||
if(isValidList(list, StellaEvent::LastKCODE))
|
||||
|
@ -195,7 +199,7 @@ void EventHandler::setJoymap()
|
|||
{
|
||||
// Since istringstream swallows whitespace, we have to make the
|
||||
// delimiters be spaces
|
||||
string list = myOSystem.settings().getString("joymap");
|
||||
string list = myOSystem->settings().getString("joymap");
|
||||
replace(list.begin(), list.end(), ':', ' ');
|
||||
|
||||
if(isValidList(list, StellaEvent::LastJSTICK*StellaEvent::LastJCODE))
|
||||
|
@ -339,9 +343,9 @@ bool EventHandler::isValidList(string list, uInt32 length)
|
|||
void EventHandler::saveState()
|
||||
{
|
||||
// Do a state save using the System
|
||||
string md5 = myOSystem.console().properties().get("Cartridge.MD5");
|
||||
string filename = myOSystem.stateFilename(md5, myCurrentState);
|
||||
int result = myOSystem.console().system().saveState(filename, md5);
|
||||
string md5 = myOSystem->console().properties().get("Cartridge.MD5");
|
||||
string filename = myOSystem->stateFilename(md5, myCurrentState);
|
||||
int result = myOSystem->console().system().saveState(filename, md5);
|
||||
|
||||
// Print appropriate message
|
||||
ostringstream buf;
|
||||
|
@ -352,7 +356,7 @@ void EventHandler::saveState()
|
|||
else if(result == 3)
|
||||
buf << "Invalid state " << myCurrentState << " file";
|
||||
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -367,16 +371,16 @@ void EventHandler::changeState()
|
|||
ostringstream buf;
|
||||
buf << "Changed to slot " << myCurrentState;
|
||||
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::loadState()
|
||||
{
|
||||
// Do a state save using the System
|
||||
string md5 = myOSystem.console().properties().get("Cartridge.MD5");
|
||||
string filename = myOSystem.stateFilename(md5, myCurrentState);
|
||||
int result = myOSystem.console().system().loadState(filename, md5);
|
||||
string md5 = myOSystem->console().properties().get("Cartridge.MD5");
|
||||
string filename = myOSystem->stateFilename(md5, myCurrentState);
|
||||
int result = myOSystem->console().system().loadState(filename, md5);
|
||||
|
||||
// Print appropriate message
|
||||
ostringstream buf;
|
||||
|
@ -387,7 +391,7 @@ void EventHandler::loadState()
|
|||
else if(result == 3)
|
||||
buf << "Invalid state " << myCurrentState << " file";
|
||||
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -396,30 +400,30 @@ void EventHandler::takeSnapshot()
|
|||
#ifdef SNAPSHOT_SUPPORT
|
||||
// Figure out the correct snapshot name
|
||||
string filename;
|
||||
string sspath = myOSystem.settings().getString("ssdir");
|
||||
string ssname = myOSystem.settings().getString("ssname");
|
||||
string sspath = myOSystem->settings().getString("ssdir");
|
||||
string ssname = myOSystem->settings().getString("ssname");
|
||||
|
||||
if(ssname == "romname")
|
||||
sspath = sspath + BSPF_PATH_SEPARATOR +
|
||||
myOSystem.console().properties().get("Cartridge.Name");
|
||||
myOSystem->console().properties().get("Cartridge.Name");
|
||||
else if(ssname == "md5sum")
|
||||
sspath = sspath + BSPF_PATH_SEPARATOR +
|
||||
myOSystem.console().properties().get("Cartridge.MD5");
|
||||
myOSystem->console().properties().get("Cartridge.MD5");
|
||||
|
||||
// Check whether we want multiple snapshots created
|
||||
if(!myOSystem.settings().getBool("sssingle"))
|
||||
if(!myOSystem->settings().getBool("sssingle"))
|
||||
{
|
||||
// Determine if the file already exists, checking each successive filename
|
||||
// until one doesn't exist
|
||||
filename = sspath + ".png";
|
||||
if(myOSystem.fileExists(filename))
|
||||
if(myOSystem->fileExists(filename))
|
||||
{
|
||||
ostringstream buf;
|
||||
for(uInt32 i = 1; ;++i)
|
||||
{
|
||||
buf.str("");
|
||||
buf << sspath << "_" << i << ".png";
|
||||
if(!myOSystem.fileExists(buf.str()))
|
||||
if(!myOSystem->fileExists(buf.str()))
|
||||
break;
|
||||
}
|
||||
filename = buf.str();
|
||||
|
@ -429,11 +433,11 @@ void EventHandler::takeSnapshot()
|
|||
filename = sspath + ".png";
|
||||
|
||||
// Now create a Snapshot object and save the PNG
|
||||
myOSystem.frameBuffer().refresh(true);
|
||||
Snapshot snapshot(myOSystem.frameBuffer());
|
||||
myOSystem->frameBuffer().refresh(true);
|
||||
Snapshot snapshot(myOSystem->frameBuffer());
|
||||
string result = snapshot.savePNG(filename);
|
||||
myOSystem.frameBuffer().showMessage(result);
|
||||
myOSystem->frameBuffer().showMessage(result);
|
||||
#else
|
||||
myOSystem.frameBuffer().showMessage("Snapshots unsupported");
|
||||
myOSystem->frameBuffer().showMessage("Snapshots unsupported");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -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: EventHandler.hxx,v 1.15 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.16 2005-02-21 20:42:21 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -40,7 +40,7 @@ class OSystem;
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.15 2005-02-21 02:23:49 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.16 2005-02-21 20:42:21 stephena Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class EventHandler
|
|||
/**
|
||||
Create a new event handler object
|
||||
*/
|
||||
EventHandler(OSystem& osystem);
|
||||
EventHandler(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
@ -123,8 +123,8 @@ class EventHandler
|
|||
void takeSnapshot();
|
||||
|
||||
private:
|
||||
// Global Console object
|
||||
OSystem& myOSystem;
|
||||
// Global OSystem object
|
||||
OSystem* myOSystem;
|
||||
|
||||
// Array of key events
|
||||
Event::Type myKeyTable[StellaEvent::LastKCODE];
|
||||
|
|
|
@ -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: FrameBuffer.cxx,v 1.13 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.14 2005-02-21 20:42:38 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -47,8 +47,8 @@
|
|||
#define RIGHTMARKER 16 // Indicates item being remapped
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FrameBuffer::FrameBuffer()
|
||||
: myOSystem(0),
|
||||
FrameBuffer::FrameBuffer(OSystem* osystem)
|
||||
: myOSystem(osystem),
|
||||
myWidth(0),
|
||||
myHeight(0),
|
||||
theRedrawEntireFrameIndicator(true),
|
||||
|
@ -81,6 +81,7 @@ FrameBuffer::FrameBuffer()
|
|||
myMenuRedraws(2),
|
||||
myInfoMenuWidth(0)
|
||||
{
|
||||
myOSystem->attach(this);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -89,10 +90,8 @@ FrameBuffer::~FrameBuffer(void)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::initialize(OSystem* osystem, const string title,
|
||||
uInt32 width, uInt32 height)
|
||||
void FrameBuffer::initialize(const string title, uInt32 width, uInt32 height)
|
||||
{
|
||||
myOSystem = osystem;
|
||||
myWidth = width;
|
||||
myHeight = height;
|
||||
|
||||
|
|
|
@ -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: FrameBuffer.hxx,v 1.14 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.15 2005-02-21 20:43:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -39,7 +39,7 @@ FIXME This class also implements a MAME-like user interface where Stella settin
|
|||
can be changed.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.14 2005-02-21 02:23:49 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.15 2005-02-21 20:43:10 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ class FrameBuffer
|
|||
/**
|
||||
Creates a new Frame Buffer
|
||||
*/
|
||||
FrameBuffer();
|
||||
FrameBuffer(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
@ -58,12 +58,11 @@ class FrameBuffer
|
|||
Initializes the framebuffer display. This must be called before any
|
||||
calls are made to derived methods.
|
||||
|
||||
@param osystem The parent osystem
|
||||
@param title The title of the window
|
||||
@param width The width of the framebuffer
|
||||
@param height The height of the framebuffer
|
||||
*/
|
||||
void initialize(OSystem* osystem, const string title, uInt32 width, uInt32 height);
|
||||
void initialize(const string title, uInt32 width, uInt32 height);
|
||||
|
||||
/**
|
||||
Updates the display, which depending on the current mode could mean
|
||||
|
|
|
@ -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: OSystem.cxx,v 1.1 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.2 2005-02-21 20:43:20 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -29,15 +29,8 @@
|
|||
#include "OSystem.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystem::OSystem(FrameBuffer& framebuffer, Sound& sound,
|
||||
Settings& settings, PropertiesSet& propset)
|
||||
: myFrameBuffer(framebuffer),
|
||||
mySound(sound),
|
||||
mySettings(settings),
|
||||
myPropSet(propset)
|
||||
OSystem::OSystem()
|
||||
{
|
||||
// Create an event handler which will collect and dispatch events
|
||||
myEventHandler = new EventHandler(*this);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -53,10 +46,6 @@ void OSystem::update()
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystem::OSystem(const OSystem& osystem)
|
||||
: myFrameBuffer(osystem.myFrameBuffer),
|
||||
mySound(osystem.mySound),
|
||||
mySettings(osystem.mySettings),
|
||||
myPropSet(osystem.myPropSet)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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: OSystem.hxx,v 1.1 2005-02-21 02:23:49 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.2 2005-02-21 20:43:20 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -35,7 +35,7 @@ class PropertiesSet;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.1 2005-02-21 02:23:49 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.2 2005-02-21 20:43:20 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -43,8 +43,7 @@ class OSystem
|
|||
/**
|
||||
Create a new OSystem abstract class
|
||||
*/
|
||||
OSystem(FrameBuffer& framebuffer, Sound& sound,
|
||||
Settings& settings, PropertiesSet& propset);
|
||||
OSystem();
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
@ -58,24 +57,52 @@ class OSystem
|
|||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
Adds the specified eventhandler to the system.
|
||||
|
||||
@param eventhandler The eventhandler to add
|
||||
*/
|
||||
void attach(EventHandler* eventhandler) { myEventHandler = eventhandler; }
|
||||
|
||||
/**
|
||||
Adds the specified framebuffer to the system.
|
||||
|
||||
@param framebuffer The framebuffer to add
|
||||
*/
|
||||
void attach(FrameBuffer* framebuffer) { myFrameBuffer = framebuffer; }
|
||||
|
||||
/**
|
||||
Adds the specified sound device to the system.
|
||||
|
||||
@param sound The sound device to add
|
||||
*/
|
||||
void attach(Sound* sound) { mySound = sound; }
|
||||
|
||||
/**
|
||||
Adds the specified settings object to the system.
|
||||
|
||||
@param settings The settings object to add
|
||||
*/
|
||||
void attach(Settings* settings) { mySettings = settings; }
|
||||
|
||||
/**
|
||||
Adds the specified game properties set to the system.
|
||||
|
||||
@param propset The properties set to add
|
||||
*/
|
||||
void attach(PropertiesSet* propset) { myPropSet = propset; }
|
||||
|
||||
/**
|
||||
Adds the specified console to the system.
|
||||
|
||||
@param console The console (game emulation object) to add
|
||||
*/
|
||||
void addConsole(Console* console) { myConsole = console; }
|
||||
void attach(Console* console) { myConsole = console; }
|
||||
|
||||
/**
|
||||
Removes the currently attached console from the system.
|
||||
*/
|
||||
void removeConsole(void) { delete myConsole; myConsole = NULL; }
|
||||
|
||||
/**
|
||||
Get the console of the system.
|
||||
|
||||
@return The console object
|
||||
*/
|
||||
Console& console(void) const { return *myConsole; }
|
||||
void detachConsole(void) { delete myConsole; myConsole = NULL; }
|
||||
|
||||
/**
|
||||
Get the event handler of the system
|
||||
|
@ -89,35 +116,41 @@ class OSystem
|
|||
|
||||
@return The frame buffer
|
||||
*/
|
||||
FrameBuffer& frameBuffer() const { return myFrameBuffer; }
|
||||
FrameBuffer& frameBuffer() const { return *myFrameBuffer; }
|
||||
|
||||
/**
|
||||
Get the sound object of the system
|
||||
|
||||
@return The sound object
|
||||
*/
|
||||
Sound& sound() const { return mySound; }
|
||||
Sound& sound() const { return *mySound; }
|
||||
|
||||
/**
|
||||
Get the settings object of the system
|
||||
|
||||
@return The settings object
|
||||
*/
|
||||
Settings& settings() const { return mySettings; }
|
||||
Settings& settings() const { return *mySettings; }
|
||||
|
||||
/**
|
||||
Get the set of game properties for the system
|
||||
|
||||
@return The properties set object
|
||||
*/
|
||||
PropertiesSet& propSet() const { return myPropSet; }
|
||||
PropertiesSet& propSet() const { return *myPropSet; }
|
||||
|
||||
/**
|
||||
Get the console of the system.
|
||||
|
||||
@return The console object
|
||||
*/
|
||||
Console& console(void) const { return *myConsole; }
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// The following methods are system-specific and must be implemented
|
||||
// in derived classes.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
This method should be called to get the filename of a state file
|
||||
given the state number.
|
||||
|
@ -142,17 +175,17 @@ class OSystem
|
|||
// Pointer to the EventHandler object
|
||||
EventHandler* myEventHandler;
|
||||
|
||||
// Reference to the FrameBuffer object
|
||||
FrameBuffer& myFrameBuffer;
|
||||
// Pointer to the FrameBuffer object
|
||||
FrameBuffer* myFrameBuffer;
|
||||
|
||||
// Reference to the Sound object
|
||||
Sound& mySound;
|
||||
// Pointer to the Sound object
|
||||
Sound* mySound;
|
||||
|
||||
// Reference to the Settings object
|
||||
Settings& mySettings;
|
||||
// Pointer to the Settings object
|
||||
Settings* mySettings;
|
||||
|
||||
// Reference to the PropertiesSet object
|
||||
PropertiesSet& myPropSet;
|
||||
// Pointer to the PropertiesSet object
|
||||
PropertiesSet* myPropSet;
|
||||
|
||||
// Pointer to the (currently defined) Console object
|
||||
Console* myConsole;
|
||||
|
|
|
@ -13,19 +13,25 @@
|
|||
// 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.31 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.32 2005-02-21 20:43:20 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "OSystem.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Settings::Settings()
|
||||
Settings::Settings(OSystem* osystem)
|
||||
: myOSystem(osystem)
|
||||
{
|
||||
// Add this settings object to the OSystem
|
||||
myOSystem->attach(this);
|
||||
|
||||
// First create the settings array
|
||||
myCapacity = 30;
|
||||
mySettings = new Setting[myCapacity];
|
||||
|
|
|
@ -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.19 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: Settings.hxx,v 1.20 2005-02-21 20:43:21 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_HXX
|
||||
|
@ -28,7 +28,7 @@ class OSystem;
|
|||
This class provides an interface for accessing frontend specific settings.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Settings.hxx,v 1.19 2005-02-21 02:23:57 stephena Exp $
|
||||
@version $Id: Settings.hxx,v 1.20 2005-02-21 20:43:21 stephena Exp $
|
||||
*/
|
||||
class Settings
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ class Settings
|
|||
/**
|
||||
Create a new settings abstract class
|
||||
*/
|
||||
Settings();
|
||||
Settings(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
|
|
@ -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: TIA.cxx,v 1.36 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: TIA.cxx,v 1.37 2005-02-21 20:43:22 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -30,15 +30,14 @@
|
|||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Sound.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
#define HBLANK 68
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TIA::TIA(OSystem& osystem)
|
||||
: myOSystem(osystem),
|
||||
myConsole(osystem.console()),
|
||||
mySound(osystem.sound()),
|
||||
TIA::TIA(const Console& console, Sound& sound, Settings& settings)
|
||||
: myConsole(console),
|
||||
mySound(sound),
|
||||
mySettings(settings),
|
||||
myColorLossEnabled(false),
|
||||
myMaximumNumberOfScanlines(262),
|
||||
myCOLUBK(myColor[0]),
|
||||
|
@ -266,6 +265,7 @@ void TIA::install(System& system)
|
|||
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
mySystem->resetCycles();
|
||||
cerr << "TIA::install()\n";
|
||||
|
||||
|
||||
// All accesses are to this device
|
||||
|
@ -282,6 +282,7 @@ void TIA::install(System& system)
|
|||
mySystem->setPageAccess(i >> shift, access);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -535,7 +536,7 @@ void TIA::update()
|
|||
const uInt32* TIA::palette() const
|
||||
{
|
||||
// See which palette we should be using
|
||||
string type = myOSystem.settings().getString("palette");
|
||||
string type = mySettings.getString("palette");
|
||||
string format = myConsole.properties().get("Display.Format");
|
||||
|
||||
if(type == "standard")
|
||||
|
@ -3272,9 +3273,9 @@ const uInt32 TIA::ourPALPaletteZ26[256] = {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TIA::TIA(const TIA& c)
|
||||
: myOSystem(c.myOSystem),
|
||||
myConsole(c.myConsole),
|
||||
: myConsole(c.myConsole),
|
||||
mySound(c.mySound),
|
||||
mySettings(c.mySettings),
|
||||
myCOLUBK(myColor[0]),
|
||||
myCOLUPF(myColor[1]),
|
||||
myCOLUP0(myColor[2]),
|
||||
|
|
|
@ -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: TIA.hxx,v 1.15 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: TIA.hxx,v 1.16 2005-02-21 20:43:25 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIA_HXX
|
||||
|
@ -24,7 +24,7 @@ class Sound;
|
|||
class System;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
class OSystem;
|
||||
class Settings;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Device.hxx"
|
||||
|
@ -42,7 +42,7 @@ class OSystem;
|
|||
be displayed on screen.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: TIA.hxx,v 1.15 2005-02-21 02:23:57 stephena Exp $
|
||||
@version $Id: TIA.hxx,v 1.16 2005-02-21 20:43:25 stephena Exp $
|
||||
*/
|
||||
class TIA : public Device , public MediaSource
|
||||
{
|
||||
|
@ -50,10 +50,11 @@ class TIA : public Device , public MediaSource
|
|||
/**
|
||||
Create a new TIA for the specified console
|
||||
|
||||
@param console The console the TIA is associated with
|
||||
@param sound The sound object the TIA is associated with
|
||||
@param console The console the TIA is associated with
|
||||
@param sound The sound object the TIA is associated with
|
||||
@param settings The settings object the TIA is associated with
|
||||
*/
|
||||
TIA(OSystem& osystem);
|
||||
TIA(const Console& console, Sound& sound, Settings& settings);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
@ -203,15 +204,15 @@ class TIA : public Device , public MediaSource
|
|||
void waitHorizontalSync();
|
||||
|
||||
private:
|
||||
// OSsystem the TIA is associated with
|
||||
const OSystem& myOSystem;
|
||||
|
||||
// Console the TIA is associated with
|
||||
const Console& myConsole;
|
||||
|
||||
// Sound object the TIA is associated with
|
||||
Sound& mySound;
|
||||
|
||||
// Settings object the TIA is associated with
|
||||
Settings& mySettings;
|
||||
|
||||
private:
|
||||
// Indicates if color loss should be enabled or disabled. Color loss
|
||||
// occurs on PAL (and maybe SECAM) systems when the previous frame
|
||||
|
|
|
@ -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: System.cxx,v 1.4 2002-08-11 17:48:13 stephena Exp $
|
||||
// $Id: System.cxx,v 1.5 2005-02-21 20:43:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -101,6 +101,7 @@ void System::reset()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void System::attach(Device* device)
|
||||
{
|
||||
cerr << "System::attach()\n";
|
||||
assert(myNumberOfDevices < 100);
|
||||
|
||||
// Add device to my collection of devices
|
||||
|
|
|
@ -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: OSystemUNIX.cxx,v 1.1 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: OSystemUNIX.cxx,v 1.2 2005-02-21 20:43:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -29,9 +29,7 @@
|
|||
#include "OSystemUNIX.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemUNIX::OSystemUNIX(FrameBuffer& framebuffer, Sound& sound,
|
||||
Settings& settings, PropertiesSet& propset)
|
||||
: OSystem(framebuffer, sound, settings, propset)
|
||||
OSystemUNIX::OSystemUNIX()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,17 +13,12 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OSystemUNIX.hxx,v 1.1 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: OSystemUNIX.hxx,v 1.2 2005-02-21 20:43:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_UNIX_HXX
|
||||
#define OSYSTEM_UNIX_HXX
|
||||
|
||||
class FrameBuffer;
|
||||
class Sound;
|
||||
class Settings;
|
||||
class PropertiesSet;
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
|
||||
|
@ -31,7 +26,7 @@ class PropertiesSet;
|
|||
This class defines UNIX-like OS's (Linux) system specific settings.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystemUNIX.hxx,v 1.1 2005-02-21 02:23:57 stephena Exp $
|
||||
@version $Id: OSystemUNIX.hxx,v 1.2 2005-02-21 20:43:53 stephena Exp $
|
||||
*/
|
||||
class OSystemUNIX : public OSystem
|
||||
{
|
||||
|
@ -39,8 +34,7 @@ class OSystemUNIX : public OSystem
|
|||
/**
|
||||
Create a new UNIX-specific operating system object
|
||||
*/
|
||||
OSystemUNIX(FrameBuffer& framebuffer, Sound& sound,
|
||||
Settings& settings, PropertiesSet& propset);
|
||||
OSystemUNIX();
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
|
|
@ -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: SettingsUNIX.cxx,v 1.8 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: SettingsUNIX.cxx,v 1.9 2005-02-21 20:43:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -30,7 +30,8 @@
|
|||
#include "SettingsUNIX.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsUNIX::SettingsUNIX()
|
||||
SettingsUNIX::SettingsUNIX(OSystem* osystem)
|
||||
: Settings(osystem)
|
||||
{
|
||||
// First set variables that the parent class needs
|
||||
myBaseDir = getenv("HOME");
|
||||
|
|
|
@ -13,19 +13,21 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SettingsUNIX.hxx,v 1.4 2005-02-21 02:23:57 stephena Exp $
|
||||
// $Id: SettingsUNIX.hxx,v 1.5 2005-02-21 20:43:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_UNIX_HXX
|
||||
#define SETTINGS_UNIX_HXX
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
/**
|
||||
This class defines UNIX-like OS's (Linux) system specific settings.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: SettingsUNIX.hxx,v 1.4 2005-02-21 02:23:57 stephena Exp $
|
||||
@version $Id: SettingsUNIX.hxx,v 1.5 2005-02-21 20:43:53 stephena Exp $
|
||||
*/
|
||||
class SettingsUNIX : public Settings
|
||||
{
|
||||
|
@ -33,7 +35,7 @@ class SettingsUNIX : public Settings
|
|||
/**
|
||||
Create a new UNIX settings object
|
||||
*/
|
||||
SettingsUNIX();
|
||||
SettingsUNIX(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
|
Loading…
Reference in New Issue