Relaxed recent equate changes to allow all symbols to be used from a .sym

file.  This will have to do for now, until we find a better way of
differentiating between constants and addresses.

Made the ROM disassembly area take advantage of a wide debugger window
by spacing out the label and disassembly areas.

Finalized location of the AVox and SaveKey EEPROM files; they're now
located in the basedir (the actual location depends on the OS).

Made deadzone for analog joysticks configurable from the commandline
and UI.  Added '-joydeadzone' commandline argument, which accepts
a value from 0 - 29, specifying a deadzone of '3200 + DEADZONE * 1000'.
Also added UI to InputDialog to set this from dynamically from the UI.

Added code to only save the AVox and SaveKey EEPROM data file when
necessary.  This is for those systems based on flash storage, where
unnecessary writes will wear down the drive.

Added SaveKey as a full-fledged controller to GameInfoDialog.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1501 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-05-11 21:18:35 +00:00
parent 694d175f36
commit 19be269077
15 changed files with 148 additions and 59 deletions

View File

@ -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: EquateList.cxx,v 1.32 2008-05-06 16:39:10 stephena Exp $
// $Id: EquateList.cxx,v 1.33 2008-05-11 21:18:34 stephena Exp $
//============================================================================
#include <fstream>
@ -66,14 +66,21 @@ void EquateList::addEquate(const string& label, int address)
// as well, and we don't yet have an infrastructure to determine that,
// so the entire region is marked as read-write
equate_t flags = EQF_READ;
#if 0
if(address >= 0x80 && address <= 0xff)
flags = EQF_RW;
else if((address & 0x1000) == 0x1000)
flags = EQF_RW;
else
//{ cerr << "label = " << label << ", address = " << hex << address << " discarded\n";
{
cerr << "label = " << label << ", address = " << hex << address << " discarded\n";
return; // don't know what else to do for now
//}
}
#else
// The above section of code is deactivated until a better means of
// determining constants vs. addresses is found
flags = EQF_RW;
#endif
removeEquate(label);

View File

@ -13,12 +13,13 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RomListWidget.cxx,v 1.11 2008-02-06 13:45:20 stephena Exp $
// $Id: RomListWidget.cxx,v 1.12 2008-05-11 21:18:34 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "bspf.hxx"
#include "ContextMenu.hxx"
#include "RomListWidget.hxx"
@ -40,8 +41,12 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
myMenu->setList(l);
myLabelWidth = font.getMaxCharWidth() * 16;
myBytesWidth = font.getMaxCharWidth() * 12;
// Take advantage of a wide debugger window when possible
const int fontWidth = font.getMaxCharWidth(),
numchars = w / fontWidth;
myLabelWidth = BSPF_max(20, int(0.35 * (numchars - 12))) * fontWidth;
myBytesWidth = 12 * fontWidth;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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.139 2008-05-08 20:23:31 stephena Exp $
// $Id: Console.cxx,v 1.140 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include <cassert>
@ -634,7 +634,7 @@ void Console::setControllers()
}
else if(right == "ATARIVOX")
{
string eepromfile = // fixme myOSystem->baseDir() + BSPF_PATH_SEPARATOR +
string eepromfile = myOSystem->baseDir() + BSPF_PATH_SEPARATOR +
"atarivox_eeprom.dat";
myControllers[rightPort] = myAVox =
new AtariVox(Controller::Right, *myEvent, *mySystem, myOSystem->serialPort(),
@ -642,7 +642,7 @@ void Console::setControllers()
}
else if(right == "SAVEKEY")
{
string eepromfile = // fixme myOSystem->baseDir() + BSPF_PATH_SEPARATOR +
string eepromfile = myOSystem->baseDir() + BSPF_PATH_SEPARATOR +
"savekey_eeprom.dat";
myControllers[rightPort] = new SaveKey(Controller::Right, *myEvent, *mySystem,
eepromfile);

View File

@ -1,4 +1,3 @@
//============================================================================
//
// SSSS tt lll lll
@ -14,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.221 2008-03-30 15:01:38 stephena Exp $
// $Id: EventHandler.cxx,v 1.222 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include <sstream>
@ -31,6 +30,7 @@
#include "Launcher.hxx"
#include "Menu.hxx"
#include "OSystem.hxx"
#include "Joystick.hxx"
#include "Paddles.hxx"
#include "PropsSet.hxx"
#include "ScrollBarWidget.hxx"
@ -55,8 +55,6 @@
}
#endif
#define JOY_DEADZONE 3200
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::EventHandler(OSystem* osystem)
: myOSystem(osystem),
@ -144,6 +142,7 @@ void EventHandler::initialize()
myGrabMouseFlag = myOSystem->settings().getBool("grabmouse");
Joystick::setDeadZone(myOSystem->settings().getInt("joydeadzone"));
Paddles::setDigitalSpeed(myOSystem->settings().getInt("pspeed"));
// Set number of lines a mousewheel will scroll
@ -849,8 +848,10 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
myEvent->set(Event::SARightAxis1Value, value);
break;
default:
{
// Otherwise, we know the event is digital
if(value > -JOY_DEADZONE && value < JOY_DEADZONE)
int deadzone = Joystick::deadzone();
if(value > -deadzone && value < deadzone)
{
// Turn off both events, since we don't know exactly which one
// was previously activated.
@ -860,6 +861,7 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
else
handleEvent(value < 0 ? eventAxisNeg : eventAxisPos, 1);
break;
}
}
#endif
}

View File

@ -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: Joystick.cxx,v 1.12 2008-04-13 23:43:14 stephena Exp $
// $Id: Joystick.cxx,v 1.13 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include "Event.hxx"
@ -85,3 +85,15 @@ void Joystick::update()
if(yaxis < -16384)
myDigitalPinState[One] = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Joystick::setDeadZone(int deadzone)
{
if(deadzone < 0) deadzone = 0;
if(deadzone > 29) deadzone = 29;
_DEAD_ZONE = 3200 + deadzone * 1000;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Joystick::_DEAD_ZONE = 3200;

View File

@ -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: Joystick.hxx,v 1.10 2008-04-13 23:43:14 stephena Exp $
// $Id: Joystick.hxx,v 1.11 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#ifndef JOYSTICK_HXX
@ -27,7 +27,7 @@
The standard Atari 2600 joystick controller.
@author Bradford W. Mott
@version $Id: Joystick.hxx,v 1.10 2008-04-13 23:43:14 stephena Exp $
@version $Id: Joystick.hxx,v 1.11 2008-05-11 21:18:35 stephena Exp $
*/
class Joystick : public Controller
{
@ -53,12 +53,22 @@ class Joystick : public Controller
*/
virtual void update();
/**
Sets the deadzone amount for real analog joysticks.
Technically, this isn't really used by the Joystick class at all,
but it seemed like the best place to put it.
*/
static void setDeadZone(int deadzone);
inline static int deadzone() { return _DEAD_ZONE; }
private:
// Pre-compute the events we care about based on given port
// This will eliminate test for left or right port in update()
Event::Type myUpEvent, myDownEvent, myLeftEvent, myRightEvent,
myXAxisValue, myYAxisValue, myFireEvent;
static int _DEAD_ZONE;
};
#endif

View File

@ -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: MT24LC256.cxx,v 1.9 2008-05-10 22:21:09 stephena Exp $
// $Id: MT24LC256.cxx,v 1.10 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include <cassert>
@ -54,7 +54,9 @@ MT24LC256::MT24LC256(const string& filename, const System& system)
myCyclesWhenTimerSet(0),
myCyclesWhenSDASet(0),
myCyclesWhenSCLSet(0),
myDataFile(filename)
myDataFile(filename),
myDataFileExists(false),
myDataChanged(false)
{
// First initialize the I2C state
jpee_init();
@ -70,21 +72,27 @@ MT24LC256::MT24LC256(const string& filename, const System& system)
{
in.seekg(0, ios::beg);
in.read((char*)myData, 32768);
myDataFileExists = true;
}
in.close();
}
else
myDataFileExists = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256::~MT24LC256()
{
// Save EEPROM data to external file
ofstream out;
out.open(myDataFile.c_str(), ios_base::binary);
if(out.is_open())
// Save EEPROM data to external file only when necessary
if(!myDataFileExists || myDataChanged)
{
out.write((char*)myData, 32768);
out.close();
ofstream out;
out.open(myDataFile.c_str(), ios_base::binary);
if(out.is_open())
{
out.write((char*)myData, 32768);
out.close();
}
}
}
@ -208,6 +216,7 @@ void MT24LC256::jpee_data_stop()
}
for (i=3; i<jpee_pptr; i++)
{
myDataChanged = true;
myData[(jpee_address++) & jpee_sizemask] = jpee_packet[i];
if (!(jpee_address & jpee_pagemask))
break; /* Writes can't cross page boundary! */

View File

@ -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: MT24LC256.hxx,v 1.4 2008-05-10 22:21:09 stephena Exp $
// $Id: MT24LC256.hxx,v 1.5 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#ifndef MT24LC256_HXX
@ -30,7 +30,7 @@ class System;
(aka Supercat) for the bulk of this code.
@author Stephen Anthony & J. Payson
@version $Id: MT24LC256.hxx,v 1.4 2008-05-10 22:21:09 stephena Exp $
@version $Id: MT24LC256.hxx,v 1.5 2008-05-11 21:18:35 stephena Exp $
*/
class MT24LC256
{
@ -89,6 +89,12 @@ class MT24LC256
// The file containing the EEPROM data
string myDataFile;
// Indicates if a valid EEPROM data file exists/was successfully loaded
bool myDataFileExists;
// Indicates if the EEPROM has changed since class invocation
bool myDataChanged;
// Required for I2C functionality
int jpee_mdat, jpee_sdat, jpee_mclk;
int jpee_sizemask, jpee_pagemask, jpee_smallmode, jpee_logmode;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.cxx,v 1.142 2008-04-11 17:56:34 stephena Exp $
// $Id: Settings.cxx,v 1.143 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include <cassert>
@ -69,6 +69,7 @@ Settings::Settings(OSystem* osystem)
setInternal("joymap", "");
setInternal("joyaxismap", "");
setInternal("joyhatmap", "");
setInternal("joydeadzone", "0");
setInternal("pspeed", "6");
setInternal("sa1", "left");
setInternal("sa2", "right");
@ -246,6 +247,12 @@ void Settings::validate()
if(i < 1 || i > 10)
setInternal("zoom_tia", "2");
i = getInt("joydeadzone");
if(i < 0)
setInternal("joydeadzone", "0");
else if(i > 29)
setInternal("joydeadzone", "29");
i = getInt("pspeed");
if(i < 1)
setInternal("pspeed", "1");
@ -312,6 +319,7 @@ void Settings::usage()
#endif
<< " -cheat <code> Use the specified cheatcode (see manual for description)\n"
<< " -showinfo <1|0> Shows some game info\n"
<< " -joydeadzone <number> Sets 'deadzone' area for analog joysticks (0-29)\n"
<< " -pspeed <number> Speed of digital emulated paddle movement (1-15)\n"
<< " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n"
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"

View File

@ -13,18 +13,17 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DialogContainer.cxx,v 1.41 2008-03-13 22:58:06 stephena Exp $
// $Id: DialogContainer.cxx,v 1.42 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include "OSystem.hxx"
#include "Dialog.hxx"
#include "Stack.hxx"
#include "EventHandler.hxx"
#include "Joystick.hxx"
#include "bspf.hxx"
#include "DialogContainer.hxx"
#define JOY_DEADZONE 3200
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DialogContainer::DialogContainer(OSystem* osystem)
: myOSystem(osystem),
@ -290,10 +289,11 @@ void DialogContainer::handleJoyAxisEvent(int stick, int axis, int value)
// Send the event to the dialog box on the top of the stack
Dialog* activeDialog = myDialogStack.top();
if(value > JOY_DEADZONE)
value -= JOY_DEADZONE;
else if(value < -JOY_DEADZONE )
value += JOY_DEADZONE;
int deadzone = Joystick::deadzone();
if(value > deadzone)
value -= deadzone;
else if(value < -deadzone )
value += deadzone;
else
value = 0;

View File

@ -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: GameInfoDialog.cxx,v 1.53 2008-04-11 17:56:34 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.54 2008-05-11 21:18:35 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -552,7 +552,7 @@ void GameInfoDialog::saveConfig()
// Controller properties
tag = myP0Controller->getSelectedTag();
for(i = 0; i < 5; ++i)
for(i = 0; i < kNumControllerTypes; ++i)
{
if(i == tag-1)
{
@ -562,7 +562,7 @@ void GameInfoDialog::saveConfig()
}
tag = myP1Controller->getSelectedTag();
for(i = 0; i < 5; ++i)
for(i = 0; i < kNumControllerTypes; ++i)
{
if(i == tag-1)
{
@ -672,12 +672,13 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* GameInfoDialog::ourControllerList[kNumControllerTypes][2] = {
{ "AtariVox", "ATARIVOX" },
{ "Joystick", "JOYSTICK" },
{ "Paddles", "PADDLES" },
{ "Booster-Grip", "BOOSTER-GRIP" },
{ "Driving", "DRIVING" },
{ "Keyboard", "KEYBOARD" },
{ "Paddles", "PADDLES" },
{ "Joystick", "JOYSTICK" }
{ "AtariVox", "ATARIVOX" },
{ "SaveKey", "SAVEKEY" }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: GameInfoDialog.hxx,v 1.31 2008-04-11 17:56:34 stephena Exp $
// $Id: GameInfoDialog.hxx,v 1.32 2008-05-11 21:18:35 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -99,7 +99,7 @@ class GameInfoDialog : public Dialog, public CommandSender
kPhosphorChanged = 'PPch',
kPPBlendChanged = 'PBch',
kNumCartTypes = 25,
kNumControllerTypes = 6
kNumControllerTypes = 7
};
/** Game properties for currently loaded ROM */

View File

@ -13,13 +13,14 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: InputDialog.cxx,v 1.31 2008-04-11 17:56:34 stephena Exp $
// $Id: InputDialog.cxx,v 1.32 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#include "bspf.hxx"
#include "Array.hxx"
#include "OSystem.hxx"
#include "Joystick.hxx"
#include "Paddles.hxx"
#include "Settings.hxx"
#include "EventMappingWidget.hxx"
@ -119,10 +120,22 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
myRightPort->appendEntry("right virtual port", 2);
wid.push_back(myRightPort);
// Add 'mouse to paddle' mapping
ypos += 2*lineHeight;
lwidth = font.getStringWidth("Paddle threshold: ");
pwidth = font.getMaxCharWidth() * 5;
// Add joystick deadzone setting
ypos += 2*lineHeight;
myDeadzone = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Joy deadzone: ", lwidth, kDeadzoneChanged);
myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29);
xpos += myDeadzone->getWidth() + 5;
myDeadzoneLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft);
myDeadzoneLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myDeadzone);
// Add 'mouse to paddle' mapping
xpos = 5; ypos += lineHeight + 3;
myPaddleMode = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Mouse is paddle: ", lwidth, kPaddleChanged);
myPaddleMode->setMinValue(0); myPaddleMode->setMaxValue(3);
@ -168,6 +181,10 @@ void InputDialog::loadConfig()
int rport = sa2 == "right" ? 2 : 1;
myRightPort->setSelectedTag(rport);
// Joystick deadzone
myDeadzone->setValue(instance()->settings().getInt("joydeadzone"));
myDeadzoneLabel->setLabel(instance()->settings().getString("joydeadzone"));
// Paddle mode
myPaddleMode->setValue(0);
myPaddleModeLabel->setLabel("0");
@ -190,6 +207,11 @@ void InputDialog::saveConfig()
const string& sa2 = myRightPort->getSelectedTag() == 2 ? "right" : "left";
instance()->eventHandler().mapStelladaptors(sa1, sa2);
// Joystick deadzone
int deadzone = myDeadzone->getValue();
instance()->settings().setInt("joydeadzone", deadzone);
Joystick::setDeadZone(deadzone);
// Paddle mode
Paddles::setMouseIsPaddle(myPaddleMode->getValue());
@ -276,6 +298,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
myRightPort->getSelectedTag() == 2 ? 1 : 2);
break;
case kDeadzoneChanged:
myDeadzoneLabel->setValue(myDeadzone->getValue());
break;
case kPaddleChanged:
myPaddleModeLabel->setValue(myPaddleMode->getValue());
break;

View File

@ -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: InputDialog.hxx,v 1.17 2008-04-11 17:56:34 stephena Exp $
// $Id: InputDialog.hxx,v 1.18 2008-05-11 21:18:35 stephena Exp $
//============================================================================
#ifndef INPUT_DIALOG_HXX
@ -54,10 +54,11 @@ class InputDialog : public Dialog
private:
enum {
kLeftChanged = 'LCch',
kRightChanged = 'RCch',
kPaddleChanged = 'PDch',
kPSpeedChanged = 'PSch'
kLeftChanged = 'LCch',
kRightChanged = 'RCch',
kDeadzoneChanged = 'DZch',
kPaddleChanged = 'PDch',
kPSpeedChanged = 'PSch'
};
TabWidget* myTab;
@ -68,6 +69,8 @@ class InputDialog : public Dialog
PopUpWidget* myLeftPort;
PopUpWidget* myRightPort;
SliderWidget* myDeadzone;
StaticTextWidget* myDeadzoneLabel;
SliderWidget* myPaddleMode;
StaticTextWidget* myPaddleModeLabel;
SliderWidget* myPaddleSpeed;

View File

@ -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: Widget.hxx,v 1.60 2008-04-29 15:13:16 stephena Exp $
// $Id: Widget.hxx,v 1.61 2008-05-11 21:18:35 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -88,7 +88,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.60 2008-04-29 15:13:16 stephena Exp $
@version $Id: Widget.hxx,v 1.61 2008-05-11 21:18:35 stephena Exp $
*/
class Widget : public GuiObject
{
@ -290,12 +290,12 @@ class SliderWidget : public ButtonWidget
void setValue(int value);
int getValue() const { return _value; }
void setMinValue(int value);
int getMinValue() const { return _valueMin; }
void setMaxValue(int value);
int getMaxValue() const { return _valueMax; }
void setStepValue(int value);
int getStepValue() const { return _stepValue; }
void setMinValue(int value);
int getMinValue() const { return _valueMin; }
void setMaxValue(int value);
int getMaxValue() const { return _valueMax; }
void setStepValue(int value);
int getStepValue() const { return _stepValue; }
virtual void handleMouseMoved(int x, int y, int button);
virtual void handleMouseDown(int x, int y, int button, int clickCount);