started working on multiple controller support

This commit is contained in:
Thomas Jentzsch 2020-09-02 21:54:31 +02:00
parent 34c937a143
commit f1b1936a73
14 changed files with 3800 additions and 3620 deletions

View File

@ -2119,17 +2119,17 @@
<tr>
<td><pre>-center &lt;1|0&gt;</pre></td>
<td>Centers all windows (if possible).</td>
<td>Center all windows (if possible).</td>
</tr>
<tr>
<td><pre>-windowedpos &lt;XxY&gt;</pre></td>
<td>Sets the window position in windowed emulator mode.</td>
<td>Set the window position in windowed emulator mode.</td>
</tr>
<tr>
<td><pre>-display &lt;number&gt;</pre></td>
<td>Sets the display for Stella's emulator.</td>
<td>Set the display for Stella's emulator.</td>
</tr>
<tr>
@ -2286,7 +2286,7 @@
<tr>
<td><pre>-tia.dbgcolors &lt;roygbp&gt;</pre></td>
<td>Assigns the colours (R)ed, (O)range, (Y)ellow, (G)reen, (B)lue and (P)urple
<td>Assign the colours (R)ed, (O)range, (Y)ellow, (G)reen, (B)lue and (P)urple
to each graphical register P0/M0/P1/M1/PF/BL, respectively. Currently,
these change be changed around to apply different colours to the
respective register.
@ -2332,7 +2332,7 @@
<tr>
<td><pre>-tv.phosphor &lt;always|byrom&gt;</pre></td>
<td>Determines how phosphor mode is enabled. If 'always', then the
<td>Determine how phosphor mode is enabled. If 'always', then the
ROM properties entry is ignored, and phosphor mode is always turned
on. Otherwise, the ROM properties determine whether phosphor mode
is used for each ROM.
@ -2354,7 +2354,7 @@
<tr>
<td><pre>-tv.scanlines &lt;0 - 100&gt;</pre></td>
<td>TV effects scanline intensity, where 0 means completely off. Note: No scanlines in 1x mode snapshots.</td>
<td>Set TV effects scanline intensity, where 0 means completely off. Note: No scanlines in 1x mode snapshots.</td>
</tr>
<tr>
@ -2364,17 +2364,17 @@
<tr>
<td><pre>-loglevel &lt;0|1|2&gt;</pre></td>
<td>Indicates level of logging to perform while the application is running. Zero completely disables logging (except for serious errors), while the remaining numbers show increasingly more detail.</td>
<td>Indicate level of logging to perform while the application is running. Zero completely disables logging (except for serious errors), while the remaining numbers show increasingly more detail.</td>
</tr>
<tr>
<td><pre>-logtoconsole &lt;1|0&gt;</pre></td>
<td>Indicates that logged output should be printed to the console/commandline as it's being collected. An internal log will still be kept, and the amount of logging is still controlled by 'loglevel'.</td>
<td>Indicate that logged output should be printed to the console/commandline as it's being collected. An internal log will still be kept, and the amount of logging is still controlled by 'loglevel'.</td>
</tr>
<tr>
<td><pre>-joydeadzone &lt;number&gt;</pre></td>
<td>Sets the joystick axis deadzone area for analog joysticks/gamepads.
<td>Set the joystick axis deadzone area for analog joysticks/gamepads.
All values within the deadzone are treated as zero-axis values,
while only those values outside are registered as valid input.
Accepts a number from 0 - 29, and uses the formula
@ -2429,7 +2429,7 @@
<tr>
<td><pre>-saport &lt;lr|rl&gt;</pre></td>
<td>Determines how to enumerate the Stelladaptor/2600-daptor devices in the
<td>Determine how to enumerate the Stelladaptor/2600-daptor devices in the
order they are found: 'lr' means first is left port, second is right port,
'rl' means the opposite.</td>
</tr>
@ -2475,7 +2475,7 @@
<tr>
<td><pre>-grabmouse &lt;1|0&gt;</pre></td>
<td>Locks the mouse cursor in the game window in emulation mode.</td>
<td>Lock the mouse cursor in the game window in emulation mode.</td>
</tr>
<tr>
@ -2541,7 +2541,7 @@
<tr>
<td><pre>-listrominfo</pre></td>
<td>Prints relevant contents of the Stella ROM database, one ROM per line,
<td>Print relevant contents of the Stella ROM database, one ROM per line,
and then exit Stella. This can be used for external frontends.</td>
</tr>
@ -2553,12 +2553,12 @@
<tr>
<td><pre>-launcherpos &lt;XxY&gt;</pre></td>
<td>Sets the window position in windowed ROM launcher mode.</td>
<td>Set the window position in windowed ROM launcher mode.</td>
</tr>
<tr>
<td><pre>-launcherdisplay &lt;number&gt;</pre></td>
<td>Sets the display for the ROM launcher.</td>
<td>Set the display for the ROM launcher.</td>
</tr>
<tr>
@ -2601,7 +2601,7 @@
<tr>
<td><pre>-hidpi &lt;0|1&gt;</pre></td>
<td>Enables the HiDPI mode which scales the UI by a factor of two.</td>
<td>Enable the HiDPI mode which scales the UI by a factor of two.</td>
</tr>
<tr>
@ -2688,13 +2688,13 @@
<tr>
<td><pre>-dis.gfxformat &lt;2|16&gt;</pre></td>
<td>Sets the base to use for displaying GFX sections in the disassembler.
<td>Set the base to use for displaying GFX sections in the disassembler.
</td>
</tr>
<tr>
<td><pre>-dis.showaddr &lt;1|0&gt;</pre></td>
<td>Shows/hides opcode addresses in the disassembler.</td>
<td>Show/hide opcode addresses in the disassembler.</td>
</tr>
<tr>
@ -2704,12 +2704,12 @@
<tr>
<td><pre>-dbg.pos &lt;XxY&gt;</pre></td>
<td>Sets the window position in windowed debugger mode.</td>
<td>Set the window position in windowed debugger mode.</td>
</tr>
<tr>
<td><pre>-dbg.display &lt;number&gt;</pre></td>
<td>Sets the display for the debugger.</td>
<td>Set the display for the debugger.</td>
</tr>
<tr>
@ -2823,15 +2823,46 @@
section for valid types.</td>
</tr>
<tr>
<td><pre>-lq1 &lt;type&gt;</pre></td>
<td>Set "Controller.Left1" property for QuadTari. See the <a href="#Properties"><b>Game Properties</b></a>
section for valid types.</td>
</tr>
<tr>
<td><pre>-lq2 &lt;type&gt;</pre></td>
<td>Set "Controller.Left2" property for QuadTari. See the <a href="#Properties"><b>Game Properties</b></a>
section for valid types.</td>
</tr>
<tr>
<td><pre>-rc &lt;type&gt;</pre></td>
<td>Set "Controller.Right" property. See the <a href="#Properties"><b>Game Properties</b></a>
section for valid types.</td>
</tr>
<tr>
<td><pre>-rq1 &lt;type&gt;</pre></td>
<td>Set "Controller.Right1" property for QuadTari. See the <a href="#Properties"><b>Game Properties</b></a>
section for valid types.</td>
</tr>
<tr>
<td><pre>-rq2 &lt;type&gt;</pre></td>
<td>Set "Controller.Right2" property for QuadTari. See the <a href="#Properties"><b>Game Properties</b></a>
section for valid types.</td>
</tr>
<tr>
<td><pre>-bc &lt;type&gt;</pre></td>
<td>Sets both "Controller.Left" and "Controller.Right" properties.
<td>Set both "Controller.Left" and "Controller.Right" properties.
See the <a href="#Properties"><b>Game Properties</b></a> section for valid types.</td>
</tr>
<tr>
<td><pre>-aq &lt;type&gt;</pre></td>
<td>Set "Controller.Left1", "Controller.Left2", "Controller.Right1" and "Controller.Right2" properties for QuadTari.
See the <a href="#Properties"><b>Game Properties</b></a> section for valid types.</td>
</tr>
@ -4051,7 +4082,7 @@ Ms Pac-Man (Stella extended codes):
<table CELLSPACING="10">
<tr>
<td VALIGN="TOP"><a name="PropertiesCartType"><i>Cart.Type:</i></a></td>
<td VALIGN="TOP"><a name="PropertiesCartType"><i>Cart.Type</i></a></td>
<td>Indicates the bank-switching type for the game.
The value of this property must be either <b>Auto</b> or one of the following
(for more information about bank-switching see Kevin Horton's <a href="http://kevtris.org/files/sizes.txt">2600 bankswitching
@ -4116,12 +4147,12 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.StartBank:</i></td>
<td VALIGN="TOP"><i>Cart.StartBank</i></td>
<td>Indicates which bank to use for reading the reset vector.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Display.Format:</i></td>
<td VALIGN="TOP"><i>Display.Format</i></td>
<td>Indicates the television format the game was designed for. The value
must be <b>Auto</b> or one of the following. Types marked as (&#185;)
do currently have no reliable auto-detection. A format can be enforced
@ -4138,27 +4169,27 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP"><i>Display.VCenter:</i></td>
<td VALIGN="TOP"><i>Display.VCenter</i></td>
<td>Indicates the offset for the vertical center of the display.
The value must be <i>n</i> such that -20 &lt;= <i>n</i> &lt;= 20.
</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Display.Phosphor:</i></td>
<td VALIGN="TOP"><i>Display.Phosphor</i></td>
<td>Indicates whether the phosphor effect should be emulated or not.
The value must be <b>Yes</b> or <b>No</b>.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Display.PPBlend:</i></td>
<td VALIGN="TOP"><i>Display.PPBlend</i></td>
<td>Indicates the amount of blending which will occur while using the
phosphor effect. The value must be <i>n</i> such that 0 &lt;= <i>n</i>
&lt;= 100. The default value is whatever is specified for tv.phosblend.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.Sound:</i></td>
<td VALIGN="TOP"><i>Cart.Sound</i></td>
<td>Indicates if the game should use 1 or 2 channels for sound output.
All original Atari 2600 machines supported 1 channel only,
but some homebrew games have been written to take advantage of stereo
@ -4177,19 +4208,19 @@ Ms Pac-Man (Stella extended codes):
<table CELLSPACING="10">
<tr>
<td VALIGN="TOP"><i>Console.TVType:</i></td>
<td VALIGN="TOP"><i>Console.TVType</i></td>
<td>Indicates the default television setting for the
game. The value must be <b>Color</b> or <b>BW</b>.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Console.LeftDiff:</i></td>
<td VALIGN="TOP"><i>Console.LeftDiff</i></td>
<td>Indicates the default difficulty setting for the left
player. The value must be <b>A</b> or <b>B</b>.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Console.RightDiff:</i></td>
<td VALIGN="TOP"><i>Console.RightDiff</i></td>
<td>Indicates the default difficulty setting for the
right player. The value must be <b>A</b> or <b>B</b>.</td>
</tr>
@ -4201,7 +4232,15 @@ Ms Pac-Man (Stella extended codes):
</p>
<table CELLSPACING="10">
<tr>
<td VALIGN="TOP"><i>Controller.Left:</i><br><i>Controller.Right:</i></td>
<td VALIGN="TOP">
<i>Controller.Left</i><br>
<i>Controller.Right</i><br>
<br>For QuadTari:<br>
<i>Controller.Left1</i><br>
<i>Controller.Left2</i><br>
<i>Controller.Right1</i><br>
<i>Controller.Right2</i><br>
</td>
<td>Indicates what type of controller the left and right player
uses. The value must be either <b>Auto</b> or one of the following types. Types marked
as (&#185;) do not have auto-detection yet.
@ -4224,12 +4263,12 @@ Ms Pac-Man (Stella extended codes):
<tr><td>Lightgun</td><td>Atari XG-1 compatible Light Gun</td></tr>
<tr><td>Mindlink &#185</td><td>Mindlink controller.</td></tr>
<tr><td>KidVid &#185</td><td>KidVid controller, limited support (8, 9 and 0 start the games).</td></tr>
<tr><td>QuadTari</td><td>QuadTari controller, limited support (joysticks only).</td></tr>
<tr><td>QuadTari</td><td>QuadTari controller, limited support (Joystick, Driving controller, SaveKey and AtariVox only).</td></tr>
</table></td>
</tr>
<tr>
<td VALIGN="TOP"><i>Console.SwapPorts:</i></td>
<td VALIGN="TOP"><i>Console.SwapPorts</i></td>
<td>Indicates that the left and right ports should be
swapped internally. This is used for ROMs like 'Raiders of the Lost Ark' where the
Player 0 joystick is plugged into the right joystick port.
@ -4237,7 +4276,7 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP"><i>Controller.SwapPaddles:</i></td>
<td VALIGN="TOP"><i>Controller.SwapPaddles</i></td>
<td>Indicates that the left and right paddles in
a particular port should be swapped. This is used for ROMs like
'Demons to Diamonds' where the default paddle is paddle 1, not
@ -4247,17 +4286,17 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP"><i>Controller.PaddlesXCenter:</i></td>
<td VALIGN="TOP"><i>Controller.PaddlesXCenter</i></td>
<td>Defines the horizontal center of the paddles (range -10..30).</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Controller.PaddlesYCenter:</i></td>
<td VALIGN="TOP"><i>Controller.PaddlesYCenter</i></td>
<td>Defines the vertical center of the paddles (range -10..30).</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Controller.MouseAxis:</i></td>
<td VALIGN="TOP"><i>Controller.MouseAxis</i></td>
<td>Indicates how the mouse should emulate virtual controllers.
In 'Auto' mode, the system decides how to best use the mouse. Otherwise,
XY indicates how to use the X/Y axis (ie, 02 is paddle0/paddle2).
@ -4275,7 +4314,7 @@ Ms Pac-Man (Stella extended codes):
<tr><td>7 </td><td>MindLink 1</td></tr>
</table>
An <I>optional</I> second parameter (default of 100) indicates how much
of the paddle range that the mouse should emulate.
of the paddle range the mouse should emulate.
</td>
</tr>
@ -4291,14 +4330,14 @@ Ms Pac-Man (Stella extended codes):
</p>
<table CELLSPACING="10">
<tr>
<td VALIGN="TOP"><i>Cart.Name:</i></td>
<td VALIGN="TOP"><i>Cart.Name</i></td>
<td>Indicates the actual name of the game. When you save snapshots,
load/save state files, or use the <a href="#ROMAudit"><b>ROM Audit Mode</b></a> functionality,
this is the name that will be used for the respective file(s).</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.MD5:</i></td>
<td VALIGN="TOP"><i>Cart.MD5</i></td>
<td>Indicates the MD5 checksum of the ROM image as a
string of hexadecimal digits. Stella uses this property while
attempting to match a game with its block of properties. If the
@ -4309,22 +4348,22 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.Manufacturer:</i></td>
<td VALIGN="TOP"><i>Cart.Manufacturer</i></td>
<td>Indicates the game's manufacturer.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.ModelNo:</i></td>
<td VALIGN="TOP"><i>Cart.ModelNo</i></td>
<td>Indicates the manufacturer's model number for the game.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.Rarity:</i></td>
<td VALIGN="TOP"><i>Cart.Rarity</i></td>
<td>Indicates how rare a cartridge is, based on the scale described on AtariAge.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Cart.Note:</i></td>
<td VALIGN="TOP"><i>Cart.Note</i></td>
<td>Contains any special notes about playing the game.</td>
</tr>

View File

@ -929,8 +929,7 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
break;
case Controller::Type::QuadTari:
// TODO: support multiple controller types
controller = make_unique<QuadTari>(port, myEvent, *mySystem);
controller = make_unique<QuadTari>(port, myOSystem, *mySystem, myProperties);
break;
default:

View File

@ -711,5 +711,8 @@ bool ControllerDetector::isProbablyQuadTari(const ByteBuffer& image, size_t size
return searchForBytes(image, size, signature, 5);
}
return false;
uInt8 signature[] = { 0x1B, 0x1F, 0x0B, 0x0E, 0x1E, 0x0B, 0x1C, 0x13 };
return searchForBytes(image, size, signature, 8);
}

File diff suppressed because it is too large Load Diff

View File

@ -21,22 +21,40 @@
#include "Driving.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Driving::Driving(Jack jack, const Event& event, const System& system)
Driving::Driving(Jack jack, const Event& event, const System& system, bool altmap)
: Controller(jack, event, system, Controller::Type::Driving)
{
if(myJack == Jack::Left)
{
myCCWEvent = Event::JoystickZeroLeft;
myCWEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire;
if(!altmap)
{
myCCWEvent = Event::JoystickZeroLeft;
myCWEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire;
}
else
{
myCCWEvent = Event::JoystickTwoLeft;
myCWEvent = Event::JoystickTwoRight;
myFireEvent = Event::JoystickTwoFire;
}
myXAxisValue = Event::PaddleZeroAnalog;
myYAxisValue = Event::PaddleOneAnalog;
}
else
{
myCCWEvent = Event::JoystickOneLeft;
myCWEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire;
if(!altmap)
{
myCCWEvent = Event::JoystickOneLeft;
myCWEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire;
}
else
{
myCCWEvent = Event::JoystickThreeLeft;
myCWEvent = Event::JoystickThreeRight;
myFireEvent = Event::JoystickThreeFire;
}
myXAxisValue = Event::PaddleTwoAnalog;
myYAxisValue = Event::PaddleThreeAnalog;
}

View File

@ -33,11 +33,12 @@ class Driving : public Controller
Create a new Indy 500 driving controller plugged into
the specified jack
@param jack The jack the controller is plugged into
@param event The event object to use for events
@param system The system using this controller
@param jack The jack the controller is plugged into
@param event The event object to use for events
@param system The system using this controller
@param altmap If true, use alternative mapping
*/
Driving(Jack jack, const Event& event, const System& system);
Driving(Jack jack, const Event& event, const System& system, bool altmap = false);
~Driving() override = default;
public:

View File

@ -618,11 +618,23 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
CMDLINE_PROPS_UPDATE("sp", PropType::Console_SwapPorts);
CMDLINE_PROPS_UPDATE("lc", PropType::Controller_Left);
CMDLINE_PROPS_UPDATE("lq1", PropType::Controller_Left1);
CMDLINE_PROPS_UPDATE("lq2", PropType::Controller_Left2);
CMDLINE_PROPS_UPDATE("rc", PropType::Controller_Right);
const string& s = mySettings->getString("bc");
if(s != "") {
props.set(PropType::Controller_Left, s);
props.set(PropType::Controller_Right, s);
CMDLINE_PROPS_UPDATE("rq1", PropType::Controller_Right1);
CMDLINE_PROPS_UPDATE("rq2", PropType::Controller_Right2);
const string& bc = mySettings->getString("bc");
if(bc != "") {
props.set(PropType::Controller_Left, bc);
props.set(PropType::Controller_Right, bc);
}
const string& aq = mySettings->getString("aq");
if(aq != "")
{
props.set(PropType::Controller_Left1, aq);
props.set(PropType::Controller_Left2, aq);
props.set(PropType::Controller_Right1, aq);
props.set(PropType::Controller_Right2, aq);
}
CMDLINE_PROPS_UPDATE("cp", PropType::Controller_SwapPaddles);
CMDLINE_PROPS_UPDATE("ma", PropType::Controller_MouseAxis);

View File

@ -51,7 +51,11 @@ void Properties::set(PropType key, const string& value)
case PropType::Console_TVType:
case PropType::Console_SwapPorts:
case PropType::Controller_Left:
case PropType::Controller_Left1:
case PropType::Controller_Left2:
case PropType::Controller_Right:
case PropType::Controller_Right1:
case PropType::Controller_Right2:
case PropType::Controller_SwapPaddles:
case PropType::Controller_MouseAxis:
case PropType::Display_Format:
@ -249,7 +253,11 @@ void Properties::print() const
<< get(PropType::Console_TVType) << "|"
<< get(PropType::Console_SwapPorts) << "|"
<< get(PropType::Controller_Left) << "|"
<< get(PropType::Controller_Left1) << "|"
<< get(PropType::Controller_Left2) << "|"
<< get(PropType::Controller_Right) << "|"
<< get(PropType::Controller_Right1) << "|"
<< get(PropType::Controller_Right2) << "|"
<< get(PropType::Controller_SwapPaddles) << "|"
<< get(PropType::Controller_PaddlesXCenter) << "|"
<< get(PropType::Controller_PaddlesYCenter) << "|"
@ -296,7 +304,11 @@ void Properties::printHeader()
<< "Console_TVType|"
<< "Console_SwapPorts|"
<< "Controller_Left|"
<< "Controller_Left1|"
<< "Controller_Left2|"
<< "Controller_Right|"
<< "Controller_Right1|"
<< "Controller_Right2|"
<< "Controller_SwapPaddles|"
<< "Controller_PaddlesXCenter|"
<< "Controller_PaddlesYCenter|"
@ -325,7 +337,11 @@ std::array<string, Properties::NUM_PROPS> Properties::ourDefaultProperties =
"COLOR", // Console.TVType
"NO", // Console.SwapPorts
"AUTO", // Controller.Left
"", // Controller.Left1
"", // Controller.Left2
"AUTO", // Controller.Right
"", // Controller.Right1
"", // Controller.Right2
"NO", // Controller.SwapPaddles
"0", // Controller.PaddlesXCenter
"0", // Controller.PaddlesYCenter
@ -353,7 +369,11 @@ std::array<string, Properties::NUM_PROPS> Properties::ourPropertyNames =
"Console.TVType",
"Console.SwapPorts",
"Controller.Left",
"Controller.Left1",
"Controller.Left2",
"Controller.Right",
"Controller.Right1",
"Controller.Right2",
"Controller.SwapPaddles",
"Controller.PaddlesXCenter",
"Controller.PaddlesYCenter",

View File

@ -35,7 +35,11 @@ enum class PropType : uInt8 {
Console_TVType,
Console_SwapPorts,
Controller_Left,
Controller_Left1,
Controller_Left2,
Controller_Right,
Controller_Right1,
Controller_Right2,
Controller_SwapPaddles,
Controller_PaddlesXCenter,
Controller_PaddlesYCenter,

View File

@ -15,45 +15,92 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystem.hxx"
#include "EventHandler.hxx"
#include "Event.hxx"
#include "Console.hxx"
#include "System.hxx"
#include "TIA.hxx"
#include "FrameBuffer.hxx"
#include "AtariVox.hxx"
#include "Driving.hxx"
#include "Joystick.hxx"
#include "SaveKey.hxx"
#include "QuadTari.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QuadTari::QuadTari(Jack jack, const Event& event, const System& system,
const Controller::Type firstType, const Controller::Type secondType)
: Controller(jack, event, system, Controller::Type::QuadTari)
QuadTari::QuadTari(Jack jack, OSystem& osystem, const System& system, const Properties& properties)
: Controller(jack, osystem.eventHandler().event(), system,
Controller::Type::QuadTari),
myOSystem(osystem)
{
// TODO: support multiple controller types
switch(firstType)
{
case Controller::Type::Joystick:
myFirstController = make_unique<Joystick>(myJack, event, system);
break;
string first, second;
Controller::Type firstType = Controller::Type::Joystick,
secondType = Controller::Type::Joystick;
default:
// TODO
break;
}
switch(secondType)
if(jack == Controller::Jack::Left)
{
case Controller::Type::Joystick:
mySecondController = make_unique<Joystick>(myJack, event, system, true); // use alternative mapping
break;
default:
// TODO
break;
first = properties.get(PropType::Controller_Left1);
second = properties.get(PropType::Controller_Left2);
}
else
{
first = properties.get(PropType::Controller_Right1);
second = properties.get(PropType::Controller_Right2);
}
if(!first.empty())
firstType = Controller::getType(first);
if(!second.empty())
secondType = Controller::getType(second);
myFirstController = addController(firstType, false);
mySecondController = addController(secondType, true);
// QuadTari auto detection setting
setPin(AnalogPin::Five, MIN_RESISTANCE);
setPin(AnalogPin::Nine, MAX_RESISTANCE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Controller> QuadTari::addController(const Controller::Type type, bool second)
{
switch(type)
{
case Controller::Type::AtariVox:
{
FilesystemNode nvramfile = myOSystem.nvramDir();
nvramfile /= "atarivox_eeprom.dat";
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.eepromaccess" : "plr.eepromaccess"))
os.frameBuffer().showMessage(msg);
};
return make_unique<AtariVox>(myJack, myEvent, mySystem,
myOSystem.settings().getString("avoxport"),
nvramfile, callback); // no alternative mapping here
}
case Controller::Type::Driving:
return make_unique<Driving>(myJack, myEvent, mySystem, second);
case Controller::Type::SaveKey:
{
FilesystemNode nvramfile = myOSystem.nvramDir();
nvramfile /= "savekey_eeprom.dat";
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.eepromaccess" : "plr.eepromaccess"))
os.frameBuffer().showMessage(msg);
};
return make_unique<SaveKey>(myJack, myEvent, mySystem,
nvramfile, callback); // no alternative mapping here
}
default:
// fall back to good old Joystick
return make_unique<Joystick>(myJack, myEvent, mySystem, second);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool QuadTari::read(DigitalPin pin)
{

View File

@ -39,9 +39,7 @@ class QuadTari: public Controller
@param firstType The type of the first, plugged-in controller
@param secondType The type of the second, plugged-in controller
*/
QuadTari(Jack jack, const Event& event, const System& system,
const Controller::Type firstType = Controller::Type::Joystick,
const Controller::Type secondType = Controller::Type::Joystick);
QuadTari(Jack jack, OSystem& osystem, const System& system, const Properties& properties);
~QuadTari() override = default;
public:
@ -90,6 +88,9 @@ class QuadTari: public Controller
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
private:
unique_ptr<Controller> addController(const Controller::Type type, bool second);
OSystem& myOSystem;
unique_ptr<Controller> myFirstController;
unique_ptr<Controller> mySecondController;

View File

@ -236,6 +236,10 @@ GameInfoDialog::GameInfoDialog(
myLeftPortLabel->getTop()-1,
pwidth, lineHeight, ctrls, "", 0, kLeftCChanged);
wid.push_back(myLeftPort);
myLeftQuadTari = new ButtonWidget(myTab, font, myLeftPort->getRight() + fontWidth * 2, myLeftPort->getTop() - 2,
"QuadTari" + ELLIPSIS, kLeftQTPressed);
wid.push_back(myLeftQuadTari);
ypos += lineHeight + VGAP;
myLeftPortDetected = new StaticTextWidget(myTab, ifont, myLeftPort->getLeft(), ypos,
@ -247,17 +251,19 @@ GameInfoDialog::GameInfoDialog(
myRightPortLabel->getTop()-1,
pwidth, lineHeight, ctrls, "", 0, kRightCChanged);
wid.push_back(myRightPort);
myRightQuadTari = new ButtonWidget(myTab, font, myRightPort->getRight() + fontWidth * 2, myRightPort->getTop() - 2,
"QuadTari" + ELLIPSIS, kRightQTPressed);
wid.push_back(myRightQuadTari);
ypos += lineHeight + VGAP;
myRightPortDetected = new StaticTextWidget(myTab, ifont, myRightPort->getLeft(), ypos,
"Sega Genesis detected");
ypos += ifont.getLineHeight() + VGAP + 4;
mySwapPorts = new CheckboxWidget(myTab, font, myLeftPort->getRight() + fontWidth*4,
myLeftPort->getTop()+1, "Swap ports");
mySwapPorts = new CheckboxWidget(myTab, font, xpos + fontWidth * 2,
myLeftPortDetected->getTop()-1, "Swap ports");
wid.push_back(mySwapPorts);
mySwapPaddles = new CheckboxWidget(myTab, font, myRightPort->getRight() + fontWidth*4,
myRightPort->getTop()+1, "Swap paddles");
wid.push_back(mySwapPaddles);
// EEPROM erase button for left/right controller
//ypos += lineHeight + VGAP + 4;
@ -271,6 +277,10 @@ GameInfoDialog::GameInfoDialog(
"(for this game only)");
ypos += lineHeight + VGAP * 4;
mySwapPaddles = new CheckboxWidget(myTab, font, xpos, ypos, "Swap paddles");
wid.push_back(mySwapPaddles);
ypos += lineHeight + VGAP;
// Paddles
myPaddlesCenter = new StaticTextWidget(myTab, font, xpos, ypos, "Paddles center:");
ypos += lineHeight + VGAP;
@ -293,7 +303,7 @@ GameInfoDialog::GameInfoDialog(
// Mouse
xpos = HBORDER + fontWidth * 24 - INDENT;
ypos = myPaddlesCenter->getTop();
ypos = mySwapPaddles->getTop() - 1;
myMouseControl = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Specific mouse axes",
kMCtrlChanged);
wid.push_back(myMouseControl);
@ -760,6 +770,8 @@ void GameInfoDialog::updateControllerStates()
myRightPortLabel->setEnabled(enableSelectControl);
myLeftPort->setEnabled(enableSelectControl);
myRightPort->setEnabled(enableSelectControl);
myLeftQuadTari->setEnabled(BSPF::startsWithIgnoreCase(contrLeft, "QUADTARI"));
myRightQuadTari->setEnabled(BSPF::startsWithIgnoreCase(contrRight, "QUADTARI"));
mySwapPorts->setEnabled(enableSelectControl);
mySwapPaddles->setEnabled(enablePaddles);
@ -859,6 +871,12 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
updateControllerStates();
break;
case kLeftQTPressed:
break;
case kRightQTPressed:
break;
case kEEButtonPressed:
eraseEEPROM();
break;

View File

@ -87,6 +87,8 @@ class GameInfoDialog : public Dialog, public CommandSender
StaticTextWidget* myLeftPortDetected{nullptr};
PopUpWidget* myRightPort{nullptr};
StaticTextWidget* myRightPortDetected{nullptr};
ButtonWidget* myLeftQuadTari{nullptr};
ButtonWidget* myRightQuadTari{nullptr};
CheckboxWidget* mySwapPorts{nullptr};
CheckboxWidget* mySwapPaddles{nullptr};
StaticTextWidget* myEraseEEPROMLabel{nullptr};
@ -114,6 +116,8 @@ class GameInfoDialog : public Dialog, public CommandSender
kPPBlendChanged = 'PBch',
kLeftCChanged = 'LCch',
kRightCChanged = 'RCch',
kLeftQTPressed = 'LQTp',
kRightQTPressed = 'RQTp',
kMCtrlChanged = 'MCch',
kEEButtonPressed = 'EEgb',
kPXCenterChanged = 'Pxch',

View File

@ -17,15 +17,19 @@ my %prop_type = (
"Console.TVType" => 11,
"Console.SwapPorts" => 12,
"Controller.Left" => 13,
"Controller.Right" => 14,
"Controller.SwapPaddles" => 15,
"Controller.PaddlesXCenter" => 16,
"Controller.PaddlesYCenter" => 17,
"Controller.MouseAxis" => 18,
"Display.Format" => 19,
"Display.VCenter" => 20,
"Display.Phosphor" => 21,
"Display.PPBlend" => 22
"Controller.Left1" => 14,
"Controller.Left2" => 15,
"Controller.Right" => 16,
"Controller.Right1" => 17,
"Controller.Right2" => 18,
"Controller.SwapPaddles" => 19,
"Controller.PaddlesXCenter" => 20,
"Controller.PaddlesYCenter" => 21,
"Controller.MouseAxis" => 22,
"Display.Format" => 23,
"Display.VCenter" => 24,
"Display.Phosphor" => 25,
"Display.PPBlend" => 26
);
my @prop_type_as_string = (
"Cart.MD5",
@ -42,7 +46,11 @@ my @prop_type_as_string = (
"Console.TVType",
"Console.SwapPorts",
"Controller.Left",
"Controller.Left1",
"Controller.Left2",
"Controller.Right",
"Controller.Right1",
"Controller.Right2",
"Controller.SwapPaddles",
"Controller.PaddlesXCenter",
"Controller.PaddlesYCenter",
@ -69,7 +77,13 @@ my @prop_defaults = (
"NO",
"",
"",
"",
"",
"",
"",
"NO",
"0",
"0",
"AUTO",
"AUTO",
"0",