mirror of https://github.com/stella-emu/stella.git
Merge branch 'master' of https://github.com/stella-emu/stella
This commit is contained in:
commit
469f246053
|
@ -95,6 +95,11 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
|
|||
else
|
||||
_isDirectory = true;
|
||||
|
||||
// Create a concrete FSNode to use
|
||||
// This *must not* be a ZIP file; it must be a real FSNode object that
|
||||
// has direct access to the actual filesystem (aka, a 'System' node)
|
||||
// Behind the scenes, this node is actually a platform-specific object
|
||||
// for whatever system we are running on
|
||||
_realNode = FilesystemNodeFactory::create(_zipFile, FilesystemNodeFactory::Type::SYSTEM);
|
||||
|
||||
setFlags(_zipFile, _virtualPath, _realNode);
|
||||
|
|
|
@ -93,7 +93,10 @@ class FilesystemNodeZIP : public AbstractFSNode
|
|||
NO_ROMS
|
||||
};
|
||||
|
||||
// Since a ZIP file is itself an abstraction, it still needs access to
|
||||
// an actual concrete filesystem node
|
||||
AbstractFSNodePtr _realNode;
|
||||
|
||||
string _zipFile, _virtualPath;
|
||||
string _name, _path, _shortPath;
|
||||
zip_error _error;
|
||||
|
|
|
@ -137,7 +137,7 @@ Bankswitch::Description Bankswitch::BSList[int(Bankswitch::Type::NumSchemes)] =
|
|||
{ "UA", "UA (8K UA Ltd.)" },
|
||||
{ "WD", "WD (Experimental)" },
|
||||
{ "X07", "X07 (64K AtariAge)" },
|
||||
#ifdef CUSTOM_ARM
|
||||
#if defined(CUSTOM_ARM)
|
||||
{ "CUSTOM", "CUSTOM (ARM)" }
|
||||
#endif
|
||||
};
|
||||
|
@ -149,11 +149,12 @@ Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
|
|||
{ "a26", Bankswitch::Type::_AUTO },
|
||||
{ "bin", Bankswitch::Type::_AUTO },
|
||||
{ "rom", Bankswitch::Type::_AUTO },
|
||||
{ "gz", Bankswitch::Type::_AUTO },
|
||||
#if defined(ZIP_SUPPORT)
|
||||
{ "zip", Bankswitch::Type::_AUTO },
|
||||
#endif
|
||||
{ "cu", Bankswitch::Type::_AUTO },
|
||||
|
||||
// All bankswitch types (tose that UnoCart and HarmonyCart support have the same name)
|
||||
// All bankswitch types (those that UnoCart and HarmonyCart support have the same name)
|
||||
{ "084", Bankswitch::Type::_0840 },
|
||||
{ "2N1", Bankswitch::Type::_2IN1 },
|
||||
{ "4N1", Bankswitch::Type::_4IN1 },
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
all : evdev-joystick
|
||||
|
||||
evdev-joystick: evdev-joystick.c
|
||||
gcc -Wall -O2 -o evdev-joystick evdev-joystick.c
|
||||
$(CC) -Wall -O2 -o evdev-joystick evdev-joystick.c
|
||||
|
||||
install: evdev-joystick 80-stelladaptor-joystick.rules
|
||||
install -s evdev-joystick /usr/local/bin/
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -32,16 +33,20 @@
|
|||
*/
|
||||
#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8)))
|
||||
|
||||
/* The default location for evdev devices in Linux */
|
||||
// The default location for evdev devices in Linux
|
||||
#define EVDEV_DIR "/dev/input/by-id/"
|
||||
|
||||
/* Function signatures; see actual functions for documentation */
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Function signatures; see actual functions for documentation
|
||||
void help(void);
|
||||
void listDevices(void);
|
||||
void printAxisType(int i);
|
||||
int showCalibration(const char* const evdev);
|
||||
int setDeadzoneAndFuzz(const char* const evdev, int axisindex,
|
||||
__s32 deadzonevalue, __s32 fuzzvalue);
|
||||
int setAxisInfo(const char* evdev, int axisindex,
|
||||
__s32 minvalue, __s32 maxvalue,
|
||||
__s32 deadzonevalue, __s32 fuzzvalue);
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void help(void)
|
||||
|
@ -51,6 +56,8 @@ void help(void)
|
|||
" --listdevs, --l List all joystick devices found\n"
|
||||
" --showcal, --s [path] Show current calibration for joystick device\n"
|
||||
" --evdev, --e [path] Set the joystick device to modify\n"
|
||||
" --minimum, --m [val] Change minimum for current joystick\n"
|
||||
" --maximum, --M [val] Change maximum for current joystick\n"
|
||||
" --deadzone, --d [val] Change deadzone for current joystick\n"
|
||||
" --fuzz, --f [val] Change fuzz for current joystick\n"
|
||||
" --axis, --a [val] The axis to modify for current joystick (by default, all axes)\n"
|
||||
|
@ -61,18 +68,21 @@ void help(void)
|
|||
"To set the deadzone values:\n"
|
||||
" evdev-joystick [ --e /path/to/event/device/file --d deadzone_value [ --a axis_index ] ]\n"
|
||||
"\n"
|
||||
"To set the minimum and maximum range values:\n"
|
||||
" evdev-joystick [ --e /path/to/event/device/file --m minimum_value --M maximum_value [ --a axis_index ] ]\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
"\n"
|
||||
"I want to see the calibration values of my event managed joystick:\n"
|
||||
" evdev-joystick --s /dev/input/event6\n"
|
||||
"\n"
|
||||
"Supported Absolute axes:\n"
|
||||
" Absolute axis 0x00 (0) (X Axis) (min: 0, max: 16383, flatness: 1023 (=6.24%), fuzz: 63)\n"
|
||||
" Absolute axis 0x01 (1) (Y Axis) (min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n"
|
||||
" Absolute axis 0x02 (2) (Z Axis) (min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n"
|
||||
" Absolute axis 0x05 (5) (Z Rate Axis) (min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n"
|
||||
" Absolute axis 0x10 (16) (Hat zero, x axis) (min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n"
|
||||
" Absolute axis 0x11 (17) (Hat zero, y axis) (min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n"
|
||||
" Absolute axis 0x00 (0) (X Axis) (value: 387, min: 0, max: 16383, flatness: 1023 (=6.24%), fuzz: 63)\n"
|
||||
" Absolute axis 0x01 (1) (Y Axis) (value: 216, min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n"
|
||||
" Absolute axis 0x02 (2) (Z Axis) (value: 0, min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n"
|
||||
" Absolute axis 0x05 (5) (Z Rate Axis) (value: 101, min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n"
|
||||
" Absolute axis 0x10 (16) (Hat zero, x axis) (value: 0, min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n"
|
||||
" Absolute axis 0x11 (17) (Hat zero, y axis) (value: 0, min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n"
|
||||
"\n"
|
||||
"I want to get rid of the deadzone on all axes on my joystick:\n"
|
||||
" evdev-joystick --e /dev/input/event6 --d 0\n"
|
||||
|
@ -167,10 +177,10 @@ int showCalibration(const char* const evdev)
|
|||
if(ioctl(fd, EVIOCGABS(axisindex), &abs_features))
|
||||
perror("evdev EVIOCGABS ioctl");
|
||||
|
||||
percent_deadzone = (double)(abs_features.flat * 100.0 / abs_features.maximum);
|
||||
printf("(min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n",
|
||||
abs_features.minimum, abs_features.maximum, abs_features.flat,
|
||||
percent_deadzone, abs_features.fuzz);
|
||||
percent_deadzone = (double)abs_features.flat * 100 / (double)abs_features.maximum;
|
||||
printf("(value: %d, min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n",
|
||||
abs_features.value, abs_features.minimum, abs_features.maximum,
|
||||
abs_features.flat, percent_deadzone, abs_features.fuzz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,8 +189,9 @@ int showCalibration(const char* const evdev)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int setDeadzoneAndFuzz(const char* const evdev, int axisindex,
|
||||
__s32 deadzonevalue, __s32 fuzzvalue)
|
||||
int setAxisInfo(const char* evdev, int axisindex,
|
||||
__s32 minvalue, __s32 maxvalue,
|
||||
__s32 deadzonevalue, __s32 fuzzvalue)
|
||||
{
|
||||
int fd = -1;
|
||||
uint8_t abs_bitmask[ABS_MAX/8 + 1];
|
||||
|
@ -218,7 +229,19 @@ int setDeadzoneAndFuzz(const char* const evdev, int axisindex,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if(deadzonevalue != -1)
|
||||
if(minvalue != INT_MIN)
|
||||
{
|
||||
printf("Setting min value to : %d\n", minvalue);
|
||||
abs_features.minimum = minvalue;
|
||||
}
|
||||
|
||||
if(maxvalue != INT_MIN)
|
||||
{
|
||||
printf("Setting max value to : %d\n", maxvalue);
|
||||
abs_features.maximum = maxvalue;
|
||||
}
|
||||
|
||||
if(deadzonevalue != INT_MIN)
|
||||
{
|
||||
if(deadzonevalue < abs_features.minimum ||
|
||||
deadzonevalue > abs_features.maximum )
|
||||
|
@ -232,7 +255,7 @@ int setDeadzoneAndFuzz(const char* const evdev, int axisindex,
|
|||
abs_features.flat = deadzonevalue;
|
||||
}
|
||||
|
||||
if(fuzzvalue != -1)
|
||||
if(fuzzvalue != INT_MIN)
|
||||
{
|
||||
if(fuzzvalue < abs_features.minimum ||
|
||||
fuzzvalue > abs_features.maximum )
|
||||
|
@ -256,10 +279,10 @@ int setDeadzoneAndFuzz(const char* const evdev, int axisindex,
|
|||
perror("evdev EVIOCGABS ioctl");
|
||||
return 1;
|
||||
}
|
||||
percent_deadzone = (double)(abs_features.flat * 100.0 / abs_features.maximum);
|
||||
printf(" (min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n",
|
||||
abs_features.minimum, abs_features.maximum, abs_features.flat,
|
||||
percent_deadzone, abs_features.fuzz);
|
||||
percent_deadzone = (double)abs_features.flat * 100 / (double)abs_features.maximum;
|
||||
printf(" (value: %d, min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n",
|
||||
abs_features.value, abs_features.minimum, abs_features.maximum,
|
||||
abs_features.flat, percent_deadzone, abs_features.fuzz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +295,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
char* evdevice = NULL;
|
||||
int c, axisindex = -1;
|
||||
__s32 flat = -1, fuzz = -1;
|
||||
__s32 min = INT_MIN, max = INT_MIN, flat = INT_MIN, fuzz = INT_MIN;
|
||||
|
||||
// Show help by default
|
||||
if(argc == 1)
|
||||
|
@ -289,6 +312,8 @@ int main(int argc, char* argv[])
|
|||
{ "listdevs", no_argument, 0, 'l' },
|
||||
{ "showcal", required_argument, 0, 's' },
|
||||
{ "evdev", required_argument, 0, 'e' },
|
||||
{ "minimum", required_argument, 0, 'm' },
|
||||
{ "maximum", required_argument, 0, 'M' },
|
||||
{ "deadzone", required_argument, 0, 'd' },
|
||||
{ "fuzz", required_argument, 0, 'f' },
|
||||
{ "axis", required_argument, 0, 'a' },
|
||||
|
@ -297,7 +322,7 @@ int main(int argc, char* argv[])
|
|||
// getopt_long stores the option index here
|
||||
int option_index = 0;
|
||||
|
||||
c = getopt_long(argc, argv, "h:l:s:e:d:f:a:", long_options, &option_index);
|
||||
c = getopt_long(argc, argv, "h:l:s:e:d:m:M:f:a:", long_options, &option_index);
|
||||
|
||||
// Detect the end of the options
|
||||
if(c == -1)
|
||||
|
@ -338,6 +363,16 @@ int main(int argc, char* argv[])
|
|||
printf("New dead zone value: %d\n", flat);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
min = atoi(optarg);
|
||||
printf("New min value: %d\n", min);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
max = atoi(optarg);
|
||||
printf("New max value: %d\n", max);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
fuzz = atoi(optarg);
|
||||
printf("New fuzz value: %d\n", fuzz);
|
||||
|
@ -366,7 +401,7 @@ int main(int argc, char* argv[])
|
|||
putchar('\n');
|
||||
}
|
||||
|
||||
if(flat != -1 || fuzz != -1)
|
||||
if(min != INT_MIN || max != INT_MIN || flat != INT_MIN || fuzz != INT_MIN)
|
||||
{
|
||||
if(evdevice == NULL)
|
||||
{
|
||||
|
@ -377,20 +412,28 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
if(axisindex == -1)
|
||||
{
|
||||
if(flat != -1)
|
||||
if(min != INT_MIN)
|
||||
printf( "Trying to set all axes minimum to: %d\n", min);
|
||||
if(max != INT_MIN)
|
||||
printf( "Trying to set all axes maximum to: %d\n", max);
|
||||
if(flat != INT_MIN)
|
||||
printf( "Trying to set all axes deadzone to: %d\n", flat);
|
||||
if(fuzz != -1)
|
||||
if(fuzz != INT_MIN)
|
||||
printf( "Trying to set all axes fuzz to: %d\n", fuzz);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(flat != -1)
|
||||
if(min != INT_MIN)
|
||||
printf( "Trying to set axis %d minimum to: %d\n", axisindex, min);
|
||||
if(max != INT_MIN)
|
||||
printf( "Trying to set axis %d maximum to: %d\n", axisindex, max);
|
||||
if(flat != INT_MIN)
|
||||
printf( "Trying to set axis %d deadzone to: %d\n", axisindex, flat);
|
||||
if(fuzz != -1)
|
||||
if(fuzz != INT_MIN)
|
||||
printf( "Trying to set axis %d fuzz to: %d\n", axisindex, fuzz);
|
||||
}
|
||||
|
||||
setDeadzoneAndFuzz(evdevice, axisindex, flat, fuzz);
|
||||
setAxisInfo(evdevice, axisindex, min, max, flat, fuzz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue