This commit is contained in:
thrust26 2019-02-11 15:53:07 +01:00
commit b6b5930a2d
6 changed files with 53 additions and 16 deletions

View File

@ -34,8 +34,13 @@ using Int16 = int16_t;
using uInt16 = uint16_t;
using Int32 = int32_t;
using uInt32 = uint32_t;
#ifdef RETRON77
using Int64 = int32_t;
using uInt64 = uint32_t;
#else
using Int64 = int64_t;
using uInt64 = uint64_t;
#endif
// The following code should provide access to the standard C++ objects and
// types: cout, cerr, string, ostream, istream, etc.

View File

@ -369,8 +369,12 @@ Bankswitch::Type CartDetector::autodetectType(const BytePtr& image, uInt32 size)
else if(size == 8*1024) // 8K
{
// First check for *potential* F8
uInt8 signature[] = { 0x8D, 0xF9, 0x1F }; // STA $1FF9
bool f8 = searchForBytes(image.get(), size, signature, 3, 2);
uInt8 signature[2][3] = {
{ 0x8D, 0xF9, 0x1F }, // STA $1FF9
{ 0x8D, 0xF9, 0xFF } // STA $FFF9
};
bool f8 = searchForBytes(image.get(), size, signature[0], 3, 2) ||
searchForBytes(image.get(), size, signature[1], 3, 2);
if(isProbablySC(image, size))
type = Bankswitch::Type::_F8SC;

View File

@ -1096,7 +1096,9 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
void DeveloperDialog::handleSettings(bool devSettings)
{
myUndrivenPinsWidget->setEnabled(devSettings);
#ifdef DEBUGGER_SUPPORT
myRWPortBreakWidget->setEnabled(devSettings);
#endif
myThumbExceptionWidget->setEnabled(devSettings);
if (mySettings != devSettings)

View File

@ -6,3 +6,21 @@ KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f
# 2600-daptor II (Microchip Technology Inc. / 2600-daptor II)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f947", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"
# Astro-daptor (Microchip Technology Inc. / Astro-daptor)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f809", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"
# 5200-daptor (Microchip Technology Inc. / 5200-daptor)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f6ec", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"
# 2600-daptor D9 (Microchip Technology Inc. / 2600-daptor D9)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f6eb", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"
# Ultimate 2600-daptor (Microchip Technology Inc. / Ultimate 2600-daptor)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d4e2", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"
# Ultimate Flashback (Microchip Technology Inc. / Ultimate Flashback)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="edec", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"
# 2600=daptor D9 (Microchip Technology Inc. / 2600=daptor D9)
KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="edd9", ACTION=="add", RUN+="/usr/local/bin/evdev-joystick --e /dev/input/%k --d 0"

View File

@ -9,9 +9,9 @@ It is developed by Stephen Anthony, and released under the GPL/v2.
evdev-joystick is used to set the deadzone for Linux 'evdev' joystick devices.
Currently, other than G25manage there is no other standalone program available
to perform such calibration. This program was originally developed for Stella
(https://stella-emu.github.io), an Atari 2600 emulator, and as such much of this document
refers to Stella. The program itself can be used to calibrate any joystick
for any application, though, and is not specific to Stella.
(https://stella-emu.github.io), an Atari 2600 emulator, and as such much of
this document refers to Stella. The program itself can be used to calibrate
any joystick for any application, though, and is not specific to Stella.
Short Explanation (Stella users with Stelladaptor, 2600-daptor, etc.)

View File

@ -32,11 +32,19 @@
*/
#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 */
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);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void help()
void help(void)
{
printf("%s","Usage:\n\n"
" --help, --h The message you're now reading\n"
@ -72,7 +80,7 @@ void help()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void listDevices()
void listDevices(void)
{
DIR* dirp = opendir(EVDEV_DIR);
struct dirent* dp;
@ -81,11 +89,11 @@ void listDevices()
return;
// Loop over dir entries using readdir
int len = strlen("event-joystick");
size_t len = strlen("event-joystick");
while((dp = readdir(dirp)) != NULL)
{
// Only select names that end in 'event-joystick'
int devlen = strlen(dp->d_name);
size_t devlen = strlen(dp->d_name);
if(devlen >= len)
{
const char* const start = dp->d_name + devlen - len;
@ -129,11 +137,11 @@ void printAxisType(int i)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int showCalibration(const char* evdev)
int showCalibration(const char* const evdev)
{
int fd = -1, axisindex;
uint8_t abs_bitmask[ABS_MAX/8 + 1];
float percent_deadzone;
double percent_deadzone;
struct input_absinfo abs_features;
if((fd = open(evdev, O_RDONLY)) < 0)
@ -159,7 +167,7 @@ int showCalibration(const char* evdev)
if(ioctl(fd, EVIOCGABS(axisindex), &abs_features))
perror("evdev EVIOCGABS ioctl");
percent_deadzone = (float)abs_features.flat * 100 / (float)abs_features.maximum;
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);
@ -171,12 +179,12 @@ int showCalibration(const char* evdev)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int setDeadzoneAndFuzz(const char* evdev, int axisindex,
int setDeadzoneAndFuzz(const char* const evdev, int axisindex,
__s32 deadzonevalue, __s32 fuzzvalue)
{
int fd = -1;
uint8_t abs_bitmask[ABS_MAX/8 + 1];
float percent_deadzone;
double percent_deadzone;
struct input_absinfo abs_features;
if ((fd = open(evdev, O_RDONLY)) < 0)
@ -248,7 +256,7 @@ int setDeadzoneAndFuzz(const char* evdev, int axisindex,
perror("evdev EVIOCGABS ioctl");
return 1;
}
percent_deadzone = (float)abs_features.flat * 100 / (float)abs_features.maximum;
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);