mirror of https://github.com/stella-emu/stella.git
Added ability to specify MouseAxis range from the UI, and send it to
the Paddles class to be actually used. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3250 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
a85debea63
commit
b9d71634a7
|
@ -27,6 +27,10 @@
|
|||
loading a ROM would always point to the last opened ROM, not to the one
|
||||
currently selected.
|
||||
|
||||
* Fixed bug in storing ROM properties; in some cases, a copy of the
|
||||
ROM properties was being stored in the external file when it was
|
||||
exactly the same as the internal entry.
|
||||
|
||||
* Added more C++11 updates all over the codebase, and ran Stella
|
||||
through Coverity for the first time. I'm proud to say that Stella
|
||||
now has a 0.00 defect rate!
|
||||
|
|
|
@ -3330,7 +3330,10 @@ Ms Pac-Man (Stella extended codes):
|
|||
<tr><td>5 </td><td>Driving 1</td></tr>
|
||||
<tr><td>6 </td><td>MindLink 0</td></tr>
|
||||
<tr><td>7 </td><td>MindLink 1</td></tr>
|
||||
</table></td>
|
||||
</table>
|
||||
An <I>optional</I> second parameter (default of 100) indicates how much
|
||||
of the paddle range that the mouse should emulate.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "Console.hxx"
|
||||
#include "Control.hxx"
|
||||
#include "Paddles.hxx"
|
||||
#include "Props.hxx"
|
||||
|
||||
#include "MouseControl.hxx"
|
||||
|
@ -30,17 +31,21 @@ MouseControl::MouseControl(Console& console, const string& mode)
|
|||
myRightController(console.rightController()),
|
||||
myCurrentModeNum(0)
|
||||
{
|
||||
if(BSPF_equalsIgnoreCase(mode, "none"))
|
||||
istringstream m_axis(mode);
|
||||
string m_mode;
|
||||
m_axis >> m_mode;
|
||||
|
||||
if(BSPF_equalsIgnoreCase(m_mode, "none"))
|
||||
{
|
||||
myModeList.push_back(MouseMode("Mouse input is disabled"));
|
||||
return;
|
||||
}
|
||||
else if(!BSPF_equalsIgnoreCase(mode, "auto") && mode.length() == 2 &&
|
||||
mode[0] >= '0' && mode[0] <= '8' &&
|
||||
mode[1] >= '0' && mode[1] <= '8')
|
||||
else if(!BSPF_equalsIgnoreCase(m_mode, "auto") && m_mode.length() == 2 &&
|
||||
m_mode[0] >= '0' && m_mode[0] <= '8' &&
|
||||
m_mode[1] >= '0' && m_mode[1] <= '8')
|
||||
{
|
||||
Axis xaxis = Axis(int(mode[0]) - '0');
|
||||
Axis yaxis = Axis(int(mode[1]) - '0');
|
||||
Axis xaxis = Axis(int(m_mode[0]) - '0');
|
||||
Axis yaxis = Axis(int(m_mode[1]) - '0');
|
||||
ostringstream msg;
|
||||
msg << "Mouse X-axis is ";
|
||||
Controller::Type xtype = Controller::Joystick, ytype = Controller::Joystick;
|
||||
|
@ -155,6 +160,13 @@ MouseControl::MouseControl(Console& console, const string& mode)
|
|||
addLeftControllerModes(noswap);
|
||||
}
|
||||
|
||||
// Set range information (currently only for paddles, but may be used
|
||||
// for other controllers in the future)
|
||||
int m_range = 100;
|
||||
if(!(m_axis >> m_range))
|
||||
m_range = 100;
|
||||
Paddles::setPaddleRange(m_range);
|
||||
|
||||
// If the mouse isn't used at all, we still need one item in the list
|
||||
if(myModeList.size() == 0)
|
||||
myModeList.push_back(MouseMode("Mouse not used for current controllers"));
|
||||
|
|
|
@ -248,7 +248,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
lwidth = font.getStringWidth("Mouse axis mode: ");
|
||||
pwidth = font.getStringWidth("Specific axis");
|
||||
items.clear();
|
||||
VarList::push_back(items, "Automatic", "auto");
|
||||
VarList::push_back(items, "Automatic", "AUTO");
|
||||
VarList::push_back(items, "Specific axis", "specific");
|
||||
myMouseControl =
|
||||
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
|
||||
|
@ -279,6 +279,18 @@ GameInfoDialog::GameInfoDialog(
|
|||
"Y-Axis is: ", lwidth);
|
||||
wid.push_back(myMouseY);
|
||||
|
||||
xpos = 10; ypos += lineHeight + 8;
|
||||
lwidth = font.getStringWidth("Mouse axis range: ");
|
||||
myMouseRange = new SliderWidget(myTab, font, xpos, ypos, 8*fontWidth, lineHeight,
|
||||
"Mouse axis range: ", lwidth, kMRangeChanged);
|
||||
myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100);
|
||||
wid.push_back(myMouseRange);
|
||||
|
||||
myMouseRangeLabel = new StaticTextWidget(myTab, font,
|
||||
xpos + myMouseRange->getWidth() + 4, ypos+1,
|
||||
3*fontWidth, fontHeight, "", kTextAlignLeft);
|
||||
myMouseRangeLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
// Add items for tab 2
|
||||
addToFocusList(wid, myTab, tabID);
|
||||
|
||||
|
@ -337,7 +349,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
wid.push_back(myPPBlend);
|
||||
|
||||
myPPBlendLabel = new StaticTextWidget(myTab, font,
|
||||
xpos + lwidth + myPhosphor->getWidth() + 10 + \
|
||||
xpos + lwidth + myPhosphor->getWidth() + 10 +
|
||||
myPPBlend->getWidth() + 4, ypos+1,
|
||||
3*fontWidth, fontHeight, "", kTextAlignLeft);
|
||||
myPPBlendLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
@ -419,8 +431,12 @@ void GameInfoDialog::loadView()
|
|||
myP0Controller->setSelected(myGameProperties.get(Controller_Left), "JOYSTICK");
|
||||
myP1Controller->setSelected(myGameProperties.get(Controller_Right), "JOYSTICK");
|
||||
mySwapPaddles->setSelected(myGameProperties.get(Controller_SwapPaddles), "NO");
|
||||
const string& mcontrol = myGameProperties.get(Controller_MouseAxis);
|
||||
bool autoAxis = BSPF_equalsIgnoreCase(mcontrol, "auto");
|
||||
|
||||
// MouseAxis property (potentially contains 'range' information)
|
||||
istringstream m_axis(myGameProperties.get(Controller_MouseAxis));
|
||||
string m_control, m_range;
|
||||
m_axis >> m_control;
|
||||
bool autoAxis = BSPF_equalsIgnoreCase(m_control, "AUTO");
|
||||
if(autoAxis)
|
||||
{
|
||||
myMouseControl->setSelectedIndex(0);
|
||||
|
@ -430,11 +446,21 @@ void GameInfoDialog::loadView()
|
|||
else
|
||||
{
|
||||
myMouseControl->setSelectedIndex(1);
|
||||
myMouseX->setSelected(mcontrol[0] - '0');
|
||||
myMouseY->setSelected(mcontrol[1] - '0');
|
||||
myMouseX->setSelected(m_control[0] - '0');
|
||||
myMouseY->setSelected(m_control[1] - '0');
|
||||
}
|
||||
myMouseX->setEnabled(!autoAxis);
|
||||
myMouseY->setEnabled(!autoAxis);
|
||||
if(m_axis >> m_range)
|
||||
{
|
||||
myMouseRange->setValue(atoi(m_range.c_str()));
|
||||
myMouseRangeLabel->setLabel(m_range);
|
||||
}
|
||||
else
|
||||
{
|
||||
myMouseRange->setValue(100);
|
||||
myMouseRangeLabel->setLabel("100");
|
||||
}
|
||||
|
||||
// Display properties
|
||||
myFormat->setSelected(myGameProperties.get(Display_Format), "AUTO");
|
||||
|
@ -479,10 +505,15 @@ void GameInfoDialog::saveConfig()
|
|||
myGameProperties.set(Console_SwapPorts,
|
||||
myLeftPort->getSelectedTag().toString() == "L" ? "NO" : "YES");
|
||||
myGameProperties.set(Controller_SwapPaddles, mySwapPaddles->getSelectedTag().toString());
|
||||
|
||||
// MouseAxis property (potentially contains 'range' information)
|
||||
string mcontrol = myMouseControl->getSelectedTag().toString();
|
||||
if(mcontrol != "auto")
|
||||
if(mcontrol != "AUTO")
|
||||
mcontrol = myMouseX->getSelectedTag().toString() +
|
||||
myMouseY->getSelectedTag().toString();
|
||||
string range = myMouseRangeLabel->getLabel();
|
||||
if(range != "100")
|
||||
mcontrol += " " + range;
|
||||
myGameProperties.set(Controller_MouseAxis, mcontrol);
|
||||
|
||||
// Display properties
|
||||
|
@ -498,10 +529,9 @@ void GameInfoDialog::saveConfig()
|
|||
else
|
||||
instance().propSet().insert(myGameProperties);
|
||||
|
||||
// In any event, inform the Console and save the properties
|
||||
// In any event, inform the Console
|
||||
if(instance().hasConsole())
|
||||
instance().console().setProperties(myGameProperties);
|
||||
instance().propSet().save(instance().propertiesFile());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -553,6 +583,10 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
myPPBlendLabel->setValue(myPPBlend->getValue());
|
||||
break;
|
||||
|
||||
case kMRangeChanged:
|
||||
myMouseRangeLabel->setValue(myMouseRange->getValue());
|
||||
break;
|
||||
|
||||
case kMCtrlChanged:
|
||||
{
|
||||
bool state = myMouseControl->getSelectedTag().toString() != "auto";
|
||||
|
|
|
@ -66,14 +66,16 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
PopUpWidget* myTVType;
|
||||
|
||||
// Controller properties
|
||||
PopUpWidget* myP0Controller;
|
||||
PopUpWidget* myP1Controller;
|
||||
PopUpWidget* mySwapPaddles;
|
||||
PopUpWidget* myLeftPort;
|
||||
PopUpWidget* myRightPort;
|
||||
PopUpWidget* myMouseControl;
|
||||
PopUpWidget* myMouseX;
|
||||
PopUpWidget* myMouseY;
|
||||
PopUpWidget* myP0Controller;
|
||||
PopUpWidget* myP1Controller;
|
||||
PopUpWidget* mySwapPaddles;
|
||||
PopUpWidget* myLeftPort;
|
||||
PopUpWidget* myRightPort;
|
||||
PopUpWidget* myMouseControl;
|
||||
PopUpWidget* myMouseX;
|
||||
PopUpWidget* myMouseY;
|
||||
SliderWidget* myMouseRange;
|
||||
StaticTextWidget* myMouseRangeLabel;
|
||||
|
||||
// Display properties
|
||||
PopUpWidget* myFormat;
|
||||
|
@ -86,6 +88,7 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
enum {
|
||||
kLeftCChanged = 'LCch',
|
||||
kRightCChanged = 'RCch',
|
||||
kMRangeChanged = 'MRch',
|
||||
kPhosphorChanged = 'PPch',
|
||||
kPPBlendChanged = 'PBch',
|
||||
kMCtrlChanged = 'MCch'
|
||||
|
|
Loading…
Reference in New Issue