mirror of https://github.com/stella-emu/stella.git
add missing files
This commit is contained in:
parent
bf4b63cb1c
commit
f19792a9e2
|
@ -0,0 +1,73 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// 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.
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Event.hxx"
|
||||||
|
#include "Joystick.hxx"
|
||||||
|
#include "QuadTari.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
QuadTari::QuadTari(Jack jack, const Event& event, const System& system)
|
||||||
|
: Controller(jack, event, system, Controller::Type::QuadTari)
|
||||||
|
{
|
||||||
|
// TODO: allow multiple controller types
|
||||||
|
if(myJack == Jack::Left)
|
||||||
|
{
|
||||||
|
myFirstController = make_unique<Joystick>(Jack::Left, event, system);
|
||||||
|
mySecondController = make_unique<Joystick>(Jack::Right, event, system); // TODO: use P2 mapping
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myFirstController = make_unique<Joystick>(Jack::Right, event, system);
|
||||||
|
mySecondController = make_unique<Joystick>(Jack::Left, event, system); // TODO: use P3 mapping
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool QuadTari::read(DigitalPin pin)
|
||||||
|
{
|
||||||
|
// We need to override the Controller::read() method, since the QuadTari
|
||||||
|
// can switch the controller multiple times per frame
|
||||||
|
// (we can't just read 60 times per second in the ::update() method)
|
||||||
|
|
||||||
|
if(true) // TODO handle controller switch
|
||||||
|
return myFirstController->read(pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void QuadTari::update()
|
||||||
|
{
|
||||||
|
myFirstController->update();
|
||||||
|
mySecondController->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool QuadTari::isAnalog() const
|
||||||
|
{
|
||||||
|
// TODO: does this work?
|
||||||
|
return myFirstController->isAnalog() || mySecondController->isAnalog();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool QuadTari::setMouseControl(
|
||||||
|
Controller::Type xtype, int xid, Controller::Type ytype, int yid)
|
||||||
|
{
|
||||||
|
// TODO: does this work?
|
||||||
|
myFirstController->setMouseControl(xtype, xid, ytype, yid);
|
||||||
|
mySecondController->setMouseControl(xtype, xid, ytype, yid);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// 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 QUADTARI_HXX
|
||||||
|
#define QUADTARI_HXX
|
||||||
|
|
||||||
|
#include "Control.hxx"
|
||||||
|
#include "Event.hxx"
|
||||||
|
|
||||||
|
/**
|
||||||
|
The QuadTari controller.
|
||||||
|
|
||||||
|
@author Thomas Jentzsch
|
||||||
|
*/
|
||||||
|
class QuadTari: public Controller
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Create a QuadTari 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
|
||||||
|
*/
|
||||||
|
QuadTari(Jack jack, const Event& event, const System& system);
|
||||||
|
~QuadTari() override = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Read the value of the specified digital pin for this controller.
|
||||||
|
|
||||||
|
@param pin The pin of the controller jack to read
|
||||||
|
@return The state of the pin
|
||||||
|
*/
|
||||||
|
bool read(DigitalPin pin) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Update the entire digital and analog pin state according to the
|
||||||
|
events currently set.
|
||||||
|
*/
|
||||||
|
void update() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name of this controller.
|
||||||
|
// TODO: Or the names of the attached controllers?
|
||||||
|
*/
|
||||||
|
string name() const override { return "QuadTari"; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Answers whether the controller is intrinsically an analog controller.
|
||||||
|
TODO: Depends on the attached controllers.
|
||||||
|
*/
|
||||||
|
bool isAnalog() const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
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(
|
||||||
|
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
unique_ptr<Controller> myFirstController;
|
||||||
|
unique_ptr<Controller> mySecondController;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Following constructors and assignment operators not supported
|
||||||
|
QuadTari() = delete;
|
||||||
|
QuadTari(const QuadTari&) = delete;
|
||||||
|
QuadTari(QuadTari&&) = delete;
|
||||||
|
QuadTari& operator=(const QuadTari&) = delete;
|
||||||
|
QuadTari& operator=(QuadTari&&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -80,6 +80,7 @@ MODULE_OBJS := \
|
||||||
src/emucore/ProfilingRunner.o \
|
src/emucore/ProfilingRunner.o \
|
||||||
src/emucore/Props.o \
|
src/emucore/Props.o \
|
||||||
src/emucore/PropsSet.o \
|
src/emucore/PropsSet.o \
|
||||||
|
src/emucore/QuadTari.o \
|
||||||
src/emucore/SaveKey.o \
|
src/emucore/SaveKey.o \
|
||||||
src/emucore/Serializer.o \
|
src/emucore/Serializer.o \
|
||||||
src/emucore/Settings.o \
|
src/emucore/Settings.o \
|
||||||
|
|
Loading…
Reference in New Issue