The 'usemouse' option now allows to use the mouse as a controller

only for analog-type devices (paddle, trackball, etc).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2819 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-08-24 18:40:02 +00:00
parent 646da290d6
commit ecacdcf5f2
9 changed files with 90 additions and 35 deletions

View File

@ -14,6 +14,15 @@
3.9.1 to 3.9.2: (August xx, 2013)
* Improved parsing of the DASM lst file for the debugger disassembly;
it sometimes missed constant declarations.
* Changed 'usemouse' argument from a true/false option to accept
'always', 'analog' and 'never'. This allows to use the mouse as a
controller under more specific circumstances. The default is
'analog', which means the mouse is only used to emulate analog-like
devices (paddles, trackball, etc).
* Added ability to use bold fonts within the debugger window, which can
be set with the 'dbg.boldfont' commandline argument as well as in the
debugger UI Settings dialog. This is useful for those that find the

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1984,8 +1984,10 @@
</tr>
<tr>
<td><pre>-usemouse &lt;1|0&gt;</pre></td>
<td>Use mouse as a controller as specified by ROM properties.</td>
<td><pre>-usemouse &lt;always|analog|never&gt;</pre></td>
<td>Use mouse as a controller as specified by ROM properties in specific case.
Always and never are self-explanatory, analog means only for analog-type devices
(paddles, trackball, etc).</td>
</tr>
<tr>
@ -2616,14 +2618,14 @@
<td valign="top">
<table border="1" cellpadding="4">
<tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">CommandLine</a></th></tr>
<tr><td>Stelladaptor X is</td><td>Specifies which virtual port each Stelladaptor/2600-daptor uses (See <b>Advanced Configuration - <a href="#Adaptor">Stelladaptor/2600-daptor Support</a></b>)</td><td>-saport</td></tr>
<tr><td>Stelladaptor port order</td><td>Specifies which virtual port each Stelladaptor/2600-daptor uses (See <b>Advanced Configuration - <a href="#Adaptor">Stelladaptor/2600-daptor Support</a></b>)</td><td>-saport</td></tr>
<tr><td>Use mouse as ...</td><td>Allow the mouse to emulate various controllers</td><td>-usemouse</td></tr>
<tr><td>AVox serial port</td><td>Described in further detail in <b>Advanced Configuration - <a href="#AtariVox">AtariVox/SaveKey Support</a></b> </td><td>-avoxport</td></tr>
<tr><td>Joy deadzone size</td><td>Deadzone area for axes on joysticks/gamepads</td><td>-joydeadzone</td></tr>
<tr><td>Digital paddle sensitivity</td><td>Sensitvity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
<tr><td>Digital paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
<tr><td>Mouse paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a mouse</td><td>-msense</td></tr>
<tr><td>Allow all 4 ...</td><td>Allow all 4 joystick directions to be pressed simultaneously</td><td>-joyallow4</td></tr>
<tr><td>Grab mouse ...</td><td>Keep mouse in window in emulation mode</td><td>-grabmouse</td></tr>
<tr><td>Use mouse as ...</td><td>Allow the mouse to emulate various controllers</td><td>-usemouse</td></tr>
</table>
</td>
</tr>
@ -2687,7 +2689,7 @@
<p><ol>
<li><p><b>Power-on options</b>: Selecting this option shows a dialog whereby
ROM properties can be temporarily overriden, and joystick/console buttons can be
ROM properties can be temporarily overridden, and joystick/console buttons can be
temporarily held down. Selecting options from this dialog will cause all ROMs launched
after that to use those properties you specify. Clicking <b>Defaults</b> will disable
its functionality, and use ROM properties as defined by the ROM itself. The dialog is as

View File

@ -2020,13 +2020,48 @@ void EventHandler::takeSnapshot(uInt32 number)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setMouseControllerMode(bool enable)
void EventHandler::setMouseControllerMode(const string& enable)
{
if(&myOSystem->console())
{
delete myMouseControl; myMouseControl = NULL;
const string& control = enable ?
bool usemouse = false;
if(BSPF_equalsIgnoreCase(enable, "always"))
usemouse = true;
else if(BSPF_equalsIgnoreCase(enable, "never"))
usemouse = false;
else // 'analog'
{
switch(myOSystem->console().controller(Controller::Left).type())
{
case Controller::Paddles:
case Controller::Driving:
case Controller::TrackBall22:
case Controller::TrackBall80:
case Controller::AmigaMouse:
case Controller::MindLink:
usemouse = true;
break;
default:
break;
}
switch(myOSystem->console().controller(Controller::Right).type())
{
case Controller::Paddles:
case Controller::Driving:
case Controller::TrackBall22:
case Controller::TrackBall80:
case Controller::AmigaMouse:
case Controller::MindLink:
usemouse = true;
break;
default:
break;
}
}
const string& control = usemouse ?
myOSystem->console().properties().get(Controller_MouseAxis) : "none";
myMouseControl = new MouseControl(myOSystem->console(), control);

View File

@ -161,8 +161,10 @@ class EventHandler
the ROM properties, otherwise disable mouse control completely
@param enable Whether to use the mouse to emulate controllers
Currently, this will be one of the following values:
'always', 'analog', 'never'
*/
void setMouseControllerMode(bool enable);
void setMouseControllerMode(const string& enable);
/**
Set the number of seconds between taking a snapshot in

View File

@ -522,7 +522,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
//////////////////////////////////////////////////////////////////////////
myConsole->initializeAudio();
myEventHandler->reset(EventHandler::S_EMULATE);
myEventHandler->setMouseControllerMode(mySettings->getBool("usemouse"));
myEventHandler->setMouseControllerMode(mySettings->getString("usemouse"));
if(createFrameBuffer() != kSuccess) // Takes care of initializeVideo()
{
logMessage("ERROR: Couldn't create framebuffer for console", 0);

View File

@ -88,7 +88,7 @@ Settings::Settings(OSystem* osystem)
setInternal("combomap", "");
setInternal("joydeadzone", "13");
setInternal("joyallow4", "false");
setInternal("usemouse", "true");
setInternal("usemouse", "analog");
setInternal("dsense", "5");
setInternal("msense", "7");
setInternal("saport", "lr");
@ -397,7 +397,9 @@ void Settings::usage()
<< " -logtoconsole <1|0> Log output to console/commandline\n"
<< " -joydeadzone <number> 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 as a controller as specified by ROM properties (see manual)\n"
<< " -usemouse <always|\n"
<< " analog|\n"
<< " never> Use mouse as a controller as specified by ROM properties in given mode(see manual)\n"
<< " -dsense <number> Sensitivity of digital emulated paddle movement (1-10)\n"
<< " -msense <number> Sensitivity of mouse emulated paddle movement (1-15)\n"
<< " -saport <lr|rl> How to assign virtual ports to multiple Stelladaptor/2600-daptors\n"

View File

@ -115,16 +115,26 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
// Stelladaptor mappings
xpos = 5; ypos = 5;
lwidth = font.getStringWidth("Stelladaptor port order: ");
pwidth = font.getStringWidth("left / right");
lwidth = font.getStringWidth("Use mouse as a controller: ");
pwidth = font.getStringWidth("Analog devices");
items.clear();
items.push_back("left / right", "lr");
items.push_back("right / left", "rl");
items.push_back("Left / Right", "lr");
items.push_back("Right / Left", "rl");
mySAPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
"Stelladaptor port order: ", lwidth);
wid.push_back(mySAPort);
// Use mouse as controller
ypos += lineHeight + 5;
items.clear();
items.push_back("Always", "always");
items.push_back("Analog devices", "analog");
items.push_back("Never", "never");
myMouseControl = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
"Use mouse as a controller: ", lwidth);
wid.push_back(myMouseControl);
// Add AtariVox serial port
ypos += lineHeight + 5;
lwidth = font.getStringWidth("AVox serial port: ");
@ -188,12 +198,6 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
myGrabMouse->clearFlags(WIDGET_ENABLED);
#endif
// Use mouse as a controller
ypos += lineHeight + 4;
myMouseControl = new CheckboxWidget(myTab, font, xpos, ypos,
"Use mouse as a controller");
wid.push_back(myMouseControl);
// Add items for virtual device ports
addToFocusList(wid, myTab, tabID);
}
@ -202,8 +206,11 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
void InputDialog::loadConfig()
{
// Left & right ports
const string& saport = instance().settings().getString("saport");
mySAPort->setSelectedIndex(BSPF_equalsIgnoreCase(saport, "rl") ? 1 : 0);
mySAPort->setSelected(instance().settings().getString("saport"), "lr");
// Use mouse as a controller
myMouseControl->setSelected(
instance().settings().getString("usemouse"), "analog");
// Joystick deadzone
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
@ -224,9 +231,6 @@ void InputDialog::loadConfig()
// Allow all 4 joystick directions
myAllowAll4->setState(instance().settings().getBool("joyallow4"));
// Use mouse as a controller
myMouseControl->setState(instance().settings().getBool("usemouse"));
myTab->loadConfig();
}
@ -236,6 +240,11 @@ void InputDialog::saveConfig()
// Left & right ports
instance().eventHandler().mapStelladaptors(mySAPort->getSelectedTag().toString());
// Use mouse as a controller
const string& usemouse = myMouseControl->getSelectedTag().toString();
instance().settings().setValue("usemouse", usemouse);
instance().eventHandler().setMouseControllerMode(usemouse);
// Joystick deadzone
int deadzone = myDeadzone->getValue();
instance().settings().setValue("joydeadzone", deadzone);
@ -260,11 +269,6 @@ void InputDialog::saveConfig()
bool allowall4 = myAllowAll4->getState();
instance().settings().setValue("joyallow4", allowall4);
instance().eventHandler().allowAllDirections(allowall4);
// Use mouse as a controller
bool usemouse = myMouseControl->getState();
instance().settings().setValue("usemouse", usemouse);
instance().eventHandler().setMouseControllerMode(usemouse);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -285,6 +289,9 @@ void InputDialog::setDefaults()
// Left & right ports
mySAPort->setSelected("lr");
// Use mouse as a controller
myMouseControl->setSelected("analog");
// Joystick deadzone
myDeadzone->setValue(0);
myDeadzoneLabel->setValue(3200);
@ -304,8 +311,6 @@ void InputDialog::setDefaults()
// Allow all 4 joystick directions
myAllowAll4->setState(false);
// Use mouse as a controller
myMouseControl->setState(true);
break;
}

View File

@ -67,6 +67,7 @@ class InputDialog : public Dialog
EventMappingWidget* myMenuEventMapper;
PopUpWidget* mySAPort;
PopUpWidget* myMouseControl;
EditTextWidget* myAVoxPort;
@ -78,7 +79,6 @@ class InputDialog : public Dialog
StaticTextWidget* myMPaddleLabel;
CheckboxWidget* myAllowAll4;
CheckboxWidget* myGrabMouse;
CheckboxWidget* myMouseControl;
};
#endif