Allow users to specify Paddle device for applen.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
0e574fad7b
commit
ed27650368
6 changed files with 33 additions and 14 deletions
4
linux.md
4
linux.md
|
@ -71,11 +71,11 @@ Keyboard shortcuts
|
||||||
In order to properly appreciate the wider hi res graphics, open a big terminal window and choose a small font size.
|
In order to properly appreciate the wider hi res graphics, open a big terminal window and choose a small font size.
|
||||||
Try ``CTRL-`` as well if ``ALT-`` does not work: terminals do not report a consistent keycode for these combinations.
|
Try ``CTRL-`` as well if ``ALT-`` does not work: terminals do not report a consistent keycode for these combinations.
|
||||||
|
|
||||||
The joystick uses evdev (currently the device name is hardcoded).
|
The joystick uses evdev (``--device-name /dev/input/by-id/id_of_device``).
|
||||||
|
|
||||||
### qapple
|
### qapple
|
||||||
|
|
||||||
This is based on Qt, currently tested with 5.10
|
This is based on Qt.
|
||||||
|
|
||||||
* keyboard shortcuts are listed in the menu entries
|
* keyboard shortcuts are listed in the menu entries
|
||||||
* graphics: runs the native NTSC code
|
* graphics: runs the native NTSC code
|
||||||
|
|
|
@ -56,10 +56,15 @@ bool getEmulatorOptions(int argc, const char * argv [], const std::string & edit
|
||||||
("headless", "Headless: disable video (freewheel)")
|
("headless", "Headless: disable video (freewheel)")
|
||||||
("fixed-speed", "Fixed (non-adaptive) speed")
|
("fixed-speed", "Fixed (non-adaptive) speed")
|
||||||
("ntsc,nt", "NTSC: execute NTSC code")
|
("ntsc,nt", "NTSC: execute NTSC code")
|
||||||
("benchmark,b", "Benchmark emulator")
|
("benchmark,b", "Benchmark emulator");
|
||||||
("no-squaring", "Gamepad range is (already) a square");
|
|
||||||
desc.add(emulatorDesc);
|
desc.add(emulatorDesc);
|
||||||
|
|
||||||
|
po::options_description paddleDesc("Paddle");
|
||||||
|
paddleDesc.add_options()
|
||||||
|
("no-squaring", "Gamepad range is (already) a square")
|
||||||
|
("device-name", po::value<std::string>(), "Gamepad device name");
|
||||||
|
desc.add(paddleDesc);
|
||||||
|
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -113,9 +118,14 @@ bool getEmulatorOptions(int argc, const char * argv [], const std::string & edit
|
||||||
options.headless = vm.count("headless") > 0;
|
options.headless = vm.count("headless") > 0;
|
||||||
options.log = vm.count("log") > 0;
|
options.log = vm.count("log") > 0;
|
||||||
options.ntsc = vm.count("ntsc") > 0;
|
options.ntsc = vm.count("ntsc") > 0;
|
||||||
options.squaring = vm.count("no-squaring") == 0;
|
|
||||||
options.fixedSpeed = vm.count("fixed-speed") > 0;
|
options.fixedSpeed = vm.count("fixed-speed") > 0;
|
||||||
|
|
||||||
|
options.paddleSquaring = vm.count("no-squaring") == 0;
|
||||||
|
if (vm.count("device-name"))
|
||||||
|
{
|
||||||
|
options.paddleDeviceName = vm["device-name"].as<std::string>();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (const po::error& e)
|
catch (const po::error& e)
|
||||||
|
@ -152,5 +162,5 @@ void applyOptions(const EmulatorOptions & options)
|
||||||
setSnapshotFilename(options.snapshotFilename, options.loadSnapshot);
|
setSnapshotFilename(options.snapshotFilename, options.loadSnapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
Paddle::setSquaring(options.squaring);
|
Paddle::setSquaring(options.paddleSquaring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,10 @@ struct EmulatorOptions
|
||||||
bool headless = false;
|
bool headless = false;
|
||||||
bool ntsc = false; // only for applen
|
bool ntsc = false; // only for applen
|
||||||
|
|
||||||
bool squaring = true; // turn the x/y range to a square
|
bool paddleSquaring = true; // turn the x/y range to a square
|
||||||
|
// on my PC it is something like
|
||||||
|
// "/dev/input/by-id/usb-©Microsoft_Corporation_Controller_1BBE3DB-event-joystick"
|
||||||
|
std::string paddleDeviceName;
|
||||||
|
|
||||||
bool saveConfigurationOnExit = false;
|
bool saveConfigurationOnExit = false;
|
||||||
bool useQtIni = false; // use Qt .ini file (read only)
|
bool useQtIni = false; // use Qt .ini file (read only)
|
||||||
|
|
|
@ -148,8 +148,9 @@ namespace
|
||||||
g_nMemoryClearType = options.memclear;
|
g_nMemoryClearType = options.memclear;
|
||||||
|
|
||||||
initialiseEmulator();
|
initialiseEmulator();
|
||||||
NVideoInitialize(options.headless);
|
NVideoInitialise(options.headless);
|
||||||
applyOptions(options);
|
applyOptions(options);
|
||||||
|
PaddleInitialise(options.paddleDeviceName);
|
||||||
|
|
||||||
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
|
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
|
||||||
|
|
||||||
|
|
|
@ -239,15 +239,17 @@ int MessageBox(HWND, const char * text, const char * caption, UINT)
|
||||||
return IDOK;
|
return IDOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NVideoInitialize(const bool headless)
|
void PaddleInitialise(const std::string & device)
|
||||||
|
{
|
||||||
|
paddle.reset(new EvDevPaddle(device));
|
||||||
|
Paddle::instance = paddle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NVideoInitialise(const bool headless)
|
||||||
{
|
{
|
||||||
frame.reset(new Frame());
|
frame.reset(new Frame());
|
||||||
asciiArt.reset(new ASCIIArt());
|
asciiArt.reset(new ASCIIArt());
|
||||||
|
|
||||||
paddle.reset(new EvDevPaddle("/dev/input/by-id/usb-©Microsoft_Corporation_Controller_1BBE3DB-event-joystick"));
|
|
||||||
|
|
||||||
Paddle::instance = paddle;
|
|
||||||
|
|
||||||
if (headless)
|
if (headless)
|
||||||
{
|
{
|
||||||
signal(SIGINT, sig_handler_exit);
|
signal(SIGINT, sig_handler_exit);
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
int ProcessKeyboard();
|
int ProcessKeyboard();
|
||||||
void ProcessInput();
|
void ProcessInput();
|
||||||
void NVideoInitialize(const bool headless);
|
void NVideoInitialise(const bool headless);
|
||||||
void NVideoRedrawScreen();
|
void NVideoRedrawScreen();
|
||||||
|
void PaddleInitialise(const std::string & device);
|
||||||
|
|
||||||
extern double g_relativeSpeed;
|
extern double g_relativeSpeed;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue