2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2005-06-16 00:56:00 +00:00
|
|
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
2001-12-27 19:54:36 +00:00
|
|
|
//
|
|
|
|
// See the file "license" for information on usage and redistribution of
|
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2005-09-11 22:55:51 +00:00
|
|
|
// $Id: Console.cxx,v 1.70 2005-09-11 22:55:51 stephena Exp $
|
2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include <assert.h>
|
2002-11-09 23:29:51 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <fstream>
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
#include "Booster.hxx"
|
|
|
|
#include "Cart.hxx"
|
|
|
|
#include "Console.hxx"
|
|
|
|
#include "Control.hxx"
|
|
|
|
#include "Driving.hxx"
|
|
|
|
#include "Event.hxx"
|
2003-09-04 16:50:48 +00:00
|
|
|
#include "EventHandler.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
#include "Joystick.hxx"
|
|
|
|
#include "Keyboard.hxx"
|
|
|
|
#include "M6502Hi.hxx"
|
|
|
|
#include "M6532.hxx"
|
|
|
|
#include "MD5.hxx"
|
|
|
|
#include "MediaSrc.hxx"
|
|
|
|
#include "Paddles.hxx"
|
|
|
|
#include "Props.hxx"
|
|
|
|
#include "PropsSet.hxx"
|
2003-09-04 16:50:48 +00:00
|
|
|
#include "Settings.hxx"
|
Huge changes across the map. Lets see if I can remember it all ...
There is now an SDL OpenGL port with filtering and alpha-blending.
It's a work in progress right now, but is already quite stable.
It's not as optimized as the software version yet, but this will
change as well. For now, you have to compile the SDL version in
either normal software mode or OpenGL mode. This will change
before the 1.4 release.
When entering menu mode, the emulation is now suspended. And when
pause is pressed, you can't enter menu mode. Because of these changes,
CPU use has dropped dramatically when viewing menus. This will benefit
all ports, since menus are now redrawn only when necessary, instead of
at the current framerate.
For a reference, on a Pentium-IV 2.4GHz, the software SDL version
maxes CPU usage at 9%, and the SDL OpenGL version at 13.5%. This is
at 60 fps and a zoomlevel of 4. While some small improvements can
(possibly) be made to the OpenGL version, I think we'll soon be hitting
the glass ceiling.
Work on the Porting.txt document is progressing, and I estimate it to
be 45% complete.
The Windows version still doesn't compile, and I still haven't looked
at it. Rest assured that it will be done before 1.4. There will be
a simultaneous release, even if the Linux versions are finished.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@200 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-11-06 22:22:33 +00:00
|
|
|
#include "Sound.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
#include "Switches.hxx"
|
|
|
|
#include "System.hxx"
|
|
|
|
#include "TIA.hxx"
|
2003-10-17 18:02:16 +00:00
|
|
|
#include "FrameBuffer.hxx"
|
2005-02-21 02:23:57 +00:00
|
|
|
#include "OSystem.hxx"
|
2005-03-14 04:08:15 +00:00
|
|
|
#include "Menu.hxx"
|
2005-08-29 18:36:42 +00:00
|
|
|
#include "CommandMenu.hxx"
|
2005-06-25 17:26:32 +00:00
|
|
|
#include "Version.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2003-09-12 18:08:54 +00:00
|
|
|
#ifdef SNAPSHOT_SUPPORT
|
|
|
|
#include "Snapshot.hxx"
|
|
|
|
#endif
|
|
|
|
|
2005-08-24 22:54:30 +00:00
|
|
|
#ifdef DEVELOPER_SUPPORT
|
|
|
|
#include "Debugger.hxx"
|
|
|
|
#endif
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-02-21 20:43:53 +00:00
|
|
|
Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
2005-02-21 02:23:57 +00:00
|
|
|
: myOSystem(osystem)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
|
|
|
myControllers[0] = 0;
|
|
|
|
myControllers[1] = 0;
|
|
|
|
myMediaSource = 0;
|
|
|
|
mySwitches = 0;
|
|
|
|
mySystem = 0;
|
2003-09-04 16:50:48 +00:00
|
|
|
myEvent = 0;
|
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
// Attach the event subsystem to the current console
|
2005-02-21 20:43:53 +00:00
|
|
|
myEvent = myOSystem->eventHandler().event();
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Get the MD5 message-digest for the ROM image
|
|
|
|
string md5 = MD5(image, size);
|
|
|
|
|
2002-01-08 17:11:32 +00:00
|
|
|
// Search for the properties based on MD5
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->propSet().getMD5(md5, myProperties);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2002-12-15 04:40:55 +00:00
|
|
|
// Make sure the MD5 value of the cartridge is set in the properties
|
|
|
|
if(myProperties.get("Cartridge.MD5") == "")
|
|
|
|
myProperties.set("Cartridge.MD5", md5);
|
|
|
|
|
2005-05-12 18:45:21 +00:00
|
|
|
// A developer can override properties from the commandline
|
|
|
|
setDeveloperProperties();
|
|
|
|
|
2005-09-06 19:42:35 +00:00
|
|
|
// Make sure height is set properly for PAL ROM
|
|
|
|
if(myProperties.get("Display.Format") == "PAL")
|
|
|
|
if(myProperties.get("Display.Height") == "210")
|
|
|
|
myProperties.set("Display.Height", "250");
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// Setup the controllers based on properties
|
|
|
|
string left = myProperties.get("Controller.Left");
|
|
|
|
string right = myProperties.get("Controller.Right");
|
|
|
|
|
|
|
|
// Construct left controller
|
|
|
|
if(left == "Booster-Grip")
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[0] = new BoosterGrip(Controller::Left, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else if(left == "Driving")
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[0] = new Driving(Controller::Left, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else if((left == "Keyboard") || (left == "Keypad"))
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[0] = new Keyboard(Controller::Left, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else if(left == "Paddles")
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[0] = new Paddles(Controller::Left, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[0] = new Joystick(Controller::Left, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Construct right controller
|
|
|
|
if(right == "Booster-Grip")
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[1] = new BoosterGrip(Controller::Right, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else if(right == "Driving")
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[1] = new Driving(Controller::Right, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else if((right == "Keyboard") || (right == "Keypad"))
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[1] = new Keyboard(Controller::Right, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else if(right == "Paddles")
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[1] = new Paddles(Controller::Right, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-04 16:50:48 +00:00
|
|
|
myControllers[1] = new Joystick(Controller::Right, *myEvent);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create switches for the console
|
2003-09-04 16:50:48 +00:00
|
|
|
mySwitches = new Switches(*myEvent, myProperties);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Now, we can construct the system and components
|
|
|
|
mySystem = new System(13, 6);
|
|
|
|
|
|
|
|
M6502* m6502;
|
2005-06-23 01:10:26 +00:00
|
|
|
m6502 = new M6502High(1);
|
2005-08-24 22:54:30 +00:00
|
|
|
#ifdef DEVELOPER_SUPPORT
|
2005-06-16 12:28:54 +00:00
|
|
|
m6502->attach(myOSystem->debugger());
|
2005-08-24 22:54:30 +00:00
|
|
|
#endif
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
M6532* m6532 = new M6532(*this);
|
Added initial trap support. It doesn't quite work yet: when I hit a
trap, the PC keeps getting reset to the start of the frame. FYI,
traps are like breakpoints, only they trigger on any access of the
trap location (e.g. loading data from it, rather than executing it
as a breakpoint).
Fixed two nasty bugs:
1. Debugger::disassemble() was printing hex bytes from the wrong address.
This is because I used readRAM(), which wants a parameter of 0-127, and
reads only from RAM. I *should* have been using peek(), which takes a
16-bit address. In fact, readRAM() is only for the GUI.
2. D6502::disassemble() was printing wrong operands in zero,x and
zero,y addressing modes, due to me passing a wrong number of places
(and thus creating a wrong format string).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@537 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-06-21 04:30:49 +00:00
|
|
|
TIA *tia = new TIA(*this, myOSystem->settings());
|
2005-05-01 18:57:21 +00:00
|
|
|
tia->setSound(myOSystem->sound());
|
2001-12-27 19:54:36 +00:00
|
|
|
Cartridge* cartridge = Cartridge::create(image, size, myProperties);
|
|
|
|
|
|
|
|
mySystem->attach(m6502);
|
|
|
|
mySystem->attach(m6532);
|
|
|
|
mySystem->attach(tia);
|
|
|
|
mySystem->attach(cartridge);
|
|
|
|
|
|
|
|
// Remember what my media source is
|
|
|
|
myMediaSource = tia;
|
2005-06-27 04:45:52 +00:00
|
|
|
myCart = cartridge;
|
2005-07-02 17:15:42 +00:00
|
|
|
myRiot = m6532;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Reset, the system to its power-on state
|
|
|
|
mySystem->reset();
|
2003-10-17 18:02:16 +00:00
|
|
|
|
2004-07-28 23:54:39 +00:00
|
|
|
// Set the correct framerate based on the format of the ROM
|
2005-05-11 19:36:00 +00:00
|
|
|
// This can be overridden by changing the framerate in the
|
2005-05-12 18:45:21 +00:00
|
|
|
// VideoDialog box or on the commandline, but it can't be saved
|
|
|
|
// (ie, framerate is now solely determined based on ROM format).
|
|
|
|
uInt32 framerate = myOSystem->settings().getInt("framerate");
|
|
|
|
if(framerate == 0)
|
|
|
|
{
|
|
|
|
if(myProperties.get("Display.Format") == "NTSC")
|
|
|
|
framerate = 60;
|
|
|
|
else if(myProperties.get("Display.Format") == "PAL")
|
|
|
|
framerate = 50;
|
|
|
|
else
|
|
|
|
framerate = 60;
|
|
|
|
}
|
|
|
|
myOSystem->setFramerate(framerate);
|
2004-07-28 23:54:39 +00:00
|
|
|
|
2003-10-17 18:02:16 +00:00
|
|
|
// Initialize the framebuffer interface.
|
|
|
|
// This must be done *after* a reset, since it needs updated values.
|
2005-04-29 19:05:06 +00:00
|
|
|
initializeVideo();
|
Broke the dependency between the FrameBuffer and Sound classes
wrt to the MediaSource.
Previously, in the main run loop for a port, you had to call
FrameBuffer::update and then
Sound::updateSound(FrameBuffer::MediaSource). Now, you can call
FrameBuffer::update() and then Sound::update(). But since the
ordering here is important, I've introduced a Console::update()
that does it all. So the main run loop for each port just
got a bit simpler.
Also changed around the Snapshot class a bit. All this is to
reinforce the fact that the MediaSource is owned by the core,
and the FrameBuffer, Sound, and Snapshot classes make use of
it. Previously, it seemed as if the FrameBuffer owned the
MediaSource.
I'm finding all these little inconsistencies because of
writing the Porting.txt document, and trying to explain
why something is being done a certain way (and if I
can't explain it, I rewrite it). So if for no other
reason, the Porting.txt document has already been
valuable.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@214 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-11-19 15:57:11 +00:00
|
|
|
|
|
|
|
// Initialize the sound interface.
|
2005-09-06 19:42:35 +00:00
|
|
|
// The # of channels can be overridden in the AudioDialog box or on
|
|
|
|
// the commandline, but it can't be saved.
|
|
|
|
uInt32 channels = myOSystem->settings().getInt("channels");
|
|
|
|
if(channels == 0)
|
|
|
|
{
|
|
|
|
if(myProperties.get("Cartridge.Sound") == "Stereo")
|
|
|
|
channels = 2;
|
|
|
|
else if(myProperties.get("Cartridge.Sound") == "Mono")
|
|
|
|
channels = 1;
|
|
|
|
else
|
|
|
|
channels = 1;
|
|
|
|
}
|
|
|
|
myOSystem->sound().setChannels(channels);
|
2005-05-12 18:45:21 +00:00
|
|
|
myOSystem->sound().setFrameRate(framerate);
|
2005-03-26 19:26:48 +00:00
|
|
|
myOSystem->sound().initialize();
|
2005-03-14 04:08:15 +00:00
|
|
|
|
2005-08-29 18:36:42 +00:00
|
|
|
// Initialize the options menu system with updated values from the framebuffer
|
2005-03-14 04:08:15 +00:00
|
|
|
myOSystem->menu().initialize();
|
2005-03-27 03:07:34 +00:00
|
|
|
myOSystem->menu().setGameProfile(myProperties);
|
2005-05-27 18:00:49 +00:00
|
|
|
|
2005-08-29 18:36:42 +00:00
|
|
|
// Initialize the command menu system with updated values from the framebuffer
|
|
|
|
myOSystem->commandMenu().initialize();
|
|
|
|
|
2005-08-24 22:54:30 +00:00
|
|
|
#ifdef DEVELOPER_SUPPORT
|
2005-05-27 18:00:49 +00:00
|
|
|
// Finally, initialize the debugging system, since it depends on the current ROM
|
2005-06-03 17:52:06 +00:00
|
|
|
myOSystem->debugger().setConsole(this);
|
2005-05-27 18:00:49 +00:00
|
|
|
myOSystem->debugger().initialize();
|
2005-08-24 22:54:30 +00:00
|
|
|
#endif
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
Console::Console(const Console& console)
|
2005-02-21 02:23:57 +00:00
|
|
|
: myOSystem(console.myOSystem)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
|
|
|
// TODO: Write this method
|
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
Console::~Console()
|
|
|
|
{
|
|
|
|
delete mySystem;
|
|
|
|
delete mySwitches;
|
|
|
|
delete myControllers[0];
|
|
|
|
delete myControllers[1];
|
Broke the dependency between the FrameBuffer and Sound classes
wrt to the MediaSource.
Previously, in the main run loop for a port, you had to call
FrameBuffer::update and then
Sound::updateSound(FrameBuffer::MediaSource). Now, you can call
FrameBuffer::update() and then Sound::update(). But since the
ordering here is important, I've introduced a Console::update()
that does it all. So the main run loop for each port just
got a bit simpler.
Also changed around the Snapshot class a bit. All this is to
reinforce the fact that the MediaSource is owned by the core,
and the FrameBuffer, Sound, and Snapshot classes make use of
it. Previously, it seemed as if the FrameBuffer owned the
MediaSource.
I'm finding all these little inconsistencies because of
writing the Porting.txt document, and trying to explain
why something is being done a certain way (and if I
can't explain it, I rewrite it). So if for no other
reason, the Porting.txt document has already been
valuable.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@214 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-11-19 15:57:11 +00:00
|
|
|
}
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const Properties& Console::properties() const
|
|
|
|
{
|
|
|
|
return myProperties;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
Console& Console::operator = (const Console&)
|
|
|
|
{
|
|
|
|
// TODO: Write this method
|
|
|
|
assert(false);
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2002-11-09 23:29:51 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::toggleFormat()
|
|
|
|
{
|
|
|
|
string format = myProperties.get("Display.Format");
|
2005-05-05 00:10:49 +00:00
|
|
|
uInt32 framerate = 60;
|
2002-11-09 23:29:51 +00:00
|
|
|
|
|
|
|
if(format == "NTSC")
|
|
|
|
{
|
|
|
|
myProperties.set("Display.Format", "PAL");
|
2004-08-12 23:54:36 +00:00
|
|
|
mySystem->reset();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("PAL Mode");
|
2005-05-05 00:10:49 +00:00
|
|
|
framerate = 50;
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
|
|
|
else if(format == "PAL")
|
|
|
|
{
|
|
|
|
myProperties.set("Display.Format", "NTSC");
|
2004-08-12 23:54:36 +00:00
|
|
|
mySystem->reset();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("NTSC Mode");
|
2005-05-05 00:10:49 +00:00
|
|
|
framerate = 60;
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
2005-05-05 00:10:49 +00:00
|
|
|
|
|
|
|
setPalette();
|
|
|
|
myOSystem->setFramerate(framerate);
|
2005-09-06 19:42:35 +00:00
|
|
|
myOSystem->sound().setFrameRate(framerate);
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-03-14 04:08:15 +00:00
|
|
|
void Console::togglePalette(const string& palette)
|
2003-12-04 19:18:45 +00:00
|
|
|
{
|
2005-03-14 04:08:15 +00:00
|
|
|
string message, type;
|
2003-12-04 19:18:45 +00:00
|
|
|
|
2005-03-14 04:08:15 +00:00
|
|
|
// Since the toggle cycles in order, if we know which palette to switch
|
|
|
|
// to we set the 'type' to the previous one in the sequence
|
|
|
|
if(palette != "")
|
|
|
|
{
|
|
|
|
if(palette == "Standard")
|
|
|
|
type = "z26";
|
|
|
|
else if(palette == "Original")
|
|
|
|
type = "standard";
|
|
|
|
else if(palette == "Z26")
|
|
|
|
type = "original";
|
|
|
|
else
|
|
|
|
type = "";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
type = myOSystem->settings().getString("palette");
|
|
|
|
|
|
|
|
|
2003-12-04 19:18:45 +00:00
|
|
|
if(type == "standard") // switch to original
|
|
|
|
{
|
2005-03-14 04:08:15 +00:00
|
|
|
type = "original";
|
|
|
|
message = "Original Stella colors";
|
2003-12-04 19:18:45 +00:00
|
|
|
}
|
|
|
|
else if(type == "original") // switch to z26
|
|
|
|
{
|
2005-03-14 04:08:15 +00:00
|
|
|
type = "z26";
|
|
|
|
message = "Z26 colors";
|
2003-12-04 19:18:45 +00:00
|
|
|
}
|
|
|
|
else if(type == "z26") // switch to standard
|
|
|
|
{
|
2005-03-14 04:08:15 +00:00
|
|
|
type = "standard";
|
|
|
|
message = "Standard Stella colors";
|
2003-12-04 19:18:45 +00:00
|
|
|
}
|
|
|
|
else // switch to standard mode if we get this far
|
|
|
|
{
|
2005-03-14 04:08:15 +00:00
|
|
|
type = "standard";
|
|
|
|
message = "Standard Stella colors";
|
2003-12-04 19:18:45 +00:00
|
|
|
}
|
2005-03-14 04:08:15 +00:00
|
|
|
|
|
|
|
myOSystem->settings().setString("palette", type);
|
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
2005-05-05 00:10:49 +00:00
|
|
|
|
|
|
|
setPalette();
|
2003-12-04 19:18:45 +00:00
|
|
|
}
|
|
|
|
|
Changed some things wrt DEVELOPER_SUPPORT. The only extra things which are
now activated when Stella is built with DEVELOPER_SUPPORT is the ability
to change Xstart, Ystart, Width, and Height. Specifically, the ability
to change NTSC/PAL mode, toggle different palettes, and save/merge changes
into the properties file is now standard in all ports, and is *not* strictly
a developer-only thing. So that means that people who use a version of
Stella compiled without DEVELOPER_SUPPORT won't really miss much (the above
features are used by very few people).
Removed the commandline arguments -Dxxx, since they haven't worked for quite
some time anyway, and I doubt that many people really use them. Besides,
there are still keyboard shortcuts to do the same thing. To any developers
who don't want to see these things disappear; the next version of Stella
will include a debugger, and _that's_ the proper place to put those things.
Removed starting and ending '|' characters from the -listrominfo output,
since parsers have an easier time when those are present only _between_
elements, not at the beginning and end.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@297 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2004-07-07 22:46:01 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::saveProperties(string filename, bool merge)
|
|
|
|
{
|
|
|
|
// Merge the current properties into the PropertiesSet file
|
|
|
|
if(merge)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
if(myOSystem->propSet().merge(myProperties, filename))
|
|
|
|
myOSystem->frameBuffer().showMessage("Properties merged");
|
Changed some things wrt DEVELOPER_SUPPORT. The only extra things which are
now activated when Stella is built with DEVELOPER_SUPPORT is the ability
to change Xstart, Ystart, Width, and Height. Specifically, the ability
to change NTSC/PAL mode, toggle different palettes, and save/merge changes
into the properties file is now standard in all ports, and is *not* strictly
a developer-only thing. So that means that people who use a version of
Stella compiled without DEVELOPER_SUPPORT won't really miss much (the above
features are used by very few people).
Removed the commandline arguments -Dxxx, since they haven't worked for quite
some time anyway, and I doubt that many people really use them. Besides,
there are still keyboard shortcuts to do the same thing. To any developers
who don't want to see these things disappear; the next version of Stella
will include a debugger, and _that's_ the proper place to put those things.
Removed starting and ending '|' characters from the -listrominfo output,
since parsers have an easier time when those are present only _between_
elements, not at the beginning and end.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@297 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2004-07-07 22:46:01 +00:00
|
|
|
else
|
2005-09-11 22:55:51 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Error merging properties");
|
Changed some things wrt DEVELOPER_SUPPORT. The only extra things which are
now activated when Stella is built with DEVELOPER_SUPPORT is the ability
to change Xstart, Ystart, Width, and Height. Specifically, the ability
to change NTSC/PAL mode, toggle different palettes, and save/merge changes
into the properties file is now standard in all ports, and is *not* strictly
a developer-only thing. So that means that people who use a version of
Stella compiled without DEVELOPER_SUPPORT won't really miss much (the above
features are used by very few people).
Removed the commandline arguments -Dxxx, since they haven't worked for quite
some time anyway, and I doubt that many people really use them. Besides,
there are still keyboard shortcuts to do the same thing. To any developers
who don't want to see these things disappear; the next version of Stella
will include a debugger, and _that's_ the proper place to put those things.
Removed starting and ending '|' characters from the -listrominfo output,
since parsers have an easier time when those are present only _between_
elements, not at the beginning and end.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@297 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2004-07-07 22:46:01 +00:00
|
|
|
}
|
|
|
|
else // Save to the specified file directly
|
|
|
|
{
|
|
|
|
ofstream out(filename.c_str(), ios::out);
|
|
|
|
|
|
|
|
if(out && out.is_open())
|
|
|
|
{
|
|
|
|
myProperties.save(out);
|
|
|
|
out.close();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Properties saved");
|
Changed some things wrt DEVELOPER_SUPPORT. The only extra things which are
now activated when Stella is built with DEVELOPER_SUPPORT is the ability
to change Xstart, Ystart, Width, and Height. Specifically, the ability
to change NTSC/PAL mode, toggle different palettes, and save/merge changes
into the properties file is now standard in all ports, and is *not* strictly
a developer-only thing. So that means that people who use a version of
Stella compiled without DEVELOPER_SUPPORT won't really miss much (the above
features are used by very few people).
Removed the commandline arguments -Dxxx, since they haven't worked for quite
some time anyway, and I doubt that many people really use them. Besides,
there are still keyboard shortcuts to do the same thing. To any developers
who don't want to see these things disappear; the next version of Stella
will include a debugger, and _that's_ the proper place to put those things.
Removed starting and ending '|' characters from the -listrominfo output,
since parsers have an easier time when those are present only _between_
elements, not at the beginning and end.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@297 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2004-07-07 22:46:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-09-11 22:55:51 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Error saving properties");
|
Changed some things wrt DEVELOPER_SUPPORT. The only extra things which are
now activated when Stella is built with DEVELOPER_SUPPORT is the ability
to change Xstart, Ystart, Width, and Height. Specifically, the ability
to change NTSC/PAL mode, toggle different palettes, and save/merge changes
into the properties file is now standard in all ports, and is *not* strictly
a developer-only thing. So that means that people who use a version of
Stella compiled without DEVELOPER_SUPPORT won't really miss much (the above
features are used by very few people).
Removed the commandline arguments -Dxxx, since they haven't worked for quite
some time anyway, and I doubt that many people really use them. Besides,
there are still keyboard shortcuts to do the same thing. To any developers
who don't want to see these things disappear; the next version of Stella
will include a debugger, and _that's_ the proper place to put those things.
Removed starting and ending '|' characters from the -listrominfo output,
since parsers have an easier time when those are present only _between_
elements, not at the beginning and end.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@297 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2004-07-07 22:46:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-29 19:05:06 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::initializeVideo()
|
|
|
|
{
|
2005-06-25 17:26:32 +00:00
|
|
|
string title = string("Stella ") + STELLA_VERSION +
|
|
|
|
": \"" + myProperties.get("Cartridge.Name") + "\"";
|
2005-04-29 19:05:06 +00:00
|
|
|
myOSystem->frameBuffer().initialize(title,
|
|
|
|
myMediaSource->width() << 1,
|
|
|
|
myMediaSource->height());
|
2005-05-05 00:10:49 +00:00
|
|
|
setPalette();
|
2005-04-29 19:05:06 +00:00
|
|
|
}
|
|
|
|
|
2005-05-01 18:57:21 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::initializeAudio()
|
|
|
|
{
|
|
|
|
myMediaSource->setSound(myOSystem->sound());
|
|
|
|
}
|
|
|
|
|
2005-05-05 00:10:49 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::setPalette()
|
|
|
|
{
|
|
|
|
myOSystem->frameBuffer().setPalette(myMediaSource->palette());
|
|
|
|
}
|
|
|
|
|
2005-06-29 00:31:49 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-07-03 01:36:40 +00:00
|
|
|
/* Original frying research and code by Fred Quimby.
|
|
|
|
I've tried the following variations on this code:
|
|
|
|
- Both OR and Exclusive OR instead of AND. This generally crashes the game
|
|
|
|
without ever giving us realistic "fried" effects.
|
|
|
|
- Loop only over the RIOT RAM. This still gave us frying-like effects, but
|
|
|
|
it seemed harder to duplicate most effects. I have no idea why, but
|
|
|
|
munging the TIA regs seems to have some effect (I'd think it wouldn't).
|
|
|
|
|
|
|
|
Fred says he also tried mangling the PC and registers, but usually it'd just
|
|
|
|
crash the game (e.g. black screen, no way out of it).
|
|
|
|
|
|
|
|
It's definitely easier to get some effects (e.g. 255 lives in Battlezone)
|
|
|
|
with this code than it is on a real console. My guess is that most "good"
|
|
|
|
frying effects come from a RIOT location getting cleared to 0. Fred's
|
|
|
|
code is more likely to accomplish this than frying a real console is...
|
|
|
|
|
|
|
|
Until someone comes up with a more accurate way to emulate frying, I'm
|
|
|
|
leaving this as Fred posted it. -- B.
|
|
|
|
*/
|
2005-06-29 00:31:49 +00:00
|
|
|
void Console::fry()
|
|
|
|
{
|
2005-07-03 01:36:40 +00:00
|
|
|
for (int ZPmem=0; ZPmem<0x100; ZPmem += rand() % 4)
|
2005-09-11 22:55:51 +00:00
|
|
|
mySystem->poke(ZPmem, mySystem->peek(ZPmem) & (uInt8)rand() % 256);
|
2005-06-29 00:31:49 +00:00
|
|
|
}
|
|
|
|
|
2003-12-04 19:18:45 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2002-11-09 23:29:51 +00:00
|
|
|
void Console::changeXStart(const uInt32 direction)
|
|
|
|
{
|
|
|
|
Int32 xstart = atoi(myProperties.get("Display.XStart").c_str());
|
|
|
|
uInt32 width = atoi(myProperties.get("Display.Width").c_str());
|
|
|
|
ostringstream strval;
|
|
|
|
string message;
|
|
|
|
|
|
|
|
if(direction == 1) // increase XStart
|
|
|
|
{
|
|
|
|
xstart += 4;
|
|
|
|
if(xstart > 80)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("XStart at maximum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if((width + xstart) > 160)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("XStart no effect");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(direction == 0) // decrease XStart
|
|
|
|
{
|
|
|
|
xstart -= 4;
|
|
|
|
if(xstart < 0)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("XStart at minimum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
strval << xstart;
|
|
|
|
myProperties.set("Display.XStart", strval.str());
|
|
|
|
mySystem->reset();
|
2005-05-01 18:57:21 +00:00
|
|
|
initializeVideo();
|
2002-11-09 23:29:51 +00:00
|
|
|
|
|
|
|
message = "XStart ";
|
|
|
|
message += strval.str();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::changeYStart(const uInt32 direction)
|
|
|
|
{
|
|
|
|
Int32 ystart = atoi(myProperties.get("Display.YStart").c_str());
|
|
|
|
ostringstream strval;
|
|
|
|
string message;
|
|
|
|
|
|
|
|
if(direction == 1) // increase YStart
|
|
|
|
{
|
|
|
|
ystart++;
|
|
|
|
if(ystart > 64)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("YStart at maximum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(direction == 0) // decrease YStart
|
|
|
|
{
|
|
|
|
ystart--;
|
|
|
|
if(ystart < 0)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("YStart at minimum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
strval << ystart;
|
|
|
|
myProperties.set("Display.YStart", strval.str());
|
|
|
|
mySystem->reset();
|
2005-05-01 18:57:21 +00:00
|
|
|
initializeVideo();
|
2002-11-09 23:29:51 +00:00
|
|
|
|
|
|
|
message = "YStart ";
|
|
|
|
message += strval.str();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::changeWidth(const uInt32 direction)
|
|
|
|
{
|
|
|
|
uInt32 xstart = atoi(myProperties.get("Display.XStart").c_str());
|
|
|
|
Int32 width = atoi(myProperties.get("Display.Width").c_str());
|
|
|
|
ostringstream strval;
|
|
|
|
string message;
|
|
|
|
|
|
|
|
if(direction == 1) // increase Width
|
|
|
|
{
|
|
|
|
width += 4;
|
|
|
|
if((width > 160) || ((width % 4) != 0))
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Width at maximum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if((width + xstart) > 160)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Width no effect");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(direction == 0) // decrease Width
|
|
|
|
{
|
|
|
|
width -= 4;
|
|
|
|
if(width < 80)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Width at minimum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
strval << width;
|
|
|
|
myProperties.set("Display.Width", strval.str());
|
|
|
|
mySystem->reset();
|
2005-05-01 18:57:21 +00:00
|
|
|
initializeVideo();
|
2002-11-09 23:29:51 +00:00
|
|
|
|
|
|
|
message = "Width ";
|
|
|
|
message += strval.str();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::changeHeight(const uInt32 direction)
|
|
|
|
{
|
|
|
|
Int32 height = atoi(myProperties.get("Display.Height").c_str());
|
|
|
|
ostringstream strval;
|
|
|
|
string message;
|
|
|
|
|
|
|
|
if(direction == 1) // increase Height
|
|
|
|
{
|
|
|
|
height++;
|
|
|
|
if(height > 256)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Height at maximum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(direction == 0) // decrease Height
|
|
|
|
{
|
|
|
|
height--;
|
|
|
|
if(height < 100)
|
|
|
|
{
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage("Height at minimum");
|
2002-11-09 23:29:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
strval << height;
|
|
|
|
myProperties.set("Display.Height", strval.str());
|
|
|
|
mySystem->reset();
|
2005-05-01 18:57:21 +00:00
|
|
|
initializeVideo();
|
2002-11-09 23:29:51 +00:00
|
|
|
|
|
|
|
message = "Height ";
|
|
|
|
message += strval.str();
|
2005-02-21 20:43:53 +00:00
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
2002-11-09 23:29:51 +00:00
|
|
|
}
|
Updated ListWidget class to automatically select an item based on
keypresses. For example, if you enter 'co', it will automatically
select and move to the "Color/BW TV" item. This will become very
useful in the ROM launcher, to move very quickly to desired game.
Changed the keys to (de)activate the TIA registers to Alt (z,x,c,v,b,n),
to match their definitions in z26.
Added 'Alt .' to disable all TIA registers, and 'Alt /' to enable all
registers. Eventually, I'll add the ability to select PF0, PF1, and PF2
separately (instead of treating them all the same, as it's done now).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@407 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-05-04 00:43:22 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::toggleTIABit(TIA::TIABit bit, const string& bitname, bool show)
|
|
|
|
{
|
|
|
|
bool result = ((TIA*)myMediaSource)->toggleBit(bit);
|
|
|
|
string message = bitname + (result ? " enabled" : " disabled");
|
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::enableBits(bool enable)
|
|
|
|
{
|
|
|
|
((TIA*)myMediaSource)->enableBits(enable);
|
|
|
|
string message = string("TIA bits") + (enable ? " enabled" : " disabled");
|
|
|
|
myOSystem->frameBuffer().showMessage(message);
|
|
|
|
}
|
2005-05-12 18:45:21 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Console::setDeveloperProperties()
|
|
|
|
{
|
|
|
|
Settings& settings = myOSystem->settings();
|
|
|
|
string s;
|
|
|
|
|
|
|
|
s = settings.getString("type");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Cartridge.Type", s);
|
|
|
|
|
|
|
|
s = settings.getString("ld");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Console.LeftDifficulty", s);
|
|
|
|
|
|
|
|
s = settings.getString("rd");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Console.RightDifficulty", s);
|
|
|
|
|
|
|
|
s = settings.getString("tv");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Console.TelevisionType", s);
|
|
|
|
|
|
|
|
s = settings.getString("lc");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Controller.Left", s);
|
|
|
|
|
|
|
|
s = settings.getString("rc");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Controller.Right", s);
|
|
|
|
|
|
|
|
s = settings.getString("bc");
|
|
|
|
if(s != "")
|
|
|
|
{
|
|
|
|
myProperties.set("Controller.Left", s);
|
|
|
|
myProperties.set("Controller.Right", s);
|
|
|
|
}
|
|
|
|
|
|
|
|
s = settings.getString("format");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Display.Format", s);
|
|
|
|
|
|
|
|
s = settings.getString("xstart");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Display.XStart", s);
|
|
|
|
|
|
|
|
s = settings.getString("ystart");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Display.YStart", s);
|
|
|
|
|
|
|
|
s = settings.getString("width");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Display.Width", s);
|
|
|
|
|
|
|
|
s = settings.getString("height");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Display.Height", s);
|
|
|
|
|
|
|
|
s = settings.getString("cpu");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Emulation.CPU", s);
|
|
|
|
|
|
|
|
s = settings.getString("hmove");
|
|
|
|
if(s != "")
|
|
|
|
myProperties.set("Emulation.HmoveBlanks", s);
|
|
|
|
}
|