From 328d15e83c2fbbe02bb999daa2ffa8c8927a11a2 Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 22 Mar 2008 17:35:03 +0000 Subject: [PATCH] Reactivated 'mouse is paddle X' functionality by integrating it directly into the Paddles class. Removed '-paddles' commandline argument. You can still change the paddle that the mouse is emulating from the UI or with Ctrl 0..3, but its no longer a setting that can be saved. Added message to LauncherDialog when a ROM is invalid and can't be loaded. Reworked the GameInfoDialog a little wrt swapping console ports. Behind the scenes, the Console.SwapPorts property is still being used, but the UI is now more consistent (you no longer select the left and right controller, but the controllers for players 0 and 1, and which port they'll be plugged into). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1435 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/Console.cxx | 3 +- stella/src/emucore/Event.hxx | 6 +-- stella/src/emucore/EventHandler.cxx | 38 +++++-------- stella/src/emucore/EventHandler.hxx | 7 +-- stella/src/emucore/Paddles.cxx | 66 ++++++++++++++--------- stella/src/emucore/Paddles.hxx | 18 +++++-- stella/src/emucore/Settings.cxx | 7 +-- stella/src/gui/GameInfoDialog.cxx | 83 +++++++++++++++++------------ stella/src/gui/GameInfoDialog.hxx | 11 ++-- stella/src/gui/InputDialog.cxx | 23 +++++--- stella/src/gui/InputDialog.hxx | 4 +- stella/src/gui/LauncherDialog.cxx | 5 +- 12 files changed, 151 insertions(+), 120 deletions(-) diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index 25dd8ee8f..9956c64d2 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.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: Console.cxx,v 1.132 2008-02-06 13:45:21 stephena Exp $ +// $Id: Console.cxx,v 1.133 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #include @@ -97,6 +97,7 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) // Also check if we should swap the paddles plugged into a jack bool swapPaddles = myProperties.get(Controller_SwapPaddles) == "YES"; + Paddles::setMouseIsPaddle(-1); // Reset to defaults // Construct left controller if(left == "BOOSTER-GRIP") diff --git a/stella/src/emucore/Event.hxx b/stella/src/emucore/Event.hxx index 6d04b21ef..fd11d88c5 100644 --- a/stella/src/emucore/Event.hxx +++ b/stella/src/emucore/Event.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: Event.hxx,v 1.33 2008-03-02 19:20:50 stephena Exp $ +// $Id: Event.hxx,v 1.34 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #ifndef EVENT_HXX @@ -25,7 +25,7 @@ class Event; /** @author Bradford W. Mott - @version $Id: Event.hxx,v 1.33 2008-03-02 19:20:50 stephena Exp $ + @version $Id: Event.hxx,v 1.34 2008-03-22 17:35:02 stephena Exp $ */ class Event { @@ -66,7 +66,7 @@ class Event SALeftAxis0Value, SALeftAxis1Value, SARightAxis0Value, SARightAxis1Value, - MouseAxisXValue, MouseAxisYValue, + MouseAxisXValue, MouseAxisYValue, MouseButtonValue, ChangeState, LoadState, SaveState, TakeSnapshot, Quit, PauseMode, MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 94c46fc2b..d1a4b6025 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -14,7 +14,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.218 2008-03-13 22:58:06 stephena Exp $ +// $Id: EventHandler.cxx,v 1.219 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #include @@ -66,8 +66,7 @@ EventHandler::EventHandler(OSystem* osystem) myGrabMouseFlag(false), myUseLauncherFlag(false), myAllowAllDirectionsFlag(false), - myFryingFlag(false), - myPaddleMode(0) + myFryingFlag(false) { // Create the event object which will be used for this handler myEvent = new Event(); @@ -146,7 +145,6 @@ void EventHandler::initialize() myGrabMouseFlag = myOSystem->settings().getBool("grabmouse"); - setPaddleMode(myOSystem->settings().getInt("paddle"), false); Paddles::setDigitalSpeed(myOSystem->settings().getInt("pspeed")); // Set number of lines a mousewheel will scroll @@ -756,8 +754,8 @@ void EventHandler::poll(uInt32 time) myOverlay->updateTime(time); } - // Turn off relative events; we assume they've been taken care of - // in at least one of the ::update() methods above + // Turn off all mouse-related items; if they haven't been taken care of + // in the previous ::update() methods, they're now invalid myEvent->set(Event::MouseAxisXValue, 0); myEvent->set(Event::MouseAxisYValue, 0); } @@ -785,7 +783,7 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, int state) { // Determine which mode we're in, then send the event to the appropriate place if(myState == S_EMULATE) - myEvent->set(Paddle_Button[myPaddleMode], state); + myEvent->set(Event::MouseButtonValue, state); else if(myOverlay) { // Take window zooming into account @@ -1835,20 +1833,16 @@ void EventHandler::takeSnapshot() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::setPaddleMode(int num, bool showmessage) { -// FIXME - communicate with Paddles class - if(num < 0 || num > 3) - return; - - myPaddleMode = num; - - if(showmessage) + if(num >= 0 && num <= 3) { - ostringstream buf; - buf << "Mouse is paddle " << num; - myOSystem->frameBuffer().showMessage(buf.str()); + Paddles::setMouseIsPaddle(num); + if(showmessage) + { + ostringstream buf; + buf << "Mouse is paddle " << num; + myOSystem->frameBuffer().showMessage(buf.str()); + } } - - myOSystem->settings().setInt("paddle", myPaddleMode); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2309,12 +2303,6 @@ EventHandler::ActionList EventHandler::ourMenuActionList[kMenuActionListSize] = { Event::UINavNext, "Next object", 0 } }; -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const Event::Type EventHandler::Paddle_Button[4] = { - Event::PaddleZeroFire, Event::PaddleOneFire, - Event::PaddleTwoFire, Event::PaddleThreeFire -}; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Used by the Stelladaptor to send absolute axis values const Event::Type EventHandler::SA_Axis[2][2] = { diff --git a/stella/src/emucore/EventHandler.hxx b/stella/src/emucore/EventHandler.hxx index e7e275ab5..cc46b18d8 100644 --- a/stella/src/emucore/EventHandler.hxx +++ b/stella/src/emucore/EventHandler.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: EventHandler.hxx,v 1.108 2008-03-02 20:48:51 stephena Exp $ +// $Id: EventHandler.hxx,v 1.109 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #ifndef EVENTHANDLER_HXX @@ -61,7 +61,7 @@ enum EventMode { mapping can take place. @author Stephen Anthony - @version $Id: EventHandler.hxx,v 1.108 2008-03-02 20:48:51 stephena Exp $ + @version $Id: EventHandler.hxx,v 1.109 2008-03-22 17:35:02 stephena Exp $ */ class EventHandler { @@ -516,9 +516,6 @@ class EventHandler static ActionList ourEmulActionList[kEmulActionListSize]; static ActionList ourMenuActionList[kMenuActionListSize]; - // Lookup table for paddle button events - static const Event::Type Paddle_Button[4]; - // Static lookup tables for Stelladaptor axis/button support static const Event::Type SA_Axis[2][2]; static const Event::Type SA_Button[2][2]; diff --git a/stella/src/emucore/Paddles.cxx b/stella/src/emucore/Paddles.cxx index 1b4b856a3..0a7735b20 100644 --- a/stella/src/emucore/Paddles.cxx +++ b/stella/src/emucore/Paddles.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: Paddles.cxx,v 1.13 2008-03-02 20:48:51 stephena Exp $ +// $Id: Paddles.cxx,v 1.14 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #define TRIGMAX 240 @@ -24,9 +24,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Paddles::Paddles(Jack jack, const Event& event, bool swap) - : Controller(jack, event, Controller::Paddles), - myMouseBaseX(-1), - myMouseBaseY(-1) + : Controller(jack, event, Controller::Paddles) { // Swap the paddle events, from paddle 0 <=> 1 and paddle 2 <=> 3 // Also consider whether this is the left or right port @@ -50,7 +48,7 @@ Paddles::Paddles(Jack jack, const Event& event, bool swap) myP1FireEvent1 = Event::PaddleOneFire; myP1FireEvent2 = Event::JoystickZeroFire3; - myMouseBaseX = 0; + if(_MOUSEX_PADDLE < 0) _MOUSEX_PADDLE = 0; } else { @@ -70,7 +68,7 @@ Paddles::Paddles(Jack jack, const Event& event, bool swap) myP1FireEvent1 = Event::PaddleZeroFire; myP1FireEvent2 = Event::JoystickZeroFire1; - myMouseBaseX = 1; + if(_MOUSEX_PADDLE < 0) _MOUSEX_PADDLE = 1; } } else @@ -93,7 +91,7 @@ Paddles::Paddles(Jack jack, const Event& event, bool swap) myP1FireEvent1 = Event::PaddleThreeFire; myP1FireEvent2 = Event::JoystickOneFire3; - myMouseBaseX = 2; + if(_MOUSEX_PADDLE < 0) _MOUSEX_PADDLE = 0; } else { @@ -113,7 +111,7 @@ Paddles::Paddles(Jack jack, const Event& event, bool swap) myP1FireEvent1 = Event::PaddleTwoFire; myP1FireEvent2 = Event::JoystickOneFire1; - myMouseBaseX = 3; + if(_MOUSEX_PADDLE < 0) _MOUSEX_PADDLE = 1; } } @@ -126,7 +124,7 @@ Paddles::Paddles(Jack jack, const Event& event, bool swap) myKeyRepeat0 = myPaddleRepeat0 = myKeyRepeat1 = myPaddleRepeat1 = 0; myCharge[0] = myCharge[1] = - myLastCharge[0] = myLastCharge[1] = 120; // half of maximum paddle charge + myLastCharge[0] = myLastCharge[1] = TRIGMAX/2; // half of maximum paddle charge myLeftMotion[0] = myLeftMotion[1] = 0; } @@ -138,6 +136,8 @@ Paddles::~Paddles() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Paddles::update() { + myDigitalPinState[Three] = myDigitalPinState[Four] = true; + // Digital events (from keyboard or joystick hats & buttons) myDigitalPinState[Three] = (myEvent.get(myP1FireEvent1) == 0 && myEvent.get(myP1FireEvent2) == 0); @@ -184,16 +184,23 @@ void Paddles::update() } // Mouse events - if(myMouseBaseX == 0 || myMouseBaseX == 1) + if(myJack == Left && (_MOUSEX_PADDLE == 0 || _MOUSEX_PADDLE == 1)) { - /* FIXME - if (MPdirection & 0x01) Charge[MouseBaseX] = Charge[MouseBaseX] + srv_micky_x; - else Charge [MouseBaseX] = Charge[MouseBaseX] - srv_micky_x; - */ - myCharge[myMouseBaseX] = - myCharge[myMouseBaseX] - myEvent.get(Event::MouseAxisXValue); - if(myCharge[myMouseBaseX] < TRIGMIN) myCharge[myMouseBaseX] = TRIGMIN; - if(myCharge[myMouseBaseX] > TRIGMAX) myCharge[myMouseBaseX] = TRIGMAX; + // TODO - add infrastructure to map mouse direction to increase or decrease charge + myCharge[_MOUSEX_PADDLE] -= myEvent.get(Event::MouseAxisXValue); + if(myCharge[_MOUSEX_PADDLE] < TRIGMIN) myCharge[_MOUSEX_PADDLE] = TRIGMIN; + if(myCharge[_MOUSEX_PADDLE] > TRIGMAX) myCharge[_MOUSEX_PADDLE] = TRIGMAX; + if(myEvent.get(Event::MouseButtonValue)) + myDigitalPinState[ourButtonPin[_MOUSEX_PADDLE]] = false; + } + else if(myJack == Right && (_MOUSEX_PADDLE == 2 || _MOUSEX_PADDLE == 3)) + { + // TODO - add infrastructure to map mouse direction to increase or decrease charge + myCharge[_MOUSEX_PADDLE-2] -= myEvent.get(Event::MouseAxisXValue); + if(myCharge[_MOUSEX_PADDLE-2] < TRIGMIN) myCharge[_MOUSEX_PADDLE-2] = TRIGMIN; + if(myCharge[_MOUSEX_PADDLE-2] > TRIGMAX) myCharge[_MOUSEX_PADDLE-2] = TRIGMAX; + if(myEvent.get(Event::MouseButtonValue)) + myDigitalPinState[ourButtonPin[_MOUSEX_PADDLE-2]] = false; } // Axis events (possibly use analog values) @@ -291,18 +298,25 @@ void Paddles::update() myLastCharge[1] = charge1; } } - -/* FIXME - if(PaddleAdjust) - { - myCharge[0] = (myCharge[0] >> 1) + PaddleAdjust; - myCharge[1] = (myCharge[1] >> 1) + PaddleAdjust; - } -*/ myAnalogPinValue[Five] = (Int32)(1000000 * (myCharge[1] / 255.0)); myAnalogPinValue[Nine] = (Int32)(1000000 * (myCharge[0] / 255.0)); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Paddles::setMouseIsPaddle(int number, int dir) +{ + // TODO - make mouse Y axis be actually used in the code above + if(dir == 0) + _MOUSEX_PADDLE = number; + else + _MOUSEY_PADDLE = number; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int Paddles::_PADDLE_SPEED = 6; +int Paddles::_MOUSEX_PADDLE = -1; +int Paddles::_MOUSEY_PADDLE = -1; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +const Controller::DigitalPin Paddles::ourButtonPin[2] = { Four, Three }; diff --git a/stella/src/emucore/Paddles.hxx b/stella/src/emucore/Paddles.hxx index 214b79132..5e0b0f6c0 100644 --- a/stella/src/emucore/Paddles.hxx +++ b/stella/src/emucore/Paddles.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: Paddles.hxx,v 1.12 2008-03-02 20:48:51 stephena Exp $ +// $Id: Paddles.hxx,v 1.13 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #ifndef PADDLES_HXX @@ -27,7 +27,7 @@ The standard Atari 2600 pair of paddle controllers. @author Bradford W. Mott - @version $Id: Paddles.hxx,v 1.12 2008-03-02 20:48:51 stephena Exp $ + @version $Id: Paddles.hxx,v 1.13 2008-03-22 17:35:02 stephena Exp $ */ class Paddles : public Controller { @@ -61,6 +61,12 @@ class Paddles : public Controller */ static void setDigitalSpeed(int speed) { _PADDLE_SPEED = speed; } + /** + Sets the mouse to emulate the paddle 'number' in the X or Y + axis. X -> dir 0, Y -> dir 1 + */ + static void setMouseIsPaddle(int number, int dir = 0); + private: // Pre-compute the events we care about based on given port // This will eliminate test for left or right port in update() @@ -78,9 +84,13 @@ class Paddles : public Controller int myLastCharge[2]; int myLeftMotion[2]; - int myMouseBaseX, myMouseBaseY; - static int _PADDLE_SPEED; + static int _MOUSEX_PADDLE; + static int _MOUSEY_PADDLE; + + // Lookup table for associating paddle buttons with controller pins + // Yes, this is hideously complex + static const Controller::DigitalPin ourButtonPin[2]; }; #endif diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 4be76f5a5..79ef6b13e 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.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: Settings.cxx,v 1.134 2008-03-12 19:42:36 stephena Exp $ +// $Id: Settings.cxx,v 1.135 2008-03-22 17:35:02 stephena Exp $ //============================================================================ #include @@ -244,10 +244,6 @@ void Settings::validate() if(i < 1 || i > 10) setInternal("zoom_tia", "2"); - i = getInt("paddle"); - if(i < 0 || i > 3) - setInternal("paddle", "0"); - i = getInt("pspeed"); if(i < 1) setInternal("pspeed", "1"); @@ -310,7 +306,6 @@ void Settings::usage() #endif << " -cheat Use the specified cheatcode (see manual for description)\n" << " -showinfo <1|0> Shows some game info\n" - << " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n" << " -pspeed Speed of digital emulated paddle movement (1-15)\n" << " -sa1 Stelladaptor 1 emulates specified joystick port\n" << " -sa2 Stelladaptor 2 emulates specified joystick port\n" diff --git a/stella/src/gui/GameInfoDialog.cxx b/stella/src/gui/GameInfoDialog.cxx index 125bc1d0b..fe018bf32 100644 --- a/stella/src/gui/GameInfoDialog.cxx +++ b/stella/src/gui/GameInfoDialog.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: GameInfoDialog.cxx,v 1.50 2008-03-12 22:04:51 stephena Exp $ +// $Id: GameInfoDialog.cxx,v 1.51 2008-03-22 17:35:03 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -160,15 +160,6 @@ GameInfoDialog::GameInfoDialog( myTVType->appendEntry("B & W", 2); wid.push_back(myTVType); - ypos += lineHeight + 5; - new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, - "Swap ports:", kTextAlignLeft); - mySwapPorts = new PopUpWidget(myTab, font, xpos+lwidth, ypos, - pwidth, lineHeight, "", 0, 0); - mySwapPorts->appendEntry("Yes", 1); - mySwapPorts->appendEntry("No", 2); - wid.push_back(mySwapPorts); - // Add items for tab 1 addToFocusList(wid, tabID); @@ -178,24 +169,40 @@ GameInfoDialog::GameInfoDialog( tabID = myTab->addTab("Controller"); xpos = 10; ypos = vBorder; - lwidth = font.getStringWidth("Right Controller: "); + lwidth = font.getStringWidth("P0 Controller: "); pwidth = font.getStringWidth("Booster-Grip"); new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, - "Left Controller:", kTextAlignLeft); - myLeftController = new PopUpWidget(myTab, font, xpos+lwidth, ypos, - pwidth, lineHeight, "", 0, 0); + "P0 Controller:", kTextAlignLeft); + myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos, + pwidth, lineHeight, "", 0, 0); for(i = 0; i < 5; ++i) - myLeftController->appendEntry(ourControllerList[i][0], i+1); - wid.push_back(myLeftController); + myP0Controller->appendEntry(ourControllerList[i][0], i+1); + wid.push_back(myP0Controller); + + myLeftPort = + new PopUpWidget(myTab, font, xpos+lwidth+myP0Controller->getWidth()+4, ypos, + pwidth, lineHeight, "in ", font.getStringWidth("in "), + kLeftCChanged); + myLeftPort->appendEntry("left port", 1); + myLeftPort->appendEntry("right port", 2); + wid.push_back(myLeftPort); ypos += lineHeight + 5; new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, - "Right Controller:", kTextAlignLeft); - myRightController = new PopUpWidget(myTab, font, xpos+lwidth, ypos, - pwidth, lineHeight, "", 0, 0); + "P1 Controller:", kTextAlignLeft); + myP1Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos, + pwidth, lineHeight, "", 0, 0); for(i = 0; i < 5; ++i) - myRightController->appendEntry(ourControllerList[i][0], i+1); - wid.push_back(myRightController); + myP1Controller->appendEntry(ourControllerList[i][0], i+1); + wid.push_back(myP1Controller); + + myRightPort = + new PopUpWidget(myTab, font, xpos+lwidth+myP1Controller->getWidth()+4, ypos, + pwidth, lineHeight, "in ", font.getStringWidth("in "), + kRightCChanged); + myRightPort->appendEntry("left port", 1); + myRightPort->appendEntry("right port", 2); + wid.push_back(myRightPort); ypos += lineHeight + 5; pwidth = font.getStringWidth("Yes"); @@ -417,12 +424,8 @@ void GameInfoDialog::loadView() myTVType->setSelectedTag(0); s = myGameProperties.get(Console_SwapPorts); - if(s == "YES") - mySwapPorts->setSelectedTag(1); - else if(s == "NO") - mySwapPorts->setSelectedTag(2); - else - mySwapPorts->setSelectedTag(0); + myLeftPort->setSelectedTag(s == "NO" ? 1 : 2); + myRightPort->setSelectedTag(s == "NO" ? 2 : 1); // Controller properties s = myGameProperties.get(Controller_Left); @@ -432,7 +435,7 @@ void GameInfoDialog::loadView() break; } i = (i == 5) ? 0: i + 1; - myLeftController->setSelectedTag(i); + myP0Controller->setSelectedTag(i); s = myGameProperties.get(Controller_Right); for(i = 0; i < 5; ++i) @@ -441,7 +444,7 @@ void GameInfoDialog::loadView() break; } i = (i == 5) ? 0: i + 1; - myRightController->setSelectedTag(i); + myP1Controller->setSelectedTag(i); s = myGameProperties.get(Controller_SwapPaddles); if(s == "YES") @@ -557,12 +560,8 @@ void GameInfoDialog::saveConfig() s = (tag == 1) ? "Color" : "BlackAndWhite"; myGameProperties.set(Console_TelevisionType, s); - tag = mySwapPorts->getSelectedTag(); - s = (tag == 1) ? "Yes" : "No"; - myGameProperties.set(Console_SwapPorts, s); - // Controller properties - tag = myLeftController->getSelectedTag(); + tag = myP0Controller->getSelectedTag(); for(i = 0; i < 5; ++i) { if(i == tag-1) @@ -572,7 +571,7 @@ void GameInfoDialog::saveConfig() } } - tag = myRightController->getSelectedTag(); + tag = myP1Controller->getSelectedTag(); for(i = 0; i < 5; ++i) { if(i == tag-1) @@ -582,6 +581,10 @@ void GameInfoDialog::saveConfig() } } + tag = myLeftPort->getSelectedTag(); + s = (tag == 1) ? "No" : "Yes"; + myGameProperties.set(Console_SwapPorts, s); + tag = mySwapPaddles->getSelectedTag(); s = (tag == 1) ? "Yes" : "No"; myGameProperties.set(Controller_SwapPaddles, s); @@ -649,6 +652,16 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, setDefaults(); break; + case kLeftCChanged: + myRightPort->setSelectedTag( + myLeftPort->getSelectedTag() == 2 ? 1 : 2); + break; + + case kRightCChanged: + myLeftPort->setSelectedTag( + myRightPort->getSelectedTag() == 2 ? 1 : 2); + break; + case kPhosphorChanged: { bool status = myPhosphor->getSelectedTag() == 1 ? true : false; diff --git a/stella/src/gui/GameInfoDialog.hxx b/stella/src/gui/GameInfoDialog.hxx index e00f3f7da..f081dfa9f 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.29 2008-02-27 20:13:55 stephena Exp $ +// $Id: GameInfoDialog.hxx,v 1.30 2008-03-22 17:35:03 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -70,12 +70,13 @@ class GameInfoDialog : public Dialog, public CommandSender PopUpWidget* myLeftDiff; PopUpWidget* myRightDiff; PopUpWidget* myTVType; - PopUpWidget* mySwapPorts; // Controller properties - PopUpWidget* myLeftController; - PopUpWidget* myRightController; + PopUpWidget* myP0Controller; + PopUpWidget* myP1Controller; PopUpWidget* mySwapPaddles; + PopUpWidget* myLeftPort; + PopUpWidget* myRightPort; // Display properties PopUpWidget* myFormat; @@ -93,6 +94,8 @@ class GameInfoDialog : public Dialog, public CommandSender }; enum { + kLeftCChanged = 'LCch', + kRightCChanged = 'RCch', kPhosphorChanged = 'PPch', kPPBlendChanged = 'PBch', kNumCartTypes = 25, diff --git a/stella/src/gui/InputDialog.cxx b/stella/src/gui/InputDialog.cxx index 69f40fb40..24934cf92 100644 --- a/stella/src/gui/InputDialog.cxx +++ b/stella/src/gui/InputDialog.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: InputDialog.cxx,v 1.28 2008-03-02 20:48:51 stephena Exp $ +// $Id: InputDialog.cxx,v 1.29 2008-03-22 17:35:03 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -115,14 +115,14 @@ void InputDialog::addVDeviceTab(const GUI::Font& font) pwidth = font.getStringWidth("right virtual port"); myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, - "Stelladaptor 1 is: ", lwidth); + "Stelladaptor 1 is: ", lwidth, kLeftChanged); myLeftPort->appendEntry("left virtual port", 1); myLeftPort->appendEntry("right virtual port", 2); wid.push_back(myLeftPort); ypos += lineHeight + 5; myRightPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, - "Stelladaptor 2 is: ", lwidth); + "Stelladaptor 2 is: ", lwidth, kRightChanged); myRightPort->appendEntry("left virtual port", 1); myRightPort->appendEntry("right virtual port", 2); wid.push_back(myRightPort); @@ -168,8 +168,8 @@ void InputDialog::loadConfig() myRightPort->setSelectedTag(rport); // Paddle mode - myPaddleMode->setValue(instance()->settings().getInt("paddle")); - myPaddleModeLabel->setLabel(instance()->settings().getString("paddle")); + myPaddleMode->setValue(0); + myPaddleModeLabel->setLabel("0"); // Paddle speed myPaddleSpeed->setValue(instance()->settings().getInt("pspeed")); @@ -187,8 +187,7 @@ void InputDialog::saveConfig() instance()->eventHandler().mapStelladaptors(sa1, sa2); // Paddle mode - int mode = myPaddleMode->getValue(); - instance()->eventHandler().setPaddleMode(mode); + Paddles::setMouseIsPaddle(myPaddleMode->getValue()); // Paddle speed int speed = myPaddleSpeed->getValue(); @@ -260,6 +259,16 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, close(); break; + case kLeftChanged: + myRightPort->setSelectedTag( + myLeftPort->getSelectedTag() == 2 ? 1 : 2); + break; + + case kRightChanged: + myLeftPort->setSelectedTag( + myRightPort->getSelectedTag() == 2 ? 1 : 2); + break; + case kPaddleChanged: myPaddleModeLabel->setValue(myPaddleMode->getValue()); break; diff --git a/stella/src/gui/InputDialog.hxx b/stella/src/gui/InputDialog.hxx index adda0d0e2..accb93ab6 100644 --- a/stella/src/gui/InputDialog.hxx +++ b/stella/src/gui/InputDialog.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: InputDialog.hxx,v 1.15 2008-03-02 20:48:51 stephena Exp $ +// $Id: InputDialog.hxx,v 1.16 2008-03-22 17:35:03 stephena Exp $ //============================================================================ #ifndef INPUT_DIALOG_HXX @@ -53,6 +53,8 @@ class InputDialog : public Dialog private: enum { + kLeftChanged = 'LCch', + kRightChanged = 'RCch', kPaddleChanged = 'PDch', kPSpeedChanged = 'PSch' }; diff --git a/stella/src/gui/LauncherDialog.cxx b/stella/src/gui/LauncherDialog.cxx index 57c2b5425..3dc7a744d 100644 --- a/stella/src/gui/LauncherDialog.cxx +++ b/stella/src/gui/LauncherDialog.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: LauncherDialog.cxx,v 1.82 2008-03-15 19:10:57 stephena Exp $ +// $Id: LauncherDialog.cxx,v 1.83 2008-03-22 17:35:03 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -328,8 +328,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd, else if(!instance()->isValidRomName(rom, extension) || !instance()->createConsole(rom, md5)) { - // TODO - show messagebox that ROM couldn't be started - cerr << "Error: invalid ROM (name or file)\n"; + instance()->frameBuffer().showMessage("Not a valid ROM file", kMiddleCenter); } } break;