mirror of https://github.com/stella-emu/stella.git
Combined 'sa1' and 'sa2' commandline arguments into one command named
'saport'. This takes the values 'lr' or 'rl', corresponding to left/right and right/left. Added ability to dynamically swap the Stelladaptor/2600-daptor ports with the 'Control-1' key. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2401 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1e396f8408
commit
3b4b10df76
|
@ -1471,6 +1471,12 @@
|
||||||
<td>Control + 0</td>
|
<td>Control + 0</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Swap Stelladaptor/2600-daptor port ordering</td>
|
||||||
|
<td>Control + 1</td>
|
||||||
|
<td>Control + 1</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Reload current ROM (singlecart ROM, TIA mode)<br>
|
<td>Reload current ROM (singlecart ROM, TIA mode)<br>
|
||||||
Load next game in ROM (multicart ROM, TIA mode)</td>
|
Load next game in ROM (multicart ROM, TIA mode)</td>
|
||||||
|
@ -1602,7 +1608,7 @@
|
||||||
<td> ✓</td>
|
<td> ✓</td>
|
||||||
<td> ✕</td>
|
<td> ✕</td>
|
||||||
<td> ✕</td>
|
<td> ✕</td>
|
||||||
<td> ✕</td>
|
<td> ✓ (2600-daptor II)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th> Driving</th>
|
<th> Driving</th>
|
||||||
|
@ -1901,13 +1907,10 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-sa1 <left|right></pre></td>
|
<td><pre>-saport <lr|rl></pre></td>
|
||||||
<td>Stelladaptor/2600-daptor 1 emulates specified joystick port.</td>
|
<td>Determines how to enumerate the Stelladaptor/2600-daptor devices in the
|
||||||
</tr>
|
order they are found: 'lr' means first is left port, second is right port,
|
||||||
|
'rl' means the opposite.</td>
|
||||||
<tr>
|
|
||||||
<td><pre>-sa2 <left|right></pre></td>
|
|
||||||
<td>Stelladaptor/2600-daptor 2 emulates specified joystick port.</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2469,7 +2472,7 @@
|
||||||
<td valign="top">
|
<td valign="top">
|
||||||
<table border="1" cellpadding="4">
|
<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><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>-sa1 & -sa2</td></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>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>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>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>Sensitvity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
|
||||||
|
@ -2640,16 +2643,18 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li>The first device found will act as the <b>left game port</b>
|
<li>The first device found will act as the <b>left game port</b>
|
||||||
on a real Atari. Depending on the device, Stella will detect it as
|
on a real Atari. Depending on the device, Stella will detect it as
|
||||||
either the left joystick, paddles 0 & 1, or the left driving controller.</li>
|
either the left joystick, paddles 0 & 1, the left driving controller,
|
||||||
|
left keypad, etc.</li>
|
||||||
|
|
||||||
<li>The second device found will act as the <b>right game port</b>
|
<li>The second device found will act as the <b>right game port</b>
|
||||||
on a real Atari. Depending on the device, Stella will detect it as
|
on a real Atari. Depending on the device, Stella will detect it as
|
||||||
either the right joystick, paddles 2 & 3, or the right driving controller.</li>
|
either the right joystick, paddles 2 & 3, the right driving controller,
|
||||||
|
right keypad, etc.</li>
|
||||||
|
|
||||||
<li>Any other devices will be ignored.</li>
|
<li>Any other devices will be ignored.</li>
|
||||||
|
|
||||||
<li>The assignment ordering of Stelladaptor/2600-daptor to port can be redefined with
|
<li>The assignment ordering of Stelladaptor/2600-daptor to port can be redefined with
|
||||||
'sa1' and 'sa2' (see description in 'Starting a Game').</li>
|
'saport' (see description in 'Starting a Game').</li>
|
||||||
</ul>
|
</ul>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
|
|
@ -161,15 +161,11 @@ void EventHandler::setupJoysticks()
|
||||||
if(name.find("2600-daptor", 0) != string::npos)
|
if(name.find("2600-daptor", 0) != string::npos)
|
||||||
{
|
{
|
||||||
saCount++;
|
saCount++;
|
||||||
if(saCount > 2) // Ignore more than 2 Stelladaptors
|
if(saCount > 2) // Ignore more than 2 2600-daptors
|
||||||
{
|
{
|
||||||
myJoysticks[i].type = StellaJoystick::JT_NONE;
|
myJoysticks[i].type = StellaJoystick::JT_NONE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if(saCount == 1) // Type will be set by mapStelladaptors()
|
|
||||||
myJoysticks[i].name = myJoysticks[i].numButtons > 2 ? "2600-daptorII 1" : "2600-daptor 1";
|
|
||||||
else if(saCount == 2)
|
|
||||||
myJoysticks[i].name = myJoysticks[i].numButtons > 2 ? "2600-daptorII 2" : "2600-daptor 2";
|
|
||||||
|
|
||||||
// 2600-daptorII devices have 3 axes and 12 buttons, and the value of the z-axis
|
// 2600-daptorII devices have 3 axes and 12 buttons, and the value of the z-axis
|
||||||
// determines how those 12 buttons are used (not all buttons are used in all modes)
|
// determines how those 12 buttons are used (not all buttons are used in all modes)
|
||||||
|
@ -177,17 +173,18 @@ void EventHandler::setupJoysticks()
|
||||||
{
|
{
|
||||||
// TODO - stubbed out for now, until we find a way to reliably get info
|
// TODO - stubbed out for now, until we find a way to reliably get info
|
||||||
// from the Z axis
|
// from the Z axis
|
||||||
|
myJoysticks[i].name = "2600-daptor II";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
myJoysticks[i].name = "2600-daptor";
|
||||||
}
|
}
|
||||||
else if(name.find("Stelladaptor", 0) != string::npos)
|
else if(name.find("Stelladaptor", 0) != string::npos)
|
||||||
{
|
{
|
||||||
saCount++;
|
saCount++;
|
||||||
if(saCount > 2) // Ignore more than 2 Stelladaptors
|
if(saCount > 2) // Ignore more than 2 Stelladaptors
|
||||||
continue;
|
continue;
|
||||||
else if(saCount == 1) // Type will be set by mapStelladaptors()
|
else // Type will be set by mapStelladaptors()
|
||||||
myJoysticks[i].name = "Stelladaptor 1";
|
myJoysticks[i].name = "Stelladaptor";
|
||||||
else if(saCount == 2)
|
|
||||||
myJoysticks[i].name = "Stelladaptor 2";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -211,9 +208,7 @@ void EventHandler::setupJoysticks()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map the stelladaptors we've found according to the specified ports
|
// Map the stelladaptors we've found according to the specified ports
|
||||||
const string& sa1 = myOSystem->settings().getString("sa1");
|
mapStelladaptors(myOSystem->settings().getString("saport"));
|
||||||
const string& sa2 = myOSystem->settings().getString("sa2");
|
|
||||||
mapStelladaptors(sa1, sa2);
|
|
||||||
|
|
||||||
setJoymap();
|
setJoymap();
|
||||||
setActionMappings(kEmulationMode);
|
setActionMappings(kEmulationMode);
|
||||||
|
@ -230,19 +225,36 @@ void EventHandler::setupJoysticks()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::mapStelladaptors(const string& sa1, const string& sa2)
|
void EventHandler::mapStelladaptors(const string& saport)
|
||||||
{
|
{
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
|
// saport will have two values:
|
||||||
|
// 'lr' means treat first valid adaptor as left port, second as right port
|
||||||
|
// 'rl' means treat first valid adaptor as right port, second as left port
|
||||||
|
// We know there will be only two such devices (at most), since the logic
|
||||||
|
// in setupJoysticks take care of that
|
||||||
|
int saCount = 0;
|
||||||
|
int saOrder[2];
|
||||||
|
if(BSPF_equalsIgnoreCase(saport, "lr"))
|
||||||
|
{
|
||||||
|
saOrder[0] = 1; saOrder[1] = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
saOrder[0] = 2; saOrder[1] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
for(uInt32 i = 0; i < myNumJoysticks; i++)
|
for(uInt32 i = 0; i < myNumJoysticks; i++)
|
||||||
{
|
{
|
||||||
if(BSPF_startsWithIgnoreCase(myJoysticks[i].name, "Stelladaptor"))
|
if(BSPF_startsWithIgnoreCase(myJoysticks[i].name, "Stelladaptor"))
|
||||||
{
|
{
|
||||||
if(sa1 == "left")
|
saCount++;
|
||||||
|
if(saOrder[saCount-1] == 1)
|
||||||
{
|
{
|
||||||
myJoysticks[i].name += " (emulates left joystick port)";
|
myJoysticks[i].name += " (emulates left joystick port)";
|
||||||
myJoysticks[i].type = StellaJoystick::JT_STELLADAPTOR_LEFT;
|
myJoysticks[i].type = StellaJoystick::JT_STELLADAPTOR_LEFT;
|
||||||
}
|
}
|
||||||
else if(sa1 == "right")
|
else if(saOrder[saCount-1] == 2)
|
||||||
{
|
{
|
||||||
myJoysticks[i].name += " (emulates right joystick port)";
|
myJoysticks[i].name += " (emulates right joystick port)";
|
||||||
myJoysticks[i].type = StellaJoystick::JT_STELLADAPTOR_RIGHT;
|
myJoysticks[i].type = StellaJoystick::JT_STELLADAPTOR_RIGHT;
|
||||||
|
@ -250,23 +262,39 @@ void EventHandler::mapStelladaptors(const string& sa1, const string& sa2)
|
||||||
}
|
}
|
||||||
else if(BSPF_startsWithIgnoreCase(myJoysticks[i].name, "2600-daptor"))
|
else if(BSPF_startsWithIgnoreCase(myJoysticks[i].name, "2600-daptor"))
|
||||||
{
|
{
|
||||||
if(sa1 == "left")
|
saCount++;
|
||||||
|
if(saOrder[saCount-1] == 1)
|
||||||
{
|
{
|
||||||
myJoysticks[i].name += " (emulates left joystick port)";
|
myJoysticks[i].name += " (emulates left joystick port)";
|
||||||
myJoysticks[i].type = StellaJoystick::JT_2600DAPTOR_LEFT;
|
myJoysticks[i].type = StellaJoystick::JT_2600DAPTOR_LEFT;
|
||||||
}
|
}
|
||||||
else if(sa1 == "right")
|
else if(saOrder[saCount-1] == 2)
|
||||||
{
|
{
|
||||||
myJoysticks[i].name += " (emulates right joystick port)";
|
myJoysticks[i].name += " (emulates right joystick port)";
|
||||||
myJoysticks[i].type = StellaJoystick::JT_2600DAPTOR_RIGHT;
|
myJoysticks[i].type = StellaJoystick::JT_2600DAPTOR_RIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myOSystem->settings().setString("sa1", sa1);
|
myOSystem->settings().setString("saport", saport);
|
||||||
myOSystem->settings().setString("sa2", sa2);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void EventHandler::toggleSAPortOrder()
|
||||||
|
{
|
||||||
|
const string& saport = myOSystem->settings().getString("saport");
|
||||||
|
if(saport == "lr")
|
||||||
|
{
|
||||||
|
mapStelladaptors("rl");
|
||||||
|
myOSystem->frameBuffer().showMessage("Stelladaptor ports right/left");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapStelladaptors("lr");
|
||||||
|
myOSystem->frameBuffer().showMessage("Stelladaptor ports left/right");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::poll(uInt64 time)
|
void EventHandler::poll(uInt64 time)
|
||||||
{
|
{
|
||||||
|
@ -479,6 +507,10 @@ void EventHandler::poll(uInt64 time)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KBDK_1: // Ctrl-1 swaps Stelladaptor/2600-daptor ports
|
||||||
|
toggleSAPortOrder();
|
||||||
|
break;
|
||||||
|
|
||||||
case KBDK_f: // Ctrl-f toggles NTSC/PAL mode
|
case KBDK_f: // Ctrl-f toggles NTSC/PAL mode
|
||||||
myOSystem->console().toggleFormat();
|
myOSystem->console().toggleFormat();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -118,12 +118,16 @@ class EventHandler
|
||||||
void setupJoysticks();
|
void setupJoysticks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Maps the given stelladaptors to specified ports on a real 2600
|
Maps the given Stelladaptor/2600-daptor(s) to specified ports on a real 2600.
|
||||||
|
|
||||||
@param sa1 Port for the first Stelladaptor to emulate (left or right)
|
@param saport How to map the ports ('lr' or 'rl')
|
||||||
@param sa2 Port for the second Stelladaptor to emulate (left or right)
|
|
||||||
*/
|
*/
|
||||||
void mapStelladaptors(const string& sa1, const string& sa2);
|
void mapStelladaptors(const string& saport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Swaps the ordering of Stelladaptor/2600-daptor(s) devices.
|
||||||
|
*/
|
||||||
|
void toggleSAPortOrder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Collects and dispatches any pending events. This method should be
|
Collects and dispatches any pending events. This method should be
|
||||||
|
|
|
@ -76,8 +76,7 @@ Settings::Settings(OSystem* osystem)
|
||||||
setInternal("mcontrol", "auto");
|
setInternal("mcontrol", "auto");
|
||||||
setInternal("dsense", "5");
|
setInternal("dsense", "5");
|
||||||
setInternal("msense", "7");
|
setInternal("msense", "7");
|
||||||
setInternal("sa1", "left");
|
setInternal("saport", "lr");
|
||||||
setInternal("sa2", "right");
|
|
||||||
setInternal("ctrlcombo", "true");
|
setInternal("ctrlcombo", "true");
|
||||||
|
|
||||||
// Snapshot options
|
// Snapshot options
|
||||||
|
@ -373,8 +372,7 @@ void Settings::usage()
|
||||||
<< " rom>\n"
|
<< " rom>\n"
|
||||||
<< " -dsense <number> Sensitivity of digital emulated paddle movement (1-10)\n"
|
<< " -dsense <number> Sensitivity of digital emulated paddle movement (1-10)\n"
|
||||||
<< " -msense <number> Sensitivity of mouse emulated paddle movement (1-15)\n"
|
<< " -msense <number> Sensitivity of mouse emulated paddle movement (1-15)\n"
|
||||||
<< " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n"
|
<< " -saport <lr|rl> How to assign virtual ports to multiple Stelladaptor/2600-daptors\n"
|
||||||
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"
|
|
||||||
<< " -ctrlcombo <1|0> Use key combos involving the Control key (Control-Q for quit may be disabled!)\n"
|
<< " -ctrlcombo <1|0> Use key combos involving the Control key (Control-Q for quit may be disabled!)\n"
|
||||||
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
||||||
<< " -stats <1|0> Overlay console info during emulation\n"
|
<< " -stats <1|0> Overlay console info during emulation\n"
|
||||||
|
|
|
@ -121,8 +121,8 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
||||||
pwidth = font.getStringWidth("left / right");
|
pwidth = font.getStringWidth("left / right");
|
||||||
|
|
||||||
items.clear();
|
items.clear();
|
||||||
items.push_back("left / right", "leftright");
|
items.push_back("left / right", "lr");
|
||||||
items.push_back("right / left", "rightleft");
|
items.push_back("right / left", "rl");
|
||||||
mySAPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
|
mySAPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
|
||||||
"Stelladaptor port order: ", lwidth);
|
"Stelladaptor port order: ", lwidth);
|
||||||
wid.push_back(mySAPort);
|
wid.push_back(mySAPort);
|
||||||
|
@ -211,9 +211,8 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
||||||
void InputDialog::loadConfig()
|
void InputDialog::loadConfig()
|
||||||
{
|
{
|
||||||
// Left & right ports
|
// Left & right ports
|
||||||
const string& sa1 = instance().settings().getString("sa1");
|
const string& saport = instance().settings().getString("saport");
|
||||||
int portorder = sa1 == "right" ? 1 : 0;
|
mySAPort->setSelected(BSPF_equalsIgnoreCase(saport, "rl") ? 1 : 0);
|
||||||
mySAPort->setSelected(portorder);
|
|
||||||
|
|
||||||
// Joystick deadzone
|
// Joystick deadzone
|
||||||
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
|
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
|
||||||
|
@ -245,11 +244,7 @@ void InputDialog::loadConfig()
|
||||||
void InputDialog::saveConfig()
|
void InputDialog::saveConfig()
|
||||||
{
|
{
|
||||||
// Left & right ports
|
// Left & right ports
|
||||||
int sa_order = mySAPort->getSelected();
|
instance().eventHandler().mapStelladaptors(mySAPort->getSelectedTag());
|
||||||
if(sa_order == 0)
|
|
||||||
instance().eventHandler().mapStelladaptors("left", "right");
|
|
||||||
else
|
|
||||||
instance().eventHandler().mapStelladaptors("right", "left");
|
|
||||||
|
|
||||||
// Joystick deadzone
|
// Joystick deadzone
|
||||||
int deadzone = myDeadzone->getValue();
|
int deadzone = myDeadzone->getValue();
|
||||||
|
@ -298,7 +293,7 @@ void InputDialog::setDefaults()
|
||||||
case 2: // Virtual devices
|
case 2: // Virtual devices
|
||||||
{
|
{
|
||||||
// Left & right ports
|
// Left & right ports
|
||||||
mySAPort->setSelected("leftright", "leftright");
|
mySAPort->setSelected("lr", "lr");
|
||||||
|
|
||||||
// Joystick deadzone
|
// Joystick deadzone
|
||||||
myDeadzone->setValue(0);
|
myDeadzone->setValue(0);
|
||||||
|
|
Loading…
Reference in New Issue