Fixed remaining debugger font issues (hopefully), and added GUI slider

for adjusting analog paddle threshold (used to eliminate jitter).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1079 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-04-05 12:28:39 +00:00
parent b6d4749146
commit 479a987b86
7 changed files with 67 additions and 17 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: TiaWidget.cxx,v 1.3 2006-03-25 00:34:17 stephena Exp $ // $Id: TiaWidget.cxx,v 1.4 2006-04-05 12:28:37 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -476,7 +476,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
// M1 register info // M1 register info
//////////////////////////// ////////////////////////////
// enaM1 // enaM1
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += lineHeight + 6;
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"M1:", kTextAlignLeft); "M1:", kTextAlignLeft);
xpos += 3*fontWidth + 8; xpos += 3*fontWidth + 8;
@ -531,7 +531,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
// BL register info // BL register info
//////////////////////////// ////////////////////////////
// enaBL // enaBL
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += lineHeight + 6;
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"BL:", kTextAlignLeft); "BL:", kTextAlignLeft);
xpos += 3*fontWidth + 8; xpos += 3*fontWidth + 8;
@ -586,7 +586,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
// PF 0/1/2 registers // PF 0/1/2 registers
//////////////////////////// ////////////////////////////
// PF0 // PF0
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += lineHeight + 6;
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
"PF:", kTextAlignLeft); "PF:", kTextAlignLeft);
xpos += 4*fontWidth; xpos += 4*fontWidth;
@ -610,7 +610,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
addFocusWidget(myPF[2]); addFocusWidget(myPF[2]);
// PF reflect, score, priority // PF reflect, score, priority
xpos = 10 + 4*fontWidth; ypos += lineHeight + 2; xpos = 10 + 4*fontWidth; ypos += lineHeight + 6;
myRefPF = new CheckboxWidget(boss, font, xpos, ypos+1, myRefPF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd); "Reflect", kCheckActionCmd);
myRefPF->setTarget(this); myRefPF->setTarget(this);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.cxx,v 1.159 2006-03-27 21:06:44 stephena Exp $ // $Id: EventHandler.cxx,v 1.160 2006-04-05 12:28:37 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -132,10 +132,9 @@ EventHandler::EventHandler(OSystem* osystem)
myGrabMouseFlag = myOSystem->settings().getBool("grabmouse"); myGrabMouseFlag = myOSystem->settings().getBool("grabmouse");
setPaddleMode(myOSystem->settings().getInt("paddle"), false); setPaddleMode(myOSystem->settings().getInt("paddle"), false);
setPaddleThreshold(myOSystem->settings().getInt("pthresh"));
myFryingFlag = false; myFryingFlag = false;
myPaddleThreshold = myOSystem->settings().getInt("pthresh");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2043,6 +2042,14 @@ void EventHandler::setPaddleSpeed(int num, int speed)
myOSystem->settings().setInt(buf.str(), speed); myOSystem->settings().setInt(buf.str(), speed);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setPaddleThreshold(int thresh)
{
myPaddleThreshold = thresh;
myOSystem->settings().setInt("pthresh", thresh);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::enterMenuMode(State state) void EventHandler::enterMenuMode(State state)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.hxx,v 1.84 2006-03-27 21:06:44 stephena Exp $ // $Id: EventHandler.hxx,v 1.85 2006-04-05 12:28:37 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -107,7 +107,7 @@ struct JoyMouse {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.84 2006-03-27 21:06:44 stephena Exp $ @version $Id: EventHandler.hxx,v 1.85 2006-04-05 12:28:37 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -260,6 +260,15 @@ class EventHandler
*/ */
void setPaddleSpeed(int num, int speed); void setPaddleSpeed(int num, int speed);
/**
Sets the amount by which paddle jitter is detected. Quick movements
of less than this amount constitute jitter, and do not generate
paddle events.
@param thresh The threshold to use for jitter detection
*/
void setPaddleThreshold(int thresh);
inline bool kbdAlt(int mod) inline bool kbdAlt(int mod)
{ {
#ifndef MAC_OSX #ifndef MAC_OSX

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Settings.cxx,v 1.84 2006-04-04 23:15:43 stephena Exp $ // $Id: Settings.cxx,v 1.85 2006-04-05 12:28:37 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -247,6 +247,12 @@ void Settings::validate()
if(i < 0 || i > 3) if(i < 0 || i > 3)
setInternal("paddle", "0"); setInternal("paddle", "0");
i = getInt("pthresh");
if(i < 400)
setInternal("pthresh", "400");
else if(i > 800)
setInternal("pthresh", "800");
s = getString("palette"); s = getString("palette");
if(s != "standard" && s != "original" && s != "z26") if(s != "standard" && s != "original" && s != "z26")
setInternal("palette", "standard"); setInternal("palette", "standard");

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: InputDialog.cxx,v 1.12 2006-03-02 13:10:53 stephena Exp $ // $Id: InputDialog.cxx,v 1.13 2006-04-05 12:28:39 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -27,7 +27,8 @@
#include "bspf.hxx" #include "bspf.hxx"
enum { enum {
kPaddleChanged = 'PDch', kPaddleChanged = 'PDch',
kPaddleThreshChanged = 'PDth',
kP0SpeedID = 100, kP0SpeedID = 100,
kP1SpeedID = 101, kP1SpeedID = 101,
kP2SpeedID = 102, kP2SpeedID = 102,
@ -107,7 +108,7 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
// Add 'mouse to paddle' mapping // Add 'mouse to paddle' mapping
ypos += 2*lineHeight; ypos += 2*lineHeight;
lwidth = font.getStringWidth("Mouse is paddle: "); lwidth = font.getStringWidth("Paddle threshold: ");
pwidth = font.getMaxCharWidth() * 5; pwidth = font.getMaxCharWidth() * 5;
myPaddleMode = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myPaddleMode = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Mouse is paddle: ", lwidth, kPaddleChanged); "Mouse is paddle: ", lwidth, kPaddleChanged);
@ -118,6 +119,19 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
myPaddleModeLabel->setFlags(WIDGET_CLEARBG); myPaddleModeLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleMode); wid.push_back(myPaddleMode);
// Add 'paddle threshhold' setting
xpos = 5; ypos += lineHeight + 3;
myPaddleThreshold = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Paddle threshold: ",
lwidth, kPaddleThreshChanged);
myPaddleThreshold->setMinValue(400); myPaddleThreshold->setMaxValue(800);
xpos += myPaddleThreshold->getWidth() + 5;
myPaddleThresholdLabel = new StaticTextWidget(myTab, font, xpos, ypos+1,
24, lineHeight,
"", kTextAlignLeft);
myPaddleThresholdLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleThreshold);
// Add paddle 0 speed // Add paddle 0 speed
xpos = 5; ypos += lineHeight + 3; xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed[0] = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myPaddleSpeed[0] = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
@ -187,6 +201,10 @@ void InputDialog::loadConfig()
myPaddleMode->setValue(instance()->settings().getInt("paddle")); myPaddleMode->setValue(instance()->settings().getInt("paddle"));
myPaddleModeLabel->setLabel(instance()->settings().getString("paddle")); myPaddleModeLabel->setLabel(instance()->settings().getString("paddle"));
// Paddle threshold
myPaddleThreshold->setValue(instance()->settings().getInt("pthresh"));
myPaddleThresholdLabel->setLabel(instance()->settings().getString("pthresh"));
// Paddle speed settings // Paddle speed settings
myPaddleSpeed[0]->setValue(instance()->settings().getInt("p1speed")); myPaddleSpeed[0]->setValue(instance()->settings().getInt("p1speed"));
myPaddleLabel[0]->setLabel(instance()->settings().getString("p1speed")); myPaddleLabel[0]->setLabel(instance()->settings().getString("p1speed"));
@ -210,6 +228,10 @@ void InputDialog::saveConfig()
int mode = myPaddleMode->getValue(); int mode = myPaddleMode->getValue();
instance()->eventHandler().setPaddleMode(mode); instance()->eventHandler().setPaddleMode(mode);
// Paddle threshold
int threshold = myPaddleThreshold->getValue();
instance()->eventHandler().setPaddleThreshold(threshold);
// Paddle speed settings // Paddle speed settings
for(int i = 0; i < 4; ++i) for(int i = 0; i < 4; ++i)
instance()->eventHandler().setPaddleSpeed(i, myPaddleSpeed[i]->getValue()); instance()->eventHandler().setPaddleSpeed(i, myPaddleSpeed[i]->getValue());
@ -275,6 +297,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
myPaddleModeLabel->setValue(myPaddleMode->getValue()); myPaddleModeLabel->setValue(myPaddleMode->getValue());
break; break;
case kPaddleThreshChanged:
myPaddleThresholdLabel->setValue(myPaddleThreshold->getValue());
break;
case kP0SpeedID: case kP0SpeedID:
case kP1SpeedID: case kP1SpeedID:
case kP2SpeedID: case kP2SpeedID:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: InputDialog.hxx,v 1.7 2006-03-02 13:10:53 stephena Exp $ // $Id: InputDialog.hxx,v 1.8 2006-04-05 12:28:39 stephena Exp $
//============================================================================ //============================================================================
#ifndef INPUT_DIALOG_HXX #ifndef INPUT_DIALOG_HXX
@ -61,6 +61,8 @@ class InputDialog : public Dialog
SliderWidget* myPaddleMode; SliderWidget* myPaddleMode;
StaticTextWidget* myPaddleModeLabel; StaticTextWidget* myPaddleModeLabel;
SliderWidget* myPaddleThreshold;
StaticTextWidget* myPaddleThresholdLabel;
SliderWidget* myPaddleSpeed[4]; SliderWidget* myPaddleSpeed[4];
StaticTextWidget* myPaddleLabel[4]; StaticTextWidget* myPaddleLabel[4];

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OptionsDialog.cxx,v 1.37 2006-03-19 20:57:55 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.38 2006-04-05 12:28:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -112,7 +112,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h); myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h);
w = 230; h = 170; w = 230; h = 185;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h); myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);