2012-01-02 16:37:17 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
2012-01-02 16:37:17 +00:00
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2019-01-01 15:05:51 +00:00
|
|
|
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
2012-01-02 16:37:17 +00:00
|
|
|
// and the Stella Team
|
|
|
|
//
|
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef MINDLINK_HXX
|
|
|
|
#define MINDLINK_HXX
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "Control.hxx"
|
|
|
|
|
|
|
|
/**
|
|
|
|
The Atari Mindlink was an unreleased video game controller intended for
|
|
|
|
release in 1984. The Mindlink was unique in that one had to move the
|
|
|
|
muscles in one's head to control the game. These movements would be read by
|
|
|
|
infrared sensors and transferred as movement in the game. For more
|
|
|
|
information, see the following link:
|
|
|
|
|
|
|
|
http://www.atarimuseum.com/videogames/consoles/2600/mindlink.html
|
|
|
|
|
|
|
|
This code was heavily borrowed from z26, and uses conventions defined
|
|
|
|
there. Specifically, IOPortA is treated as a complete uInt8, whereas
|
|
|
|
the Stella core actually stores this information in boolean arrays
|
|
|
|
addressable by DigitalPin number.
|
|
|
|
|
|
|
|
@author Stephen Anthony & z26 team
|
|
|
|
*/
|
|
|
|
class MindLink : public Controller
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Create a new MindLink 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
|
|
|
|
*/
|
|
|
|
MindLink(Jack jack, const Event& event, const System& system);
|
2015-12-29 21:28:10 +00:00
|
|
|
virtual ~MindLink() = default;
|
2012-01-02 16:37:17 +00:00
|
|
|
|
|
|
|
public:
|
2012-03-25 14:42:09 +00:00
|
|
|
/**
|
|
|
|
Write the given value to the specified digital pin for this
|
|
|
|
controller. Writing is only allowed to the pins associated
|
|
|
|
with the PIA. Therefore you cannot write to pin six.
|
|
|
|
|
|
|
|
@param pin The pin of the controller jack to write to
|
|
|
|
@param value The value to write to the pin
|
|
|
|
*/
|
2019-03-29 23:17:24 +00:00
|
|
|
void write(DigitalPin pin, bool value) override { setPin(pin, value); }
|
2012-03-25 14:42:09 +00:00
|
|
|
|
2012-01-02 16:37:17 +00:00
|
|
|
/**
|
|
|
|
Called after *all* digital pins have been written on Port A.
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
void controlWrite(uInt8) override { nextMindlinkBit(); }
|
2012-01-02 16:37:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Update the entire digital and analog pin state according to the
|
|
|
|
events currently set.
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
void update() override;
|
2012-01-02 16:37:17 +00:00
|
|
|
|
2019-03-29 23:17:24 +00:00
|
|
|
/**
|
|
|
|
Returns the name of this controller.
|
|
|
|
*/
|
|
|
|
string name() const override { return "MindLink"; }
|
|
|
|
|
2018-03-17 22:33:05 +00:00
|
|
|
/**
|
|
|
|
Answers whether the controller is intrinsically an analog controller.
|
|
|
|
*/
|
|
|
|
bool isAnalog() const override { return true; }
|
|
|
|
|
2012-04-19 13:00:02 +00:00
|
|
|
/**
|
|
|
|
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 the same way (or at all), it's up to the specific class to
|
|
|
|
decide how to use this data.
|
|
|
|
|
|
|
|
In the current implementation, the left button is tied to the X axis,
|
|
|
|
and the right one tied to the Y axis.
|
|
|
|
|
|
|
|
@param xtype The controller to use for x-axis data
|
|
|
|
@param xid The controller ID to use for x-axis data (-1 for no id)
|
|
|
|
@param ytype The controller to use for y-axis data
|
|
|
|
@param yid The controller ID to use for y-axis data (-1 for no id)
|
|
|
|
|
|
|
|
@return Whether the controller supports using the mouse
|
|
|
|
*/
|
|
|
|
bool setMouseControl(
|
2015-07-10 18:59:03 +00:00
|
|
|
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
|
2012-04-19 13:00:02 +00:00
|
|
|
|
2012-01-02 16:37:17 +00:00
|
|
|
private:
|
|
|
|
void nextMindlinkBit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Position value in Mindlink controller
|
2016-12-30 00:00:30 +00:00
|
|
|
// Gets transferred bitwise (16 bits)
|
2019-12-29 22:06:56 +00:00
|
|
|
int myMindlinkPos{0x2800};
|
2012-01-02 16:37:17 +00:00
|
|
|
|
|
|
|
// Which bit to transfer next
|
2019-12-29 22:06:56 +00:00
|
|
|
int myMindlinkShift{1};
|
2012-04-19 13:00:02 +00:00
|
|
|
|
|
|
|
// Whether to use the mouse to emulate this controller
|
2019-12-29 22:06:56 +00:00
|
|
|
int myMouseEnabled{false};
|
2015-04-26 19:02:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Following constructors and assignment operators not supported
|
|
|
|
MindLink() = delete;
|
|
|
|
MindLink(const MindLink&) = delete;
|
|
|
|
MindLink(MindLink&&) = delete;
|
|
|
|
MindLink& operator=(const MindLink&) = delete;
|
|
|
|
MindLink& operator=(MindLink&&) = delete;
|
2012-01-02 16:37:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|