From bf108706ac02b0337411c766e2e20f60db1b3944 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 28 Sep 2005 22:49:06 +0000 Subject: [PATCH] Second pass at editing properties in GameInfoDialog. It still doesn't work, but at least it compiles. Fixed bug whereby pressing modifier keys in GUI mode would sometimes be interpreted (and printed) as regular keys). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@799 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/docs/stella.html | 22 ++-- stella/src/emucore/EventHandler.cxx | 9 +- stella/src/gui/GameInfoDialog.cxx | 196 +++++++++++++++++----------- stella/src/gui/GameInfoDialog.hxx | 37 +++--- stella/src/gui/GuiUtils.hxx | 5 +- stella/src/gui/OptionsDialog.cxx | 4 +- 6 files changed, 162 insertions(+), 111 deletions(-) diff --git a/stella/docs/stella.html b/stella/docs/stella.html index 104e3a737..cab4c830a 100644 --- a/stella/docs/stella.html +++ b/stella/docs/stella.html @@ -244,6 +244,15 @@ a per-user 'user.pro' properties files. Changes made by the user and stored in 'user.pro' are no longer erased when upgrading Stella. +
  • Added ability to edit current ROM properties from directly within + Stella, which can then be saved directly into the 'user.pro' file. + So creating a properties entry for a new ROM can be done without + any external tools.
  • + +
  • Added cartridge 'frying', thanks to Fred "batari" Quimby. This + emulates the action of turning the power button on and off on a + real Atari, often resulting in some strange effects.
  • +
  • Added support for cartridges with 3E bankswitching format.
  • Added Alt/Shift-Cmd z, x, c, v, b, n keys to enable/disable the @@ -272,7 +281,7 @@ further details.
  • Removed mergeprops commandline argument, since there are now - dedicated keys to do either save or merge game properties.
  • + dedicated keys to either save or merge game properties.
  • Removed hidecursor commandline argument. Stella will now automatically decide when to use this setting.
  • @@ -823,11 +832,6 @@ Set "Display.Height" property (100 - 256). - -
    -cpu <High|Low>
    - Set "Emulation.CPU" property. - -
    -hmove <Yes|No>
    Set "Emulation.HmoveBlanks" property. @@ -1820,12 +1824,6 @@ 100 <= n <= 256. - - Emulation.CPU: - This property indicates the CPU emulation quality. The value of - this property must be High or Low. - - Emulation.HmoveBlanks: This property indicates whether the TIA HMOVE blank bug should be diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 45b15bb66..58cdffed4 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -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.99 2005-09-25 23:14:00 urchlay Exp $ +// $Id: EventHandler.cxx,v 1.100 2005-09-28 22:49:06 stephena Exp $ //============================================================================ #include @@ -711,8 +711,11 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta else if (key >= SDLK_KP0 && key <= SDLK_KP9) unicode = key - SDLK_KP0 + '0'; else if (key == SDLK_BACKSPACE || key == SDLK_DELETE || - (key >= SDLK_UP && key <= SDLK_PAGEDOWN) || - !unicode) + (key >= SDLK_UP && key <= SDLK_PAGEDOWN)) + unicode = key; + else if (key >= SDLK_NUMLOCK && key <= SDLK_UNDO) + return; + else unicode = key; switch((int)myState) diff --git a/stella/src/gui/GameInfoDialog.cxx b/stella/src/gui/GameInfoDialog.cxx index 2551e7c83..6bdfdcd54 100644 --- a/stella/src/gui/GameInfoDialog.cxx +++ b/stella/src/gui/GameInfoDialog.cxx @@ -13,53 +13,138 @@ // 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.11 2005-09-28 19:59:24 stephena Exp $ +// $Id: GameInfoDialog.cxx,v 1.12 2005-09-28 22:49:06 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project //============================================================================ -#include "DialogContainer.hxx" -#include "BrowserDialog.hxx" +#include "GuiUtils.hxx" +#include "OSystem.hxx" +#include "Props.hxx" +#include "Widget.hxx" +#include "Dialog.hxx" +#include "EditTextWidget.hxx" #include "PopUpWidget.hxx" #include "TabWidget.hxx" -#include "FSNode.hxx" -#include "bspf.hxx" -#include "LauncherDialog.hxx" -#include "LauncherOptionsDialog.hxx" +#include "GameInfoDialog.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LauncherOptionsDialog::LauncherOptionsDialog( +GameInfoDialog::GameInfoDialog( OSystem* osystem, DialogContainer* parent, GuiObject* boss, int x, int y, int w, int h) : Dialog(osystem, parent, x, y, w, h), - CommandSender(boss), - myBrowser(NULL) + CommandSender(boss) { const GUI::Font& font = instance()->font(); + const int fontHeight = font.getFontHeight(), + lineHeight = font.getLineHeight(); const int vBorder = 4; - int xpos, ypos; + int xpos, ypos, lwidth, tabID; + WidgetArray wid; // The tab widget xpos = 2; ypos = vBorder; myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); - // 1) The ROM locations tab - myTab->addTab("ROM Settings"); + // 1) Cartridge properties + wid.clear(); + tabID = myTab->addTab("Cartridge"); +// myPrompt = new PromptWidget(myTab, 2, 2, widWidth, widHeight); +// myTab->setParentWidget(tabID, myPrompt); +// addToFocusList(myPrompt->getFocusList(), tabID); - // ROM path - xpos = 15; - new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path", - kChooseRomDirCmd, 0); - xpos += kButtonWidth + 30; - myRomPath = new StaticTextWidget(myTab, xpos, ypos + 3, - _w - xpos - 10, kLineHeight, - "", kTextAlignLeft); + xpos = 10; + lwidth = font.getStringWidth("Manufacturer: "); + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Name:", kTextAlignLeft); + myName = new EditTextWidget(myTab, xpos+lwidth, ypos, 100, fontHeight, ""); + wid.push_back(myName); - // 2) The snapshot settings tab - myTab->addTab(" Snapshot Settings "); + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "MD5:", kTextAlignLeft); +/* + myMD5 = new StaticTextWidget(myTab, xpos, ypos, + xpos+lwidth, fontHeight, + "HAHA!", kTextAlignLeft); + myMD5->setLabel("GAGA!"); +*/ + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Manufacturer:", kTextAlignLeft); + myManufacturer = new EditTextWidget(myTab, xpos+lwidth, ypos, + 100, fontHeight, ""); + wid.push_back(myManufacturer); + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Model:", kTextAlignLeft); + myModelNo = new EditTextWidget(myTab, xpos+lwidth, ypos, + 100, fontHeight, ""); + wid.push_back(myModelNo); + + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Rarity:", kTextAlignLeft); + myRarity = new PopUpWidget(myTab, xpos+lwidth, ypos, 100, lineHeight, + "", 0, 0); + myRarity->appendEntry("(1) Common", 1); + myRarity->appendEntry("(2) Common+", 2); + myRarity->appendEntry("(3) Scarce", 3); + myRarity->appendEntry("(4) Scarce+", 4); + myRarity->appendEntry("(5) Rare", 5); +/* + myRarity->appendEntry("(6) Rare+", 6); + myRarity->appendEntry("(7) Very Rare", 7); + myRarity->appendEntry("(8) Very Rare+", 8); + myRarity->appendEntry("(9) Extremely Rare", 9); + myRarity->appendEntry("(10) Unbelievably Rare", 10); + myRarity->appendEntry("(H) Homebrew", 11); + myRarity->appendEntry("(R) Reproduction", 12); + myRarity->appendEntry("(P) Prototype", 13); +*/ + wid.push_back(myRarity); + + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Note:", kTextAlignLeft); + myNote = new EditTextWidget(myTab, xpos+lwidth, ypos, + 100, fontHeight, ""); + wid.push_back(myNote); + +/* + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Sound:", kTextAlignLeft); + mySound = new EditTextWidget(myTab, xpos+lwidth, ypos, + 100, fontHeight, ""); + wid.push_back(mySound); + + ypos += lineHeight + 3; + new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight, + "Type:", kTextAlignLeft); + myType = new EditTextWidget(myTab, xpos+lwidth, ypos, + 100, fontHeight, ""); + wid.push_back(myType); +*/ + + // Add items for tab 0 + addToFocusList(wid, tabID); + + // 2) Console/Controller properties +// myTab->addTab("Console"); + + + // 3) Controller properties +// myTab->addTab("Controller"); + + + // 4) Display properties +// myTab->addTab("Display"); + +/* // Snapshot path xpos = 15; new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path", @@ -80,6 +165,7 @@ LauncherOptionsDialog::LauncherOptionsDialog( xpos = 30; ypos += 18; mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, "Multiple snapshots"); +*/ // Activate the first tab myTab->setActiveTab(0); @@ -92,22 +178,18 @@ LauncherOptionsDialog::LauncherOptionsDialog( addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); #endif - - // Create file browser dialog - int baseW = instance()->frameBuffer().baseWidth(); - int baseH = instance()->frameBuffer().baseHeight(); - myBrowser = new BrowserDialog(this, 60, 20, baseW - 120, baseH - 40); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LauncherOptionsDialog::~LauncherOptionsDialog() +GameInfoDialog::~GameInfoDialog() { - delete myBrowser; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherOptionsDialog::loadConfig() +void GameInfoDialog::loadConfig() { +cerr << "loadConfig()\n"; +/* string s; bool b; @@ -127,13 +209,15 @@ void LauncherOptionsDialog::loadConfig() b = instance()->settings().getBool("sssingle"); mySnapSingleCheckbox->setState(!b); - +*/ myTab->loadConfig(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherOptionsDialog::saveConfig() +void GameInfoDialog::saveConfig() { +cerr << "saveConfig()\n"; +/* string s; bool b; @@ -151,30 +235,11 @@ void LauncherOptionsDialog::saveConfig() // Flush changes to disk instance()->settings().saveConfig(); +*/ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherOptionsDialog::openRomBrowser() -{ - myBrowser->setTitle("Select ROM directory:"); - myBrowser->setEmitSignal(kRomDirChosenCmd); - myBrowser->setStartPath(myRomPath->getLabel()); - - parent()->addDialog(myBrowser); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherOptionsDialog::openSnapBrowser() -{ - myBrowser->setTitle("Select snapshot directory:"); - myBrowser->setEmitSignal(kSnapDirChosenCmd); - myBrowser->setStartPath(mySnapPath->getLabel()); - - parent()->addDialog(myBrowser); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd, +void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, int data, int id) { switch (cmd) @@ -182,31 +247,8 @@ void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd, case kOKCmd: saveConfig(); close(); - sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed break; - case kChooseRomDirCmd: - openRomBrowser(); - break; - - case kChooseSnapDirCmd: - openSnapBrowser(); - break; - - case kRomDirChosenCmd: - { - FilesystemNode dir(myBrowser->getResult()); - myRomPath->setLabel(dir.path()); - break; - } - - case kSnapDirChosenCmd: - { - FilesystemNode dir(myBrowser->getResult()); - mySnapPath->setLabel(dir.path()); - break; - } - default: Dialog::handleCommand(sender, cmd, data, 0); break; diff --git a/stella/src/gui/GameInfoDialog.hxx b/stella/src/gui/GameInfoDialog.hxx index b8455918b..b40f84285 100644 --- a/stella/src/gui/GameInfoDialog.hxx +++ b/stella/src/gui/GameInfoDialog.hxx @@ -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.8 2005-09-28 19:59:24 stephena Exp $ +// $Id: GameInfoDialog.hxx,v 1.9 2005-09-28 22:49:06 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -28,6 +28,7 @@ class EditTextWidget; class PopUpWidget; class StaticTextWidget; class TabWidget; +class Properties; #include "Dialog.hxx" #include "Command.hxx" @@ -35,15 +36,15 @@ class TabWidget; class GameInfoDialog : public Dialog, public CommandSender { public: - GameInfoDialog(OSystem* osystem, DialogContainer* parent, - GuiObject* boss, + GameInfoDialog(OSystem* osystem, DialogContainer* parent, GuiObject* boss, int x, int y, int w, int h); ~GameInfoDialog(); - virtual void loadConfig(); - virtual void saveConfig(); + void setGameProfile(Properties& props) { myGameProperties = &props; } - virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); + void loadConfig(); + void saveConfig(); + void handleCommand(CommandSender* sender, int cmd, int data, int id); private: TabWidget* myTab; @@ -53,24 +54,30 @@ class GameInfoDialog : public Dialog, public CommandSender StaticTextWidget* myMD5; EditTextWidget* myManufacturer; EditTextWidget* myModelNo; + PopUpWidget* myRarity; EditTextWidget* myNote; - PopupWidget* mySound; - PopupWidget* myType; + PopUpWidget* mySound; + PopUpWidget* myType; // Console/controller properties - PopupWidget* myLeftDiff; - PopupWidget* myRightDiff; - PopupWidget* myTVType; - PopupWidget* myLeftController; - PopupWidget* myRightController; + PopUpWidget* myLeftDiff; + PopUpWidget* myRightDiff; + PopUpWidget* myTVType; + PopUpWidget* myLeftController; + PopUpWidget* myRightController; // Display properties - PopupWidget* myFormat; + PopUpWidget* myFormat; EditTextWidget* myXStart; EditTextWidget* myWidth; EditTextWidget* myYStart; EditTextWidget* myHeight; - PopupWidget* myHmoveBlanks; + PopUpWidget* myHmoveBlanks; + + Properties* myGameProperties; + + ButtonWidget* myNextButton; + ButtonWidget* myPrevButton; }; #endif diff --git a/stella/src/gui/GuiUtils.hxx b/stella/src/gui/GuiUtils.hxx index 8d2bad955..6fb4066e4 100644 --- a/stella/src/gui/GuiUtils.hxx +++ b/stella/src/gui/GuiUtils.hxx @@ -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: GuiUtils.hxx,v 1.19 2005-09-06 19:42:35 stephena Exp $ +// $Id: GuiUtils.hxx,v 1.20 2005-09-28 22:49:06 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,7 +29,7 @@ Probably not very neat, but at least it works ... @author Stephen Anthony - @version $Id: GuiUtils.hxx,v 1.19 2005-09-06 19:42:35 stephena Exp $ + @version $Id: GuiUtils.hxx,v 1.20 2005-09-28 22:49:06 stephena Exp $ */ #define kFontHeight 10 @@ -55,6 +55,7 @@ enum { kCloseCmd = 'CLOS', kNextCmd = 'NEXT', kPrevCmd = 'PREV', + kEditCmd = 'EDIT', kDefaultsCmd = 'DEFA', kSetPositionCmd = 'SETP', kTabChangedCmd = 'TBCH', diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 3d2205d4c..068ef1c3a 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.cxx @@ -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: OptionsDialog.cxx,v 1.29 2005-09-26 19:10:37 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.30 2005-09-28 22:49:06 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -106,7 +106,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent) w = 255; h = 150; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myGameInfoDialog = new GameInfoDialog(myOSystem, parent, x, y, w, h); + myGameInfoDialog = new GameInfoDialog(myOSystem, parent, this, x, y, w, h); w = 140; h = 40; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);