diff --git a/Announce.txt b/Announce.txt index 08232fab0..9e3f088d8 100644 --- a/Announce.txt +++ b/Announce.txt @@ -9,7 +9,7 @@ SSSS ttt eeeee llll llll aaaaa =========================================================================== - Release 3.4.1 for Linux, MacOSX and Windows + Release 3.5 for Linux, MacOSX and Windows =========================================================================== The Atari 2600 Video Computer System (VCS), introduced in 1977, was the @@ -21,31 +21,31 @@ all of your favourite Atari 2600 games again! Stella was originally developed for Linux by Bradford W. Mott, however, it has been ported to a number of other platforms and is currently maintained by Stephen Anthony. -This is the 3.4.1 release of Stella for Linux, Mac OSX and Windows. The +This is the 3.5 release of Stella for Linux, Mac OSX and Windows. The distributions currently available are: * Binaries for Windows XP/Vista/7 : - Stella-3.4.1-win32.exe (32-bit EXE installer) - Stella-3.4.1-x64.exe (64-bit EXE installer) - Stella-3.4.1-windows.zip (32/64 bit versions) + Stella-3.5-win32.exe (32-bit EXE installer) + Stella-3.5-x64.exe (64-bit EXE installer) + Stella-3.5-windows.zip (32/64 bit versions) * Binaries for Windows 98/2000 : - Stella-3.4.1_98_2k-windows.zip (32-bit for Windows 98/2000) + Stella-3.5_98_2k-windows.zip (32-bit for Windows 98/2000) * Binary distribution for MacOSX 32-bit & 64-bit : - Stella-3.4.1-macosx.dmg (32-bit Universal Binary) - Stella-3.4.1_intel_10.6-macosx.dmg (32/64-bit Intel/Snow-Leopard only) + Stella-3.5-macosx.dmg (32-bit Universal Binary) + Stella-3.5_intel_10.6-macosx.dmg (32/64-bit Intel/Snow-Leopard only) * Binary distribution in 32-bit & 64-bit Ubuntu DEB format : - stella_3.4.1-1_i386.deb - stella_3.4.1-1_amd64.deb + stella_3.5-1_i386.deb + stella_3.5-1_amd64.deb * Binary distribution in 32-bit & 64-bit RPM format : - stella-3.4.1-2.i386.rpm - stella-3.4.1-2.x86_64.rpm + stella-3.5-2.i386.rpm + stella-3.5-2.x86_64.rpm * Source code distribution for all platforms : - stella-3.4.1-src.tar.gz + stella-3.5-src.tar.gz PLEASE DO NOT WRITE ASKING FOR ROM IMAGES TO USE WITH STELLA! ALL SUCH REQUESTS WILL BE IGNORED! diff --git a/Changes.txt b/Changes.txt index 6eb3727ca..7232cfc4e 100644 --- a/Changes.txt +++ b/Changes.txt @@ -12,7 +12,7 @@ Release History =========================================================================== -3.4.1 to 3.5: (December xx, 2011) +3.4.1 to 3.5: (December 31, 2011) * Added several improvements to the joystick management code. Joystick event mapping is now saved per device, meaning that if you map events @@ -27,6 +27,11 @@ mapping for joystick 0 would inadvertantly change settings for joystick 1, and could potentially lead to a program crash. + * Added 'mcontrol' commandline argument, which can specify to use each + mouse axis as a separate paddle. The old (and default) behaviour can + be activated by setting this argument to 'auto'. Related to this, + removed redundant 'usemouse' argument. + * Huge restructuring of the OpenGL code, making it compatible with OpenGL 2.x+ features (such as vertex buffer objects), while at the same time keeping compatibility with OpenGL 1.5 / OpenGL ES. diff --git a/Makefile b/Makefile index 971a00a32..5fe66b8f4 100644 --- a/Makefile +++ b/Makefile @@ -171,11 +171,7 @@ install: all $(INSTALL) -d "$(DESTDIR)$(DATADIR)/applications" $(INSTALL) -c -m 644 "$(srcdir)/src/unix/stella.desktop" "$(DESTDIR)$(DATADIR)/applications" $(INSTALL) -d "$(DESTDIR)$(DATADIR)/icons" - $(INSTALL) -d "$(DESTDIR)$(DATADIR)/icons/mini" - $(INSTALL) -d "$(DESTDIR)$(DATADIR)/icons/large" $(INSTALL) -c -m 644 "$(srcdir)/src/common/stella.png" "$(DESTDIR)$(DATADIR)/icons" - $(INSTALL) -c -m 644 "$(srcdir)/src/common/stella.png" "$(DESTDIR)$(DATADIR)/icons/mini" - $(INSTALL) -c -m 644 "$(srcdir)/src/common/stella.png" "$(DESTDIR)$(DATADIR)/icons/large" install-strip: install $(STRIP) stella$(EXEEXT) @@ -185,8 +181,6 @@ uninstall: rm -rf "$(DESTDIR)$(DOCDIR)/" rm -f "$(DESTDIR)$(DATADIR)/applications/stella.desktop" rm -f "$(DESTDIR)$(DATADIR)/icons/stella.png" - rm -f "$(DESTDIR)$(DATADIR)/icons/mini/stella.png" - rm -f "$(DESTDIR)$(DATADIR)/icons/large/stella.png" # Special rule for M6502.ins, generated from m4 (there's probably a better way to do this ...) src/emucore/M6502.ins: src/emucore/M6502.m4 diff --git a/Readme.txt b/Readme.txt index b3f3261fe..0c8cdeed1 100644 --- a/Readme.txt +++ b/Readme.txt @@ -1,4 +1,4 @@ -This is release 3.4.1 of Stella. Stella is a multi-platform Atari 2600 VCS +This is release 3.5 of Stella. Stella is a multi-platform Atari 2600 VCS emulator which allows you to play all of your favourite Atari 2600 games on your PC. You'll find the Stella Users Manual in the docs subdirectory. If you'd like to verify that you have the latest release of Stella visit @@ -9,4 +9,4 @@ the Stella Website at: Enjoy, The Stella Team -June 11, 2011 +December 31, 2011 diff --git a/Todo.txt b/Todo.txt index 6a743a19b..705cff73c 100644 --- a/Todo.txt +++ b/Todo.txt @@ -12,9 +12,7 @@ To Do List =========================================================================== -All Todo items are now available in the Stella tracker on AtariAge: +If you would like to contribute to Stella's development then feel free to +contact me by email: - http://www.atariage.com/forums/tracker/project-16-stella-emulator - -If you would like to contribute to Stella's development then find something -on the list above and email Stephen Anthony (stephena@users.sf.net). \ No newline at end of file + Stephen Anthony (stephena@users.sf.net). diff --git a/debian/changelog b/debian/changelog index d9f04551a..b2f274e72 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +stella (3.5-1) stable; urgency=high + + * Version 3.5 release + + -- Stephen Anthony Sat, 31 Dec 2011 18:38:25 +0200 + + stella (3.4.1-1) stable; urgency=high * Version 3.4.1 release diff --git a/docs/graphics/eventmapping.png b/docs/graphics/eventmapping.png index f982f9ec8..86d63670e 100644 Binary files a/docs/graphics/eventmapping.png and b/docs/graphics/eventmapping.png differ diff --git a/docs/graphics/eventmapping_devsports.png b/docs/graphics/eventmapping_devsports.png index 714bf1688..ed0aad8df 100644 Binary files a/docs/graphics/eventmapping_devsports.png and b/docs/graphics/eventmapping_devsports.png differ diff --git a/docs/graphics/eventmapping_remap.png b/docs/graphics/eventmapping_remap.png index 25e7bcf70..6cbb286ae 100644 Binary files a/docs/graphics/eventmapping_remap.png and b/docs/graphics/eventmapping_remap.png differ diff --git a/docs/graphics/options_input.png b/docs/graphics/options_input.png index 9cb4531e4..ac3333281 100644 Binary files a/docs/graphics/options_input.png and b/docs/graphics/options_input.png differ diff --git a/docs/index.html b/docs/index.html index 280303f37..74028d428 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1794,13 +1794,15 @@ -
-usemouse <1|0>
- Enable using the mouse for various controllers (paddle, driving, etc). +
-grabmouse <1|0>
+ Keeps the mouse in the game window in emulation mode. -
-grabmouse <1|0>
- Keeps the mouse in the game window in emulation mode. +
-mcontrol <auto|XY>
+ Enable using the mouse axes for various controllers automatically (paddle, driving, etc), + or specifically use each axis for a particular paddle. In the latter case, XY indicates + how to use the X/Y axis (ie, 02 is paddle0/paddle2, etc). @@ -2387,8 +2389,8 @@ Digital paddle sensitivitySensitvity used when emulating a paddle using a digital device-dsense Mouse paddle sensitivitySensitivity used when emulating a paddle using a mouse-msense Allow all 4 ...Allow all 4 joystick directions to be pressed simultaneously-joyallow4 - Use mouse as ...Use the mouse for various controllers (paddles, driving, etc)-usemouse Grab mouse ...Keep mouse in window in emulation mode-grabmouse + Use mouse as ...Mouse axes are either automatically or specifically mapped to certain actions-mcontrol diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 1ef3ea50e..06e15e4a2 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -122,6 +122,14 @@ template inline T BSPF_abs (T x) { return (x>=0) ? x : -x; } template inline T BSPF_min (T a, T b) { return (a inline T BSPF_max (T a, T b) { return (a>b) ? a : b; } +// Convert integer to string +inline string BSPF_toString(int num) +{ + ostringstream buf; + buf << num; + return buf.str(); +} + // Test whether two strings are equal (case insensitive) inline bool BSPF_equalsIgnoreCase(const string& s1, const string& s2) { diff --git a/src/emucore/Booster.cxx b/src/emucore/Booster.cxx index 06f729bb9..1b64228e7 100644 --- a/src/emucore/Booster.cxx +++ b/src/emucore/Booster.cxx @@ -22,7 +22,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::BoosterGrip) + : Controller(jack, event, system, Controller::BoosterGrip), + myControlID(-1) { if(myJack == Left) { @@ -97,8 +98,7 @@ void BoosterGrip::update() // Mouse motion and button events // Since there are 4 possible controller numbers, we use 0 & 2 // for the left jack, and 1 & 3 for the right jack - if((myJack == Left && !(ourControlNum & 0x1)) || - (myJack == Right && ourControlNum & 0x1)) + if(myControlID > -1) { // The following code was taken from z26 #define MJ_Threshold 2 @@ -127,3 +127,18 @@ void BoosterGrip::update() myDigitalPinState[Six] = false; } } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void BoosterGrip::setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID) +{ + // In 'automatic' mode, both axes on the mouse map to a single normal booster + if(xaxis == Controller::Automatic || yaxis == Controller::Automatic) + { + myControlID = ((myJack == Left && (ctrlID == 0 || ctrlID == 1)) || + (myJack == Right && (ctrlID == 2 || ctrlID == 3)) + ) ? ctrlID & 0x01 : -1; + } + else // Otherwise, boosters are not used in 'non-auto' mode + myControlID = -1; +} diff --git a/src/emucore/Booster.hxx b/src/emucore/Booster.hxx index 0696652f5..a9336582b 100644 --- a/src/emucore/Booster.hxx +++ b/src/emucore/Booster.hxx @@ -55,12 +55,34 @@ class BoosterGrip : public Controller */ void update(); + /** + Determines how this controller will treat values received from the + X and Y axis of the mouse. Since not all controllers use the mouse, + it's up to the specific class to decide how to use this data. + + If either of the axis is set to 'Automatic', then we automatically + use this number for the control type as follows: + 0 - paddle 0, joystick 0 (and controllers similar to a joystick) + 1 - paddle 1, joystick 1 (and controllers similar to a joystick) + 2 - paddle 2, joystick 0 (and controllers similar to a joystick) + 3 - paddle 3, joystick 1 (and controllers similar to a joystick) + + @param xaxis How the controller should use x-axis data + @param yaxis How the controller should use y-axis data + @param ctrlID The controller ID to use axis 'auto' mode + */ + void setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID = -1); + 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, myFireEvent, myBoosterEvent, myTriggerEvent, myXAxisValue, myYAxisValue; + + // Controller to emulate in mouse axis 'automatic' mode + int myControlID; }; #endif diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index fb2cadcb2..bf2029682 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -618,8 +618,6 @@ void Console::setControllers(const string& rommd5) // Also check if we should swap the paddles plugged into a jack bool swapPaddles = myProperties.get(Controller_SwapPaddles) == "YES"; - // Set default controller for mouse - Controller::setMouseIsController(0); // Construct left controller if(left == "BOOSTERGRIP") @@ -636,7 +634,6 @@ void Console::setControllers(const string& rommd5) } else if(BSPF_startsWithIgnoreCase(left, "PADDLES")) { - Controller::setMouseIsController(swapPaddles ? 1 : 0); bool swapAxis = false, swapDir = false; if(left == "PADDLES_IAXIS") swapAxis = true; diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx index 5e1788f54..3d815dd95 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -182,23 +182,12 @@ string Controller::about() const return name() + " in " + (myJack == Left ? "left port" : "right port"); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Controller::setMouseIsController(int number) -{ - ourControlNum = number; - if(ourControlNum < 0) ourControlNum = 0; - else if (ourControlNum > 3) ourControlNum = 3; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const Int32 Controller::maximumResistance = 0x7FFFFFFF; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const Int32 Controller::minimumResistance = 0x00000000; -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Int32 Controller::ourControlNum = 0; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Controller::Controller(const Controller& c) : myJack(c.myJack), diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 41798be14..241daf691 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -71,10 +71,17 @@ class Controller : public Serializable /** Enumeration of the controller jacks */ - enum Jack - { - Left, Right - }; + enum Jack { Left, Right }; + + /** + Enumeration of the digital pins of a controller port + */ + enum DigitalPin { One, Two, Three, Four, Six }; + + /** + Enumeration of the analog pins of a controller port + */ + enum AnalogPin { Five, Nine }; /** Enumeration of the controller types @@ -86,6 +93,15 @@ class Controller : public Serializable KidVid, Genesis }; + /** + Enumeration of mouse axis control types + */ + enum MouseAxisControl + { + Paddle0 = 0, Paddle1, Paddle2, Paddle3, + Automatic, NoControl + }; + public: /** Create a new controller plugged into the specified jack @@ -108,24 +124,6 @@ class Controller : public Serializable */ const Type type() const; - public: - /** - Enumeration of the digital pins of a controller port - */ - enum DigitalPin - { - One, Two, Three, Four, Six - }; - - /** - Enumeration of the analog pins of a controller port - */ - enum AnalogPin - { - Five, Nine - }; - - public: /** Read the value of the specified digital pin for this controller. @@ -162,10 +160,29 @@ class Controller : public Serializable /** Notification method invoked by the system right before the system resets its cycle counter to zero. It may be necessary - to override this method for devices that remember cycle counts. + to override this method for controllers that remember cycle counts. */ virtual void systemCyclesReset() { }; + /** + Determines how this controller will treat values received from the + X and Y axis of the mouse. Since not all controllers use the mouse, + it's up to the specific class to decide how to use this data. + + If either of the axis is set to 'Automatic', then we automatically + use this number for the control type as follows: + 0 - paddle 0, joystick 0 (and controllers similar to a joystick) + 1 - paddle 1, joystick 1 (and controllers similar to a joystick) + 2 - paddle 2, joystick 0 (and controllers similar to a joystick) + 3 - paddle 3, joystick 1 (and controllers similar to a joystick) + + @param xaxis How the controller should use x-axis data + @param yaxis How the controller should use y-axis data + @param ctrlID The controller ID to use axis 'auto' mode + */ + virtual void setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID = -1) { }; + /** Returns the name of this controller. */ @@ -192,17 +209,6 @@ class Controller : public Serializable */ bool load(Serializer& in); - /** - Sets the mouse to emulate controller number 'X'. Note that this - can accept values 0 to 3, since there can be up to four possible - controllers (when using paddles). In all other cases when only - two controllers are present, it's up to the specific class to - decide how to use this data. - - @param number The controller number (0, 1, 2, 3) - */ - static void setMouseIsController(int number); - public: /// Constant which represents maximum resistance for analog pins static const Int32 maximumResistance; @@ -232,9 +238,6 @@ class Controller : public Serializable /// The analog value on each analog pin Int32 myAnalogPinValue[2]; - /// The controller number - static Int32 ourControlNum; - protected: // Copy constructor isn't supported by controllers so make it private Controller(const Controller&); diff --git a/src/emucore/Driving.cxx b/src/emucore/Driving.cxx index 9345a2ffc..a6a53c2c9 100644 --- a/src/emucore/Driving.cxx +++ b/src/emucore/Driving.cxx @@ -25,7 +25,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Driving::Driving(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::Driving), - myCounter(0) + myCounter(0), + myControlID(-1) { if(myJack == Left) { @@ -72,8 +73,7 @@ void Driving::update() // Mouse motion and button events // Since there are 4 possible controller numbers, we use 0 & 2 // for the left jack, and 1 & 3 for the right jack - if((myJack == Left && !(ourControlNum & 0x1)) || - (myJack == Right && ourControlNum & 0x1)) + if(myControlID > -1) { int m_axis = myEvent.get(Event::MouseAxisXValue); if(m_axis < -2) myCounter--; @@ -112,3 +112,18 @@ void Driving::update() myDigitalPinState[One] = (gray & 0x1) != 0; myDigitalPinState[Two] = (gray & 0x2) != 0; } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Driving::setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID) +{ + // In 'automatic' mode, both axes on the mouse map to a single normal joystick + if(xaxis == Controller::Automatic || yaxis == Controller::Automatic) + { + myControlID = ((myJack == Left && (ctrlID == 0 || ctrlID == 1)) || + (myJack == Right && (ctrlID == 2 || ctrlID == 3)) + ) ? ctrlID & 0x01 : -1; + } + else // Otherwise, joysticks are not used in 'non-auto' mode + myControlID = -1; +} diff --git a/src/emucore/Driving.hxx b/src/emucore/Driving.hxx index fdee8893c..2ac1f80b9 100644 --- a/src/emucore/Driving.hxx +++ b/src/emucore/Driving.hxx @@ -55,6 +55,25 @@ class Driving : public Controller */ void update(); + /** + Determines how this controller will treat values received from the + X and Y axis of the mouse. Since not all controllers use the mouse, + it's up to the specific class to decide how to use this data. + + If either of the axis is set to 'Automatic', then we automatically + use this number for the control type as follows: + 0 - paddle 0, joystick 0 (and controllers similar to a joystick) + 1 - paddle 1, joystick 1 (and controllers similar to a joystick) + 2 - paddle 2, joystick 0 (and controllers similar to a joystick) + 3 - paddle 3, joystick 1 (and controllers similar to a joystick) + + @param xaxis How the controller should use x-axis data + @param yaxis How the controller should use y-axis data + @param ctrlID The controller ID to use axis 'auto' mode + */ + void setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID = -1); + private: // Counter to iterate through the gray codes uInt32 myCounter; @@ -70,6 +89,9 @@ class Driving : public Controller // This will eliminate test for left or right port in update() Event::Type myCWEvent, myCCWEvent, myFireEvent, myXAxisValue, myYAxisValue, myAxisMouseMotion; + + // Controller to emulate in mouse axis 'automatic' mode + int myControlID; }; #endif diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 11436efc8..433f79b04 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -125,7 +125,6 @@ void EventHandler::initialize() Joystick::setDeadZone(myOSystem->settings().getInt("joydeadzone")); Paddles::setDigitalSensitivity(myOSystem->settings().getInt("dsense")); Paddles::setMouseSensitivity(myOSystem->settings().getInt("msense")); - setMouseControllerMode(myOSystem->settings().getBool("usemouse") ? 0 : -1, false); // Set quick select delay when typing characters in listwidgets ListWidget::setQuickSelectDelay(myOSystem->settings().getInt("listdelay")); @@ -504,21 +503,21 @@ void EventHandler::poll(uInt64 time) { switch(int(key)) { - case SDLK_0: // Ctrl-0 sets the mouse to controller 0 - setMouseControllerMode(0, true); + case SDLK_0: // Ctrl-0 sets the mouse to paddle 0 + setMouseAsPaddle(0, "Mouse is paddle 0"); break; - case SDLK_1: // Ctrl-1 sets the mouse to controller 1 - setMouseControllerMode(1, true); + case SDLK_1: // Ctrl-1 sets the mouse to paddle 1 + setMouseAsPaddle(1, "Mouse is paddle 1"); break; - case SDLK_2: // Ctrl-2 sets the mouse to controller 2 - setMouseControllerMode(2, true); + case SDLK_2: // Ctrl-2 sets the mouse to paddle 2 + setMouseAsPaddle(2, "Mouse is paddle 2"); break; - case SDLK_3: // Ctrl-3 sets the mouse to controller 3 - setMouseControllerMode(3, true); - break; + case SDLK_3: // Ctrl-3 sets the mouse to paddle 3 + setMouseAsPaddle(3, "Mouse is paddle 3"); + break; case SDLK_f: // Ctrl-f toggles NTSC/PAL mode myOSystem->console().toggleFormat(); @@ -607,15 +606,12 @@ void EventHandler::poll(uInt64 time) // Determine which mode we're in, then send the event to the appropriate place if(myState == S_EMULATE) { - if(myMouseEnabled) + if(!mySkipMouseMotion) { - if(!mySkipMouseMotion) - { - myEvent->set(Event::MouseAxisXValue, event.motion.xrel); - myEvent->set(Event::MouseAxisYValue, event.motion.yrel); - } - mySkipMouseMotion = false; + myEvent->set(Event::MouseAxisXValue, event.motion.xrel); + myEvent->set(Event::MouseAxisYValue, event.motion.yrel); } + mySkipMouseMotion = false; } else if(myOverlay) myOverlay->handleMouseMotionEvent(event.motion.x, event.motion.y, 0); @@ -630,8 +626,7 @@ void EventHandler::poll(uInt64 time) // Determine which mode we're in, then send the event to the appropriate place if(myState == S_EMULATE) { - if(myMouseEnabled) - myEvent->set(Event::MouseButtonValue, state); + myEvent->set(Event::MouseButtonValue, state); } else if(myOverlay) { @@ -1924,21 +1919,52 @@ void EventHandler::takeSnapshot(uInt32 number) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::setMouseControllerMode(int num, bool showmessage) +void EventHandler::setMouseControllerMode(const string& mode, + const string& message) { - if(num >= 0 && num <= 3) + if(!&myOSystem->console()) + return; + + Controller& lc = myOSystem->console().controller(Controller::Left); + Controller& rc = myOSystem->console().controller(Controller::Right); + if(mode == "auto") { - myMouseEnabled = true; - Controller::setMouseIsController(num); - if(showmessage) - { - ostringstream buf; - buf << "Mouse is controller " << num; - myOSystem->frameBuffer().showMessage(buf.str()); - } + bool swap = myOSystem->console().properties().get(Controller_SwapPaddles) == "YES"; + lc.setMouseControl(Controller::Automatic, Controller::Automatic, swap ? 1 : 0); + rc.setMouseControl(Controller::Automatic, Controller::Automatic, swap ? 1 : 0); } else - myMouseEnabled = false; + { + Controller::MouseAxisControl xaxis = (Controller::MouseAxisControl) + ((int)mode[0] - '0'); + Controller::MouseAxisControl yaxis = (Controller::MouseAxisControl) + ((int)mode[1] - '0'); + + lc.setMouseControl(xaxis, yaxis); + rc.setMouseControl(xaxis, yaxis); + } + + if(message != "") + myOSystem->frameBuffer().showMessage(message); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void EventHandler::setMouseAsPaddle(int paddle, const string& message) +{ + if(myOSystem->settings().getString("mcontrol") == "auto") + { + myOSystem->console().controller(Controller::Left).setMouseControl( + Controller::Automatic, Controller::Automatic, paddle); + myOSystem->console().controller(Controller::Right).setMouseControl( + Controller::Automatic, Controller::Automatic, paddle); + + myOSystem->frameBuffer().showMessage(message); + } + else + { + myOSystem->frameBuffer().showMessage( + "Mouse axis mode not auto, paddle not changed"); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 95358a221..7f4e544a8 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -151,12 +151,13 @@ class EventHandler void quit() { handleEvent(Event::Quit, 1); } /** - Sets the mouse to act as controller 'num' + Sets the mouse axis to act as controller 'mode', where the mode is + defined from the Controller::MouseAxisControl enum - @param num The controller which the mouse should emulate - @param showmessage Print a message to the framebuffer + @param mode The controller which the mouse axes should emulate + @param message Print the (non-empty) message to the framebuffer */ - void setMouseControllerMode(int num, bool showmessage = false); + void setMouseControllerMode(const string& mode, const string& message = ""); /** Set the number of seconds between taking a snapshot in @@ -338,6 +339,7 @@ class EventHandler void saveKeyMapping(); void saveJoyMapping(); void saveComboMapping(); + void setMouseAsPaddle(int paddle, const string& message); /** Tests if a given event should use continuous/analog values. @@ -387,9 +389,6 @@ class EventHandler // Indicates the current state of the system (ie, which mode is current) State myState; - // Indicates whether the mouse is enabled for game controller actions - bool myMouseEnabled; - // Indicates whether the joystick emulates 'impossible' directions bool myAllowAllDirectionsFlag; diff --git a/src/emucore/Joystick.cxx b/src/emucore/Joystick.cxx index 90dc7ea52..ec20d6524 100644 --- a/src/emucore/Joystick.cxx +++ b/src/emucore/Joystick.cxx @@ -22,7 +22,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Joystick::Joystick(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::Joystick) + : Controller(jack, event, system, Controller::Joystick), + myControlID(-1) { if(myJack == Left) { @@ -89,8 +90,7 @@ void Joystick::update() // Mouse motion and button events // Since there are 4 possible controller numbers, we use 0 & 2 // for the left jack, and 1 & 3 for the right jack - if((myJack == Left && !(ourControlNum & 0x1)) || - (myJack == Right && ourControlNum & 0x1)) + if(myControlID > -1) { // The following code was taken from z26 #define MJ_Threshold 2 @@ -120,6 +120,21 @@ void Joystick::update() } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Joystick::setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID) +{ + // In 'automatic' mode, both axes on the mouse map to a single normal joystick + if(xaxis == Controller::Automatic || yaxis == Controller::Automatic) + { + myControlID = ((myJack == Left && (ctrlID == 0 || ctrlID == 1)) || + (myJack == Right && (ctrlID == 2 || ctrlID == 3)) + ) ? ctrlID & 0x01 : -1; + } + else // Otherwise, joysticks are not used in 'non-auto' mode + myControlID = -1; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Joystick::setDeadZone(int deadzone) { diff --git a/src/emucore/Joystick.hxx b/src/emucore/Joystick.hxx index 51fb9aad9..c96ef2355 100644 --- a/src/emucore/Joystick.hxx +++ b/src/emucore/Joystick.hxx @@ -54,6 +54,25 @@ class Joystick : public Controller */ void update(); + /** + Determines how this controller will treat values received from the + X and Y axis of the mouse. Since not all controllers use the mouse, + it's up to the specific class to decide how to use this data. + + If either of the axis is set to 'Automatic', then we automatically + use this number for the control type as follows: + 0 - paddle 0, joystick 0 (and controllers similar to a joystick) + 1 - paddle 1, joystick 1 (and controllers similar to a joystick) + 2 - paddle 2, joystick 0 (and controllers similar to a joystick) + 3 - paddle 3, joystick 1 (and controllers similar to a joystick) + + @param xaxis How the controller should use x-axis data + @param yaxis How the controller should use y-axis data + @param ctrlID The controller ID to use axis 'auto' mode + */ + void setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID = -1); + /** Sets the deadzone amount for real analog joysticks. Technically, this isn't really used by the Joystick class at all, @@ -68,6 +87,9 @@ class Joystick : public Controller Event::Type myUpEvent, myDownEvent, myLeftEvent, myRightEvent, myXAxisValue, myYAxisValue, myFireEvent; + // Controller to emulate in mouse axis 'automatic' mode + int myControlID; + static int _DEAD_ZONE; }; diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index b3035be9e..b0b5bf44f 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -521,6 +521,7 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum) ////////////////////////////////////////////////////////////////////////// myConsole->initializeAudio(); myEventHandler->reset(EventHandler::S_EMULATE); + myEventHandler->setMouseControllerMode(mySettings->getString("mcontrol")); if(createFrameBuffer() != kSuccess) // Takes care of initializeVideo() { logMessage("ERROR: Couldn't create framebuffer for console\n", 0); diff --git a/src/emucore/Paddles.cxx b/src/emucore/Paddles.cxx index 89fc169e7..29c303016 100644 --- a/src/emucore/Paddles.cxx +++ b/src/emucore/Paddles.cxx @@ -25,7 +25,10 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Paddles::Paddles(Jack jack, const Event& event, const System& system, bool swapport, bool swapaxis, bool swapdir) - : Controller(jack, event, system, Controller::Paddles) + : Controller(jack, event, system, Controller::Paddles), + myMPaddleID(-1), + myMPaddleIDX(-1), + myMPaddleIDY(-1) { // The following logic reflects that mapping paddles to different // devices can be extremely complex @@ -281,18 +284,40 @@ void Paddles::update() // Mouse motion events give relative movement // That is, they're only relevant if they're non-zero - if((myJack == Left && ourControlNum <= 1) || - (myJack == Right && ourControlNum > 1)) + if(myMPaddleID > -1) { - int num = ourControlNum & 0x01; - myCharge[num] -= + // We're in auto mode, where a single axis is used for one paddle only + myCharge[myMPaddleID] -= ((myEvent.get(myAxisMouseMotion) >> 1) * _MOUSE_SENSITIVITY); - if(myCharge[num] < TRIGMIN) - myCharge[num] = TRIGMIN; - if(myCharge[num] > TRIGMAX) - myCharge[num] = TRIGMAX; + if(myCharge[myMPaddleID] < TRIGMIN) + myCharge[myMPaddleID] = TRIGMIN; + if(myCharge[myMPaddleID] > TRIGMAX) + myCharge[myMPaddleID] = TRIGMAX; if(myEvent.get(Event::MouseButtonValue)) - myDigitalPinState[ourButtonPin[num]] = false; + myDigitalPinState[ourButtonPin[myMPaddleID]] = false; + } + else + { + // Test for 'untied' mouse axis mode, where each axis is potentially + // mapped to a separate paddle + if(myMPaddleIDX > -1) + { + myCharge[myMPaddleIDX] -= + ((myEvent.get(Event::MouseAxisXValue) >> 1) * _MOUSE_SENSITIVITY); + if(myCharge[myMPaddleIDX] < TRIGMIN) + myCharge[myMPaddleIDX] = TRIGMIN; + if(myCharge[myMPaddleIDX] > TRIGMAX) + myCharge[myMPaddleIDX] = TRIGMAX; + } + if(myMPaddleIDY > -1) + { + myCharge[myMPaddleIDY] -= + ((myEvent.get(Event::MouseAxisYValue) >> 1) * _MOUSE_SENSITIVITY); + if(myCharge[myMPaddleIDY] < TRIGMIN) + myCharge[myMPaddleIDY] = TRIGMIN; + if(myCharge[myMPaddleIDY] > TRIGMAX) + myCharge[myMPaddleIDY] = TRIGMAX; + } } // Finally, consider digital input, where movement happens @@ -350,6 +375,57 @@ void Paddles::update() myLastCharge[0] = myCharge[0]; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Paddles::setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID) +{ + // In 'automatic' mode, both axes on the mouse map to a single paddle + // This overrides any other mode + if(xaxis == Controller::Automatic || yaxis == Controller::Automatic) + { + myMPaddleID = ((myJack == Left && (ctrlID == 0 || ctrlID == 1)) || + (myJack == Right && (ctrlID == 2 || ctrlID == 3)) + ) ? ctrlID & 0x01 : -1; + myMPaddleIDX = myMPaddleIDY = -1; + } + else + { + // The following is somewhat complex, but we need to pre-process as much + // as possible, so that ::update() can run quickly + myMPaddleID = -1; + if(myJack == Left) + { + switch(xaxis) + { + case Controller::Paddle0: myMPaddleIDX = 0; break; + case Controller::Paddle1: myMPaddleIDX = 1; break; + default: myMPaddleIDX = -1; break; + } + switch(yaxis) + { + case Controller::Paddle0: myMPaddleIDY = 0; break; + case Controller::Paddle1: myMPaddleIDY = 1; break; + default: myMPaddleIDY = -1; break; + } + } + else // myJack == Right + { + switch(xaxis) + { + case Controller::Paddle2: myMPaddleIDX = 0; break; + case Controller::Paddle3: myMPaddleIDX = 1; break; + default: myMPaddleIDX = -1; break; + } + switch(yaxis) + { + case Controller::Paddle2: myMPaddleIDY = 0; break; + case Controller::Paddle3: myMPaddleIDY = 1; break; + default: myMPaddleIDY = -1; break; + } + } + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Paddles::setDigitalSensitivity(int sensitivity) { diff --git a/src/emucore/Paddles.hxx b/src/emucore/Paddles.hxx index ac2e47ddd..2381a0d2b 100644 --- a/src/emucore/Paddles.hxx +++ b/src/emucore/Paddles.hxx @@ -61,6 +61,25 @@ class Paddles : public Controller */ void update(); + /** + Determines how this controller will treat values received from the + X and Y axis of the mouse. Since not all controllers use the mouse, + it's up to the specific class to decide how to use this data. + + If either of the axis is set to 'Automatic', then we automatically + use this number for the control type as follows: + 0 - paddle 0, joystick 0 (and controllers similar to a joystick) + 1 - paddle 1, joystick 1 (and controllers similar to a joystick) + 2 - paddle 2, joystick 0 (and controllers similar to a joystick) + 3 - paddle 3, joystick 1 (and controllers similar to a joystick) + + @param xaxis How the controller should use x-axis data + @param yaxis How the controller should use y-axis data + @param ctrlID The controller ID to use axis 'auto' mode + */ + void setMouseControl( + MouseAxisControl xaxis, MouseAxisControl yaxis, int ctrlID = -1); + /** Sets the sensitivity for digital emulation of paddle movement. This is only used for *digital* events (ie, buttons or keys, @@ -98,6 +117,10 @@ class Paddles : public Controller myP0FireEvent1, myP0FireEvent2, myP1FireEvent1, myP1FireEvent2, myAxisMouseMotion; + // The following are used for the various mouse-axis modes + int myMPaddleID; // paddle to emulate in 'automatic' mode + int myMPaddleIDX, myMPaddleIDY; // paddles to emulate in 'specific axis' mode + bool myKeyRepeat0, myKeyRepeat1; int myPaddleRepeat0, myPaddleRepeat1; int myCharge[2], myLastCharge[2]; diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 284292200..f8bfd8b05 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -73,7 +73,7 @@ Settings::Settings(OSystem* osystem) setInternal("combomap", ""); setInternal("joydeadzone", "13"); setInternal("joyallow4", "false"); - setInternal("usemouse", "true"); + setInternal("mcontrol", "auto"); setInternal("dsense", "5"); setInternal("msense", "7"); setInternal("sa1", "left"); @@ -278,6 +278,16 @@ void Settings::validate() if(i < 0) setInternal("joydeadzone", "0"); else if(i > 29) setInternal("joydeadzone", "29"); + s = getString("mcontrol"); + if(s != "auto") + { + if(s.length() != 2 || s[0] < '0' || s[0] > '9' || s[1] < '0' || s[1] > '9') + setInternal("mcontrol", "auto"); + } + + if(i < 1) setInternal("dsense", "1"); + else if(i > 10) setInternal("dsense", "10"); + i = getInt("dsense"); if(i < 1) setInternal("dsense", "1"); else if(i > 10) setInternal("dsense", "10"); @@ -362,7 +372,7 @@ void Settings::usage() << " -logtoconsole <1|0> Log output to console/commandline\n" << " -joydeadzone Sets 'deadzone' area for analog joysticks (0-29)\n" << " -joyallow4 <1|0> Allow all 4 directions on a joystick to be pressed simultaneously\n" - << " -usemouse <1|0> Use mouse for various controllers (paddle, driving, etc)\n" + << " -mcontrol Use mouse axes as specified paddle controller type (see manual)\n" << " -dsense Sensitivity of digital emulated paddle movement (1-10)\n" << " -msense Sensitivity of mouse emulated paddle movement (1-15)\n" << " -sa1 Stelladaptor 1 emulates specified joystick port\n" diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 4cf6551ba..750e63bf3 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -50,7 +50,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent, // Set real dimensions _w = BSPF_min(50 * fontWidth + 10, max_w); - _h = BSPF_min(13 * (lineHeight + 4) + 10, max_h); + _h = BSPF_min(14 * (lineHeight + 4) + 14, max_h); // The tab widget xpos = 2; ypos = vBorder; @@ -117,27 +117,22 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) // Stelladaptor mappings xpos = 5; ypos = 5; - lwidth = font.getStringWidth("Stelladaptor 2 is: "); - pwidth = font.getStringWidth("right virtual port"); + lwidth = font.getStringWidth("Stelladaptor port order: "); + pwidth = font.getStringWidth("left / right"); items.clear(); - items.push_back("left virtual port", "left"); - items.push_back("right virtual port", "right"); - myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, - "Stelladaptor 1 is: ", lwidth, kLeftChanged); - wid.push_back(myLeftPort); - - ypos += lineHeight + 5; - // ... use items from above - myRightPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, - "Stelladaptor 2 is: ", lwidth, kRightChanged); - wid.push_back(myRightPort); + items.push_back("left / right", "leftright"); + items.push_back("right / left", "rightleft"); + mySAPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, + "Stelladaptor port order: ", lwidth); + wid.push_back(mySAPort); // Add AtariVox serial port - xpos = 5; ypos += 2*lineHeight; + ypos += lineHeight + 5; + lwidth = font.getStringWidth("AVox serial port: "); int fwidth = _w - xpos - lwidth - 20; new StaticTextWidget(myTab, font, xpos, ypos, lwidth, fontHeight, - "AVox serial port:", kTextAlignLeft); + "AVox serial port: ", kTextAlignLeft); myAVoxPort = new EditTextWidget(myTab, font, xpos+lwidth, ypos, fwidth, fontHeight, ""); wid.push_back(myAVoxPort); @@ -146,7 +141,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) pwidth = font.getMaxCharWidth() * 8; // Add joystick deadzone setting - ypos += lineHeight + 5; + ypos += lineHeight + 8; myDeadzone = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Joystick deadzone size: ", lwidth, kDeadzoneChanged); myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29); @@ -157,7 +152,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) wid.push_back(myDeadzone); // Add paddle speed (digital emulation) - xpos = 5; ypos += lineHeight + 3; + xpos = 5; ypos += lineHeight + 4; myDPaddleSpeed = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Digital paddle sensitivity: ", lwidth, kDPSpeedChanged); @@ -169,7 +164,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) wid.push_back(myDPaddleSpeed); // Add paddle speed (mouse emulation) - xpos = 5; ypos += lineHeight + 3; + xpos = 5; ypos += lineHeight + 4; myMPaddleSpeed = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Mouse paddle sensitivity: ", lwidth, kMPSpeedChanged); @@ -181,26 +176,52 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) wid.push_back(myMPaddleSpeed); // Add 'allow all 4 directions' for joystick - xpos = 10; ypos += 2*lineHeight; + xpos = 10; ypos += lineHeight + 8; 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); - // Grab mouse (in windowed mode) ypos += lineHeight + 4; myGrabMouse = new CheckboxWidget(myTab, font, xpos, ypos, "Grab mouse in emulation mode"); wid.push_back(myGrabMouse); #ifndef WINDOWED_SUPPORT - myGrabMouse->clearFlags(WIDGET_ENABLED); + myGrabMouse->clearFlags(WIDGET_ENABLED); #endif + // Mouse is controller type + ypos += lineHeight + 8; + lwidth = font.getStringWidth("Use mouse as a controller: "); + pwidth = font.getStringWidth("Specific axis"); + items.clear(); + items.push_back("Automatic", "auto"); + items.push_back("Specific axis", "paddle"); + myMouseControl = + new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, + "Use mouse as a controller: ", lwidth, kMPCtrlChanged); + wid.push_back(myMouseControl); + + // Mouse controller specific axis + lwidth = font.getStringWidth("X-Axis is: "); + pwidth = font.getStringWidth("Paddle 3"); + items.clear(); + items.push_back("not used", BSPF_toString(Controller::NoControl)); + items.push_back("Paddle 0", BSPF_toString(Controller::Paddle0)); + items.push_back("Paddle 1", BSPF_toString(Controller::Paddle1)); + items.push_back("Paddle 2", BSPF_toString(Controller::Paddle2)); + items.push_back("Paddle 3", BSPF_toString(Controller::Paddle3)); + + xpos = 45; ypos += lineHeight + 4; + myMouseX = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, + "X-Axis is: ", lwidth); + wid.push_back(myMouseX); + + ypos += lineHeight + 4; + myMouseY = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, + "Y-Axis is: ", lwidth); + wid.push_back(myMouseY); + // Add items for virtual device ports addToFocusList(wid, tabID); } @@ -210,19 +231,13 @@ void InputDialog::loadConfig() { // Left & right ports const string& sa1 = instance().settings().getString("sa1"); - int lport = sa1 == "right" ? 1 : 0; - myLeftPort->setSelected(lport); - const string& sa2 = instance().settings().getString("sa2"); - int rport = sa2 == "right" ? 1 : 0; - myRightPort->setSelected(rport); + int portorder = sa1 == "right" ? 1 : 0; + mySAPort->setSelected(portorder); // Joystick deadzone myDeadzone->setValue(instance().settings().getInt("joydeadzone")); myDeadzoneLabel->setValue(Joystick::deadzone()); - // Mouse/paddle enabled - myMouseEnabled->setState(instance().settings().getBool("usemouse")); - // Grab mouse myGrabMouse->setState(instance().settings().getBool("grabmouse")); @@ -238,6 +253,24 @@ void InputDialog::loadConfig() // Allow all 4 joystick directions myAllowAll4->setState(instance().settings().getBool("joyallow4")); + // Mouse is controller type + const string& mcontrol = instance().settings().getString("mcontrol"); + bool autoAxis = mcontrol == "auto"; + if(autoAxis) + { + myMouseControl->setSelected(0); + myMouseX->setSelected(0); + myMouseY->setSelected(0); + } + else + { + myMouseControl->setSelected(1); + myMouseX->setSelected(BSPF_toString(mcontrol[0] - '0'), ""); + myMouseY->setSelected(BSPF_toString(mcontrol[1] - '0'), ""); + } + myMouseX->setEnabled(!autoAxis); + myMouseY->setEnabled(!autoAxis); + myTab->loadConfig(); } @@ -245,20 +278,17 @@ void InputDialog::loadConfig() void InputDialog::saveConfig() { // Left & right ports - const string& sa1 = myLeftPort->getSelectedTag(); - const string& sa2 = myRightPort->getSelectedTag(); - instance().eventHandler().mapStelladaptors(sa1, sa2); + int sa_order = mySAPort->getSelected(); + if(sa_order == 0) + instance().eventHandler().mapStelladaptors("left", "right"); + else + instance().eventHandler().mapStelladaptors("right", "left"); // Joystick deadzone int deadzone = myDeadzone->getValue(); instance().settings().setInt("joydeadzone", deadzone); Joystick::setDeadZone(deadzone); - // Mouse/paddle enabled - bool usemouse = myMouseEnabled->getState(); - instance().settings().setBool("usemouse", usemouse); - instance().eventHandler().setMouseControllerMode(usemouse ? 0 : -1); - // Grab mouse instance().settings().setBool("grabmouse", myGrabMouse->getState()); instance().frameBuffer().setCursorState(); @@ -278,6 +308,13 @@ void InputDialog::saveConfig() bool allowall4 = myAllowAll4->getState(); instance().settings().setBool("joyallow4", allowall4); instance().eventHandler().allowAllDirections(allowall4); + + // Mouse is controller type + string mcontrol = myMouseControl->getSelectedTag(); + if(mcontrol != "auto") + mcontrol = myMouseX->getSelectedTag() + myMouseY->getSelectedTag(); + instance().settings().setString("mcontrol", mcontrol); + instance().eventHandler().setMouseControllerMode(mcontrol); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -296,16 +333,12 @@ void InputDialog::setDefaults() case 2: // Virtual devices { // Left & right ports - myLeftPort->setSelected("left", "left"); - myRightPort->setSelected("right", "right"); + mySAPort->setSelected("leftright", "leftright"); // Joystick deadzone myDeadzone->setValue(0); myDeadzoneLabel->setValue(3200); - // Mouse/paddle enabled - myMouseEnabled->setState(true); - // Grab mouse myGrabMouse->setState(true); @@ -320,6 +353,13 @@ void InputDialog::setDefaults() // Allow all 4 joystick directions myAllowAll4->setState(false); + + // Mouse is controller type + myMouseControl->setSelected(0); + myMouseX->setSelected(0); + myMouseY->setSelected(0); + myMouseX->setEnabled(false); + myMouseY->setEnabled(false); break; } @@ -398,16 +438,6 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, setDefaults(); break; - case kLeftChanged: - myRightPort->setSelected( - myLeftPort->getSelected() == 1 ? 0 : 1); - break; - - case kRightChanged: - myLeftPort->setSelected( - myRightPort->getSelected() == 1 ? 0 : 1); - break; - case kDeadzoneChanged: myDeadzoneLabel->setValue(3200 + 1000*myDeadzone->getValue()); break; @@ -420,6 +450,14 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, myMPaddleLabel->setValue(myMPaddleSpeed->getValue()); break; + case kMPCtrlChanged: + { + bool state = myMouseControl->getSelectedTag() != "auto"; + myMouseX->setEnabled(state); + myMouseY->setEnabled(state); + break; + } + default: Dialog::handleCommand(sender, cmd, data, 0); } diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index 65280f5b0..9da272036 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -56,11 +56,10 @@ class InputDialog : public Dialog private: enum { - kLeftChanged = 'LCch', - kRightChanged = 'RCch', kDeadzoneChanged = 'DZch', kDPSpeedChanged = 'PDch', - kMPSpeedChanged = 'PMch' + kMPSpeedChanged = 'PMch', + kMPCtrlChanged = 'PMcl' }; TabWidget* myTab; @@ -68,8 +67,7 @@ class InputDialog : public Dialog EventMappingWidget* myEmulEventMapper; EventMappingWidget* myMenuEventMapper; - PopUpWidget* myLeftPort; - PopUpWidget* myRightPort; + PopUpWidget* mySAPort; EditTextWidget* myAVoxPort; @@ -80,8 +78,10 @@ class InputDialog : public Dialog StaticTextWidget* myDPaddleLabel; StaticTextWidget* myMPaddleLabel; CheckboxWidget* myAllowAll4; - CheckboxWidget* myMouseEnabled; CheckboxWidget* myGrabMouse; + PopUpWidget* myMouseControl; + PopUpWidget* myMouseX; + PopUpWidget* myMouseY; }; #endif diff --git a/src/macosx/Info-Stella.plist b/src/macosx/Info-Stella.plist index 87f4bd8ac..232b1c1e8 100644 --- a/src/macosx/Info-Stella.plist +++ b/src/macosx/Info-Stella.plist @@ -53,7 +53,7 @@ CFBundleSignature StLa CFBundleVersion - 3.4.1 + 3.5 NSMainNibFile SDLMain.nib NSPrincipalClass diff --git a/src/unix/stella.SlackBuild b/src/unix/stella.SlackBuild index b7ece141e..02db5da0a 100644 --- a/src/unix/stella.SlackBuild +++ b/src/unix/stella.SlackBuild @@ -13,7 +13,7 @@ die() { exit 1 } -VERSION=3.4.1 +VERSION=3.5 ARCH=${ARCH-i486} BUILD=1 diff --git a/src/unix/stella.spec b/src/unix/stella.spec index 20f6df95e..e33a05909 100644 --- a/src/unix/stella.spec +++ b/src/unix/stella.spec @@ -1,5 +1,5 @@ %define name stella -%define version 3.4.1 +%define version 3.5 %define rel 1 %define enable_gl 1 @@ -108,6 +108,9 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} %_datadir/icons/large/%{name}.png %changelog +* Sat Dec 31 2011 Stephen Anthony 3.5-1 +- Version 3.5 release + * Sat Jun 11 2011 Stephen Anthony 3.4.1-1 - Version 3.4.1 release diff --git a/src/win32/stella.rc b/src/win32/stella.rc index 312035a9b..77c57b519 100755 --- a/src/win32/stella.rc +++ b/src/win32/stella.rc @@ -36,8 +36,8 @@ IDI_ICON ICON "stella.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,4,1,0 - PRODUCTVERSION 3,4,1,0 + FILEVERSION 3,5,0,0 + PRODUCTVERSION 3,5,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -55,12 +55,12 @@ BEGIN VALUE "Comments", "The multi-platform Atari 2600 emulator. Stella is released under the GPLv2." VALUE "CompanyName", "The Stella Team (http://stella.sourceforge.net)" VALUE "FileDescription", "Stella" - VALUE "FileVersion", "3.4.1" + VALUE "FileVersion", "3.5" VALUE "InternalName", "Stella" VALUE "LegalCopyright", "Copyright (C) 1995-2011 The Stella Team" VALUE "OriginalFilename", "Stella.exe" VALUE "ProductName", "Stella" - VALUE "ProductVersion", "3.4.1" + VALUE "ProductVersion", "3.5" END END BLOCK "VarFileInfo"