Some fixes for 'small screen' functionality. The lower bound of 320x240

is now enforced in more areas of the code, specifically, in BrowserDialog,
VideoDialog and InputDialog.

Rearranged some options in InputDialog (for spacing), and removed the
'mouse is paddle ...' option.  It was never being saved to the config
file anyway, and is still selectable with Ctrl-0,1,2,3 keys.

Added 'maxres' commandline argument, which overrides the built-in
determination of desktop size normally done by SDL.  This is not
documented, and is not meant to be used by anyone other than those
testing Stella on 'small' systems.  It's basically a way to set the
desktop size without recompiling Stella each time.

Still TODO is look at all other dialogs, making sure they fit in the
minimum size.  PopupDialog in particular needs to be fixed.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1942 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-02-13 18:34:24 +00:00
parent c9e1735527
commit f7d8334768
18 changed files with 105 additions and 105 deletions

View File

@ -12,6 +12,15 @@
Release History
===========================================================================
3.0 to 3.0.1: (February 13, 2010)
* Fixed a major bug with text drawing in software rendering mode.
Switching between windowed and fullscreen mode while text was being
shown could result in garbled text or even a program crash.
-Have fun!
2.8.4 to 3.0: (September 11, 2009)
* Huge updates to the TIA emulation system. Illegal HMOVEs are now
@ -78,8 +87,6 @@
* Fixed editing of cheats in the Cheat Dialog; the old cheat wasn't
being removed.
-Have fun!
2.8.3 to 2.8.4: (July 4, 2009)

View File

@ -944,9 +944,22 @@ bool OSystem::queryVideoHardware()
return false;
// First get the maximum windowed desktop resolution
// Check the 'maxres' setting, which is an undocumented developer feature
// that specifies the desktop size
// Normally, this wouldn't be set, and we ask SDL directly
int w, h;
mySettings->getSize("maxres", w, h);
if(w == 0 || h == 0)
{
const SDL_VideoInfo* info = SDL_GetVideoInfo();
myDesktopWidth = info->current_w;
myDesktopHeight = info->current_h;
}
else
{
myDesktopWidth = BSPF_max(w, 320);
myDesktopHeight = BSPF_max(h, 240);
}
// Various parts of the codebase assume a minimum screen size of 320x240
assert(myDesktopWidth >= 320 && myDesktopHeight >= 240);

View File

@ -123,6 +123,7 @@ Settings::Settings(OSystem* osystem)
setInternal("audiofirst", "true");
setInternal("fastscbios", "false");
setExternal("romloadcount", "0");
setExternal("maxres", "0x0");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -121,11 +121,11 @@ void AboutDialog::updateStrings(int page, int lines, string& title)
case 2:
title = "The Stella Team";
ADD_ATEXT("\\L\\c0"" Bradford W. Mott");
ADD_ATEXT("\\L\\c2"" Original author, lead developer");
ADD_ATEXT("\\L\\c2"" Original author");
ADD_ATEXT("\\L\\c0"" Stephen Anthony");
ADD_ATEXT("\\L\\c2"" Lead developer, Linux/OSX/Win32 maintainer");
ADD_ATEXT("\\L\\c0"" Mark Grebe");
ADD_ATEXT("\\L\\c2"" Original author/maintainer for OSX port");
ADD_ATEXT("\\L\\c2"" Original author for OSX port");
ADD_ATEXT("\\L\\c0"" Brian Watson");
ADD_ATEXT("\\L\\c2"" Emulation core enhancement, debugger support");
break;

View File

@ -39,7 +39,8 @@
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font)
BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
int max_w, int max_h)
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 0, 0),
CommandSender(boss),
_fileList(NULL),
@ -55,8 +56,8 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font)
// Set real dimensions
// This is one dialog that can take as much space as is available
_w = BSPF_min(instance().desktopWidth(), 480u);
_h = BSPF_min(instance().desktopHeight(), 380u);
_w = BSPF_min(max_w, 480);
_h = BSPF_min(max_h, 380);
xpos = 10; ypos = 4;
_title = new StaticTextWidget(this, font, xpos, ypos,

View File

@ -36,7 +36,7 @@ class GameList;
class BrowserDialog : public Dialog, public CommandSender
{
public:
BrowserDialog(GuiObject* boss, const GUI::Font& font);
BrowserDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h);
virtual ~BrowserDialog();
const FilesystemNode& getResult() { return _node; }

View File

@ -32,7 +32,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileSnapDialog::FileSnapDialog(
OSystem* osystem, DialogContainer* parent,
const GUI::Font& font, GuiObject* boss)
const GUI::Font& font, GuiObject* boss,
int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0),
CommandSender(boss),
myBrowser(NULL),
@ -152,7 +153,7 @@ FileSnapDialog::FileSnapDialog(
}
// Create file browser dialog
myBrowser = new BrowserDialog(this, font);
myBrowser = new BrowserDialog(this, font, max_w, max_h);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -38,7 +38,8 @@ class FileSnapDialog : public Dialog, public CommandSender
{
public:
FileSnapDialog(OSystem* osystem, DialogContainer* parent,
const GUI::Font& font, GuiObject* boss);
const GUI::Font& font, GuiObject* boss,
int max_w, int max_h);
~FileSnapDialog();
void handleCommand(CommandSender* sender, int cmd, int data, int id);

View File

@ -124,49 +124,6 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
"Stelladaptor 2 is: ", lwidth, kRightChanged);
wid.push_back(myRightPort);
lwidth = font.getStringWidth("Paddle threshold: ");
pwidth = font.getMaxCharWidth() * 8;
// 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);
xpos += myPaddleMode->getWidth() + 5;
myPaddleModeLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft);
myPaddleModeLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleMode);
// Add mouse enable/disable
xpos += 8 + myPaddleModeLabel->getWidth();
myMouseEnabled = new CheckboxWidget(myTab, font, xpos, ypos,
"Use mouse", kPMouseChanged);
wid.push_back(myMouseEnabled);
// Add paddle speed
xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Paddle speed: ",
lwidth, kPSpeedChanged);
myPaddleSpeed->setMinValue(1); myPaddleSpeed->setMaxValue(15);
xpos += myPaddleSpeed->getWidth() + 5;
myPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft);
myPaddleLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed);
// Add AtariVox serial port
xpos = 5; ypos += 2*lineHeight;
int fwidth = _w - xpos - lwidth - 20;
@ -176,12 +133,44 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
fwidth, fontHeight, "");
wid.push_back(myAVoxPort);
lwidth = font.getStringWidth("Digital paddle speed: ");
pwidth = font.getMaxCharWidth() * 8;
// Add joystick deadzone setting
ypos += 2*lineHeight;
myDeadzone = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Joystick 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 paddle speed
xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Digital paddle speed: ",
lwidth, kPSpeedChanged);
myPaddleSpeed->setMinValue(1); myPaddleSpeed->setMaxValue(15);
xpos += myPaddleSpeed->getWidth() + 5;
myPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft);
myPaddleLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed);
// Add 'allow all 4 directions' for joystick
xpos = 10; ypos += 2*lineHeight;
myAllowAll4 = new CheckboxWidget(myTab, font, xpos, ypos,
"Allow all 4 directions on joystick");
wid.push_back(myAllowAll4);
// Add mouse enable/disable
xpos = 10; ypos += lineHeight + 4;
myMouseEnabled = new CheckboxWidget(myTab, font, xpos, ypos,
"Use mouse as a controller");
wid.push_back(myMouseEnabled);
// Add items for virtual device ports
addToFocusList(wid, tabID);
}
@ -201,10 +190,6 @@ void InputDialog::loadConfig()
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
myDeadzoneLabel->setLabel(instance().settings().getString("joydeadzone"));
// Paddle mode
myPaddleMode->setValue(0);
myPaddleModeLabel->setLabel("0");
// Mouse/paddle enabled
bool usemouse = instance().settings().getBool("usemouse");
myMouseEnabled->setState(usemouse);
@ -220,7 +205,6 @@ void InputDialog::loadConfig()
myAllowAll4->setState(instance().settings().getBool("joyallow4"));
myTab->loadConfig();
handleMouseChanged(usemouse);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -236,9 +220,6 @@ void InputDialog::saveConfig()
instance().settings().setInt("joydeadzone", deadzone);
Joystick::setDeadZone(deadzone);
// Paddle mode
Paddles::setMouseIsPaddle(myPaddleMode->getValue());
// Mouse/paddle enabled
bool usemouse = myMouseEnabled->getState();
instance().settings().setBool("usemouse", usemouse);
@ -306,13 +287,6 @@ bool InputDialog::handleJoyHat(int stick, int hat, int value)
return Dialog::handleJoyHat(stick, hat, value);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::handleMouseChanged(bool state)
{
myPaddleMode->setEnabled(state);
myPaddleModeLabel->setEnabled(state);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id)
@ -343,18 +317,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
myDeadzoneLabel->setValue(myDeadzone->getValue());
break;
case kPaddleChanged:
myPaddleModeLabel->setValue(myPaddleMode->getValue());
break;
case kPSpeedChanged:
myPaddleLabel->setValue(myPaddleSpeed->getValue());
break;
case kPMouseChanged:
handleMouseChanged(data == 1);
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
}

View File

@ -51,16 +51,13 @@ class InputDialog : public Dialog
private:
void addVDeviceTab(const GUI::Font& font);
void handleMouseChanged(bool state);
private:
enum {
kLeftChanged = 'LCch',
kRightChanged = 'RCch',
kDeadzoneChanged = 'DZch',
kPaddleChanged = 'PDch',
kPSpeedChanged = 'PSch',
kPMouseChanged = 'PMch'
kPSpeedChanged = 'PSch'
};
TabWidget* myTab;
@ -71,15 +68,14 @@ class InputDialog : public Dialog
PopUpWidget* myLeftPort;
PopUpWidget* myRightPort;
EditTextWidget* myAVoxPort;
SliderWidget* myDeadzone;
StaticTextWidget* myDeadzoneLabel;
SliderWidget* myPaddleMode;
StaticTextWidget* myPaddleModeLabel;
SliderWidget* myPaddleSpeed;
StaticTextWidget* myPaddleLabel;
CheckboxWidget* myMouseEnabled;
EditTextWidget* myAVoxPort;
CheckboxWidget* myAllowAll4;
CheckboxWidget* myMouseEnabled;
};
#endif

View File

@ -171,7 +171,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
mySelectedItem = 0; // Highlight 'Rom Listing'
// Create an options dialog, similar to the in-game one
myOptions = new OptionsDialog(osystem, parent, this, true); // not in game mode
myOptions = new OptionsDialog(osystem, parent, this, w, h, true); // not in game mode
// Create a game list, which contains all the information about a ROM that
// the launcher needs

View File

@ -27,7 +27,20 @@ class Properties;
Menu::Menu(OSystem* osystem)
: DialogContainer(osystem)
{
myBaseDialog = new OptionsDialog(myOSystem, this, 0, false); // in game mode
// This dialog is overlaid on the main TIA screen; we make sure it will fit
// If the TIA can use 1x mode, it implies that the overlay can be no larger
// than 320x240
// Otherwise we can use 2x mode, in which 640x420 is the minimum TIA size
int dw = osystem->desktopWidth(), dh = osystem->desktopHeight();
if(dw < 640 || dh < 480)
{
dw = 320; dh = 240;
}
else
{
dw = 640; dh = 420;
}
myBaseDialog = new OptionsDialog(myOSystem, this, 0, dw, dh, false); // in game mode
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -47,7 +47,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
GuiObject* boss, bool global)
GuiObject* boss, int max_w, int max_h, bool global)
: Dialog(osystem, parent, 0, 0, 0, 0),
myVideoDialog(NULL),
myAudioDialog(NULL),
@ -116,7 +116,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
addCancelWidget(b);
// Now create all the dialogs attached to each menu button
myVideoDialog = new VideoDialog(osystem, parent, font);
myVideoDialog = new VideoDialog(osystem, parent, font, max_w, max_h);
myAudioDialog = new AudioDialog(osystem, parent, font);
/* FIXME - may not be needed with small-font functionality
@ -132,8 +132,8 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
*/
myInputDialog = new InputDialog(osystem, parent, font);
myUIDialog = new UIDialog(osystem, parent, font);
myFileSnapDialog = new FileSnapDialog(osystem, parent, font, boss);
myRomAuditDialog = new RomAuditDialog(osystem, parent, font);
myFileSnapDialog = new FileSnapDialog(osystem, parent, font, boss, max_w, max_h);
myRomAuditDialog = new RomAuditDialog(osystem, parent, font, max_w, max_h);
myGameInfoDialog = new GameInfoDialog(osystem, parent, font, this);
#ifdef CHEATCODE_SUPPORT
myCheatCodeDialog = new CheatCodeDialog(osystem, parent, font);

View File

@ -44,13 +44,12 @@ class OptionsDialog : public Dialog
{
public:
OptionsDialog(OSystem* osystem, DialogContainer* parent, GuiObject* boss,
bool global);
int max_w, int max_h, bool global);
virtual ~OptionsDialog();
private:
void loadConfig();
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
void checkBounds(int width, int height, int* x, int* y, int* w, int* h);
private:
VideoDialog* myVideoDialog;

View File

@ -34,7 +34,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomAuditDialog::RomAuditDialog(OSystem* osystem, DialogContainer* parent,
const GUI::Font& font)
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0),
myBrowser(NULL)
{
@ -90,7 +90,7 @@ RomAuditDialog::RomAuditDialog(OSystem* osystem, DialogContainer* parent,
addBGroupToFocusList(wid);
// Create file browser dialog
myBrowser = new BrowserDialog(this, font);
myBrowser = new BrowserDialog(this, font, max_w, max_h);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -37,7 +37,7 @@ class RomAuditDialog : public Dialog
{
public:
RomAuditDialog(OSystem* osystem, DialogContainer* parent,
const GUI::Font& font);
const GUI::Font& font, int max_w, int max_h);
~RomAuditDialog();
void handleCommand(CommandSender* sender, int cmd, int data, int id);

View File

@ -40,7 +40,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
const GUI::Font& font)
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0)
{
const int lineHeight = font.getLineHeight(),
@ -56,8 +56,8 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
StringMap items;
// Set real dimensions
_w = 52 * fontWidth + 10;
_h = 15 * (lineHeight + 4) + 10;
_w = BSPF_min(52 * fontWidth + 10, max_w);
_h = BSPF_min(15 * (lineHeight + 4) + 10, max_h);
// The tab widget
xpos = ypos = 5;
@ -169,7 +169,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
// Add message concerning usage
ypos += (lineHeight + 4) * 2;
ypos = myTab->getHeight() - 5 - 2*fontHeight - 10;
new StaticTextWidget(myTab, font, 10, ypos,
font.getStringWidth("(*) Requires application restart"), fontHeight,
"(*) Requires application restart", kTextAlignLeft);
@ -182,8 +182,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
items.clear();
items.push_back("On", "1");
items.push_back("Off", "0");
items.push_back("Disabled", "-1");
items.push_back("Never", "-1");
lwidth = font.getStringWidth("Fullscreen: ");
pwidth = font.getStringWidth("Never"),
myFullscreenPopup =
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Fullscreen: ", lwidth, kFullScrChanged);

View File

@ -38,7 +38,8 @@ class TabWidget;
class VideoDialog : public Dialog
{
public:
VideoDialog(OSystem* osystem, DialogContainer* parent, const GUI::Font& font);
VideoDialog(OSystem* osystem, DialogContainer* parent, const GUI::Font& font,
int max_w, int max_h);
~VideoDialog();
private: