The mouse can now emulate Sega Genesis controllers. In this mode, the B/C

buttons use the mouse left/right buttons, respectively.

Updated changelog and documentation.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2373 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-01-29 18:44:45 +00:00
parent b7e489a071
commit 6029835618
7 changed files with 131 additions and 42 deletions

View File

@ -12,7 +12,7 @@
Release History
===========================================================================
3.5 to 3.5.1: (January xx, 2012)
3.5 to 3.5.5: (February xx, 2012)
* Due to changes in the debugger, old state files will not work with
this release.
@ -21,9 +21,6 @@
some cases, there could be some sound 'crackling' when starting a
ROM after at least one ROM had already been loaded.
* Fixed bug in 'Fixed Debug Colors' mode; under certain circumstances,
playfield graphics could be coloured as being player graphics.
* Several significant improvements to the debugger I/O tab:
- added controller input widgets for many of the built-in
controllers, allowing to control joysticks, paddles, etc
@ -31,6 +28,22 @@
- added ability to modify the SWCHB/SWBCNT port B registers.
- added ability to view TIA INPTx and VBLANK latch/dump bits.
* Reworked 'mcontrol' argument, and added ability to map the mouse
axes separately for paddles 0-4 or driving controllers 0-1. In
such modes, the left mouse button is tied to the x-axis, and the
right button is tied to the y-axis.
* Mouse 'specific-axis' mode is now saved per-ROM, meaning that each
ROM can have separate settings. For example, this allows one ROM to
use paddles 0 and 1, while another can use paddles 0 and 2, etc.
* The key-combo for switching the mouse between controller modes is now
'Control-0' (Control-1,2,3 have been removed). This switches
between all possible modes for the current virtual controllers.
* Fixed bug in 'Fixed Debug Colors' mode; under certain circumstances,
playfield graphics could be coloured as being player graphics.
* Fixed bug in PAL color-loss setting in Video Settings; changing the
settings wouldn't take effect until the ROM was reloaded.
@ -40,7 +53,9 @@
advanced types of cheats.
* Updated ROM properties database for all Sega Genesis controller
compatible ROMs.
compatible ROMs. Also, the mouse can now emulate a Genesis
controller, with the left/right buttons mapped to buttons B and C,
respectively.
* Added 'FA2' bankswitch scheme, thanks to code from Chris D.
Walton. This scheme will be used in an upcoming 'Star Castle' ROM.

View File

@ -10,7 +10,7 @@
<br><br>
<center><h2><b>A multi-platform Atari 2600 VCS emulator</b></h2></center>
<center><h4><b>Release 3.5</b></h4></center>
<center><h4><b>Release 3.5.5</b></h4></center>
<br><br>
<center><h2><b>User's Guide</b></h2></center>
@ -54,7 +54,7 @@
<br><br><br>
<center><b>February 1999 - December 2011</b></center>
<center><b>February 1999 - February 2012</b></center>
<center><b>The Stella Team</b></center>
<center><b><a href="http://stella.sourceforge.net">Stella Homepage</a></b></center>
@ -256,8 +256,8 @@
joysticks or mouse</li>
<li>Emulates the CBS BoosterGrip Controller using your computer's keyboard,
joysticks or mouse</li>
<li>Emulates the Sega Genesis Controller using your computer's keyboard or
joysticks</li>
<li>Emulates the Sega Genesis Controller using your computer's keyboard,
joysticks or mouse</li>
<li>Emulates CX-22 / CX-80 style trackballs and Amiga Mouse using your
computer's mouse</li>
<li>Support for real Atari 2600 controllers using the
@ -1466,29 +1466,11 @@
</tr>
<tr>
<td>Set mouse to emulate controller 0</td>
<td>Switch mouse between controller emulation modes</td>
<td>Control + 0</td>
<td>Control + 0</td>
</tr>
<tr>
<td>Set mouse to emulate controller 1</td>
<td>Control + 1</td>
<td>Control + 1</td>
</tr>
<tr>
<td>Set mouse to emulate controller 2</td>
<td>Control + 2</td>
<td>Control + 2</td>
</tr>
<tr>
<td>Set mouse to emulate controller 3</td>
<td>Control + 3</td>
<td>Control + 3</td>
</tr>
<tr>
<td>Reload current ROM (singlecart ROM, TIA mode)<br>
Load next game in ROM (multicart ROM, TIA mode)</td>
@ -1595,7 +1577,7 @@
<td> &#x2713;</td>
<td> &#x2713;</td>
<td> &#x2713;</td>
<td> &#x2713; (+ extra)</td>
<td> &#x2713;</td>
<td> &#x2713;</td>
</tr>
<tr>
@ -1610,7 +1592,7 @@
<th> Genesis</th>
<td> &#x2713;</td>
<td> &#x2713; (+ extra)</td>
<td> &#x2715;</td>
<td> &#x2713;</td>
<td> &#x2715;</td>
<td> &#x2715;</td>
</tr>
@ -1898,10 +1880,9 @@
</tr>
<tr>
<td><pre>-mcontrol &lt;auto|XY&gt;</pre></td>
<td>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).</td>
<td><pre>-mcontrol &lt;never|auto|rom&gt;</pre></td>
<td>Disable mouse input entirely, enable using the mouse axes for various controllers automatically (paddle, driving, etc),
or use the settings specified by the current ROM.</td>
</tr>
<tr>
@ -2218,6 +2199,12 @@
<td>Set "Controller.SwapPaddles" property.</td>
</tr>
<tr>
<td><pre>-ma &lt;Auto|XY&gt;</pre></td>
<td>Set "Controller.MouseAxis" property.
See the <i>Game Properties</i> section for valid types.</td>
</tr>
<tr>
<td><pre>-format &lt;format&gt;</pre></td>
<td>Set "Display.Format" property. See the <i>Game Properties</i> section
@ -3149,7 +3136,7 @@ Ms Pac-Man (Stella extended codes):
<tr><td><a href="http://www.richard.hutchinson.dsl.pipex.com/new_page_5.htm">
AtariVox</a></td><td>A SpeakJet based unlimited-vocabulary speech / sound synthesizer with 32K EEPROM.</td></tr>
<tr><td><a href="http://www.vectrex.biz/MemCard.htm">SaveKey</a></td><td>A 32K EEPROM for saving high scores, etc (the EEPROM portion of an AtariVox).</td></tr>
<tr><td>Genesis </td><td>Sega Genesis controller, which can be used similar to a BoosterGrip, giving two extra buttons.</td></tr>
<tr><td>Genesis </td><td>Sega Genesis controller, which can be used similar to a BoosterGrip, giving an extra button.</td></tr>
</table></td>
</tr>
@ -3163,6 +3150,30 @@ Ms Pac-Man (Stella extended codes):
'Console.SwapPorts'. The value must be <b>Yes</b> or <b>No</b>.</td>
</tr>
<tr>
<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).
Currently, the mouse X-axis and left button are tied together, as are the
Y-axis and right button. The value must be <b>Auto</b> or <b>XY</b>, as follows:
<table cellpadding="2" border="1">
<tr><th>&nbsp;Id&nbsp;</th><th>Controller</th></tr>
<tr><td>0 </td><td>Paddle 0</td></tr>
<tr><td>1 </td><td>Paddle 1</td></tr>
<tr><td>2 </td><td>Paddle 2</td></tr>
<tr><td>3 </td><td>Paddle 3</td></tr>
<tr><td>4 </td><td>Driving 0</td></tr>
<tr><td>5 </td><td>Driving 1</td></tr>
<tr><td>7 </td><td>Axis disabled</td></tr>
</table></td>
</tr>
<!--
In the latter case, XY indicates
how to use the X/Y axis (ie, 02 is paddle0/paddle2).
-->
<tr>
<td VALIGN="TOP"><i>Display.Format:</i></td>
<td>Indicates the television format the game was designed for. The value

View File

@ -96,8 +96,6 @@ void BoosterGrip::update()
myDigitalPinState[One] = false;
// 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(myControlID > -1)
{
// The following code was taken from z26

View File

@ -73,8 +73,6 @@ void Driving::update()
else if(myEvent.get(myCWEvent) != 0 || d_axis > 16384) myCounter++;
// 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(myControlID > -1)
{
int m_axis = myEvent.get(Event::MouseAxisXValue);

View File

@ -22,7 +22,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Genesis::Genesis(Jack jack, const Event& event, const System& system)
: Controller(jack, event, system, Controller::Genesis)
: Controller(jack, event, system, Controller::Genesis),
myControlID(-1)
{
if(myJack == Left)
{
@ -69,4 +70,51 @@ void Genesis::update()
// in that the logic is inverted
myAnalogPinValue[Five] = (myEvent.get(myFire2Event) == 0) ?
minimumResistance : maximumResistance;
// Mouse motion and button events
if(myControlID > -1)
{
// The following code was taken from z26
#define MJ_Threshold 2
int mousex = myEvent.get(Event::MouseAxisXValue),
mousey = myEvent.get(Event::MouseAxisYValue);
if(mousex || mousey)
{
if((!(abs(mousey) > abs(mousex) << 1)) && (abs(mousex) >= MJ_Threshold))
{
if(mousex < 0)
myDigitalPinState[Three] = false;
else if (mousex > 0)
myDigitalPinState[Four] = false;
}
if((!(abs(mousex) > abs(mousey) << 1)) && (abs(mousey) >= MJ_Threshold))
{
if(mousey < 0)
myDigitalPinState[One] = false;
else if(mousey > 0)
myDigitalPinState[Two] = false;
}
}
// Get mouse button state
if(myEvent.get(Event::MouseButtonLeftValue))
myDigitalPinState[Six] = false;
if(myEvent.get(Event::MouseButtonRightValue))
myAnalogPinValue[Five] = maximumResistance;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Genesis::setMouseControl(
MouseControl::Axis xaxis, MouseControl::Axis yaxis, int ctrlID)
{
// In 'automatic' mode, both axes on the mouse map to a single Genesis
if(xaxis == MouseControl::Automatic || yaxis == MouseControl::Automatic)
{
myControlID = ((myJack == Left && ctrlID == 0) ||
(myJack == Right && ctrlID == 1)
) ? ctrlID : -1;
}
else // Otherwise, Genesis controllers are not used in 'non-auto' mode
myControlID = -1;
}

View File

@ -57,11 +57,32 @@ class Genesis : public Controller
*/
void update();
/**
Determines how this controller will treat values received from the
X/Y axis and left/right buttons 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 the ctrlID for the control type.
In the current implementation, the left button is tied to the X axis,
and the right one tied to the Y axis.
@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(
MouseControl::Axis xaxis, MouseControl::Axis 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,
myFire1Event, myFire2Event;
// Controller to emulate in mouse axis 'automatic' mode
int myControlID;
};
#endif

View File

@ -88,8 +88,6 @@ void Joystick::update()
myDigitalPinState[One] = false;
// 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(myControlID > -1)
{
// The following code was taken from z26