vice-emu-commit Mailing List for VICE (Page 8)
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(38) |
May
(60) |
Jun
(122) |
Jul
(148) |
Aug
(178) |
Sep
(151) |
Oct
(131) |
Nov
(208) |
Dec
(129) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(193) |
Feb
(209) |
Mar
(221) |
Apr
(243) |
May
(165) |
Jun
(168) |
Jul
(198) |
Aug
(161) |
Sep
(103) |
Oct
(98) |
Nov
(168) |
Dec
(99) |
| 2010 |
Jan
(263) |
Feb
(156) |
Mar
(57) |
Apr
(93) |
May
(85) |
Jun
(124) |
Jul
(57) |
Aug
(58) |
Sep
(113) |
Oct
(148) |
Nov
(114) |
Dec
(193) |
| 2011 |
Jan
(200) |
Feb
(207) |
Mar
(91) |
Apr
(91) |
May
(142) |
Jun
(104) |
Jul
(115) |
Aug
(137) |
Sep
(266) |
Oct
(91) |
Nov
(85) |
Dec
(186) |
| 2012 |
Jan
(98) |
Feb
(146) |
Mar
(160) |
Apr
(99) |
May
(59) |
Jun
(257) |
Jul
(84) |
Aug
(103) |
Sep
(169) |
Oct
(206) |
Nov
(90) |
Dec
(296) |
| 2013 |
Jan
(294) |
Feb
(130) |
Mar
(36) |
Apr
(14) |
May
(51) |
Jun
(74) |
Jul
(180) |
Aug
(85) |
Sep
(26) |
Oct
(45) |
Nov
(29) |
Dec
(21) |
| 2014 |
Jan
(56) |
Feb
(40) |
Mar
(57) |
Apr
(30) |
May
(31) |
Jun
(11) |
Jul
(107) |
Aug
(135) |
Sep
(142) |
Oct
(195) |
Nov
(139) |
Dec
(133) |
| 2015 |
Jan
(293) |
Feb
(161) |
Mar
(146) |
Apr
(85) |
May
(139) |
Jun
(51) |
Jul
(21) |
Aug
(24) |
Sep
(29) |
Oct
(136) |
Nov
(212) |
Dec
(118) |
| 2016 |
Jan
(119) |
Feb
(165) |
Mar
(229) |
Apr
(219) |
May
(134) |
Jun
(119) |
Jul
(134) |
Aug
(236) |
Sep
(203) |
Oct
(215) |
Nov
(300) |
Dec
(140) |
| 2017 |
Jan
(188) |
Feb
(20) |
Mar
(147) |
Apr
(198) |
May
(26) |
Jun
(21) |
Jul
(67) |
Aug
(219) |
Sep
(209) |
Oct
(194) |
Nov
(144) |
Dec
(99) |
| 2018 |
Jan
(139) |
Feb
(122) |
Mar
(116) |
Apr
(85) |
May
(232) |
Jun
(181) |
Jul
(190) |
Aug
(105) |
Sep
(92) |
Oct
(178) |
Nov
(105) |
Dec
(86) |
| 2019 |
Jan
(119) |
Feb
(79) |
Mar
(74) |
Apr
(117) |
May
(115) |
Jun
(307) |
Jul
(107) |
Aug
(131) |
Sep
(103) |
Oct
(60) |
Nov
(118) |
Dec
(70) |
| 2020 |
Jan
(114) |
Feb
(103) |
Mar
(77) |
Apr
(121) |
May
(193) |
Jun
(110) |
Jul
(214) |
Aug
(210) |
Sep
(179) |
Oct
(260) |
Nov
(237) |
Dec
(334) |
| 2021 |
Jan
(163) |
Feb
(186) |
Mar
(58) |
Apr
(81) |
May
(108) |
Jun
(175) |
Jul
(154) |
Aug
(180) |
Sep
(217) |
Oct
(204) |
Nov
(232) |
Dec
(190) |
| 2022 |
Jan
(253) |
Feb
(134) |
Mar
(229) |
Apr
(190) |
May
(125) |
Jun
(70) |
Jul
(8) |
Aug
(22) |
Sep
(19) |
Oct
(33) |
Nov
(94) |
Dec
(164) |
| 2023 |
Jan
(158) |
Feb
(366) |
Mar
(272) |
Apr
(109) |
May
(198) |
Jun
(226) |
Jul
(200) |
Aug
(94) |
Sep
(108) |
Oct
(62) |
Nov
(175) |
Dec
(116) |
| 2024 |
Jan
(35) |
Feb
(40) |
Mar
(51) |
Apr
(89) |
May
(24) |
Jun
(26) |
Jul
(53) |
Aug
(71) |
Sep
(23) |
Oct
(11) |
Nov
(22) |
Dec
(58) |
| 2025 |
Jan
(26) |
Feb
(40) |
Mar
(107) |
Apr
(39) |
May
(35) |
Jun
(20) |
Jul
(11) |
Aug
(24) |
Sep
(35) |
Oct
(22) |
Nov
|
Dec
|
|
From: <gp...@us...> - 2025-04-07 20:09:25
|
Revision: 45627
http://sourceforge.net/p/vice-emu/code/45627
Author: gpz
Date: 2025-04-07 20:09:08 +0000 (Mon, 07 Apr 2025)
Log Message:
-----------
better check for invalid value
Modified Paths:
--------------
trunk/vice/src/tools/cartconv/cartconv.c
Modified: trunk/vice/src/tools/cartconv/cartconv.c
===================================================================
--- trunk/vice/src/tools/cartconv/cartconv.c 2025-04-07 20:08:04 UTC (rev 45626)
+++ trunk/vice/src/tools/cartconv/cartconv.c 2025-04-07 20:09:08 UTC (rev 45627)
@@ -1419,12 +1419,19 @@
}
return 2;
case 'l':
+ {
+ char *endptr = NULL;
checkarg(arg);
- load_address = (int)strtoul(arg, NULL, 0);
+ load_address = (int)strtoul(arg, &endptr, 0);
+ if (strlen(arg) != (endptr - arg)) {
+ fprintf(stderr, "ERROR: invalid characters in number '%s'.\n", arg);
+ exit(-1);
+ }
if (load_address == 0) {
fprintf(stderr, "WARNING: load address is 0, are you sure?\n");
}
return 2;
+ }
case 's':
checkarg(arg);
if (cart_subtype == 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-07 20:08:21
|
Revision: 45626
http://sourceforge.net/p/vice-emu/code/45626
Author: gpz
Date: 2025-04-07 20:08:04 +0000 (Mon, 07 Apr 2025)
Log Message:
-----------
disable debug output
Modified Paths:
--------------
trunk/vice/src/c64/cart/dqbb.c
Modified: trunk/vice/src/c64/cart/dqbb.c
===================================================================
--- trunk/vice/src/c64/cart/dqbb.c 2025-04-06 13:02:04 UTC (rev 45625)
+++ trunk/vice/src/c64/cart/dqbb.c 2025-04-07 20:08:04 UTC (rev 45626)
@@ -93,7 +93,7 @@
range of $de00-$deff
*/
-#define DBGDQBB
+/* #define DBGDQBB */
#ifdef DBGDQBB
#define DBG(x) log_printf x
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-06 13:02:21
|
Revision: 45625
http://sourceforge.net/p/vice-emu/code/45625
Author: gpz
Date: 2025-04-06 13:02:04 +0000 (Sun, 06 Apr 2025)
Log Message:
-----------
fix typo, patch by Stefan Haubental
Modified Paths:
--------------
trunk/vice/src/c1541.c
Modified: trunk/vice/src/c1541.c
===================================================================
--- trunk/vice/src/c1541.c 2025-04-05 15:58:18 UTC (rev 45624)
+++ trunk/vice/src/c1541.c 2025-04-06 13:02:04 UTC (rev 45625)
@@ -403,7 +403,7 @@
"into \n<destination> in the file system. If <destination> is not "
"specified, copy \nit into a file with the same name as <source>."
"\nPlease note that due to GEOS using ASCII, not PETSCII, the name should"
- " be\bentered in inverted case (ie to read 'rEADmE', use 'ReadMe'",
+ " be\nentered in inverted case (ie to read 'rEADmE', use 'ReadMe'",
1, 2,
read_geos_cmd },
{ "geoswrite",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-05 15:58:34
|
Revision: 45624
http://sourceforge.net/p/vice-emu/code/45624
Author: gpz
Date: 2025-04-05 15:58:18 +0000 (Sat, 05 Apr 2025)
Log Message:
-----------
output a warning when the load address given is 0, eg because of mistyping a hex number without 0x
Modified Paths:
--------------
trunk/vice/src/tools/cartconv/cartconv.c
Modified: trunk/vice/src/tools/cartconv/cartconv.c
===================================================================
--- trunk/vice/src/tools/cartconv/cartconv.c 2025-04-03 01:24:03 UTC (rev 45623)
+++ trunk/vice/src/tools/cartconv/cartconv.c 2025-04-05 15:58:18 UTC (rev 45624)
@@ -1421,6 +1421,9 @@
case 'l':
checkarg(arg);
load_address = (int)strtoul(arg, NULL, 0);
+ if (load_address == 0) {
+ fprintf(stderr, "WARNING: load address is 0, are you sure?\n");
+ }
return 2;
case 's':
checkarg(arg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-04-03 01:24:20
|
Revision: 45623
http://sourceforge.net/p/vice-emu/code/45623
Author: compyx
Date: 2025-04-03 01:24:03 +0000 (Thu, 03 Apr 2025)
Log Message:
-----------
Joystick: Linux evdev: scan symlinks in /dev/input/by-id/
Rather than scanning /dev/input/ directly, we scan the symlinks generated by
udev in /dev/input/by-id/ and only process links ending in '-event-joystick'.
Will need testing if this on Debian specifically, or a general udev thing.
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
===================================================================
--- trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-02 06:30:48 UTC (rev 45622)
+++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-03 01:24:03 UTC (rev 45623)
@@ -272,14 +272,9 @@
*/
static int sd_filter(const struct dirent *de)
{
- const char *name = de->d_name;
- size_t len = strlen(name);
-
- /* we need "event" plus at least one more character */
- if (len > 5u && memcmp(name, "event", 5u) == 0) {
- return 1;
- }
- return 0;
+ /* on Debian 12.10 joystick devices end with "-event-joystick", no idea if
+ * this is also true on other Linux distros, needs checking! */
+ return strstr(de->d_name, "-event-joystick") != NULL;
}
/** \brief Scan device for available buttons
@@ -339,11 +334,11 @@
joystick_device_t *joydev;
struct libevdev *evdev;
joy_priv_t *priv;
- char path[256];
+ char path[1024];
int fd;
int rc;
- snprintf(path, sizeof path, "/dev/input/%s", node);
+ snprintf(path, sizeof path, "/dev/input/by-id/%s", node);
fd = open(path, O_RDONLY|O_NONBLOCK);
if (fd < 0) {
return NULL;
@@ -405,7 +400,7 @@
log_message(joy_evdev_log, "Initializing Linux evdev joystick driver.");
joystick_driver_register(&driver);
- sd_result = scandir("/dev/input", &namelist, sd_filter, alphasort);
+ sd_result = scandir("/dev/input/by-id", &namelist, sd_filter, alphasort);
if (sd_result < 0) {
log_error(LOG_DEFAULT, "scandir() failed on /dev/input: %s", strerror(errno));
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-04-02 06:31:06
|
Revision: 45622
http://sourceforge.net/p/vice-emu/code/45622
Author: compyx
Date: 2025-04-02 06:30:48 +0000 (Wed, 02 Apr 2025)
Log Message:
-----------
Joystick: reject devices based on number of inputs
Reject devices when calling `joystick_device_register()` if the device in
question doesn't at least have one button and either at least two axes or at
least one hat. Call `driver->close()` and `joystick_device_free()` on rejected
device so the driver doesn't have to worry about cleaning up.
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
trunk/vice/src/joyport/joystick.c
Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
===================================================================
--- trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-01 22:10:11 UTC (rev 45621)
+++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-02 06:30:48 UTC (rev 45622)
@@ -234,8 +234,12 @@
if (joydev != NULL && joydev->priv != NULL) {
joy_priv_t *priv = joydev->priv;
- close(priv->fd);
- libevdev_free(priv->evdev);
+ if (priv->fd >= 0) {
+ close(priv->fd);
+ }
+ if (priv->evdev != NULL) {
+ libevdev_free(priv->evdev);
+ }
priv->fd = -1;
priv->evdev = NULL;
}
@@ -413,11 +417,7 @@
//log_message(joy_evdev_log, "Possible device '%s'", namelist[i]->d_name);
joydev = scan_device(namelist[i]->d_name);
if (joydev != NULL) {
- if (!joystick_device_register(joydev)) {
- log_message(joy_evdev_log,
- "Failed to add device, continuing with next device.");
- joystick_device_free(joydev);
- }
+ joystick_device_register(joydev);
}
}
free(namelist);
Modified: trunk/vice/src/joyport/joystick.c
===================================================================
--- trunk/vice/src/joyport/joystick.c 2025-04-01 22:10:11 UTC (rev 45621)
+++ trunk/vice/src/joyport/joystick.c 2025-04-02 06:30:48 UTC (rev 45622)
@@ -3636,8 +3636,12 @@
*/
bool joystick_device_register(joystick_device_t *joydev)
{
- if (joydev == NULL || joydev->name == NULL) {
- /* TODO: reject devices with too little inputs */
+ /* reject devices with too little inputs */
+ if (!((joydev->num_axes >= 2 || joydev->num_hats >= 1) &&
+ joydev->num_buttons >= 1)) {
+ /* close and free device */
+ joy_driver.close(joydev);
+ joystick_device_free(joydev);
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-01 22:10:28
|
Revision: 45621
http://sourceforge.net/p/vice-emu/code/45621
Author: gpz
Date: 2025-04-01 22:10:11 +0000 (Tue, 01 Apr 2025)
Log Message:
-----------
blindly fix some more supposed issues with reading open i/o. if/how 157x/1581/FD/HD needs to be fixed is stll to be determined
Modified Paths:
--------------
trunk/vice/src/drive/iec/memiec.c
Modified: trunk/vice/src/drive/iec/memiec.c
===================================================================
--- trunk/vice/src/drive/iec/memiec.c 2025-04-01 22:05:21 UTC (rev 45620)
+++ trunk/vice/src/drive/iec/memiec.c 2025-04-01 22:10:11 UTC (rev 45621)
@@ -138,69 +138,64 @@
case DRIVE_TYPE_1541:
case DRIVE_TYPE_1541II:
drv->cpu->pageone = drv->drive_ram + 0x100;
-#if 0 /* FIXME: we must make sure the read functions are always being called,
- so the "last value on bus" hack can work */
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x000007fd);
- drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0x000007fd);
-#endif
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, NULL, 0);
drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0);
drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
if (drv->drive_ram2_enabled) {
- drivemem_set_func(cpud, 0x20, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x2000], 0x20003ffd);
+ drivemem_set_func(cpud, 0x20, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x2000], 0);
} else {
- drivemem_set_func(cpud, 0x20, 0x28, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x200027fd);
+ drivemem_set_func(cpud, 0x20, 0x28, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0);
drivemem_set_func(cpud, 0x38, 0x3c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x3c, 0x40, via2d_read, via2d_store, via2d_peek, NULL, 0);
}
if (drv->drive_ram4_enabled) {
- drivemem_set_func(cpud, 0x40, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0x40005ffd);
+ drivemem_set_func(cpud, 0x40, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0);
} else {
- drivemem_set_func(cpud, 0x40, 0x48, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x400047fd);
+ drivemem_set_func(cpud, 0x40, 0x48, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0);
drivemem_set_func(cpud, 0x58, 0x5c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x5c, 0x60, via2d_read, via2d_store, via2d_peek, NULL, 0);
}
if (drv->drive_ram6_enabled) {
- drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0x60007ffd);
+ drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0);
} else {
- drivemem_set_func(cpud, 0x60, 0x68, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x600067fd);
+ drivemem_set_func(cpud, 0x60, 0x68, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0);
drivemem_set_func(cpud, 0x78, 0x7c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x7c, 0x80, via2d_read, via2d_store, via2d_peek, NULL, 0);
}
if (drv->drive_ram8_enabled) {
- drivemem_set_func(cpud, 0x80, 0xa0, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x8000], 0x80009ffd);
+ drivemem_set_func(cpud, 0x80, 0xa0, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x8000], 0);
} else {
- drivemem_set_func(cpud, 0x80, 0xa0, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x80009ffd);
+ drivemem_set_func(cpud, 0x80, 0xa0, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0);
}
if (drv->drive_rama_enabled) {
- drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0xa000], 0xa000bffd);
+ drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0xa000], 0);
} else {
- drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_rom, NULL, drive_peek_rom, &drv->trap_rom[0x2000], 0xa000bffd);
+ drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_rom, NULL, drive_peek_rom, &drv->trap_rom[0x2000], 0);
}
- drivemem_set_func(cpud, 0xc0, 0x100, drive_read_rom, NULL, drive_peek_rom, &drv->trap_rom[0x4000], 0xc000fffd);
+ drivemem_set_func(cpud, 0xc0, 0x100, drive_read_rom, NULL, drive_peek_rom, &drv->trap_rom[0x4000], 0);
break;
case DRIVE_TYPE_1570:
case DRIVE_TYPE_1571:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x000007fd);
- drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0x000007fd);
- drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x08000ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, NULL, 0);
+ drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0);
+ drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0);
drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
drivemem_set_func(cpud, 0x20, 0x30, wd1770d_read, wd1770d_store, wd1770d_peek, NULL, 0);
if (drv->drive_ram4_enabled) {
drivemem_set_func(cpud, 0x40, 0x48, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
- drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0x48005ffd);
+ drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0);
} else {
drivemem_set_func(cpud, 0x40, 0x60, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
}
if (drv->drive_ram6_enabled) {
- drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0x60007ffd);
+ drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0);
} else {
drivemem_set_func(cpud, 0x60, 0x80, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
}
- drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
+ drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0);
break;
case DRIVE_TYPE_1571CR:
/* The mos5710 IC in the 1571CR drive implements:
@@ -228,9 +223,9 @@
RAM 0 1 1 x x x x 6xxx 7xxx
*/
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x000007fd);
- drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0x000007fd);
- drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x08000ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, NULL, 0);
+ drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0);
+ drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0);
drivemem_set_func(cpud, 0x10, 0x14, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x14, 0x18, via2d_read, via2d_store, via2d_peek, NULL, 0);
drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
@@ -239,29 +234,31 @@
/* FIXME: the following is very incorrect */
if (drv->drive_ram4_enabled) {
drivemem_set_func(cpud, 0x40, 0x48, mos5710_read, mos5710_store, mos5710_peek, NULL, 0);
- drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0x48005ffd);
+ drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0);
} else {
drivemem_set_func(cpud, 0x40, 0x60, mos5710_read, mos5710_store, mos5710_peek, NULL, 0);
}
if (drv->drive_ram6_enabled) {
- drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0x60007ffd);
+ drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0);
} else {
drivemem_set_func(cpud, 0x60, 0x80, mos5710_read, mos5710_store, mos5710_peek, NULL, 0);
}
- drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
+ drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0);
break;
+ /* FIXME: check open-i/o behaviour for 1581/65C02, see bug #2113 */
case DRIVE_TYPE_1581:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x00001ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, NULL, 0);
drivemem_set_func(cpud, 0x01, 0x20, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x0100], 0x00001ffd);
drivemem_set_func(cpud, 0x40, 0x60, cia1581_read, cia1581_store, cia1581_peek, NULL, 0);
drivemem_set_func(cpud, 0x60, 0x80, wd1770d_read, wd1770d_store, wd1770d_peek, NULL, 0);
drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
break;
+ /* FIXME: check open-i/o behaviour for FD/65C02, see bug #2113 */
case DRIVE_TYPE_2000:
case DRIVE_TYPE_4000:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x00003ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, NULL, 0);
drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x0100], 0x00003ffd);
drivemem_set_func(cpud, 0x40, 0x4c, via4000_read, via4000_store, via4000_peek, NULL, 0);
drivemem_set_func(cpud, 0x4e, 0x50, pc8477d_read, pc8477d_store, pc8477d_peek, NULL, 0);
@@ -270,9 +267,10 @@
/* for performance reasons it's only this page */
drivemem_set_func(cpud, 0xf0, 0xf1, drive_read_rom_ds1216, NULL, drive_peek_rom_ds1216, &drv->trap_rom[0x7000], 0x8000fffd);
break;
+ /* FIXME: check open-i/o behaviour for CMDHD/65C02, see bug #2113 */
case DRIVE_TYPE_CMDHD:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x00003ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, NULL, 0);
drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x0100], 0x00003ffd);
/* CMDHD uses a lot of weird registers to mamage the memory above 0x4000
so the granularity here doesn't work. We just group it all together */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-01 22:05:38
|
Revision: 45620
http://sourceforge.net/p/vice-emu/code/45620
Author: gpz
Date: 2025-04-01 22:05:21 +0000 (Tue, 01 Apr 2025)
Log Message:
-----------
update testlists
Modified Paths:
--------------
testprogs/testbench/c64-testlist.in
testprogs/testbench/c64rmk2-testlist.txt
testprogs/testbench/chameleon-testlist.txt
testprogs/testbench/denise-testlist.txt
testprogs/testbench/emu64-testlist.txt
testprogs/testbench/frodo-testlist.txt
testprogs/testbench/hoxs64-testlist.txt
testprogs/testbench/kernal64c128c64-testlist.txt
testprogs/testbench/kernal64c64-testlist.txt
testprogs/testbench/micro64-testlist.txt
testprogs/testbench/u64-testlist.txt
testprogs/testbench/virtualc64-testlist.txt
testprogs/testbench/x128c64-testlist.txt
testprogs/testbench/x64-testlist.txt
testprogs/testbench/x64sc-testlist.txt
testprogs/testbench/yace-testlist.txt
testprogs/testbench/z64kc128c64-testlist.txt
testprogs/testbench/z64kc64-testlist.txt
Modified: testprogs/testbench/c64-testlist.in
===================================================================
--- testprogs/testbench/c64-testlist.in 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/c64-testlist.in 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1569,6 +1569,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/c64rmk2-testlist.txt
===================================================================
--- testprogs/testbench/c64rmk2-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/c64rmk2-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -691,7 +691,7 @@
../CIA/tod/,hzsync3.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,hzsync4.prg,exitcode,100000000,vicii-pal
../CIA/tod/,hzsync5.prg,exitcode,100000000,vicii-pal
-../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal
+../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,powerup.prg,exitcode,100000000
../CIA/tod/,read-latch.prg,exitcode,100000000,vicii-pal
../CIA/tod/,stability.prg,exitcode,40000000,vicii-pal
@@ -1132,6 +1132,7 @@
../drive/rpm/,rpm3.prg,exitcode,12000000,mountp64:rpm.p64,vicii-pal
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/chameleon-testlist.txt
===================================================================
--- testprogs/testbench/chameleon-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/chameleon-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1472,6 +1472,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/denise-testlist.txt
===================================================================
--- testprogs/testbench/denise-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/denise-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1567,6 +1567,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/emu64-testlist.txt
===================================================================
--- testprogs/testbench/emu64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/emu64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1385,6 +1385,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/frodo-testlist.txt
===================================================================
--- testprogs/testbench/frodo-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/frodo-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1320,6 +1320,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/hoxs64-testlist.txt
===================================================================
--- testprogs/testbench/hoxs64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/hoxs64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1285,6 +1285,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/kernal64c128c64-testlist.txt
===================================================================
--- testprogs/testbench/kernal64c128c64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/kernal64c128c64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1468,6 +1468,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/kernal64c64-testlist.txt
===================================================================
--- testprogs/testbench/kernal64c64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/kernal64c64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1468,6 +1468,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/micro64-testlist.txt
===================================================================
--- testprogs/testbench/micro64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/micro64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1437,6 +1437,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/u64-testlist.txt
===================================================================
--- testprogs/testbench/u64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/u64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1396,6 +1396,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/virtualc64-testlist.txt
===================================================================
--- testprogs/testbench/virtualc64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/virtualc64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -698,7 +698,7 @@
../CIA/tod/,hzsync3.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,hzsync4.prg,exitcode,100000000,vicii-pal
../CIA/tod/,hzsync5.prg,exitcode,100000000,vicii-pal
-../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal
+../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,powerup.prg,exitcode,100000000
../CIA/tod/,read-latch.prg,exitcode,100000000,vicii-pal
../CIA/tod/,stability.prg,exitcode,40000000,vicii-pal
@@ -1430,6 +1430,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/x128c64-testlist.txt
===================================================================
--- testprogs/testbench/x128c64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/x128c64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -702,7 +702,7 @@
../CIA/tod/,hzsync3.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,hzsync4.prg,exitcode,100000000,vicii-pal
../CIA/tod/,hzsync5.prg,exitcode,100000000,vicii-pal
-../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal
+../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,powerup.prg,exitcode,100000000
../CIA/tod/,read-latch.prg,exitcode,100000000,vicii-pal
../CIA/tod/,stability.prg,exitcode,40000000,vicii-pal
@@ -1517,6 +1517,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/x64-testlist.txt
===================================================================
--- testprogs/testbench/x64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/x64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -702,7 +702,7 @@
../CIA/tod/,hzsync3.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,hzsync4.prg,exitcode,100000000,vicii-pal
../CIA/tod/,hzsync5.prg,exitcode,100000000,vicii-pal
-../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal
+../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,powerup.prg,exitcode,100000000
../CIA/tod/,read-latch.prg,exitcode,100000000,vicii-pal
../CIA/tod/,stability.prg,exitcode,40000000,vicii-pal
@@ -1570,6 +1570,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/x64sc-testlist.txt
===================================================================
--- testprogs/testbench/x64sc-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/x64sc-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -702,7 +702,7 @@
../CIA/tod/,hzsync3.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,hzsync4.prg,exitcode,100000000,vicii-pal
../CIA/tod/,hzsync5.prg,exitcode,100000000,vicii-pal
-../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal
+../CIA/tod/,hzsync6.prg,exitcode,100000000,vicii-pal,comment:not 100% stable - rerun on failure
../CIA/tod/,powerup.prg,exitcode,100000000
../CIA/tod/,read-latch.prg,exitcode,100000000,vicii-pal
../CIA/tod/,stability.prg,exitcode,40000000,vicii-pal
@@ -1570,6 +1570,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/yace-testlist.txt
===================================================================
--- testprogs/testbench/yace-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/yace-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1389,6 +1389,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/z64kc128c64-testlist.txt
===================================================================
--- testprogs/testbench/z64kc128c64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/z64kc128c64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1466,6 +1466,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
Modified: testprogs/testbench/z64kc64-testlist.txt
===================================================================
--- testprogs/testbench/z64kc64-testlist.txt 2025-04-01 22:04:30 UTC (rev 45619)
+++ testprogs/testbench/z64kc64-testlist.txt 2025-04-01 22:05:21 UTC (rev 45620)
@@ -1466,6 +1466,7 @@
../drive/skew/,skew1.prg,exitcode,30000000,mountg64:skew.g64
../drive/selftest/,selftest.prg,exitcode,8000000
../drive/openbus/,openbus.prg,exitcode,8000000
+../drive/openbus/,openbus2.prg,exitcode,8000000
../drive/viavarious/,via1.prg,exitcode,88000000
../drive/viavarious/,via2.prg,exitcode,130000000
../drive/viavarious/,via3.prg,exitcode,130000000
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-01 22:04:48
|
Revision: 45619
http://sourceforge.net/p/vice-emu/code/45619
Author: gpz
Date: 2025-04-01 22:04:30 +0000 (Tue, 01 Apr 2025)
Log Message:
-----------
update open i/o test(s)
Modified Paths:
--------------
testprogs/drive/openbus/Makefile
testprogs/drive/openbus/main.asm
testprogs/drive/openbus/readme.txt
Added Paths:
-----------
testprogs/drive/openbus/openbus2.prg
Modified: testprogs/drive/openbus/Makefile
===================================================================
--- testprogs/drive/openbus/Makefile 2025-04-01 14:25:05 UTC (rev 45618)
+++ testprogs/drive/openbus/Makefile 2025-04-01 22:04:30 UTC (rev 45619)
@@ -1,11 +1,17 @@
-all: openbus.prg
+all: openbus.prg openbus2.prg
openbus.prg: main.asm
- acme main.asm
+ acme -f cbm -DTEST=1 -o openbus.prg main.asm
+openbus2.prg: main.asm
+ acme -f cbm -DTEST=2 -o openbus2.prg main.asm
+
test: openbus.prg
- x64sc -truedrive -autostartprgmode 2 openbus.prg
+ x64sc -default -drive8truedrive -autostartprgmode 2 openbus.prg
+test2: openbus2.prg
+ x64sc -default -drive8truedrive -autostartprgmode 2 openbus2.prg
clean:
- rm -f *~
- rm -f openbus.prg
+ $(RM) *~
+ $(RM) openbus.prg
+ $(RM) openbus2.prg
Modified: testprogs/drive/openbus/main.asm
===================================================================
--- testprogs/drive/openbus/main.asm 2025-04-01 14:25:05 UTC (rev 45618)
+++ testprogs/drive/openbus/main.asm 2025-04-01 22:04:30 UTC (rev 45619)
@@ -1,6 +1,5 @@
!convtab pet
!cpu 6510
- !to "openbus.prg", cbm
;-------------------------------------------------------------------------------
@@ -60,6 +59,7 @@
bpl -
; check indirect RAM read data
+!if TEST = 1 {
ldx #$00
-
txa
@@ -68,7 +68,17 @@
inx
cpx #$ff
bne -
-
+}
+!if TEST = 2 {
+ ldx #$00
+-
+ lda #$08
+ cmp $0401,x
+ bne chkerr1
+ inx
+ cpx #$ff
+ bne -
+}
; check high-byte read data 08xx-17xx
ldx #$08
-
@@ -163,7 +173,7 @@
sta .openbus,x
inx
bne -
-
+
; generate test data
ldx #$00
-
@@ -173,6 +183,7 @@
bne -
; copy ram content via open bus and dummy cycle on indexing wrap
+!if TEST = 1 {
ldx #$01
-
lda .openbus - 1,x
@@ -179,9 +190,21 @@
sta .readdata,x
inx
bne -
+}
+!if TEST = 2 {
+ ldx #1
+-
+ stx lo
+lo=*+1
+ lda .openbus
+ sta .readdata,x
+ inx
+ bne -
+}
; some extra probes for high-byte-still-on-bus
; RAM/VIA mirrors will be skipped during validation on C64 side
+!if TEST = 1 {
ldy #$23 ; arbitrary offset, must be less than $80
sty $14
ldy #$08
@@ -192,7 +215,21 @@
iny
cpy #$78
bne -
-
+}
+!if TEST = 2 {
+ ldy #$23 ; arbitrary offset, must be less than $80
+ sty .lo
+ ldy #$08
+-
+ sty .hi
+.lo=*+1
+.hi=*+2
+ lda $dead
+ sta .wrdata,y
+ iny
+ cpy #$78
+ bne -
+}
jsr snd_start
; send indirect read test data
Added: testprogs/drive/openbus/openbus2.prg
===================================================================
(Binary files differ)
Index: testprogs/drive/openbus/openbus2.prg
===================================================================
--- testprogs/drive/openbus/openbus2.prg 2025-04-01 14:25:05 UTC (rev 45618)
+++ testprogs/drive/openbus/openbus2.prg 2025-04-01 22:04:30 UTC (rev 45619)
Property changes on: testprogs/drive/openbus/openbus2.prg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-commodore-exec
\ No newline at end of property
Modified: testprogs/drive/openbus/readme.txt
===================================================================
--- testprogs/drive/openbus/readme.txt 2025-04-01 14:25:05 UTC (rev 45618)
+++ testprogs/drive/openbus/readme.txt 2025-04-01 22:04:30 UTC (rev 45619)
@@ -1,3 +1,7 @@
+
+openbus.prg
+-----------
+
Checks open bus values by forcing known data from ram with
the dummy cycle on an indexing overflow (lda $07ff,x with x >=1)
and reading the last instruction byte in open areas from 0800-7f00
@@ -7,3 +11,13 @@
but not yet tested. Will fail on a 1581.
(gpz 30/3/2025) works on my 1541(old), fails on 1570
+
+a related test program for the VIC20 is in VIC20/unconnected/
+
+
+openbus2.prg
+------------
+
+A variant of the above program, which uses "lda abs" only
+
+(gpz 1/4/2025) works on my 1541(old)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-04-01 14:25:23
|
Revision: 45618
http://sourceforge.net/p/vice-emu/code/45618
Author: compyx
Date: 2025-04-01 14:25:05 +0000 (Tue, 01 Apr 2025)
Log Message:
-----------
FreeBSD: use custom mapper callback to fix Logitech F710 Y axis
For some bizarre reason the left thumbstick's Y axis is inverted on FreeBSD
14.2, so we use the custom mapper callback to set the 'invert' property of
its calibration data.
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
===================================================================
--- trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-04-01 00:03:35 UTC (rev 45617)
+++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-04-01 14:25:05 UTC (rev 45618)
@@ -110,10 +110,11 @@
/* Forward declarations */
-static bool bsd_joy_open (joystick_device_t *joydev);
-static void bsd_joy_poll (joystick_device_t *joydev);
-static void bsd_joy_close(joystick_device_t *joydev);
-static void joy_priv_free(void *priv);
+static bool bsd_joy_open (joystick_device_t *joydev);
+static void bsd_joy_poll (joystick_device_t *joydev);
+static void bsd_joy_close (joystick_device_t *joydev);
+static void bsd_joy_customize(joystick_device_t *joydev);
+static void joy_priv_free (void *priv);
/** \brief Log for BSD joystick driver */
@@ -124,6 +125,7 @@
.open = bsd_joy_open,
.poll = bsd_joy_poll,
.close = bsd_joy_close,
+ .customize = bsd_joy_customize,
.priv_free = joy_priv_free
};
@@ -426,8 +428,10 @@
axis->code = (uint32_t)HID_USAGE(item->usage);
axis->minimum = item->logical_minimum;
axis->maximum = item->logical_maximum;
-
- log_message(bsd_joy_log, "axis %u: %s", axis->code, axis->name);
+#if 0
+ log_message(bsd_joy_log, "axis %u: %s (%d-%d)",
+ axis->code, axis->name, axis->minimum, axis->maximum);
+#endif
joystick_device_add_axis(joydev, axis);
}
@@ -661,3 +665,25 @@
{
/* NOP */
}
+
+
+/** \brief Custom mapper/calibrator
+ *
+ * \param[in] joydev joystick device
+ */
+static void bsd_joy_customize(joystick_device_t *joydev)
+{
+#ifdef FREEBSD_COMPILE
+ if (joydev->vendor == 0x046d && joydev->product == 0xc21f) {
+ joystick_axis_t *left_thumb_y;
+
+ /* Logitech F710 (XInput mode) */
+
+ /* For some reason the Y axis of the left thumbstick is inverted on at
+ * least FreeBSD 14.2. On NetBSD 10.1 the device doesn't appear to
+ * function at all */
+ left_thumb_y = joydev->axes[1];
+ left_thumb_y->calibration.invert = true;
+ }
+#endif
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-04-01 00:03:53
|
Revision: 45617
http://sourceforge.net/p/vice-emu/code/45617
Author: gpz
Date: 2025-04-01 00:03:35 +0000 (Tue, 01 Apr 2025)
Log Message:
-----------
WIP fix for #2113. Debug stuff is still enabled. Similar fixes must be applied to the other drives - and perhaps to PET and Plus4
Modified Paths:
--------------
trunk/vice/src/drive/drivemem.c
trunk/vice/src/drive/iec/memiec.c
Modified: trunk/vice/src/drive/drivemem.c
===================================================================
--- trunk/vice/src/drive/drivemem.c 2025-03-31 17:08:08 UTC (rev 45616)
+++ trunk/vice/src/drive/drivemem.c 2025-04-01 00:03:35 UTC (rev 45617)
@@ -51,6 +51,14 @@
#include "wd1770.h"
#include "cmdhd.h"
+#define DEBUG_DRIVEMEM
+
+#ifdef DEBUG_DRIVEMEM
+#define LOG(x) log_printf
+#else
+#define LOG(x)
+#endif
+
static drive_read_func_t *read_tab_watch[0x101];
static drive_store_func_t *store_tab_watch[0x101];
@@ -66,6 +74,7 @@
static uint8_t drive_read_free(diskunit_context_t *drv, uint16_t address)
{
+ LOG(("%04x %02x drive_read_free", address, drv->cpu->cpu_last_data));
return drv->cpu->cpu_last_data;
}
@@ -77,7 +86,8 @@
static uint8_t drive_peek_free(diskunit_context_t *drv, uint16_t address)
{
- return 0;
+ LOG(("%04x %02x drive_peek_free", address, drv->cpu->cpu_last_data));
+ return drv->cpu->cpu_last_data;
}
/* ------------------------------------------------------------------------- */
@@ -100,6 +110,7 @@
static uint8_t drive_read_watch(diskunit_context_t *drv, uint16_t address)
{
+ LOG(("%04x %02x drive_read_watch\n", address, drv->cpud->read_tab[0][address >> 8](drv, address)));
monitor_watch_push_load_addr(address, drv->cpu->monspace);
return drv->cpu->cpu_last_data = drv->cpud->read_tab[0][address >> 8](drv, address);
}
Modified: trunk/vice/src/drive/iec/memiec.c
===================================================================
--- trunk/vice/src/drive/iec/memiec.c 2025-03-31 17:08:08 UTC (rev 45616)
+++ trunk/vice/src/drive/iec/memiec.c 2025-04-01 00:03:35 UTC (rev 45617)
@@ -42,21 +42,49 @@
#include "pc8477.h"
#include "cmdhd.h"
+
+#define DEBUG_MEMIEC
+
+#ifdef DEBUG_MEMIEC
+#define LOG(x) log_printf
+#else
+#define LOG(x)
+#endif
+
static uint8_t drive_read_rom(diskunit_context_t *drv, uint16_t address)
{
+ LOG(("%04x %02x drive_read_rom\n", address, drv->rom[address & 0x7fff]));
return drv->cpu->cpu_last_data = drv->rom[address & 0x7fff];
}
+static uint8_t drive_peek_rom(diskunit_context_t *drv, uint16_t address)
+{
+ LOG(("%04x %02x drive_peek_rom\n", address, drv->rom[address & 0x7fff]));
+ return drv->rom[address & 0x7fff];
+}
+
static uint8_t drive_read_rom_ds1216(diskunit_context_t *drv, uint16_t address)
{
return drv->cpu->cpu_last_data = ds1216e_read(drv->ds1216, address, drv->rom[address & 0x7fff]);
}
+static uint8_t drive_peek_rom_ds1216(diskunit_context_t *drv, uint16_t address)
+{
+ return ds1216e_read(drv->ds1216, address, drv->rom[address & 0x7fff]);
+}
+
static uint8_t drive_read_ram(diskunit_context_t *drv, uint16_t address)
{
+ LOG(("%04x %02x drive_read_ram\n", address, drv->drive_ram[address]));
return drv->cpu->cpu_last_data = drv->drive_ram[address];
}
+static uint8_t drive_peek_ram(diskunit_context_t *drv, uint16_t address)
+{
+ LOG(("%04x %02x drive_peek_ram\n", address, drv->drive_ram[address]));
+ return drv->drive_ram[address];
+}
+
static void drive_store_ram(diskunit_context_t *drv, uint16_t address, uint8_t value)
{
drv->cpu->cpu_last_data = value;
@@ -65,9 +93,16 @@
static uint8_t drive_read_1541ram(diskunit_context_t *drv, uint16_t address)
{
+ LOG(("%04x %02x drive_read_1541ram\n", address, drv->drive_ram[address & 0x7ff]));
return drv->cpu->cpu_last_data = drv->drive_ram[address & 0x7ff];
}
+static uint8_t drive_peek_1541ram(diskunit_context_t *drv, uint16_t address)
+{
+ LOG(("%04x %02x drive_peek_1541ram\n", address, drv->drive_ram[address & 0x7ff]));
+ return drv->drive_ram[address & 0x7ff];
+}
+
static void drive_store_1541ram(diskunit_context_t *drv, uint16_t address, uint8_t value)
{
drv->cpu->cpu_last_data = value;
@@ -76,9 +111,16 @@
static uint8_t drive_read_zero(diskunit_context_t *drv, uint16_t address)
{
+ LOG(("%04x %02x drive_read_zero\n", address, drv->drive_ram[address & 0xffu]));
return drv->cpu->cpu_last_data = drv->drive_ram[address & 0xffu];
}
+static uint8_t drive_peek_zero(diskunit_context_t *drv, uint16_t address)
+{
+ LOG(("%04x %02x drive_peek_zero\n", address, drv->drive_ram[address & 0xffu]));
+ return drv->drive_ram[address & 0xffu];
+}
+
static void drive_store_zero(diskunit_context_t *drv, uint16_t address, uint8_t value)
{
drv->cpu->cpu_last_data = value;
@@ -96,64 +138,69 @@
case DRIVE_TYPE_1541:
case DRIVE_TYPE_1541II:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive_ram, 0x000007fd);
- drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, NULL, &drv->drive_ram[0x0100], 0x000007fd);
+#if 0 /* FIXME: we must make sure the read functions are always being called,
+ so the "last value on bus" hack can work */
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x000007fd);
+ drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0x000007fd);
+#endif
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0);
+ drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0);
drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
if (drv->drive_ram2_enabled) {
- drivemem_set_func(cpud, 0x20, 0x40, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x2000], 0x20003ffd);
+ drivemem_set_func(cpud, 0x20, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x2000], 0x20003ffd);
} else {
- drivemem_set_func(cpud, 0x20, 0x28, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive_ram, 0x200027fd);
+ drivemem_set_func(cpud, 0x20, 0x28, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x200027fd);
drivemem_set_func(cpud, 0x38, 0x3c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x3c, 0x40, via2d_read, via2d_store, via2d_peek, NULL, 0);
}
if (drv->drive_ram4_enabled) {
- drivemem_set_func(cpud, 0x40, 0x60, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x4000], 0x40005ffd);
+ drivemem_set_func(cpud, 0x40, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0x40005ffd);
} else {
- drivemem_set_func(cpud, 0x40, 0x48, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive_ram, 0x400047fd);
+ drivemem_set_func(cpud, 0x40, 0x48, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x400047fd);
drivemem_set_func(cpud, 0x58, 0x5c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x5c, 0x60, via2d_read, via2d_store, via2d_peek, NULL, 0);
}
if (drv->drive_ram6_enabled) {
- drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x6000], 0x60007ffd);
+ drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0x60007ffd);
} else {
- drivemem_set_func(cpud, 0x60, 0x68, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive_ram, 0x600067fd);
+ drivemem_set_func(cpud, 0x60, 0x68, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x600067fd);
drivemem_set_func(cpud, 0x78, 0x7c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x7c, 0x80, via2d_read, via2d_store, via2d_peek, NULL, 0);
}
if (drv->drive_ram8_enabled) {
- drivemem_set_func(cpud, 0x80, 0xa0, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x8000], 0x80009ffd);
+ drivemem_set_func(cpud, 0x80, 0xa0, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x8000], 0x80009ffd);
} else {
- drivemem_set_func(cpud, 0x80, 0xa0, drive_read_rom, NULL, NULL, drv->trap_rom, 0x80009ffd);
+ drivemem_set_func(cpud, 0x80, 0xa0, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x80009ffd);
}
if (drv->drive_rama_enabled) {
- drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0xa000], 0xa000bffd);
+ drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0xa000], 0xa000bffd);
} else {
- drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_rom, NULL, NULL, &drv->trap_rom[0x2000], 0xa000bffd);
+ drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_rom, NULL, drive_peek_rom, &drv->trap_rom[0x2000], 0xa000bffd);
}
- drivemem_set_func(cpud, 0xc0, 0x100, drive_read_rom, NULL, NULL, &drv->trap_rom[0x4000], 0xc000fffd);
+ drivemem_set_func(cpud, 0xc0, 0x100, drive_read_rom, NULL, drive_peek_rom, &drv->trap_rom[0x4000], 0xc000fffd);
break;
case DRIVE_TYPE_1570:
case DRIVE_TYPE_1571:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive_ram, 0x000007fd);
- drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, NULL, &drv->drive_ram[0x0100], 0x000007fd);
- drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive_ram, 0x08000ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x000007fd);
+ drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0x000007fd);
+ drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x08000ffd);
drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
drivemem_set_func(cpud, 0x20, 0x30, wd1770d_read, wd1770d_store, wd1770d_peek, NULL, 0);
if (drv->drive_ram4_enabled) {
drivemem_set_func(cpud, 0x40, 0x48, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
- drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x4000], 0x48005ffd);
+ drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0x48005ffd);
} else {
drivemem_set_func(cpud, 0x40, 0x60, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
}
if (drv->drive_ram6_enabled) {
- drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x6000], 0x60007ffd);
+ drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0x60007ffd);
} else {
drivemem_set_func(cpud, 0x60, 0x80, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
}
- drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->trap_rom, 0x8000fffd);
+ drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
break;
case DRIVE_TYPE_1571CR:
/* The mos5710 IC in the 1571CR drive implements:
@@ -181,9 +228,9 @@
RAM 0 1 1 x x x x 6xxx 7xxx
*/
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive_ram, 0x000007fd);
- drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, NULL, &drv->drive_ram[0x0100], 0x000007fd);
- drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive_ram, 0x08000ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x000007fd);
+ drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, &drv->drive_ram[0x0100], 0x000007fd);
+ drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, drive_peek_1541ram, drv->drive_ram, 0x08000ffd);
drivemem_set_func(cpud, 0x10, 0x14, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
drivemem_set_func(cpud, 0x14, 0x18, via2d_read, via2d_store, via2d_peek, NULL, 0);
drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
@@ -192,41 +239,41 @@
/* FIXME: the following is very incorrect */
if (drv->drive_ram4_enabled) {
drivemem_set_func(cpud, 0x40, 0x48, mos5710_read, mos5710_store, mos5710_peek, NULL, 0);
- drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x4000], 0x48005ffd);
+ drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x4000], 0x48005ffd);
} else {
drivemem_set_func(cpud, 0x40, 0x60, mos5710_read, mos5710_store, mos5710_peek, NULL, 0);
}
if (drv->drive_ram6_enabled) {
- drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x6000], 0x60007ffd);
+ drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x6000], 0x60007ffd);
} else {
drivemem_set_func(cpud, 0x60, 0x80, mos5710_read, mos5710_store, mos5710_peek, NULL, 0);
}
- drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->trap_rom, 0x8000fffd);
+ drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
break;
case DRIVE_TYPE_1581:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive_ram, 0x00001ffd);
- drivemem_set_func(cpud, 0x01, 0x20, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x0100], 0x00001ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x00001ffd);
+ drivemem_set_func(cpud, 0x01, 0x20, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x0100], 0x00001ffd);
drivemem_set_func(cpud, 0x40, 0x60, cia1581_read, cia1581_store, cia1581_peek, NULL, 0);
drivemem_set_func(cpud, 0x60, 0x80, wd1770d_read, wd1770d_store, wd1770d_peek, NULL, 0);
- drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->trap_rom, 0x8000fffd);
+ drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
break;
case DRIVE_TYPE_2000:
case DRIVE_TYPE_4000:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive_ram, 0x00003ffd);
- drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x0100], 0x00003ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x00003ffd);
+ drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x0100], 0x00003ffd);
drivemem_set_func(cpud, 0x40, 0x4c, via4000_read, via4000_store, via4000_peek, NULL, 0);
drivemem_set_func(cpud, 0x4e, 0x50, pc8477d_read, pc8477d_store, pc8477d_peek, NULL, 0);
- drivemem_set_func(cpud, 0x50, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x5000], 0x50007ffd);
- drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->trap_rom, 0x8000fffd);
+ drivemem_set_func(cpud, 0x50, 0x80, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x5000], 0x50007ffd);
+ drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, drive_peek_rom, drv->trap_rom, 0x8000fffd);
/* for performance reasons it's only this page */
- drivemem_set_func(cpud, 0xf0, 0xf1, drive_read_rom_ds1216, NULL, NULL, &drv->trap_rom[0x7000], 0x8000fffd);
+ drivemem_set_func(cpud, 0xf0, 0xf1, drive_read_rom_ds1216, NULL, drive_peek_rom_ds1216, &drv->trap_rom[0x7000], 0x8000fffd);
break;
case DRIVE_TYPE_CMDHD:
drv->cpu->pageone = drv->drive_ram + 0x100;
- drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive_ram, 0x00003ffd);
- drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, NULL, &drv->drive_ram[0x0100], 0x00003ffd);
+ drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, drive_peek_zero, drv->drive_ram, 0x00003ffd);
+ drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, drive_peek_ram, &drv->drive_ram[0x0100], 0x00003ffd);
/* CMDHD uses a lot of weird registers to mamage the memory above 0x4000
so the granularity here doesn't work. We just group it all together */
drivemem_set_func(cpud, 0x40, 0x100, cmdhd_read, cmdhd_store, NULL, NULL, 0x0000fffd);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-31 17:08:21
|
Revision: 45616
http://sourceforge.net/p/vice-emu/code/45616
Author: empathicqubit
Date: 2025-03-31 17:08:08 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
Make sure menu_draw actually exists before drawing to the monitor in SDL2
Modified Paths:
--------------
trunk/vice/src/arch/sdl/uimon.c
Modified: trunk/vice/src/arch/sdl/uimon.c
===================================================================
--- trunk/vice/src/arch/sdl/uimon.c 2025-03-31 16:46:12 UTC (rev 45615)
+++ trunk/vice/src/arch/sdl/uimon.c 2025-03-31 17:08:08 UTC (rev 45616)
@@ -124,7 +124,7 @@
char *buf = lib_strdup(buffer);
- if (using_ui_monitor) {
+ if (using_ui_monitor && menu_draw) {
int y = menu_draw->max_text_y - 1;
char *p = buf;
int i = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-31 16:46:20
|
Revision: 45615
http://sourceforge.net/p/vice-emu/code/45615
Author: compyx
Date: 2025-03-31 16:46:12 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
Nuke trailing whitespace from orbit
Modified Paths:
--------------
trunk/vice/src/arch/sdl/uimenu.c
trunk/vice/src/joyport/joystick.c
trunk/vice/src/joyport/joystick.h
Modified: trunk/vice/src/arch/sdl/uimenu.c
===================================================================
--- trunk/vice/src/arch/sdl/uimenu.c 2025-03-31 16:34:58 UTC (rev 45614)
+++ trunk/vice/src/arch/sdl/uimenu.c 2025-03-31 16:46:12 UTC (rev 45615)
@@ -1209,7 +1209,7 @@
case SDL_JOYBUTTONUP:
if (sdljoy_get_joy_for_event(e.jbutton.which, &joydev, &joynum)) {
joy_button_event(joydev->buttons[e.jbutton.button],
- e.type == SDL_JOYBUTTONDOWN ? 1 : 0);
+ e.type == SDL_JOYBUTTONDOWN ? 1 : 0);
}
break;
case SDL_JOYHATMOTION:
Modified: trunk/vice/src/joyport/joystick.c
===================================================================
--- trunk/vice/src/joyport/joystick.c 2025-03-31 16:34:58 UTC (rev 45614)
+++ trunk/vice/src/joyport/joystick.c 2025-03-31 16:46:12 UTC (rev 45615)
@@ -3103,7 +3103,7 @@
*/
void joy_hat_event(joystick_hat_t *hat, int32_t value)
{
- int joyport = hat->device->joyport;
+ int joyport = hat->device->joyport;
int32_t prev = hat->prev;
if (value == prev) {
@@ -3702,7 +3702,7 @@
/** \brief Get number of registered joystick devices
- *
+ *
* \return number of devices
*/
int joystick_device_count(void)
@@ -3779,7 +3779,7 @@
*/
static void joystick_calibration_default_for_axis(joystick_axis_t *axis)
{
- if (!axis->digital) {
+ if (!axis->digital) {
int32_t range = axis->maximum - axis->minimum;
/* add one to get proper range, but only if the result fits */
Modified: trunk/vice/src/joyport/joystick.h
===================================================================
--- trunk/vice/src/joyport/joystick.h 2025-03-31 16:34:58 UTC (rev 45614)
+++ trunk/vice/src/joyport/joystick.h 2025-03-31 16:46:12 UTC (rev 45615)
@@ -179,8 +179,7 @@
*/
typedef struct joystick_calibration_s {
bool invert; /**< invert value */
- struct
- {
+ struct {
int32_t negative; /**< axis threshold: V <= T: active input */
int32_t positive; /**< axis threshold: V >= T: active input */
} threshold;
@@ -270,7 +269,7 @@
/** \brief HID product ID */
uint16_t product;
-
+
/** \brief List of axes */
joystick_axis_t **axes;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-31 16:35:11
|
Revision: 45614
http://sourceforge.net/p/vice-emu/code/45614
Author: compyx
Date: 2025-03-31 16:34:58 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
Merge branch compyx/joymap-001 into trunk
This is the first step towards proper joystick mapping and calibration in the
Gtk3 UI (and future UIs):
* Reorganize data structures: mappings now are members of axis, button and hat
objects, and a joystick device is a collection of axes, buttons and hats.
Also add calibration data as members of the axis and button objects.
* Move responsibilities from the drivers to common code: the drivers pass raw
axis and button values to the common code and the common code decides what
those values mean (applying calibration). Hats are a different beast: so
currently the drivers need to decide which joystick directions their hat
values translate to.
* Managing resources is done (mostly) in common code: joystick devices take
ownership of axis, button and hat objects and the common code takes ownership
of joystick devices. The drivers are responsible for allocating and freeing
any arch-specific data, the rest is taken care of by the common code.
* Add additional information about host inputs in the data structures: for the
UI we need names of the axes, buttons and hats, and to be able to identify
the devices we need vendor and product IDs (so at a later point we can have
per-device loading of mappings/calibration).
* Identify inputs by ID, rather than index: SDL may refer to inputs by index,
but Linux evdev, Free/NetBSD HID and DirectInput do not. DirectInput and BSD
drivers are new implementations and Linux evdev was already a recent addition.
Modified Paths:
--------------
trunk/vice/doc/Makefile.am
trunk/vice/doc/mkdoxy.sh
trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
trunk/vice/src/arch/sdl/joy.c
trunk/vice/src/arch/sdl/joy.h
trunk/vice/src/arch/sdl/menu_joystick.c
trunk/vice/src/arch/sdl/ui.c
trunk/vice/src/arch/sdl/uimenu.c
trunk/vice/src/joyport/joystick.c
trunk/vice/src/joyport/joystick.h
trunk/vice/src/machine.c
Added Paths:
-----------
trunk/vice/data/CBM-II/sdl_sym_de.vkm
trunk/vice/doc/joystick.md
Removed Paths:
-------------
trunk/vice/data/CBM-II/sdl_sym_de.vkm
Deleted: trunk/vice/data/CBM-II/sdl_sym_de.vkm
===================================================================
--- trunk/vice/data/CBM-II/sdl_sym_de.vkm 2025-03-31 07:56:10 UTC (rev 45613)
+++ trunk/vice/data/CBM-II/sdl_sym_de.vkm 2025-03-31 16:34:58 UTC (rev 45614)
@@ -1,288 +0,0 @@
-# VICE keyboard mapping file
-#
-# A Keyboard map is read in as patch to the current map.
-#
-# File format:
-# - comment lines start with '#'
-# - keyword lines start with '!keyword'
-# - normal lines have 'keysym/scancode row column shiftflag'
-#
-# Keywords and their lines are:
-# '!CLEAR' clear whole table
-# '!INCLUDE filename' read file as mapping file
-# '!LSHIFT row col' left shift keyboard row/column
-# '!RSHIFT row col' right shift keyboard row/column
-# '!VSHIFT shiftkey' virtual shift key (RSHIFT or LSHIFT)
-# '!SHIFTL shiftkey' shift lock key (RSHIFT or LSHIFT)
-# for emulated keyboards that have only one shift key, set both LSHIFT
-# and RSHIFT to the same row/col and use RSHIFT for VSHIFT and SHIFTL.
-# '!LCTRL row col' left control keyboard row/column
-# '!VCTRL ctrlkey' virtual control key (LCTRL)
-# '!LCBM row col' left CBM keyboard row/column
-# '!VCBM cbmkey' virtual CBM key (LCBM)
-# '!UNDEF keysym' remove keysym from table
-#
-# Shiftflag can have these values, flags can be ORed to combine them:
-# 0x0000 0 key is not shifted for this keysym/scancode
-# 0x0001 1 key is combined with shift for this keysym/scancode
-# 0x0002 2 key is left shift on emulated machine
-# 0x0004 4 key is right shift on emulated machine (use only this one
-# for emulated keyboards that have only one shift key)
-# 0x0008 8 key can be shifted or not with this keysym/scancode
-# 0x0010 16 deshift key for this keysym/scancode
-# 0x0020 32 another definition for this keysym/scancode follows
-# 0x0040 64 key is shift-lock on emulated machine
-# 0x0080 128 shift modifier required on host
-# 0x0100 256 key is used for an alternative keyboard mapping, e.g. C64 mode in x128
-# 0x0200 512 alt-r (alt-gr) modifier required on host
-# 0x0400 1024 ctrl modifier required on host
-# 0x0800 2048 key is combined with cbm for this keysym/scancode
-# 0x1000 4096 key is combined with ctrl for this keysym/scancode
-# 0x2000 8192 key is (left) cbm on emulated machine
-# 0x4000 16384 key is (left) ctrl on emulated machine
-#
-# Negative row values:
-# 'keysym -1 n' joystick keymap A, direction n
-# 'keysym -2 n' joystick keymap B, direction n
-# 'keysym -3 0' first RESTORE key
-# 'keysym -3 1' second RESTORE key
-# 'keysym -4 0' 40/80 column key (x128)
-# 'keysym -4 1' CAPS (ASCII/DIN) key (x128)
-# 'keysym -5 n' joyport keypad, key n (not supported in x128)
-#
-# Joystick direction values:
-# 0 Fire
-# 1 South/West
-# 2 South
-# 3 South/East
-# 4 West
-# 5 East
-# 6 North/West
-# 7 North
-# 8 North/East
-#
-# Joyport keypad key layout:
-# --------------------------
-# | 0 | 1 | 2 | 3 | 4 |
-# --------------------------
-# | 5 | 6 | 7 | 8 | 9 |
-# --------------------------
-# | 10 | 11 | 12 | 13 | 14 |
-# --------------------------
-# | 15 | 16 | 17 | 18 | 19 |
-# --------------------------
-#
-# When a bigger spaced key is used,
-# it uses the upper left most key value.
-
-# Symbolic Mapping, DE Layout, CBM2, SDL
-
-# note: For some reason SDL does not get keyboard events for "dead keys" at all,
-# so a "nodeadkeys" layout must be used. CAUTION: apparently SDL generates
-# some tables internally at startup - switching the host layout while
-# the emulator is running produces unpredictable results (broken keycodes)
-
-# Commodore cbm2 keyboard matrix:
-#
-# references:
-# http://www.zimmers.net/anonftp/pub/cbm/b/documents/de/keyboard-matrix.gif
-# http://www.zimmers.net/anonftp/pub/cbm/b/documents/keymap-us.gif
-# http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/b/p500-keyboard.txt
-# http://www.floodgap.com/retrobits/ckb/secret/cbm-610-keyboard.jpg
-#
-# Keys starting with 'KP' are on the number pad. Both shifts and shift lock
-# are in parallel at one point in matrix.
-#
-# 0 1 2 3 4 5
-# +--------+--------+--------+--------+--------+--------+
-# 0 | F9 | 9 ( | O | L | ; : | / ? |
-# +--------+--------+--------+--------+--------+--------+
-# 1 | F10 | 0 ) | - | P | [ | ' " |
-# +--------+--------+--------+--------+--------+--------+
-# 2 | c.down | = + |<- pound| ] | return | pi |
-# +--------+--------+--------+--------+--------+--------+
-# 3 | c.up | c.left | c.right|del ins | CBM |########|
-# +--------+--------+--------+--------+--------+--------+
-# 4 |home/clr|KP ? |KP 7 |KP 4 |KP 1 |KP 0 |
-# +--------+--------+--------+--------+--------+--------+
-# 5 |rvs/off |KP CE |KP 8 |KP 5 |KP 2 |KP . |
-# +--------+--------+--------+--------+--------+--------+
-# 6 | graph |KP * |KP 9 |KP 6 |KP 3 |KP 00 |
-# +--------+--------+--------+--------+--------+--------+
-# 7 |run/stop|KP / |KP - |KP + |KP enter|########|
-# +--------+--------+--------+--------+--------+--------+
-# 8 | F1 | escape | TAB |########| Shift | CTRL |
-# +--------+--------+--------+--------+--------+--------+
-# 9 | F2 | 1 ! | Q | A | Z |########|
-# +--------+--------+--------+--------+--------+--------+
-#10 | F3 | 2 @ | W | S | X | C |
-# +--------+--------+--------+--------+--------+--------+
-#11 | F4 | 3 # | E | D | F | V |
-# +--------+--------+--------+--------+--------+--------+
-#12 | F5 | 4 $ | R | T | G | B |
-# +--------+--------+--------+--------+--------+--------+
-#13 | F6 | 5 % | 6 ^ | Y | H | N |
-# +--------+--------+--------+--------+--------+--------+
-#14 | F7 | 7 & | U | J | M | space |
-# +--------+--------+--------+--------+--------+--------+
-#15 | F8 | 8 * | I | K | , < | . > |
-# +--------+--------+--------+--------+--------+--------+
-
-# CBM2 Keyboard layout:
-#
-# F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 down up left right clr rvs graph r/s
-#
-# ESC 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) - =+ arrow/pound del ? CE * /
-# TAB q w e r t y u i o p [ ] return 7 8 9 -
-# SL a s d f g h j k l ;: '" pi 4 5 6 +
-# LS z x c v b n m ,< .> /? RS CBM 1 2 3
-# CTRL SPACE 0 . 00 enter
-
-!CLEAR
-!LSHIFT 8 4
-!RSHIFT 8 4
-!VSHIFT RSHIFT
-!SHIFTL RSHIFT
-!LCBM 3 4
-!VCBM LCBM
-!LCTRL 8 5
-!VCTRL LCTRL
-
-27 8 1 8 /* ESC -> ESC */
-
-49 9 1 8 /* 1 -> 1 */
-50 10 1 0x20 /* 2 -> 2 */
-50 1 5 0x80 /* shift 2 -> " */
-51 11 1 8 /* 3 -> 3 */
-52 12 1 8 /* 4 -> 4 */
-53 13 1 8 /* 5 -> 5 */
-54 13 2 0x20 /* 6 -> 6 */
-54 14 1 0x81 /* shift 6 -> & shift+7 */
-55 14 1 0x20 /* 7 -> 7 */
-55 0 5 0x90 /* shift 7 -> / */
-56 15 1 0x20 /* 8 -> 8 */
-56 0 1 0x80 /* shift 8 -> ( shift+9 */
-57 0 1 0x20 /* 9 -> 9 */
-57 1 1 0x80 /* shift 9 -> ) shift+0 */
-48 1 1 0x20 /* 0 -> 0 */
-48 2 1 0x90 /* shift 0 -> = */
-
-223 4 1 0x00b0 /* shift ? -> ? */
-223 4 1 0x0201 /* ctrl ? -> ctrl+ */
-
-180 2 2 8 /* ´ ` -> pound */
-
-45 1 2 0x20 /* Minus -> Minus */
-45 2 2 0x90 /* shift+Minus -> left arrow */
-
-306 8 5 0x4008 /* Left Ctrl -> CTRL */
-305 3 4 0x2008 /* Right Ctrl -> CBM */
-
-304 8 4 4 /* Left Shift -> Shift */
-301 8 4 64 /* Caps Lock -> Shift Lock */
-303 8 4 4 /* Right Shift -> Shift */
-
-32 14 5 8 /* Space -> Space */
-8 3 3 8 /* Backspace -> Del */
-9 8 2 8 /* TAB -> TAB */
-13 2 4 8 /* Return -> Return */
-
-44 15 4 0x20 /* , -> , */
-44 0 4 0x90 /* shift , -> ; */
-
-46 15 5 0x20 /* . -> . */
-46 0 4 0x420 /* ctrl . -> . */
-46 0 4 0x80 /* shift . -> : */
-
-#47 0 5 8 /* / -> / */
-
-60 15 4 0x021 /* < -> ,+shift */
-60 15 5 0x080 /* shift > -> .+shift */
-
-43 2 1 0x21 /* + -> Plus */
-43 15 1 0x80 /* shift++ -> * */
-
-252 10 1 1 /* ue -> @ */
-246 1 4 8 /* oe -> [ */
-228 2 3 8 /* ae -> ] */
-
-35 11 1 33 /* # -> 3+shift */
-35 1 5 0x420 /* ctrl # -> '+ctrl */
-35 1 5 0x90 /* ' -> 7+shift */
-
-94 13 2 0x021 /* ^ -> shift+6 (arrow up) */
-94 2 5 0x420 /* ctrl ^ -> pi */
-94 2 5 0x8b0 /* shift ^ -> pi */
-
-113 9 2 0x28 /* Q -> Q */
-113 10 1 0x201 /* altgr Q -> @ */
-
-119 10 2 8 /* W -> W */
-101 11 2 8 /* E -> E */
-114 12 2 8 /* R -> R */
-116 12 3 8 /* T -> T */
-121 13 3 8 /* Y -> Y */
-117 14 2 8 /* U -> U */
-105 15 2 8 /* I -> I */
-111 0 2 8 /* O -> O */
-112 1 3 8 /* P -> P */
-97 9 3 8 /* A -> A */
-115 10 3 8 /* S -> S */
-100 11 3 8 /* D -> D */
-102 11 4 8 /* F -> F */
-103 12 4 8 /* G -> G */
-104 13 4 8 /* H -> H */
-106 14 3 8 /* J -> J */
-107 15 3 8 /* K -> K */
-108 0 3 8 /* L -> L */
-122 9 4 8 /* Z -> Z */
-120 10 4 8 /* X -> X */
-99 10 5 8 /* C -> C */
-118 11 5 8 /* V -> V */
-98 12 5 8 /* B -> B */
-110 13 5 8 /* N -> N */
-109 14 4 8 /* M -> M */
-
-
-282 8 0 8 /* F1 -> F1 */
-283 9 0 8 /* F2 -> F2 */
-284 10 0 8 /* F3 -> F3 */
-285 11 0 8 /* F4 -> F4 */
-286 12 0 8 /* F5 -> F5 */
-287 13 0 8 /* F6 -> F6 */
-288 14 0 8 /* F7 -> F7 */
-289 15 0 8 /* F8 -> F8 */
-290 0 0 8 /* F9 -> F9 */
-291 1 0 8 /* F10 -> F10 */
-
-#292 1 0 8 /* F11 -> (unused) */
-#293 1 0 8 /* F12 -> run/stop */
-
-273 3 0 8 /* Up -> CRSR UP */
-276 3 1 8 /* Left -> CRSR LEFT */
-275 3 2 8 /* Right -> CRSR RIGHT */
-274 2 0 8 /* Down -> CRSR DOWN */
-
-277 6 5 8 /* Ins -> KP 00 */
-127 5 1 8 /* Del -> KP CE */
-278 4 0 8 /* Home -> CLR/HOME */
-279 5 0 8 /* End -> Rev/Off */
-280 7 0 8 /* PgUp -> Run/Stop */
-281 6 0 8 /* PgDown -> Norm/Graph */
-
-271 7 4 8 /* Numpad Enter -> Numpad Enter */
-267 7 1 8 /* Numpad / -> Numpad / */
-268 6 1 8 /* Numpad * -> Numpad * */
-263 4 2 8 /* Numpad 7 -> Numpad 7 */
-264 5 2 8 /* Numpad 8 -> Numpad 8 */
-265 6 2 8 /* Numpad 9 -> Numpad 9 */
-269 7 2 8 /* Numpad - -> Numpad - */
-260 4 3 8 /* Numpad 4 -> Numpad 4 */
-261 5 3 8 /* Numpad 5 -> Numpad 5 */
-262 6 3 8 /* Numpad 6 -> Numpad 6 */
-270 7 3 8 /* Numpad + -> Numpad + */
-257 4 4 8 /* Numpad 1 -> Numpad 1 */
-258 5 4 8 /* Numpad 2 -> Numpad 2 */
-259 6 4 8 /* Numpad 3 -> Numpad 3 */
-256 4 5 8 /* Numpad 0 -> Numpad 0 */
-266 5 5 8 /* Numpad . -> Numpad . */
Copied: trunk/vice/data/CBM-II/sdl_sym_de.vkm (from rev 45613, branches/compyx/joymap-001/vice/data/CBM-II/sdl_sym_de.vkm)
===================================================================
--- trunk/vice/data/CBM-II/sdl_sym_de.vkm (rev 0)
+++ trunk/vice/data/CBM-II/sdl_sym_de.vkm 2025-03-31 16:34:58 UTC (rev 45614)
@@ -0,0 +1,288 @@
+# VICE keyboard mapping file
+#
+# A Keyboard map is read in as patch to the current map.
+#
+# File format:
+# - comment lines start with '#'
+# - keyword lines start with '!keyword'
+# - normal lines have 'keysym/scancode row column shiftflag'
+#
+# Keywords and their lines are:
+# '!CLEAR' clear whole table
+# '!INCLUDE filename' read file as mapping file
+# '!LSHIFT row col' left shift keyboard row/column
+# '!RSHIFT row col' right shift keyboard row/column
+# '!VSHIFT shiftkey' virtual shift key (RSHIFT or LSHIFT)
+# '!SHIFTL shiftkey' shift lock key (RSHIFT or LSHIFT)
+# for emulated keyboards that have only one shift key, set both LSHIFT
+# and RSHIFT to the same row/col and use RSHIFT for VSHIFT and SHIFTL.
+# '!LCTRL row col' left control keyboard row/column
+# '!VCTRL ctrlkey' virtual control key (LCTRL)
+# '!LCBM row col' left CBM keyboard row/column
+# '!VCBM cbmkey' virtual CBM key (LCBM)
+# '!UNDEF keysym' remove keysym from table
+#
+# Shiftflag can have these values, flags can be ORed to combine them:
+# 0x0000 0 key is not shifted for this keysym/scancode
+# 0x0001 1 key is combined with shift for this keysym/scancode
+# 0x0002 2 key is left shift on emulated machine
+# 0x0004 4 key is right shift on emulated machine (use only this one
+# for emulated keyboards that have only one shift key)
+# 0x0008 8 key can be shifted or not with this keysym/scancode
+# 0x0010 16 deshift key for this keysym/scancode
+# 0x0020 32 another definition for this keysym/scancode follows
+# 0x0040 64 key is shift-lock on emulated machine
+# 0x0080 128 shift modifier required on host
+# 0x0100 256 key is used for an alternative keyboard mapping, e.g. C64 mode in x128
+# 0x0200 512 alt-r (alt-gr) modifier required on host
+# 0x0400 1024 ctrl modifier required on host
+# 0x0800 2048 key is combined with cbm for this keysym/scancode
+# 0x1000 4096 key is combined with ctrl for this keysym/scancode
+# 0x2000 8192 key is (left) cbm on emulated machine
+# 0x4000 16384 key is (left) ctrl on emulated machine
+#
+# Negative row values:
+# 'keysym -1 n' joystick keymap A, direction n
+# 'keysym -2 n' joystick keymap B, direction n
+# 'keysym -3 0' first RESTORE key
+# 'keysym -3 1' second RESTORE key
+# 'keysym -4 0' 40/80 column key (x128)
+# 'keysym -4 1' CAPS (ASCII/DIN) key (x128)
+# 'keysym -5 n' joyport keypad, key n (not supported in x128)
+#
+# Joystick direction values:
+# 0 Fire
+# 1 South/West
+# 2 South
+# 3 South/East
+# 4 West
+# 5 East
+# 6 North/West
+# 7 North
+# 8 North/East
+#
+# Joyport keypad key layout:
+# --------------------------
+# | 0 | 1 | 2 | 3 | 4 |
+# --------------------------
+# | 5 | 6 | 7 | 8 | 9 |
+# --------------------------
+# | 10 | 11 | 12 | 13 | 14 |
+# --------------------------
+# | 15 | 16 | 17 | 18 | 19 |
+# --------------------------
+#
+# When a bigger spaced key is used,
+# it uses the upper left most key value.
+
+# Symbolic Mapping, DE Layout, CBM2, SDL
+
+# note: For some reason SDL does not get keyboard events for "dead keys" at all,
+# so a "nodeadkeys" layout must be used. CAUTION: apparently SDL generates
+# some tables internally at startup - switching the host layout while
+# the emulator is running produces unpredictable results (broken keycodes)
+
+# Commodore cbm2 keyboard matrix:
+#
+# references:
+# http://www.zimmers.net/anonftp/pub/cbm/b/documents/de/keyboard-matrix.gif
+# http://www.zimmers.net/anonftp/pub/cbm/b/documents/keymap-us.gif
+# http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/b/p500-keyboard.txt
+# http://www.floodgap.com/retrobits/ckb/secret/cbm-610-keyboard.jpg
+#
+# Keys starting with 'KP' are on the number pad. Both shifts and shift lock
+# are in parallel at one point in matrix.
+#
+# 0 1 2 3 4 5
+# +--------+--------+--------+--------+--------+--------+
+# 0 | F9 | 9 ( | O | L | ; : | / ? |
+# +--------+--------+--------+--------+--------+--------+
+# 1 | F10 | 0 ) | - | P | [ | ' " |
+# +--------+--------+--------+--------+--------+--------+
+# 2 | c.down | = + |<- pound| ] | return | pi |
+# +--------+--------+--------+--------+--------+--------+
+# 3 | c.up | c.left | c.right|del ins | CBM |########|
+# +--------+--------+--------+--------+--------+--------+
+# 4 |home/clr|KP ? |KP 7 |KP 4 |KP 1 |KP 0 |
+# +--------+--------+--------+--------+--------+--------+
+# 5 |rvs/off |KP CE |KP 8 |KP 5 |KP 2 |KP . |
+# +--------+--------+--------+--------+--------+--------+
+# 6 | graph |KP * |KP 9 |KP 6 |KP 3 |KP 00 |
+# +--------+--------+--------+--------+--------+--------+
+# 7 |run/stop|KP / |KP - |KP + |KP enter|########|
+# +--------+--------+--------+--------+--------+--------+
+# 8 | F1 | escape | TAB |########| Shift | CTRL |
+# +--------+--------+--------+--------+--------+--------+
+# 9 | F2 | 1 ! | Q | A | Z |########|
+# +--------+--------+--------+--------+--------+--------+
+#10 | F3 | 2 @ | W | S | X | C |
+# +--------+--------+--------+--------+--------+--------+
+#11 | F4 | 3 # | E | D | F | V |
+# +--------+--------+--------+--------+--------+--------+
+#12 | F5 | 4 $ | R | T | G | B |
+# +--------+--------+--------+--------+--------+--------+
+#13 | F6 | 5 % | 6 ^ | Y | H | N |
+# +--------+--------+--------+--------+--------+--------+
+#14 | F7 | 7 & | U | J | M | space |
+# +--------+--------+--------+--------+--------+--------+
+#15 | F8 | 8 * | I | K | , < | . > |
+# +--------+--------+--------+--------+--------+--------+
+
+# CBM2 Keyboard layout:
+#
+# F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 down up left right clr rvs graph r/s
+#
+# ESC 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) - =+ arrow/pound del ? CE * /
+# TAB q w e r t y u i o p [ ] return 7 8 9 -
+# SL a s d f g h j k l ;: '" pi 4 5 6 +
+# LS z x c v b n m ,< .> /? RS CBM 1 2 3
+# CTRL SPACE 0 . 00 enter
+
+!CLEAR
+!LSHIFT 8 4
+!RSHIFT 8 4
+!VSHIFT RSHIFT
+!SHIFTL RSHIFT
+!LCBM 3 4
+!VCBM LCBM
+!LCTRL 8 5
+!VCTRL LCTRL
+
+27 8 1 8 /* ESC -> ESC */
+
+49 9 1 8 /* 1 -> 1 */
+50 10 1 0x20 /* 2 -> 2 */
+50 1 5 0x80 /* shift 2 -> " */
+51 11 1 8 /* 3 -> 3 */
+52 12 1 8 /* 4 -> 4 */
+53 13 1 8 /* 5 -> 5 */
+54 13 2 0x20 /* 6 -> 6 */
+54 14 1 0x81 /* shift 6 -> & shift+7 */
+55 14 1 0x20 /* 7 -> 7 */
+55 0 5 0x90 /* shift 7 -> / */
+56 15 1 0x20 /* 8 -> 8 */
+56 0 1 0x80 /* shift 8 -> ( shift+9 */
+57 0 1 0x20 /* 9 -> 9 */
+57 1 1 0x80 /* shift 9 -> ) shift+0 */
+48 1 1 0x20 /* 0 -> 0 */
+48 2 1 0x90 /* shift 0 -> = */
+
+223 4 1 0x00b0 /* shift ? -> ? */
+223 4 1 0x0201 /* ctrl ? -> ctrl+ */
+
+180 2 2 8 /* ´ ` -> pound */
+
+45 1 2 0x20 /* Minus -> Minus */
+45 2 2 0x90 /* shift+Minus -> left arrow */
+
+306 8 5 0x4008 /* Left Ctrl -> CTRL */
+305 3 4 0x2008 /* Right Ctrl -> CBM */
+
+304 8 4 4 /* Left Shift -> Shift */
+301 8 4 64 /* Caps Lock -> Shift Lock */
+303 8 4 4 /* Right Shift -> Shift */
+
+32 14 5 8 /* Space -> Space */
+8 3 3 8 /* Backspace -> Del */
+9 8 2 8 /* TAB -> TAB */
+13 2 4 8 /* Return -> Return */
+
+44 15 4 0x20 /* , -> , */
+44 0 4 0x90 /* shift , -> ; */
+
+46 15 5 0x20 /* . -> . */
+46 0 4 0x420 /* ctrl . -> . */
+46 0 4 0x80 /* shift . -> : */
+
+#47 0 5 8 /* / -> / */
+
+60 15 4 0x021 /* < -> ,+shift */
+60 15 5 0x080 /* shift > -> .+shift */
+
+43 2 1 0x21 /* + -> Plus */
+43 15 1 0x80 /* shift++ -> * */
+
+252 10 1 1 /* ue -> @ */
+246 1 4 8 /* oe -> [ */
+228 2 3 8 /* ae -> ] */
+
+35 11 1 33 /* # -> 3+shift */
+35 1 5 0x420 /* ctrl # -> '+ctrl */
+35 1 5 0x90 /* ' -> 7+shift */
+
+94 13 2 0x021 /* ^ -> shift+6 (arrow up) */
+94 2 5 0x420 /* ctrl ^ -> pi */
+94 2 5 0x8b0 /* shift ^ -> pi */
+
+113 9 2 0x28 /* Q -> Q */
+113 10 1 0x201 /* altgr Q -> @ */
+
+119 10 2 8 /* W -> W */
+101 11 2 8 /* E -> E */
+114 12 2 8 /* R -> R */
+116 12 3 8 /* T -> T */
+121 13 3 8 /* Y -> Y */
+117 14 2 8 /* U -> U */
+105 15 2 8 /* I -> I */
+111 0 2 8 /* O -> O */
+112 1 3 8 /* P -> P */
+97 9 3 8 /* A -> A */
+115 10 3 8 /* S -> S */
+100 11 3 8 /* D -> D */
+102 11 4 8 /* F -> F */
+103 12 4 8 /* G -> G */
+104 13 4 8 /* H -> H */
+106 14 3 8 /* J -> J */
+107 15 3 8 /* K -> K */
+108 0 3 8 /* L -> L */
+122 9 4 8 /* Z -> Z */
+120 10 4 8 /* X -> X */
+99 10 5 8 /* C -> C */
+118 11 5 8 /* V -> V */
+98 12 5 8 /* B -> B */
+110 13 5 8 /* N -> N */
+109 14 4 8 /* M -> M */
+
+
+282 8 0 8 /* F1 -> F1 */
+283 9 0 8 /* F2 -> F2 */
+284 10 0 8 /* F3 -> F3 */
+285 11 0 8 /* F4 -> F4 */
+286 12 0 8 /* F5 -> F5 */
+287 13 0 8 /* F6 -> F6 */
+288 14 0 8 /* F7 -> F7 */
+289 15 0 8 /* F8 -> F8 */
+290 0 0 8 /* F9 -> F9 */
+291 1 0 8 /* F10 -> F10 */
+
+#292 1 0 8 /* F11 -> (unused) */
+#293 1 0 8 /* F12 -> run/stop */
+
+273 3 0 8 /* Up -> CRSR UP */
+276 3 1 8 /* Left -> CRSR LEFT */
+275 3 2 8 /* Right -> CRSR RIGHT */
+274 2 0 8 /* Down -> CRSR DOWN */
+
+277 6 5 8 /* Ins -> KP 00 */
+127 5 1 8 /* Del -> KP CE */
+278 4 0 8 /* Home -> CLR/HOME */
+279 5 0 8 /* End -> Rev/Off */
+280 7 0 8 /* PgUp -> Run/Stop */
+281 6 0 8 /* PgDown -> Norm/Graph */
+
+271 7 4 8 /* Numpad Enter -> Numpad Enter */
+267 7 1 8 /* Numpad / -> Numpad / */
+268 6 1 8 /* Numpad * -> Numpad * */
+263 4 2 8 /* Numpad 7 -> Numpad 7 */
+264 5 2 8 /* Numpad 8 -> Numpad 8 */
+265 6 2 8 /* Numpad 9 -> Numpad 9 */
+269 7 2 8 /* Numpad - -> Numpad - */
+260 4 3 8 /* Numpad 4 -> Numpad 4 */
+261 5 3 8 /* Numpad 5 -> Numpad 5 */
+262 6 3 8 /* Numpad 6 -> Numpad 6 */
+270 7 3 8 /* Numpad + -> Numpad + */
+257 4 4 8 /* Numpad 1 -> Numpad 1 */
+258 5 4 8 /* Numpad 2 -> Numpad 2 */
+259 6 4 8 /* Numpad 3 -> Numpad 3 */
+256 4 5 8 /* Numpad 0 -> Numpad 0 */
+266 5 5 8 /* Numpad . -> Numpad . */
Modified: trunk/vice/doc/Makefile.am
===================================================================
--- trunk/vice/doc/Makefile.am 2025-03-31 07:56:10 UTC (rev 45613)
+++ trunk/vice/doc/Makefile.am 2025-03-31 16:34:58 UTC (rev 45614)
@@ -6,6 +6,7 @@
Documentation-Howto.txt \
Doxygen-Howto.txt \
iec-bus.txt \
+ joystick.md \
Release-Howto.txt \
vice.texi \
gpl.texi
Copied: trunk/vice/doc/joystick.md (from rev 45613, branches/compyx/joymap-001/vice/doc/joystick.md)
===================================================================
--- trunk/vice/doc/joystick.md (rev 0)
+++ trunk/vice/doc/joystick.md 2025-03-31 16:34:58 UTC (rev 45614)
@@ -0,0 +1,269 @@
+# VICE Joystick API
+
+> To get a nicely formatted HTML version of this document, including syntax
+> highlighting, use:
+>
+> `pandoc -s -t html -f gfm joystick.md > joystick.html`
+
+
+## Preface
+
+This document describes the updated joystick API, which currently is a **work in
+progress**. All information herein is subject to change while the joystick code
+is being worked on. The inner workings of the actual emulation of the I/O system
+will not be described, just the translation of host device input to emulated
+joystick device, so no actual CIA/VIA emulation.
+
+
+## Overview of the joystick system in VICE
+
+The joystick system in VICE is split into two parts: **common code** and
+**driver code**. The driver code is specific to an OS/UI, while the common code,
+as the name implies, is used for every OS/UI.
+
+### Common code
+
+The common code (in `src/joyport/`) is responsible for interpreting data from
+the drivers and passing that to the emulation, as well as handling mapping and
+calibration of host inputs to emulated inputs. It is also responsible for
+providing the UI with information on host and emulated devices, and at a later
+point, passing host input to the UI for mapping and calibration dialogs.
+
+### Driver code
+
+The driver code is responsible for reading data from a host device and passing
+that back to the common code, as well as providing the common code with a list
+of available host devices and their properties.
+
+
+## Changes in the separation of driver and common code
+
+I've tried to keep the code required to implement a driver as small as possible,
+moving a number of responsibilities from the drivers to the common code.
+
+* The old code would let the driver interpret raw axis and button values and
+ send that back to the emulation (during the `poll()` callback). The drivers
+ now simply pass the raw values to the common code, and the common code
+ interprets those values with the help of the information on the host devices
+ provided by the driver (while also doing calibration).
+
+* A driver no longer needs to concern itself with ordering inputs, the common
+ code handles that.
+
+* Every input now has a unique *code*, which can be an event code (like with
+ Linux' evdev), a simple index of the input (as in SDL) or a HID usage code
+ (as on FreeBSD/NetBSD). The API provides drivers with methods of looking up
+ axis, button and hat objects through their respective code.
+
+* Event handlers in the common code now refer to inputs by instance, not index.
+ So for an axis event a driver would call `joy_axis_event()` with a host device
+ instance, axis instance and raw axis value.
+
+
+**TODO**: Proper (simple) description of `joystick_device_t` and its members
+ `joystick_axis_t`, `joystick_button_t` and `joystick_hat_t`.
+
+**TODO**: Explain ownership of objects (container assumes ownership of its
+ elements and is responsible for freeing them after use, etc).
+
+
+## Implementing a driver
+
+Implementing a driver should be fairly straightforward. A driver registers
+itself with the joystick system and adds host devices it has detected.
+
+During joystick system initialization an arch-specific initialization function
+is called (and expected to be implemented by the driver), where the driver
+registers itself and adds host devices:
+
+```C
+void joystick_arch_init(void)
+```
+
+The function to register the driver is:
+
+```C
+void joystick_driver_register(const joystick_driver_t *driver)
+```
+
+Where `joystick_driver_t` is defined as:
+```C
+typedef struct joystick_driver_s {
+ /** \brief Open host device for use */
+ bool (*open) (joystick_device_t *);
+
+ /** \brief Poll host device */
+ void (*poll) (joystick_device_t *);
+
+ /** \brief Close host device */
+ void (*close) (joystick_device_t *);
+
+ /** \brief Optional method to free arch-specific device data */
+ void (*priv_free)(void *);
+
+ /** \brief Function to call after registering a device
+ *
+ * This function is called after #joystick_device_register has processed
+ * its argument. It can be used to customize mappings or calibration if so
+ * required.
+ */
+ void (*customize)(joystick_device_t *);
+
+} joystick_driver_t;
+```
+
+> Currently (re)opening a device hasn't been implemented yet, so the `open()`
+> method can be ignored, for now.
+
+### Driver methods
+
+The `poll()` method is called by the emulation at the end of *every emulated
+scanline*, and is expected to process any pending event data and pass that
+along to `joy_axis_event()`, `joy_button_event()` or `joy_hat_event()`.
+
+The `close()` method should close the host device (e.g. close file descriptor)
+and put the device in a proper state for opening again. It should **not** free
+its private data in the `priv` member of the `joystick_device_t`, that is done
+in the `priv_free()` method, called by the joystick system on shutdown.
+It should also **not** free the joystick device instance, that again is done by
+the joystick system.
+
+The `priv_free()` method (if used) is, as mentioned above, called on emulator
+shutdown (or once we implement plug-n-pray, on device unplugging), and can be
+used to free any arch-specific resources that cannot be contained in the
+`joystick_device_t` instance or its members.
+> For example: the DirectInput driver for Windows stores a `GUID` and an
+> `LPDIRECTINPUTDEVICE8` instance in `priv`.
+
+The `customize()` method can be used to customize the default mapping and
+calibration applied by the joystick system when `joystick_device_register()` is
+called.
+
+
+### Example of driver implementation
+
+The basic structure of a driver is the following:
+
+```C
+
+/* Some arch-specific data of a device (obvious pseudo code) */
+typedef struct foo_priv_s {
+ FOO_DEVICE *foodev;
+} foo_priv_t;
+
+
+/* Declaration of driver methods */
+static joystick_driver_t foo_driver = {
+ .poll = foo_poll,
+ .close = foo_close
+ .priv_free = foo_priv_free
+};
+
+
+/*
+ * Called after the joystick system has initialized during emulator boot
+ */
+void joystick_arch_init(void)
+{
+ /* Arch-specific initialization, if required */
+ FOO_JOYSTICK_SYSTEM_INIT();
+
+ /* Register driver */
+ joystick_driver_register(&foo_driver);
+
+ /* Iterate devices and register them with the joystick system */
+ for (int i = 0; i < NUM_HOST_DEVICES; i++) {
+
+ joystick_device_t *joydev = joystick_device_new();
+
+ FOO_DEVICE *foodev = OPEN_FOO_DEVICE(i);
+
+ joystick_device_set_name(joydev, foodev->name);
+ joystick_device_set_node(joydev, foodev->...); /* filesystem node of
+ device, GUID string,
+ whatever */
+ joydev->vendor = foodev->vendor_id; /* USB HID vendor ID */
+ joydev->product = foodev->product_id; /* USB HID product ID */
+
+ /* Iterate axes, buttons and perhaps hats of a device and add them */
+ for (int a = 0; a < NUM_AXES(foodev); a++) {
+
+ joystick_axis_t *axis = joystick_axis_new(foodev->AXES[a].name);
+ axis->code = foodev->AXES[a].code; /* some unique event code, can
+ be HID usage, or just index
+ of axis */
+ /* set limits if available */
+ axis->minimum = foodev->AXES[a].min; /* default is INT16_MIN */
+ axis->maximum = foodev->AXES[a].max; /* default is INT16_MAX */
+
+ /* store arch-specific data in `priv` member */
+ foo_priv_t *priv = lib_malloc(sizeof *priv);
+ priv->foodev = foodev;
+ joydev->priv = priv;
+
+ /* add axis to device: device takes ownership */
+ joystick_device_add_axis(joydev, axis);
+ }
+
+ /*
+ * ... Do the same for buttons and hats, if available ...
+ */
+
+ /* Now register the device with the joystick system: the joystick
+ * system takes ownership of the device and its members
+ */
+ joystick_device_register(joydev);
+ }
+}
+
+
+/*
+ * Clean up any arch-specific resources here on emulator shutdown
+ */
+void joystick_arch_shutdown(void)
+{
+ FOO_JOYSTICK_SYSTEM_CLOSE();
+}
+
+
+static void foo_poll(joystick_device_t *joydev)
+{
+ foo_priv_t *priv = joydev->priv;
+
+ while (HAS_EVENT_PENDING(priv->foodev) {
+ FOO_EVENT event = GET_EVENT(priv->foodev);
+
+ switch (event.type) {
+ case FOO_AXIS:
+ joystick_axis_t *axis = joystick_axis_from_code(joydev, event.code);
+ joy_axis_event(axis, event.value);
+ break;
+ case FOO_BUTTON:
+ joystick_button_t *button = joystick_button_from_code(joydev, event.code);
+ joy_button_event(button, event.value);
+ break;
+ }
+ }
+}
+
+
+static void foo_close(joystick_device_t *joydev)
+{
+ foo_priv_t *priv = joydev->priv;
+
+ if (priv->foodev != NULL) {
+ FOO_DEVICE_CLOSE(priv->foodev);
+ priv->foodev = NULL;
+ }
+}
+
+
+static void foo_priv_free(void *priv)
+{
+ foo_priv_t *p = priv;
+
+ FOO_DEVICE_FREE(p->foodev);
+ lib_free(p);
+}
+```
+
Modified: trunk/vice/doc/mkdoxy.sh
===================================================================
--- trunk/vice/doc/mkdoxy.sh 2025-03-31 07:56:10 UTC (rev 45613)
+++ trunk/vice/doc/mkdoxy.sh 2025-03-31 16:34:58 UTC (rev 45614)
@@ -73,6 +73,7 @@
ARCH_GTK3_INPUT=" ../src/arch/gtk3"
ARCH_GTK3_INPUT+=" ../src/arch/gtk3/widgets"
ARCH_GTK3_INPUT+=" ../src/arch/gtk3/widgets/base"
+ARCH_GTK3_INPUT+=" ../src/arch/gtk3/joystickdrv"
ARCH_SDL_INPUT=" ../src/arch/sdl"
@@ -87,6 +88,7 @@
INPUT+=" ../src/hwsiddrv"
INPUT+=" ../src/iecbus"
INPUT+=" ../src/imagecontents"
+INPUT+=" ../src/joyport"
INPUT+=" ../src/monitor"
INPUT+=" ../src/parallel"
INPUT+=" ../src/printerdrv"
Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
===================================================================
--- trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-31 07:56:10 UTC (rev 45613)
+++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-31 16:34:58 UTC (rev 45614)
@@ -1,8 +1,7 @@
/** \file joystick_bsd.c
- * \brief NetBSD/FreeBSD/DragonFly USB joystick support
+ * \brief NetBSD/FreeBSD USB joystick support
*
- * \author Dieter Baron <di...@ni...>
- * \author Marco van den Heuvel <bla...@ya...>
+ * \author Bas Wassink <b.w...@zi...>
*
* \todo Check if this code also works on OpenBSD.
*/
@@ -30,11 +29,46 @@
#include "vice.h"
-
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <errno.h>
+#include <dirent.h>
#include <fcntl.h>
-#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <unistd.h>
+#include <usbhid.h>
+#ifdef FREEBSD_COMPILE
+/* for hid_* and HUG_* */
+#include <dev/hid/hid.h>
+/* for struct usb_device_info */
+#include <dev/usb/usb_ioctl.h>
+#endif
+
+#ifdef NETBSD_COMPILE
+#include <dev/usb/usb.h>
+#include <dev/usb/usbhid.h>
+#include <dev/hid/hid.h>
+
+/* FreeBSD (9.3) doesn't have the D-Pad defines */
+#ifndef HUG_D_PAD_UP
+#define HUG_D_PAD_UP 0x0090
+#endif
+#ifndef HUG_D_PAD_DOWN
+#define HUG_D_PAD_DOWN 0x0091
+#endif
+#ifndef HUG_D_PAD_RIGHT
+#define HUG_D_PAD_RIGHT 0x0092
+#endif
+#ifndef HUG_D_PAD_LEFT
+#define HUG_D_PAD_LEFT 0x0093
+#endif
+
+#endif /* NETBSD_COMPILE */
+
#include "cmdline.h"
#include "joystick.h"
#include "keyboard.h"
@@ -42,346 +76,588 @@
#include "log.h"
#include "resources.h"
#include "types.h"
+#include "util.h"
+/* Constants used when calling scandir(3) and (re)constructing nodes in the
+ * file system of HID devices
+ */
-#define ITEM_AXIS 0
-#define ITEM_BUTTON 1
-#define ITEM_HAT 2
+/** \brief Root directory of \c uhid* files */
+#define ROOT_NODE "/dev"
-static log_t bsd_joystick_log;
+/** \brief Length of the #ROOT_NODE */
+#define ROOT_NODE_LEN 4
-#ifdef HAVE_USB_H
-#include <usb.h>
-#endif
+/** \brief Prefix of HID files in the \c /dev virtual file system */
+#define NODE_PREFIX "uhid"
-#ifdef DRAGONFLYBSD_COMPILE
-/* sys/param.h contains the __DragonFly_version macro */
-# include <sys/param.h>
-# if __DragonFly_version >= 300200
-/* DragonFly >= 3.2 (USB4BSD stack) */
-# include <bus/u4b/usb.h>
-# include <bus/u4b/usbhid.h>
-# else
-/* DragonFly < 3.2: old USB stack */
-# include <bus/usb/usb.h>
-# include <bus/usb/usbhid.h>
-# endif
-#else
-# ifdef FREEBSD_COMPILE
-# include <sys/ioccom.h>
-# endif
-# include <dev/usb/usb.h>
-# include <dev/usb/usbhid.h>
-#endif
+/** \brief Length of the #NODE_PREIFX */
+#define NODE_PREFIX_LEN 4
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#if defined(HAVE_USBHID_H)
-#include <usbhid.h>
-#elif defined(HAVE_LIBUSB_H)
-#include <libusb.h>
-#elif defined(HAVE_LIBUSBHID_H)
-#include <libusbhid.h>
-#endif
+/** \brief Driver-specific data
+ */
+typedef struct joy_priv_s {
+ void *buffer; /**< buffer for reading HID data */
+ report_desc_t rep_desc; /**< HID report descriptor */
+ int rep_size; /**< size of \c rep_desc */
+ int rep_id; /**< report ID */
+ int fd; /**< file descriptor of HID device */
+ int *prev_axes; /**< previous raw value of axes */
+ int *prev_buttons; /**< previous raw value of buttons */
+ int *prev_hats; /**< previous raw value of hats */
+} joy_priv_t;
-#define MAX_DEV 16 /* number of uhid devices to try (NetBSD 9.3 has 16
- /dev/uhid* nodes) */
+/* Forward declarations */
+static bool bsd_joy_open (joystick_device_t *joydev);
+static void bsd_joy_poll (joystick_device_t *joydev);
+static void bsd_joy_close(joystick_device_t *joydev);
+static void joy_priv_free(void *priv);
-/*
- * This hat map was created from values observed on NetBSD 9.2
- * with an analog joystick "ADDISON TECHNOLOGY" that also has a hat switch.
- * uhidev1 at uhub1 port 6 configuration 1 interface 0
- * uhidev1: vendor 0907 (0x907) product 0523 (0x523), rev 1.00/1.00, addr 40, iclass 3/0
- * uhid0 at uhidev1: input=3, output=0, feature=0
+
+/** \brief Log for BSD joystick driver */
+static log_t bsd_joy_log;
+
+/** \brief BSD joystick driver declaration */
+static joystick_driver_t driver = {
+ .open = bsd_joy_open,
+ .poll = bsd_joy_poll,
+ .close = bsd_joy_close,
+ .priv_free = joy_priv_free
+};
+
+
+/** \brief Allocate new private data object
*
- * Only 0 and the odd values (horizontal and vertical) were observed
- * but let's leave the diagonals in too, just in case.
+ * Allocate and initialize private data object instance.
*
- * There are apparently hats with 0 for neutral and 1 for up, and some
- * with 8 for neutral and 0 for up. The other values are off by 1.
- * We try to autodetect, by seeing which of 0 or 8 occurs first.
- * We report no direction until one of those is seen.
+ * \return new data object
*/
-#define MAX_HAT_MAP_INDEX 8
-static const uint8_t hat_map[MAX_HAT_MAP_INDEX + 2] = {
- 0, /* 0 */
- JOYSTICK_DIRECTION_UP, /* 1 */
- JOYSTICK_DIRECTION_UP | JOYSTICK_DIRECTION_RIGHT, /* 2 */
- JOYSTICK_DIRECTION_RIGHT, /* 3 */
- JOYSTICK_DIRECTION_RIGHT | JOYSTICK_DIRECTION_DOWN, /* 4 */
- JOYSTICK_DIRECTION_DOWN, /* 5 */
- JOYSTICK_DIRECTION_DOWN | JOYSTICK_DIRECTION_LEFT, /* 6 */
- JOYSTICK_DIRECTION_LEFT, /* 7 */
- JOYSTICK_DIRECTION_LEFT | JOYSTICK_DIRECTION_UP, /* 8 */
- 0, /* 9 */
-};
+static joy_priv_t *joy_priv_new(void)
+{
+ joy_priv_t *priv = lib_malloc(sizeof *priv);
-struct usb_joy_item {
- struct hid_item item;
- struct usb_joy_item *next;
+ priv->buffer = NULL;
+ priv->rep_desc = NULL;
+ priv->rep_size = 0;
+ priv->fd = -1;
+ priv->rep_id = 0;
+ priv->prev_axes = NULL;
+ priv->prev_buttons = NULL;
+ priv->prev_hats = NULL;
+ return priv;
+}
- int type;
- int min_val;
- int max_val;
- int ordinal_number;
-};
+/** \brief Free private data instance
+ *
+ * Free private data object and its resources.
+ * Closes file descriptor, cleans up HID report descriptor and free HID buffer.
+ *
+ * \param[in] priv private data object
+ */
+static void joy_priv_free(void *priv)
+{
+ joy_priv_t *p = priv;
-typedef struct bsd_joystick_priv_s {
- struct usb_joy_item *usb_joy_item;
- char *usb_joy_buf;
- int usb_joy_fd;
- int usb_joy_size;
-} bsd_joystick_priv_t;
+ if (p != NULL) {
+ if (p->fd >= 0) {
+ close(p->fd);
+ }
+ lib_free(p->buffer);
+ if (p->rep_desc != NULL) {
+ hid_dispose_report_desc(p->rep_desc);
+ }
+ lib_free(p->prev_axes);
+ lib_free(p->prev_buttons);
+ lib_free(p->prev_hats);
+ lib_free(p);
+ }
+}
-static void usb_joy_add_item(struct usb_joy_item **item, struct hid_item *hi, int orval, int type)
+/** \brief Open joystick device for polling
+ *
+ * \param[in] joydev joystick device
+ */
+static bool bsd_joy_open (joystick_device_t *joydev)
{
- struct usb_joy_item *it;
- int w;
+ return true; /* NOP */
+}
- it = lib_malloc(sizeof *it);
- it->next = *item;
- *item = it;
+/** \brief Poll joystick device
+ *
+ * \param[in] joydev joystick device
+ */
+static void bsd_joy_poll(joystick_device_t *joydev)
+{
+ joy_priv_t *priv = joydev->priv;
- memcpy(&it->item, hi, sizeof(*hi));
- it->type = type;
- it->ordinal_number = orval;
+ if (priv != NULL && priv->fd >= 0) {
+ ssize_t rsize;
- switch (type) {
- case ITEM_AXIS:
- w = (hi->logical_maximum - hi->logical_minimum) / 3;
- it->min_val = hi->logical_minimum + w;
- it->max_val = hi->logical_maximum - w;
- break;
- case ITEM_BUTTON:
- it->min_val = hi->logical_minimum;
- it->max_val = hi->logical_maximum - 1;
- break;
- case ITEM_HAT:
- it->min_val = -1; /* mapping not autodetected yet */
- break;
+ while ((rsize = read(priv->fd, priv->buffer, (size_t)priv->rep_size)) == priv->rep_size) {
+ struct hid_data *data;
+ struct hid_item item;
+
+ data = hid_start_parse(priv->rep_desc, 1 << hid_input, priv->rep_id);
+ if (data == NULL) {
+ return;
+ }
+
+ while (hid_get_item(data, &item) > 0) {
+ joystick_axis_t *axis;
+ joystick_button_t *button;
+ joystick_hat_t *hat;
+ int value = hid_get_data(priv->buffer, &item);
+ int usage = HID_USAGE(item.usage);
+ unsigned int page = HID_PAGE(item.usage);
+ int prev;
+
+ switch (page) {
+ case HUP_GENERIC_DESKTOP:
+ switch (usage) {
+ case HUG_X: /* fall through */
+ case HUG_Y: /* fall through */
+ case HUG_Z: /* fall through */
+ case HUG_RX: /* fall through */
+ case HUG_RY: /* fall through */
+ case HUG_RZ: /* fall through */
+ case HUG_SLIDER:
+ /* axis */
+ axis = joystick_axis_from_code(joydev, (uint32_t)usage);
+ if (axis != NULL) {
+ /* XXX: On my Logitech F710 the Y axis is inverted by
+ * FreeBSD, NetBSD just reports insane values.
+ * So for FreeBSD we'd need calibration to be
+ * implemented for the F710 to work.
+ */
+ prev = priv->prev_axes[axis->index];
+ if (value != prev) {
+ priv->prev_axes[axis->index] = value;
+ joy_axis_event(axis, (int32_t)value);
+ }
+ }
+ break;
+
+ case HUG_HAT_SWITCH:
+ /* hat */
+ hat = joystick_hat_from_code(joydev, (uint32_t)usage);
+ if (hat != NULL) {
+ prev = priv->prev_hats[hat->index];
+ if (prev != value) {
+ priv->prev_hats[hat->index] = value;
+ joy_hat_event(hat, (int32_t)value);
+ }
+ }
+ break;
+
+ case HUG_D_PAD_UP: /* fall through */
+ case HUG_D_PAD_DOWN: /* fall through */
+ case HUG_D_PAD_LEFT: /* fall through */
+ case HUG_D_PAD_RIGHT:
+ /* D-Pad is mapped as buttons */
+ button = joystick_button_from_code(joydev, (uint32_t)usage);
+ if (button != NULL) {
+ prev = priv->prev_buttons[button->index];
+ if (prev != value) {
+ priv->prev_buttons[button->index] = value;
+ joy_button_event(button, (int32_t)value);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case HUP_BUTTON:
+ /* button event */
+ button = joystick_button_from_code(joydev, (uint32_t)usage);
+ if (button != NULL) {
+ prev = priv->prev_buttons[button->index];
+ if (prev != value) {
+ priv->prev_buttons[button->index] = value;
+ joy_button_event(button, (int32_t)value);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ hid_end_parse(data);
+ }
+
+ if (rsize != -1 && errno != EAGAIN) {
+ log_warning(bsd_joy_log,
+ "weird report size: %zd: %s",
+ rsize, strerror(errno));
+ }
}
}
-static void usb_free_item(struct usb_joy_item **item)
+/** \brief Close joystick device
+ *
+ * \param[in] joydev joystick device
+ */
+static void bsd_joy_close(joystick_device_t *joydev)
{
- struct usb_joy_item *it, *it2;
-
- it=*item;
- while (it) {
- it2 = it;
- it = it->next;
- lib_free(it2);
+ if (joydev != NULL && joydev->priv != NULL) {
+ joy_priv_free(joydev->priv);
+ joydev->priv = NULL;
}
- *item = NULL;
}
-static void usb_joystick_close(void* priv)
+
+/** \brief scandir select callback
+ *
+ * Check if name matches "uhid?*".
+ *
+ * \param[in] de directory entry
+ *
+ * \return non-0 when matching "uhid?*"
+ */
+static int sd_select(const struct dirent *de)
{
- bsd_joystick_priv_t *joypriv = priv;
- close(joypriv->usb_joy_fd);
- usb_free_item(&joypriv->usb_joy_item);
- lib_free(priv);
+ const char *name = de->d_name;
+
+ return ((strlen(name) >= NODE_PREFIX_LEN + 1u) &&
+ (strncmp(NODE_PREFIX, name, NODE_PREFIX_LEN) == 0));
}
-static void usb_joystick(int jp, void* priv)
+/** \brief Get full path of UHID device node
+ *
+ * \param[in] node node in /dev/
+ *
+ * \return full path to \a node
+ * \note free with \c lib_free() after use
+ */
+static char *full_node_path(const char *node)
{
- int val;
- ssize_t ret;
- struct usb_joy_item *it;
- bsd_joystick_priv_t *joypriv = priv;
+ size_t nlen = strlen(node);
+ size_t plen = ROOT_NODE_LEN + 1u + nlen + 1u;
+ char *path = lib_malloc(plen);
- val = 0;
- while ((ret = read(joypriv->usb_joy_fd, joypriv->usb_joy_buf, joypriv->usb_joy_size)) == joypriv->usb_joy_size) {
- val = 1;
+ memcpy(path, ROOT_NODE, ROOT_NODE_LEN);
+ path[ROOT_NODE_LEN] = '/';
+ memcpy(path + ROOT_NODE_LEN + 1, node, nlen + 1u);
+ return path;
+}
+
+/** \brief Open device for HID usage
+ *
+ * Open \c node and get associated HID data from it for scanning/polling.
+ * This function opens the device and allocates a buffer for HID reports, gets
+ * the report ID and size and allocates a \c joy_priv_t instance with all that
+ * data.
+ *
+ * \param[in] node path in <tt>/dev/</tt> to the device
+ *
+ * \return new initialized \c joy_priv_t instance or <tt>NULL</tt> on error
+ */
+static joy_priv_t *joy_hid_open(const char *node)
+{
+ joy_priv_t *priv;
+ report_desc_t rep_desc;
+ int rep_id;
+ int rep_size;
+ int fd;
+
+ fd = open(node, O_RDONLY|O_NONBLOCK);
+ if (fd < 0) {
+ /* don't log, (Net)BSD allocates a lot of nodes in /dev that aren't
+ * actually valid */
+ return NULL;
}
- if (ret != -1 && errno != EAGAIN) {
- /* XXX */
- log_warning(bsd_joystick_log, "strange read return: %zd/%d", ret, errno);
- return;
+
+ /* get report ID if possible, else asume 0 */
+#ifdef USB_GET_REPORT_ID
+ if (ioctl(fd, USB_GET_REPORT_ID, &rep_id) < 0) {
+ log_warning(bsd_joy_log, "USB_GET_REPORT_ID failed.");
+ close(fd);
+ return NULL;
}
- if (!val) {
- return;
+#else
+ rep_id = 0;
+#endif
+
+ /* get report description */
+ rep_desc = hid_get_report_desc(fd);
+ if (rep_desc == NULL) {
+ log_error(bsd_joy_log,
+ "failed to get HID report for %s: %s",
+ node, strerror(errno));
+ close(fd);
+ return NULL;
}
- for (it = joypriv->usb_joy_item; it; it = it->next) {
- val = hid_get_data(joypriv->usb_joy_buf, &it->item);
- if (it->type == ITEM_HAT) {
- if (val >= 0 && val <= MAX_HAT_MAP_INDEX) {
- /* Autodect if 0 is neutral, or 8 */
- if (it->min_val < 0) {
- if (val == 0) {
- it->min_val = 0;
- } else if (val == 8) {
- it->min_val = 1;
- } else {
- /* Not yet autodetected */
- }
- /* Report neutral position for now */
- joy_hat_event(jp, it->ordinal_number, 0);
- } else {
- val += it->min_val;
- joy_hat_event(jp, it->ordinal_number, hat_map[val]);
+ /* get report size */
+ rep_size = hid_report_size(rep_desc, hid_input, rep_id);
+ if (rep_size <= 0) {
+ log_error(bsd_joy_log, "invalid report size of %d", rep_size);
+ hid_dispose_report_desc(rep_desc);
+ close(fd);
+ return NULL;
+ }
+
+ /* success: allocate private data object and store what we need for polling
+ * and further querying */
+ priv = joy_priv_new();
+ priv->buffer = lib_malloc((size_t)rep_size);
+ priv->rep_desc = rep_desc;
+ priv->rep_size = rep_size;
+ priv->rep_id = rep_id;
+ priv->fd = fd;
+
+ return priv;
+}
+
+/** \brief Add axis to joystick device
+ *
+ * \param[in] joydev joystick device
+ * \param[in] item HID item with axis information
+ *
+ */
+static void add_joy_axis(joystick_device_t *joydev,
+ const struct hid_item *item)
+{
+ joystick_axis_t *axis;
+
+ axis = joystick_axis_new(hid_usage_in_page(item->usage));
+ axis->code = (uint32_t)HID_USAGE(item->usage);
+ axis->minimum = item->logical_minimum;
+ axis->maximum = item->logical_maximum;
+
+ log_message(bsd_joy_log, "axis %u: %s", axis->code, axis->name);
+ joystick_device_add_axis(joydev, axis);
+}
+
+/** \brief Add button to joystick device
+ *
+ * \param[in] joydev joystick device
+ * \param[in] item HID item with button information
+ */
+static void add_joy_button(joystick_device_t *joydev,
+ const struct hid_item *item)
+{
+ joystick_button_t *button;
+
+ button = joystick_button_new(hid_usage_in_page(item->usage));
+ button->code = (uint32_t)HID_USAGE(item->usage);
+
+ log_message(bsd_joy_log, "button %u: %s", button->code, button->name);
+ joystick_device_add_button(joydev, button);
+}
+
+/** \brief Add hat to joystick device
+ *
+ * \param[in] joydev joystick device
+ * \param[in] item HID item with hat information
+ */
+static void add_joy_hat(joystick_device_t *joydev,
+ const struct hid_item *item)
+{
+ joystick_hat_t *hat;
+
+ hat = joystick_hat_new(hid_usage_in_page(item->usage));
+ hat->code = (uint32_t)HID_USAGE(item->usage);
+
+ log_message(bsd_joy_log, "hat %u: %s", hat->code, hat->name);
+ joystick_device_add_hat(joydev, hat);
+}
+
+/** \brief Scan device for inputs
+ *
+ * Scan \a joydev for axes, buttons and hats and register them with \a joydev.
+ *
+ * \param[in] joydev joystick device
+ *
+ * \return \c true on succes
+ */
+static bool scan_inputs(joystick_device_t *joydev)
+{
+ joy_priv_t *priv;
+ struct hid_data *hdata;
+ struct hid_item hitem;
+
+ priv = joydev->priv;
+ hdata = hid_start_parse(priv->rep_desc, 1 << hid_input, priv->rep_id);
+ if (hdata == NULL) {
+ log_error(bsd_joy_log, "hid_start_parse() failed: %s,", strerror(errno));
+ return false;
+ }
+
+ while (hid_get_item(hdata, &hitem) > 0) {
+ unsigned int page = HID_PAGE (hitem.usage);
+ int usage = HID_USAGE(hitem.usage);
+
+ switch (page) {
+ case HUP_GENERIC_DESKTOP:
+ switch (usage) {
+ case HUG_X: /* fall through */
+ case HUG_Y: /* fall through */
+ case HUG_Z: /* fall through */
+ case HUG_RX: /* fall through */
+ case HUG_RY: /* fall through */
+ case HUG_RZ: /* fall through */
+ case...
[truncated message content] |
|
From: <co...@us...> - 2025-03-31 07:56:13
|
Revision: 45613
http://sourceforge.net/p/vice-emu/code/45613
Author: compyx
Date: 2025-03-31 07:56:10 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
Merge trunk (r45603:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-001/vice/configure.ac
branches/compyx/joymap-001/vice/doc/vice.texi
branches/compyx/joymap-001/vice/src/arch/gtk3/widgets/settings_userport.c
branches/compyx/joymap-001/vice/src/arch/sdl/menu_wic64.c
branches/compyx/joymap-001/vice/src/arch/shared/console_unix.c
branches/compyx/joymap-001/vice/src/arch/shared/rawnetarch_unix.c
branches/compyx/joymap-001/vice/src/userport/userport_wic64.c
branches/compyx/joymap-001/vice/src/vicefeatures.c
Modified: branches/compyx/joymap-001/vice/configure.ac
===================================================================
--- branches/compyx/joymap-001/vice/configure.ac 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/configure.ac 2025-03-31 07:56:10 UTC (rev 45613)
@@ -2433,7 +2433,7 @@
AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
HAVE_RAWNET_SUPPORT="yes";
- AC_DEFINE(VICE_USE_LIBNET_1_1,,[Support for The Final Ethernet])
+ AC_DEFINE(HAVE_LIBNET,,[Support for libnet library])
TFE_LIBS="-lpcap `libnet-config --libs`"
libnet_cflags="`libnet-config --defines`"
],,$LIBS)],,$LIBS)
@@ -2444,6 +2444,7 @@
AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
HAVE_RAWNET_SUPPORT="yes";
+ AC_DEFINE(HAVE_LIBNET,,[Support for libnet library])
TFE_LIBS="-lpcap `libnet-config --libs`"
libnet_cflags="`libnet-config --defines`"
],,$LIBS)],,$LIBS)
Modified: branches/compyx/joymap-001/vice/doc/vice.texi
===================================================================
--- branches/compyx/joymap-001/vice/doc/vice.texi 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/doc/vice.texi 2025-03-31 07:56:10 UTC (rev 45613)
@@ -8802,9 +8802,14 @@
@vindex WIC64IPAddress
@item WIC64IPAddress
-String specifying the IP address used by the wic64 emulation
+String specifying the IP address used by the wic64 emulation (if DHCP is disabled)
(vic20, x64, x64sc, xscpu64 and x128 only).
+@vindex WIC64DHCP
+@item WIC64DHCP
+Boolean specifying whether the WiC64 local IP address should be choosen automatically
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
@vindex WIC64Logenabled
@item WIC64Logenabled
Integer, 1: user selected WiC64 tracing, 0: no tracing
@@ -8893,6 +8898,27 @@
Timeout to wait for URLs in seconds, 1 - 255
(vic20, x64, x64sc, xscpu64 and x128 only).
+@findex -wic64ipaddress
+@item -wic64ipaddress <IP>
+Specify WiC64 IP (when DHCP is disabled)
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
+@findex -wic64macaddress
+@item -wic64macaddress <MAC>
+Specify WiC64 MAC
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
+@findex -wic64token
+@item -wic64token <token>
+Specify WiC64 security token
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
+@findex -wic64dhcp, +wic64dhcp
+@item -wic64dhcp
+@itemx +wic64dhcp
+Enable/disable automatically setting the local IP address (default: enabled)
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
@end table
@c -----------------------------------------------------------------------------
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/widgets/settings_userport.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/widgets/settings_userport.c 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/widgets/settings_userport.c 2025-03-31 07:56:10 UTC (rev 45613)
@@ -358,7 +358,7 @@
"Enable WiC64 logging");
}
-/** \brief Create widget for the "WIC64Logenabled" resource
+/** \brief Create widget for the "WIC64Resetuser" resource
*
* \return GtkCheckButton
*/
@@ -398,7 +398,7 @@
return combo;
}
-#if 0 /* disabled, as security token editable actually makes no sense */
+#if 1 /* disabled, as security token editable actually makes no sense */
/** \brief Handler for the 'icon-press' event of the "Security token" entry
*
* Toggle visibility of the WIC64 security token when clicking the "eye" icon
@@ -441,8 +441,21 @@
vice_gtk3_resource_entry_factory(wic64_server_save);
vice_gtk3_resource_spin_int_factory(wic64_remote_timeout_save);
vice_gtk3_resource_combo_int_sync(wic64_tz_save);
+ /* FIXME: also update MAC, SecToken */
}
+/** \brief Handler for the 'clicked' event of the 'dhcp' checkbox
+ *
+ * \param[in] widget checkbox triggering the event
+ * \param[in] user_data the textfield to enable/disable accordingly
+ */
+static void on_wic64_dhcp_clicked(GtkWidget *dhcp, gpointer p)
+{
+ GtkWidget *ip_addr = p;
+ gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dhcp)) ^ 1;
+ gtk_widget_set_sensitive(ip_addr, enabled);
+}
+
/** \brief Append WIC64 widgets to the main grid
*
* \param[in] parent_grid main grid
@@ -460,11 +473,11 @@
GtkWidget *resetuser;
GtkWidget *lines_widget;
GtkWidget *trace_level;
-#if 0
GtkWidget *mac_addr;
GtkWidget *ip_addr;
GtkWidget *sec_token;
-#endif
+ GtkWidget *dhcp;
+
GtkWidget *reset;
int row = 0;
@@ -494,7 +507,6 @@
gtk_grid_attach(GTK_GRID(grid), server, 1, row, 1, 1);
row++;
-#if 0
label = label_helper("MAC address");
mac_addr = vice_gtk3_resource_entry_new("WIC64MACAddress");
gtk_widget_set_hexpand(mac_addr, TRUE);
@@ -504,12 +516,16 @@
label = label_helper("IP address");
ip_addr = vice_gtk3_resource_entry_new("WIC64IPAddress");
+ dhcp = vice_gtk3_resource_check_button_new("WIC64DHCP", "DHCP");
gtk_widget_set_hexpand(ip_addr, TRUE);
gtk_grid_attach(GTK_GRID(grid), label, 0, row, 1, 1);
gtk_grid_attach(GTK_GRID(grid), ip_addr, 1, row, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), dhcp, 2, row, 1, 1);
row++;
-#endif
+ g_signal_connect(dhcp, "clicked", G_CALLBACK(on_wic64_dhcp_clicked), ip_addr);
+ gtk_widget_set_sensitive(ip_addr, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dhcp)) ^ 1);
+
label = label_helper("Timezone");
wic64_tz_save = tz_widget = create_wic64_timezone_combo();
gtk_widget_set_hexpand(tz_widget, TRUE);
@@ -517,7 +533,7 @@
gtk_grid_attach(GTK_GRID(grid), tz_widget, 1, row, 1, 1);
row++;
-#if 0 /* keep it for now, as it was @compyx's fun to hack it ;-) */
+#if 1 /* keep it for now, as it was @compyx's fun to hack it ;-) */
label = label_helper("Security token");
sec_token = vice_gtk3_resource_entry_new("WIC64SecToken");
gtk_widget_set_hexpand(sec_token, TRUE);
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/menu_wic64.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/menu_wic64.c 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/menu_wic64.c 2025-03-31 07:56:10 UTC (rev 45613)
@@ -44,7 +44,6 @@
static ui_menu_entry_t *dyn_menu_wic64;
UI_MENU_DEFINE_TOGGLE(WIC64Logenabled)
-UI_MENU_DEFINE_TOGGLE(WIC64ColorizeLog)
UI_MENU_DEFINE_INT(WIC64Hexdumplines);
UI_MENU_DEFINE_INT(WIC64RemoteTimeout);
UI_MENU_DEFINE_INT(WIC64LogLevel);
@@ -51,6 +50,10 @@
UI_MENU_DEFINE_STRING(WIC64DefaultServer)
UI_MENU_DEFINE_TOGGLE(WIC64Resetuser)
UI_MENU_DEFINE_RADIO(WIC64Timezone);
+UI_MENU_DEFINE_STRING(WIC64SecToken)
+UI_MENU_DEFINE_STRING(WIC64IPAddress)
+UI_MENU_DEFINE_STRING(WIC64MACAddress)
+UI_MENU_DEFINE_TOGGLE(WIC64DHCP)
/** \brief Generate WiC64 runtime timezones menu
*
@@ -96,7 +99,7 @@
return NULL;
}
-#define MENTRIES 12
+#define MENTRIES 16
ui_menu_entry_t wic64_menu[MENTRIES];
ui_callback_data_t uiwic64_menu_create(void)
@@ -123,53 +126,52 @@
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "WiC64 tracing";
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_TOGGLE;
- wic64_menu[j].callback = toggle_WIC64Logenabled_callback;
+ wic64_menu[j].string = "Remote Timeout";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
+ wic64_menu[j].callback = int_WIC64RemoteTimeout_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Hexdump lines (0=unlimited):";
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
- wic64_menu[j].callback = int_WIC64Hexdumplines_callback;
+ wic64_menu[j].string = "Default server:";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
+ wic64_menu[j].callback = string_WIC64DefaultServer_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Remote Timeout";
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
- wic64_menu[j].callback = int_WIC64RemoteTimeout_callback;
- wic64_menu[j].data = NULL;
+ wic64_menu[j].string = "Timezone";
+ wic64_menu[j].type = MENU_ENTRY_DYNAMIC_SUBMENU;
+ wic64_menu[j].callback = submenu_radio_callback;
+ wic64_menu[j].data = dyn_menu_wic64;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Colorized tracing";
+ wic64_menu[j].string = "DHCP (set IP automatically)";
wic64_menu[j].type = MENU_ENTRY_RESOURCE_TOGGLE;
- wic64_menu[j].callback = toggle_WIC64ColorizeLog_callback;
+ wic64_menu[j].callback = toggle_WIC64DHCP_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- sprintf(tl, "Trace level (0..%d, 0: off)", WIC64_MAXTRACELEVEL);
- wic64_menu[j].string = tl;
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
- wic64_menu[j].callback = int_WIC64LogLevel_callback;
+ wic64_menu[j].string = "IP Address:";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
+ wic64_menu[j].callback = string_WIC64IPAddress_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Default server:";
+ wic64_menu[j].string = "MAC Address:";
wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
- wic64_menu[j].callback = string_WIC64DefaultServer_callback;
+ wic64_menu[j].callback = string_WIC64MACAddress_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Timezone";
- wic64_menu[j].type = MENU_ENTRY_DYNAMIC_SUBMENU;
- wic64_menu[j].callback = submenu_radio_callback;
- wic64_menu[j].data = dyn_menu_wic64;
+ wic64_menu[j].string = "Security Token:";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
+ wic64_menu[j].callback = string_WIC64SecToken_callback;
+ wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
@@ -185,6 +187,29 @@
wic64_menu[j].callback = custom_wic64_reset_callback;
wic64_menu[j].data = NULL;
j++;
+
+ wic64_menu[j].action = ACTION_NONE;
+ wic64_menu[j].string = "WiC64 tracing";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_TOGGLE;
+ wic64_menu[j].callback = toggle_WIC64Logenabled_callback;
+ wic64_menu[j].data = NULL;
+ j++;
+
+ wic64_menu[j].action = ACTION_NONE;
+ wic64_menu[j].string = "Hexdump lines (0=unlimited):";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
+ wic64_menu[j].callback = int_WIC64Hexdumplines_callback;
+ wic64_menu[j].data = NULL;
+ j++;
+
+ wic64_menu[j].action = ACTION_NONE;
+ sprintf(tl, "Trace level (0..%d, 0: off)", WIC64_MAXTRACELEVEL);
+ wic64_menu[j].string = tl;
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
+ wic64_menu[j].callback = int_WIC64LogLevel_callback;
+ wic64_menu[j].data = NULL;
+ j++;
+
wic64_menu[j].string = NULL;
if (j >= MENTRIES) {
log_error(LOG_DEFAULT, "internal error: %s, %d >= MENTRIES(%d)", __FUNCTION__, j, MENTRIES);
Modified: branches/compyx/joymap-001/vice/src/arch/shared/console_unix.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/shared/console_unix.c 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/src/arch/shared/console_unix.c 2025-03-31 07:56:10 UTC (rev 45613)
@@ -108,8 +108,10 @@
int native_console_close(console_t *log)
{
- lib_free(log->private);
- lib_free(log);
+ if(log != NULL) {
+ lib_free(log->private);
+ lib_free(log);
+ }
linenoiseHistoryFree();
return 0;
}
Modified: branches/compyx/joymap-001/vice/src/arch/shared/rawnetarch_unix.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/shared/rawnetarch_unix.c 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/src/arch/shared/rawnetarch_unix.c 2025-03-31 07:56:10 UTC (rev 45613)
@@ -96,14 +96,8 @@
static pcap_t *rawnet_pcap_fp = NULL;
#ifdef HAVE_LIBNET
-#ifdef VICE_USE_LIBNET_1_1
static libnet_t *TfeLibnetFP = NULL;
-#else /* VICE_USE_LIBNET_1_1 */
-static struct libnet_link_int *TfeLibnetFP = NULL;
-#endif /* VICE_USE_LIBNET_1_1 */
-
static char TfeLibnetErrBuf[LIBNET_ERRBUF_SIZE];
-
#endif /* HAVE_LIBNET */
@@ -202,11 +196,7 @@
#ifdef HAVE_LIBNET
/* now, open the libnet device to be able to send afterwards */
-#ifdef VICE_USE_LIBNET_1_1
TfeLibnetFP = libnet_init(LIBNET_LINK, (char *)interface_name, TfeLibnetErrBuf);
-#else /* VICE_USE_LIBNET_1_1 */
- TfeLibnetFP = libnet_open_link_interface(interface_name, TfeLibnetErrBuf);
-#endif /* VICE_USE_LIBNET_1_1 */
if (TfeLibnetFP == NULL) {
log_message(rawnet_arch_log, "Libnet interface could not be opened: '%s'", TfeLibnetErrBuf);
@@ -334,10 +324,8 @@
#ifdef HAVE_LIBNET
-# ifdef VICE_USE_LIBNET_1_1
+#define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_libnet_1_1
-# define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_libnet_1_1
-
static void rawnet_arch_transmit_libnet_1_1(int force, int onecoll,
int inhibit_crc, int tx_pad_dis, int txlength, uint8_t *txframe)
{
@@ -373,35 +361,6 @@
} while (0);
}
-# else /* VICE_USE_LIBNET_1_1 */
-
-# define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_libnet_1_0
-
-static void rawnet_arch_transmit_libnet_1_0(int force, int onecoll,
- int inhibit_crc, int tx_pad_dis, int txlength, uint8_t *txframe)
-{
- u_char *plibnet_buffer = NULL;
-
- /* we want to send via libnet 1.0 */
-
- if (libnet_init_packet(txlength, &plibnet_buffer)==-1) {
- log_message(rawnet_arch_log, "WARNING! Could not send packet!");
- } else {
- if (plibnet_buffer) {
- memcpy(plibnet_buffer, txframe, txlength);
- libnet_write_link_layer(TfeLibnetFP, "eth0", plibnet_buffer, txlength);
- libnet_destroy_packet(&plibnet_buffer);
- } else {
- log_message(rawnet_arch_log,
- "WARNING! Could not send packet: plibnet_buffer==NULL, "
- "but libnet_init_packet() did NOT fail!!");
- }
- }
-
-}
-
-# endif
-
#else /* HAVE_LIBNET */
# define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_pcap
Modified: branches/compyx/joymap-001/vice/src/userport/userport_wic64.c
===================================================================
--- branches/compyx/joymap-001/vice/src/userport/userport_wic64.c 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/src/userport/userport_wic64.c 2025-03-31 07:56:10 UTC (rev 45613)
@@ -104,6 +104,7 @@
static int wic64_set_ipaddress(const char *val, void *p);
static int wic64_set_sectoken(const char *val, void *p);
static int wic64_set_timezone(int val, void *param);
+static int wic64_set_dhcp(int val, void *param);
static int wic64_set_logenabled(int val, void *param);
static int wic64_set_loglevel(int val, void *param);
static int wic64_set_resetuser(int val, void *param);
@@ -170,6 +171,7 @@
static char *wic64_mac_address = NULL; /* c-string std. notation e.g 0a:02:0b:04:05:0c */
static char *wic64_internal_ip = NULL; /* c-string std. notation e.g. 192.168.1.10 */
static unsigned char wic64_external_ip[4] = { 0, 0, 0, 0 }; /* just a dummy, report not implemented to user cmd 0x13 */
+
static uint8_t wic64_timezone[2] = { 0, 0};
static uint16_t wic64_udp_port = 0;
static uint16_t wic64_tcp_port = 0;
@@ -179,7 +181,8 @@
static uint8_t wic64_remote_timeout_triggered = 0;
static int force_timeout = 0;
static char *wic64_sec_token = NULL;
-static int current_tz = 2;
+static int current_tz = 2; /* WIC64Timezone */
+static int current_dhcp = 1; /* WIC64DHCP */
static int wic64_logenabled = 0;
static int wic64_loglevel = 0;
static int wic64_resetuser = 0;
@@ -304,15 +307,19 @@
/* ---------------------------------------------------------------------*/
+#define IPADDR_INVALID "255.255.255.255"
+#define MACADDR_INVALID "FF:FF:FF:FF:FF:FF"
+#define SECTOKEN_INVALID "0123456789ab"
+
static const resource_string_t wic64_resources[] =
{
{ "WIC64DefaultServer", "http://x.wic64.net/", (resource_event_relevant_t)0, NULL,
&default_server_hostname, wic64_set_default_server, NULL },
- { "WIC64MACAddress", "DEADBE", (resource_event_relevant_t)0, NULL,
+ { "WIC64MACAddress", MACADDR_INVALID, (resource_event_relevant_t)0, NULL,
(char **) &wic64_mac_address, wic64_set_macaddress, NULL },
- { "WIC64IPAddress", "AAAA", (resource_event_relevant_t)0, NULL,
+ { "WIC64IPAddress", IPADDR_INVALID, (resource_event_relevant_t)0, NULL,
(char **) &wic64_internal_ip, wic64_set_ipaddress, NULL },
- { "WIC64SecToken", "0123456789ab", (resource_event_relevant_t)0, NULL,
+ { "WIC64SecToken", SECTOKEN_INVALID, (resource_event_relevant_t)0, NULL,
(char **) &wic64_sec_token, wic64_set_sectoken, NULL },
RESOURCE_STRING_LIST_END,
};
@@ -320,6 +327,8 @@
static const resource_int_t wic64_resources_int[] = {
{ "WIC64Timezone", 2, RES_EVENT_NO, NULL,
¤t_tz, wic64_set_timezone, NULL },
+ { "WIC64DHCP", 1, RES_EVENT_NO, NULL,
+ ¤t_dhcp, wic64_set_dhcp, NULL },
{ "WIC64Logenabled", 0, RES_EVENT_NO, NULL,
&wic64_logenabled, wic64_set_logenabled, NULL },
{ "WIC64LogLevel", 0, RES_EVENT_NO, NULL,
@@ -376,6 +385,21 @@
{ "-wic64timezone", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "WIC64Timezone", NULL,
"<0..31>", "Specify default timezone index, e.g. 2: European Central Time" },
+ { "-wic64ipaddress", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "WIC64IPAddress", NULL,
+ "<IP>", "Specify WiC64 IP" },
+ { "-wic64macaddress", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "WIC64MACAddress", NULL,
+ "<MAC>", "Specify WiC64 MAC" },
+ { "-wic64token", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "WIC64SecToken", NULL,
+ "<token>", "Specify WiC64 security token" },
+ { "-wic64dhcp", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "WIC64DHCP", (void *)1,
+ NULL, "Enable WiC64 DHCP" },
+ { "+wic64DHCP", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "WIC64DHCP", (void *)0,
+ NULL, "Disable WiC64 DHCP" },
{ "-wic64trace", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "WIC64Logenabled", (void *)1,
NULL, "Enable WiC64 tracing" },
@@ -635,18 +659,42 @@
static int wic64_set_macaddress(const char *val, void *v)
{
- util_string_set((char **)&wic64_mac_address, val);
- return 0;
+ unsigned int a, b, c, d, e, f;
+ int ret;
+ /* validate string */
+ ret = sscanf(val, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f);
+ if ((ret == 6) &&
+ (/*(a >= 0) &&*/ (a <= 255)) &&
+ (/*(b >= 0) &&*/ (b <= 255)) &&
+ (/*(c >= 0) &&*/ (c <= 255)) &&
+ (/*(d >= 0) &&*/ (d <= 255)) &&
+ (/*(e >= 0) &&*/ (e <= 255)) &&
+ (/*(f >= 0) &&*/ (f <= 255))) {
+ util_string_set((char **)&wic64_mac_address, val);
+ return 0;
+ }
+ return -1;
}
static int wic64_set_ipaddress(const char *val, void *v)
{
- util_string_set((char **)&wic64_internal_ip, val);
- return 0;
+ int ret, a, b, c, d;
+ /* validate string */
+ ret = sscanf(val, "%d.%d.%d.%d", &a, &b, &c, &d);
+ if ((ret == 4) &&
+ ((a >= 0) && (a <= 255)) &&
+ ((b >= 0) && (b <= 255)) &&
+ ((c >= 0) && (c <= 255)) &&
+ ((d >= 0) && (d <= 255))) {
+ util_string_set((char **)&wic64_internal_ip, val);
+ return 0;
+ }
+ return -1;
}
static int wic64_set_sectoken(const char *val, void *v)
{
+ /* TODO: validate string */
util_string_set((char **)&wic64_sec_token, val);
return 0;
}
@@ -657,6 +705,12 @@
return 0;
}
+static int wic64_set_dhcp(int val, void *param)
+{
+ current_dhcp = val;
+ return 0;
+}
+
static int wic64_set_logenabled(int val, void *param)
{
wic64_logenabled = val;
@@ -778,7 +832,7 @@
lib_unsigned_rand(0, 15),
lib_unsigned_rand(0, 15));
resources_set_string("WIC64MACAddress", tmp);
- resources_set_string("WIC64SecToken", "0123456789ab");
+ resources_set_string("WIC64SecToken", SECTOKEN_INVALID);
}
void userport_wic64_factory_reset(void)
@@ -2541,10 +2595,60 @@
}
}
+/*
+ return a reasonable "local IP"
+
+ this is used in two cases:
+ - the WIC64IPAddress in the config is empty, and WIC64DHCP is 0. In that
+ case we use the local IP as default
+ - WIC64DHCP is 1. In that case we should always use the local IP
+
+ Note: This is a surprisingly non trivial operation. For instance, due to
+ the high level approach of the emulation, we can't really tell what our
+ local IP is, without trying to connect somewhere.
+
+ What we really intend to do here, is determining the IP address, which will
+ be used by libcurl when we make connections, so it can be shown to the user
+ in the emulation.
+*/
+static int getlocalip(char *str)
+{
+ char *ip;
+ CURLcode res;
+ CURL *c = curl_easy_init();
+
+ *str = 0;
+
+ /* try to connect to the default server */
+ curl_easy_setopt(c, CURLOPT_URL, default_server_hostname);
+ curl_easy_setopt(c, CURLOPT_CONNECT_ONLY, 0);
+
+ /* Perform the connect */
+ res = curl_easy_perform(c);
+ /* Check for errors */
+ if((res == CURLE_OK) &&
+ !curl_easy_getinfo(c, CURLINFO_LOCAL_IP, &ip) && ip) {
+ /* if the connection was successful, libcurl will return the local ip */
+ strcpy(str, ip);
+ } else {
+ /* as a last resort, just produce a random 'local' IP */
+ snprintf(str, 16, "192.168.%u.%u",
+ lib_unsigned_rand(1, 254),
+ lib_unsigned_rand(1, 254));
+ }
+
+ /* always cleanup */
+ curl_easy_reset(c);
+ curl_easy_cleanup(c);
+
+ return 0;
+}
+
static void userport_wic64_reset(void)
{
char *tmp;
int tmp_tz;
+ int tmp_dhcp;
wic64_log(CONS_COL_NO, "%s", __FUNCTION__);
commandptr = input_state = input_length = force_timeout = 0;
@@ -2553,36 +2657,6 @@
memset(sec_token, 0, 32);
sec_init = 0;
- if ((resources_get_string("WIC64MACAddress", (const char **)&tmp) == -1) ||
- (tmp == NULL) ||
- (strcmp((const char*)tmp, "DEADBE") == 0)) {
- wic64_mac_address = lib_malloc(32);
- snprintf(wic64_mac_address, 32, "08:d1:f9:%02x:%02x:%02x",
- lib_unsigned_rand(0, 15),
- lib_unsigned_rand(0, 15),
- lib_unsigned_rand(0, 15));
- debug_log(CONS_COL_NO, 2, "WIC64: generated MAC: %s", wic64_mac_address);
- } else {
- wic64_mac_address = tmp;
- }
-
- if ((resources_get_string("WIC64IPAddress", (const char **)&tmp) == -1) ||
- (tmp == NULL) ||
- (strcmp((const char *)tmp, "AAAA") == 0)) {
- wic64_internal_ip = lib_malloc(16);
- snprintf(wic64_internal_ip, 16, "192.168.%u.%u",
- lib_unsigned_rand(1, 254),
- lib_unsigned_rand(1, 254));
- debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
- } else {
- wic64_internal_ip = tmp;
- }
- if (resources_get_int("WIC64Timezone", &tmp_tz) == -1) {
- current_tz = 2;
- } else {
- current_tz = tmp_tz;
- }
-
if (http_get_alarm) {
alarm_unset(http_get_alarm);
}
@@ -2617,6 +2691,58 @@
lib_free(post_url);
post_url = NULL;
}
+
+ if (resources_get_int("WIC64Timezone", &tmp_tz) == -1) {
+ current_tz = 2;
+ } else {
+ current_tz = tmp_tz;
+ }
+
+ if (resources_get_int("WIC64DHCP", &tmp_dhcp) == -1) {
+ current_dhcp = 1;
+ } else {
+ current_dhcp = tmp_dhcp;
+ }
+
+ if ((resources_get_string("WIC64MACAddress", (const char **)&tmp) == -1) ||
+ (tmp == NULL) ||
+ (strcmp((const char*)tmp, MACADDR_INVALID) == 0)) {
+ /* if MAC is empty in the config, then generate a random one and save it
+ in the resource */
+ wic64_mac_address = lib_malloc(32);
+ snprintf(wic64_mac_address, 32, "08:d1:f9:%02x:%02x:%02x",
+ lib_unsigned_rand(0, 15),
+ lib_unsigned_rand(0, 15),
+ lib_unsigned_rand(0, 15));
+ debug_log(CONS_COL_NO, 2, "WIC64: generated MAC: %s", wic64_mac_address);
+ } else {
+ wic64_mac_address = tmp;
+ debug_log(CONS_COL_NO, 2, "WIC64: using saved MAC: %s", wic64_mac_address);
+ }
+
+ if (current_dhcp) {
+ if (wic64_internal_ip == NULL) {
+ wic64_internal_ip = lib_malloc(16);
+ }
+ getlocalip(wic64_internal_ip);
+ debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
+ }
+
+ if ((resources_get_string("WIC64IPAddress", (const char **)&tmp) == -1) ||
+ (tmp == NULL) ||
+ (strcmp((const char *)tmp, IPADDR_INVALID) == 0)) {
+ /* ip is empty */
+ if (wic64_internal_ip == NULL) {
+ wic64_internal_ip = lib_malloc(16);
+ }
+ getlocalip(wic64_internal_ip);
+ debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
+ } else {
+ /* use saved ip */
+ wic64_internal_ip = tmp;
+ }
+
+
/* wic64_set_status("RESET"); real HW doesn't tell this */
wic64_log(LOG_COL_LBLUE, "cyan color: host -> WiC64 communication");
Modified: branches/compyx/joymap-001/vice/src/vicefeatures.c
===================================================================
--- branches/compyx/joymap-001/vice/src/vicefeatures.c 2025-03-31 07:54:07 UTC (rev 45612)
+++ branches/compyx/joymap-001/vice/src/vicefeatures.c 2025-03-31 07:56:10 UTC (rev 45613)
@@ -196,16 +196,6 @@
1 },
#endif
-/* FIXME: support for libnet < 1.1 should get removed */
-#if defined(UNIX_COMPILE) /* (unix) */
- { "VICE_USE_LIBNET_1_1", "Enable support for libnet 1.1",
-#ifndef VICE_USE_LIBNET_1_1
- 0 },
-#else
- 1 },
-#endif
-#endif
-
#if defined(UNIX_COMPILE) || defined(WINDOWS_COMPILE) /* (unix/windows) */
{ "HAVE_REALDEVICE", "Support for OpenCBM", /* (former CBM4Linux). */
#ifndef HAVE_REALDEVICE
@@ -324,6 +314,15 @@
1 },
#endif
+#if defined(UNIX_COMPILE) /* (unix) */
+ { "HAVE_LIBNET", "Use the libnet library.",
+#ifndef HAVE_LIBNET
+ 0 },
+#else
+ 1 },
+#endif
+#endif
+
#if !defined(WINDOWS_COMPILE) /* not windows */
{ "HAVE_TUNTAP", "Support for TUN/TAP virtual network interface.",
#ifndef HAVE_TUNTAP
@@ -485,29 +484,12 @@
#if 0
/* FIXME: appear in config.h but are not used in code: */
-/* Support for direct PCI I/O access Catweasel MKIII. */
-#define HAVE_CATWEASELMKIII_IO /**/
-/* Enable Fullscreen support. */
-/* #undef HAVE_FULLSCREEN */
-/* Support for PCI/ISA HardSID. */
-#define HAVE_HARDSID_IO /**/
-/* Enable support for BSD style joysticks. */
-/* #undef BSD_JOYSTICK */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
-/* WARNING win32 and osx bindist greps for this in config.h! */
+/* WARNING osx bindist greps for this in config.h! */
/* External FFMPEG libraries are used */
#define EXTERNAL_FFMPEG /**/
/* WARNING osx bindist greps for this in config.h! */
/* External linking for lame libs */
#define HAVE_EXTERNAL_LAME /**/
-/* WARNING: seems to be used in makefiles all over the place */
-/* Enable the readline library */
-/* #undef HAVE_READLINE */
-
-/* appear in code, but should get removed */
-
-/* FIXME: support for libnet < 1.1 should get removed (unix) */
-/* Enable support for libnet 1.1 */
-#define VICE_USE_LIBNET_1_1
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-31 07:54:10
|
Revision: 45612
http://sourceforge.net/p/vice-emu/code/45612
Author: compyx
Date: 2025-03-31 07:54:07 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
Joystick: allow drivers to disable sorting of inputs
Should, for some obscure reason, a driver doesn't want to have the joystick
system sort inputs on their event code/ID, it can disable this behaviour by
setting the `disable_sort` member of a joystick device to `true`.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/joyport/joystick.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-31 01:04:31 UTC (rev 45611)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-31 07:54:07 UTC (rev 45612)
@@ -3348,21 +3348,22 @@
{
joystick_device_t *joydev = lib_malloc(sizeof *joydev);
- joydev->name = NULL;
- joydev->node = NULL;
- joydev->vendor = 0;
- joydev->product = 0;
- joydev->axes = lib_calloc(NUM_AXES_INITIAL, sizeof *joydev->axes);
- joydev->buttons = lib_calloc(NUM_BUTTONS_INITIAL, sizeof *joydev->buttons);
- joydev->hats = lib_calloc(NUM_HATS_INITIAL, sizeof *joydev->hats);
- joydev->num_axes = 0;
- joydev->num_buttons = 0;
- joydev->num_hats = 0;
- joydev->max_axes = NUM_AXES_INITIAL;
- joydev->max_buttons = NUM_BUTTONS_INITIAL;
- joydev->max_hats = NUM_HATS_INITIAL;
- joydev->joyport = -1;
- joydev->priv = NULL;
+ joydev->name = NULL;
+ joydev->node = NULL;
+ joydev->vendor = 0;
+ joydev->product = 0;
+ joydev->axes = lib_calloc(NUM_AXES_INITIAL, sizeof *joydev->axes);
+ joydev->buttons = lib_calloc(NUM_BUTTONS_INITIAL, sizeof *joydev->buttons);
+ joydev->hats = lib_calloc(NUM_HATS_INITIAL, sizeof *joydev->hats);
+ joydev->num_axes = 0;
+ joydev->num_buttons = 0;
+ joydev->num_hats = 0;
+ joydev->max_axes = NUM_AXES_INITIAL;
+ joydev->max_buttons = NUM_BUTTONS_INITIAL;
+ joydev->max_hats = NUM_HATS_INITIAL;
+ joydev->disable_sort = false;
+ joydev->joyport = -1;
+ joydev->priv = NULL;
return joydev;
}
@@ -3655,7 +3656,9 @@
* give us the inputs in a defined order (e.g. DirectInput reports my Saitek
* ST50' Y axis before the X axis), so the default mappings will fail.
*/
- order_inputs_on_code(joydev);
+ if (!joydev->disable_sort) {
+ order_inputs_on_code(joydev);
+ }
/* Now we can try to apply a default mapping */
joystick_device_apply_default_mapping(joydev);
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-31 01:04:31 UTC (rev 45611)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-31 07:54:07 UTC (rev 45612)
@@ -290,10 +290,18 @@
int num_hats;
/* bookkeeping for resizing arrays when adding elements */
- size_t max_axes; /**< size of \c axes array */
- size_t max_buttons; /**< size of \c buttons array */
- size_t max_hats; /**< size of \c hats array */
+ size_t max_axes; /**< size of \c axes array */
+ size_t max_buttons; /**< size of \c buttons array */
+ size_t max_hats; /**< size of \c hats array */
+ /** \brief Do not sort axes, buttons and hats
+ *
+ * If, for some reason, a driver doesn't want the joystick system to sort
+ * the axes, buttons and hats of a device when registering that device, this
+ * flag can be set to \c true to disable sorting of those objects.
+ */
+ bool disable_sort;
+
/** \brief Emulated machine's joystick port associated with host device */
int joyport;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-03-31 01:04:34
|
Revision: 45611
http://sourceforge.net/p/vice-emu/code/45611
Author: gpz
Date: 2025-03-31 01:04:31 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
add missing commandline- and gui options. implement some kind of fake 'dhcp'
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/arch/gtk3/widgets/settings_userport.c
trunk/vice/src/arch/sdl/menu_wic64.c
trunk/vice/src/userport/userport_wic64.c
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-03-31 00:33:42 UTC (rev 45610)
+++ trunk/vice/doc/vice.texi 2025-03-31 01:04:31 UTC (rev 45611)
@@ -8802,9 +8802,14 @@
@vindex WIC64IPAddress
@item WIC64IPAddress
-String specifying the IP address used by the wic64 emulation
+String specifying the IP address used by the wic64 emulation (if DHCP is disabled)
(vic20, x64, x64sc, xscpu64 and x128 only).
+@vindex WIC64DHCP
+@item WIC64DHCP
+Boolean specifying whether the WiC64 local IP address should be choosen automatically
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
@vindex WIC64Logenabled
@item WIC64Logenabled
Integer, 1: user selected WiC64 tracing, 0: no tracing
@@ -8893,6 +8898,27 @@
Timeout to wait for URLs in seconds, 1 - 255
(vic20, x64, x64sc, xscpu64 and x128 only).
+@findex -wic64ipaddress
+@item -wic64ipaddress <IP>
+Specify WiC64 IP (when DHCP is disabled)
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
+@findex -wic64macaddress
+@item -wic64macaddress <MAC>
+Specify WiC64 MAC
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
+@findex -wic64token
+@item -wic64token <token>
+Specify WiC64 security token
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
+@findex -wic64dhcp, +wic64dhcp
+@item -wic64dhcp
+@itemx +wic64dhcp
+Enable/disable automatically setting the local IP address (default: enabled)
+(vic20, x64, x64sc, xscpu64 and x128 only).
+
@end table
@c -----------------------------------------------------------------------------
Modified: trunk/vice/src/arch/gtk3/widgets/settings_userport.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_userport.c 2025-03-31 00:33:42 UTC (rev 45610)
+++ trunk/vice/src/arch/gtk3/widgets/settings_userport.c 2025-03-31 01:04:31 UTC (rev 45611)
@@ -358,7 +358,7 @@
"Enable WiC64 logging");
}
-/** \brief Create widget for the "WIC64Logenabled" resource
+/** \brief Create widget for the "WIC64Resetuser" resource
*
* \return GtkCheckButton
*/
@@ -398,7 +398,7 @@
return combo;
}
-#if 0 /* disabled, as security token editable actually makes no sense */
+#if 1 /* disabled, as security token editable actually makes no sense */
/** \brief Handler for the 'icon-press' event of the "Security token" entry
*
* Toggle visibility of the WIC64 security token when clicking the "eye" icon
@@ -441,8 +441,21 @@
vice_gtk3_resource_entry_factory(wic64_server_save);
vice_gtk3_resource_spin_int_factory(wic64_remote_timeout_save);
vice_gtk3_resource_combo_int_sync(wic64_tz_save);
+ /* FIXME: also update MAC, SecToken */
}
+/** \brief Handler for the 'clicked' event of the 'dhcp' checkbox
+ *
+ * \param[in] widget checkbox triggering the event
+ * \param[in] user_data the textfield to enable/disable accordingly
+ */
+static void on_wic64_dhcp_clicked(GtkWidget *dhcp, gpointer p)
+{
+ GtkWidget *ip_addr = p;
+ gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dhcp)) ^ 1;
+ gtk_widget_set_sensitive(ip_addr, enabled);
+}
+
/** \brief Append WIC64 widgets to the main grid
*
* \param[in] parent_grid main grid
@@ -460,11 +473,11 @@
GtkWidget *resetuser;
GtkWidget *lines_widget;
GtkWidget *trace_level;
-#if 0
GtkWidget *mac_addr;
GtkWidget *ip_addr;
GtkWidget *sec_token;
-#endif
+ GtkWidget *dhcp;
+
GtkWidget *reset;
int row = 0;
@@ -494,7 +507,6 @@
gtk_grid_attach(GTK_GRID(grid), server, 1, row, 1, 1);
row++;
-#if 0
label = label_helper("MAC address");
mac_addr = vice_gtk3_resource_entry_new("WIC64MACAddress");
gtk_widget_set_hexpand(mac_addr, TRUE);
@@ -504,12 +516,16 @@
label = label_helper("IP address");
ip_addr = vice_gtk3_resource_entry_new("WIC64IPAddress");
+ dhcp = vice_gtk3_resource_check_button_new("WIC64DHCP", "DHCP");
gtk_widget_set_hexpand(ip_addr, TRUE);
gtk_grid_attach(GTK_GRID(grid), label, 0, row, 1, 1);
gtk_grid_attach(GTK_GRID(grid), ip_addr, 1, row, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), dhcp, 2, row, 1, 1);
row++;
-#endif
+ g_signal_connect(dhcp, "clicked", G_CALLBACK(on_wic64_dhcp_clicked), ip_addr);
+ gtk_widget_set_sensitive(ip_addr, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dhcp)) ^ 1);
+
label = label_helper("Timezone");
wic64_tz_save = tz_widget = create_wic64_timezone_combo();
gtk_widget_set_hexpand(tz_widget, TRUE);
@@ -517,7 +533,7 @@
gtk_grid_attach(GTK_GRID(grid), tz_widget, 1, row, 1, 1);
row++;
-#if 0 /* keep it for now, as it was @compyx's fun to hack it ;-) */
+#if 1 /* keep it for now, as it was @compyx's fun to hack it ;-) */
label = label_helper("Security token");
sec_token = vice_gtk3_resource_entry_new("WIC64SecToken");
gtk_widget_set_hexpand(sec_token, TRUE);
Modified: trunk/vice/src/arch/sdl/menu_wic64.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_wic64.c 2025-03-31 00:33:42 UTC (rev 45610)
+++ trunk/vice/src/arch/sdl/menu_wic64.c 2025-03-31 01:04:31 UTC (rev 45611)
@@ -44,7 +44,6 @@
static ui_menu_entry_t *dyn_menu_wic64;
UI_MENU_DEFINE_TOGGLE(WIC64Logenabled)
-UI_MENU_DEFINE_TOGGLE(WIC64ColorizeLog)
UI_MENU_DEFINE_INT(WIC64Hexdumplines);
UI_MENU_DEFINE_INT(WIC64RemoteTimeout);
UI_MENU_DEFINE_INT(WIC64LogLevel);
@@ -51,6 +50,10 @@
UI_MENU_DEFINE_STRING(WIC64DefaultServer)
UI_MENU_DEFINE_TOGGLE(WIC64Resetuser)
UI_MENU_DEFINE_RADIO(WIC64Timezone);
+UI_MENU_DEFINE_STRING(WIC64SecToken)
+UI_MENU_DEFINE_STRING(WIC64IPAddress)
+UI_MENU_DEFINE_STRING(WIC64MACAddress)
+UI_MENU_DEFINE_TOGGLE(WIC64DHCP)
/** \brief Generate WiC64 runtime timezones menu
*
@@ -96,7 +99,7 @@
return NULL;
}
-#define MENTRIES 12
+#define MENTRIES 16
ui_menu_entry_t wic64_menu[MENTRIES];
ui_callback_data_t uiwic64_menu_create(void)
@@ -123,53 +126,52 @@
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "WiC64 tracing";
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_TOGGLE;
- wic64_menu[j].callback = toggle_WIC64Logenabled_callback;
+ wic64_menu[j].string = "Remote Timeout";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
+ wic64_menu[j].callback = int_WIC64RemoteTimeout_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Hexdump lines (0=unlimited):";
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
- wic64_menu[j].callback = int_WIC64Hexdumplines_callback;
+ wic64_menu[j].string = "Default server:";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
+ wic64_menu[j].callback = string_WIC64DefaultServer_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Remote Timeout";
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
- wic64_menu[j].callback = int_WIC64RemoteTimeout_callback;
- wic64_menu[j].data = NULL;
+ wic64_menu[j].string = "Timezone";
+ wic64_menu[j].type = MENU_ENTRY_DYNAMIC_SUBMENU;
+ wic64_menu[j].callback = submenu_radio_callback;
+ wic64_menu[j].data = dyn_menu_wic64;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Colorized tracing";
+ wic64_menu[j].string = "DHCP (set IP automatically)";
wic64_menu[j].type = MENU_ENTRY_RESOURCE_TOGGLE;
- wic64_menu[j].callback = toggle_WIC64ColorizeLog_callback;
+ wic64_menu[j].callback = toggle_WIC64DHCP_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- sprintf(tl, "Trace level (0..%d, 0: off)", WIC64_MAXTRACELEVEL);
- wic64_menu[j].string = tl;
- wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
- wic64_menu[j].callback = int_WIC64LogLevel_callback;
+ wic64_menu[j].string = "IP Address:";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
+ wic64_menu[j].callback = string_WIC64IPAddress_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Default server:";
+ wic64_menu[j].string = "MAC Address:";
wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
- wic64_menu[j].callback = string_WIC64DefaultServer_callback;
+ wic64_menu[j].callback = string_WIC64MACAddress_callback;
wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
- wic64_menu[j].string = "Timezone";
- wic64_menu[j].type = MENU_ENTRY_DYNAMIC_SUBMENU;
- wic64_menu[j].callback = submenu_radio_callback;
- wic64_menu[j].data = dyn_menu_wic64;
+ wic64_menu[j].string = "Security Token:";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_STRING;
+ wic64_menu[j].callback = string_WIC64SecToken_callback;
+ wic64_menu[j].data = NULL;
j++;
wic64_menu[j].action = ACTION_NONE;
@@ -185,6 +187,29 @@
wic64_menu[j].callback = custom_wic64_reset_callback;
wic64_menu[j].data = NULL;
j++;
+
+ wic64_menu[j].action = ACTION_NONE;
+ wic64_menu[j].string = "WiC64 tracing";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_TOGGLE;
+ wic64_menu[j].callback = toggle_WIC64Logenabled_callback;
+ wic64_menu[j].data = NULL;
+ j++;
+
+ wic64_menu[j].action = ACTION_NONE;
+ wic64_menu[j].string = "Hexdump lines (0=unlimited):";
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
+ wic64_menu[j].callback = int_WIC64Hexdumplines_callback;
+ wic64_menu[j].data = NULL;
+ j++;
+
+ wic64_menu[j].action = ACTION_NONE;
+ sprintf(tl, "Trace level (0..%d, 0: off)", WIC64_MAXTRACELEVEL);
+ wic64_menu[j].string = tl;
+ wic64_menu[j].type = MENU_ENTRY_RESOURCE_INT;
+ wic64_menu[j].callback = int_WIC64LogLevel_callback;
+ wic64_menu[j].data = NULL;
+ j++;
+
wic64_menu[j].string = NULL;
if (j >= MENTRIES) {
log_error(LOG_DEFAULT, "internal error: %s, %d >= MENTRIES(%d)", __FUNCTION__, j, MENTRIES);
Modified: trunk/vice/src/userport/userport_wic64.c
===================================================================
--- trunk/vice/src/userport/userport_wic64.c 2025-03-31 00:33:42 UTC (rev 45610)
+++ trunk/vice/src/userport/userport_wic64.c 2025-03-31 01:04:31 UTC (rev 45611)
@@ -104,6 +104,7 @@
static int wic64_set_ipaddress(const char *val, void *p);
static int wic64_set_sectoken(const char *val, void *p);
static int wic64_set_timezone(int val, void *param);
+static int wic64_set_dhcp(int val, void *param);
static int wic64_set_logenabled(int val, void *param);
static int wic64_set_loglevel(int val, void *param);
static int wic64_set_resetuser(int val, void *param);
@@ -170,6 +171,7 @@
static char *wic64_mac_address = NULL; /* c-string std. notation e.g 0a:02:0b:04:05:0c */
static char *wic64_internal_ip = NULL; /* c-string std. notation e.g. 192.168.1.10 */
static unsigned char wic64_external_ip[4] = { 0, 0, 0, 0 }; /* just a dummy, report not implemented to user cmd 0x13 */
+
static uint8_t wic64_timezone[2] = { 0, 0};
static uint16_t wic64_udp_port = 0;
static uint16_t wic64_tcp_port = 0;
@@ -179,7 +181,8 @@
static uint8_t wic64_remote_timeout_triggered = 0;
static int force_timeout = 0;
static char *wic64_sec_token = NULL;
-static int current_tz = 2;
+static int current_tz = 2; /* WIC64Timezone */
+static int current_dhcp = 1; /* WIC64DHCP */
static int wic64_logenabled = 0;
static int wic64_loglevel = 0;
static int wic64_resetuser = 0;
@@ -304,15 +307,19 @@
/* ---------------------------------------------------------------------*/
+#define IPADDR_INVALID "255.255.255.255"
+#define MACADDR_INVALID "FF:FF:FF:FF:FF:FF"
+#define SECTOKEN_INVALID "0123456789ab"
+
static const resource_string_t wic64_resources[] =
{
{ "WIC64DefaultServer", "http://x.wic64.net/", (resource_event_relevant_t)0, NULL,
&default_server_hostname, wic64_set_default_server, NULL },
- { "WIC64MACAddress", "DEADBE", (resource_event_relevant_t)0, NULL,
+ { "WIC64MACAddress", MACADDR_INVALID, (resource_event_relevant_t)0, NULL,
(char **) &wic64_mac_address, wic64_set_macaddress, NULL },
- { "WIC64IPAddress", "AAAA", (resource_event_relevant_t)0, NULL,
+ { "WIC64IPAddress", IPADDR_INVALID, (resource_event_relevant_t)0, NULL,
(char **) &wic64_internal_ip, wic64_set_ipaddress, NULL },
- { "WIC64SecToken", "0123456789ab", (resource_event_relevant_t)0, NULL,
+ { "WIC64SecToken", SECTOKEN_INVALID, (resource_event_relevant_t)0, NULL,
(char **) &wic64_sec_token, wic64_set_sectoken, NULL },
RESOURCE_STRING_LIST_END,
};
@@ -320,6 +327,8 @@
static const resource_int_t wic64_resources_int[] = {
{ "WIC64Timezone", 2, RES_EVENT_NO, NULL,
¤t_tz, wic64_set_timezone, NULL },
+ { "WIC64DHCP", 1, RES_EVENT_NO, NULL,
+ ¤t_dhcp, wic64_set_dhcp, NULL },
{ "WIC64Logenabled", 0, RES_EVENT_NO, NULL,
&wic64_logenabled, wic64_set_logenabled, NULL },
{ "WIC64LogLevel", 0, RES_EVENT_NO, NULL,
@@ -376,6 +385,21 @@
{ "-wic64timezone", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "WIC64Timezone", NULL,
"<0..31>", "Specify default timezone index, e.g. 2: European Central Time" },
+ { "-wic64ipaddress", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "WIC64IPAddress", NULL,
+ "<IP>", "Specify WiC64 IP" },
+ { "-wic64macaddress", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "WIC64MACAddress", NULL,
+ "<MAC>", "Specify WiC64 MAC" },
+ { "-wic64token", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "WIC64SecToken", NULL,
+ "<token>", "Specify WiC64 security token" },
+ { "-wic64dhcp", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "WIC64DHCP", (void *)1,
+ NULL, "Enable WiC64 DHCP" },
+ { "+wic64DHCP", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "WIC64DHCP", (void *)0,
+ NULL, "Disable WiC64 DHCP" },
{ "-wic64trace", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "WIC64Logenabled", (void *)1,
NULL, "Enable WiC64 tracing" },
@@ -635,18 +659,42 @@
static int wic64_set_macaddress(const char *val, void *v)
{
- util_string_set((char **)&wic64_mac_address, val);
- return 0;
+ unsigned int a, b, c, d, e, f;
+ int ret;
+ /* validate string */
+ ret = sscanf(val, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f);
+ if ((ret == 6) &&
+ (/*(a >= 0) &&*/ (a <= 255)) &&
+ (/*(b >= 0) &&*/ (b <= 255)) &&
+ (/*(c >= 0) &&*/ (c <= 255)) &&
+ (/*(d >= 0) &&*/ (d <= 255)) &&
+ (/*(e >= 0) &&*/ (e <= 255)) &&
+ (/*(f >= 0) &&*/ (f <= 255))) {
+ util_string_set((char **)&wic64_mac_address, val);
+ return 0;
+ }
+ return -1;
}
static int wic64_set_ipaddress(const char *val, void *v)
{
- util_string_set((char **)&wic64_internal_ip, val);
- return 0;
+ int ret, a, b, c, d;
+ /* validate string */
+ ret = sscanf(val, "%d.%d.%d.%d", &a, &b, &c, &d);
+ if ((ret == 4) &&
+ ((a >= 0) && (a <= 255)) &&
+ ((b >= 0) && (b <= 255)) &&
+ ((c >= 0) && (c <= 255)) &&
+ ((d >= 0) && (d <= 255))) {
+ util_string_set((char **)&wic64_internal_ip, val);
+ return 0;
+ }
+ return -1;
}
static int wic64_set_sectoken(const char *val, void *v)
{
+ /* TODO: validate string */
util_string_set((char **)&wic64_sec_token, val);
return 0;
}
@@ -657,6 +705,12 @@
return 0;
}
+static int wic64_set_dhcp(int val, void *param)
+{
+ current_dhcp = val;
+ return 0;
+}
+
static int wic64_set_logenabled(int val, void *param)
{
wic64_logenabled = val;
@@ -778,7 +832,7 @@
lib_unsigned_rand(0, 15),
lib_unsigned_rand(0, 15));
resources_set_string("WIC64MACAddress", tmp);
- resources_set_string("WIC64SecToken", "0123456789ab");
+ resources_set_string("WIC64SecToken", SECTOKEN_INVALID);
}
void userport_wic64_factory_reset(void)
@@ -2541,10 +2595,60 @@
}
}
+/*
+ return a reasonable "local IP"
+
+ this is used in two cases:
+ - the WIC64IPAddress in the config is empty, and WIC64DHCP is 0. In that
+ case we use the local IP as default
+ - WIC64DHCP is 1. In that case we should always use the local IP
+
+ Note: This is a surprisingly non trivial operation. For instance, due to
+ the high level approach of the emulation, we can't really tell what our
+ local IP is, without trying to connect somewhere.
+
+ What we really intend to do here, is determining the IP address, which will
+ be used by libcurl when we make connections, so it can be shown to the user
+ in the emulation.
+*/
+static int getlocalip(char *str)
+{
+ char *ip;
+ CURLcode res;
+ CURL *c = curl_easy_init();
+
+ *str = 0;
+
+ /* try to connect to the default server */
+ curl_easy_setopt(c, CURLOPT_URL, default_server_hostname);
+ curl_easy_setopt(c, CURLOPT_CONNECT_ONLY, 0);
+
+ /* Perform the connect */
+ res = curl_easy_perform(c);
+ /* Check for errors */
+ if((res == CURLE_OK) &&
+ !curl_easy_getinfo(c, CURLINFO_LOCAL_IP, &ip) && ip) {
+ /* if the connection was successful, libcurl will return the local ip */
+ strcpy(str, ip);
+ } else {
+ /* as a last resort, just produce a random 'local' IP */
+ snprintf(str, 16, "192.168.%u.%u",
+ lib_unsigned_rand(1, 254),
+ lib_unsigned_rand(1, 254));
+ }
+
+ /* always cleanup */
+ curl_easy_reset(c);
+ curl_easy_cleanup(c);
+
+ return 0;
+}
+
static void userport_wic64_reset(void)
{
char *tmp;
int tmp_tz;
+ int tmp_dhcp;
wic64_log(CONS_COL_NO, "%s", __FUNCTION__);
commandptr = input_state = input_length = force_timeout = 0;
@@ -2553,36 +2657,6 @@
memset(sec_token, 0, 32);
sec_init = 0;
- if ((resources_get_string("WIC64MACAddress", (const char **)&tmp) == -1) ||
- (tmp == NULL) ||
- (strcmp((const char*)tmp, "DEADBE") == 0)) {
- wic64_mac_address = lib_malloc(32);
- snprintf(wic64_mac_address, 32, "08:d1:f9:%02x:%02x:%02x",
- lib_unsigned_rand(0, 15),
- lib_unsigned_rand(0, 15),
- lib_unsigned_rand(0, 15));
- debug_log(CONS_COL_NO, 2, "WIC64: generated MAC: %s", wic64_mac_address);
- } else {
- wic64_mac_address = tmp;
- }
-
- if ((resources_get_string("WIC64IPAddress", (const char **)&tmp) == -1) ||
- (tmp == NULL) ||
- (strcmp((const char *)tmp, "AAAA") == 0)) {
- wic64_internal_ip = lib_malloc(16);
- snprintf(wic64_internal_ip, 16, "192.168.%u.%u",
- lib_unsigned_rand(1, 254),
- lib_unsigned_rand(1, 254));
- debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
- } else {
- wic64_internal_ip = tmp;
- }
- if (resources_get_int("WIC64Timezone", &tmp_tz) == -1) {
- current_tz = 2;
- } else {
- current_tz = tmp_tz;
- }
-
if (http_get_alarm) {
alarm_unset(http_get_alarm);
}
@@ -2617,6 +2691,58 @@
lib_free(post_url);
post_url = NULL;
}
+
+ if (resources_get_int("WIC64Timezone", &tmp_tz) == -1) {
+ current_tz = 2;
+ } else {
+ current_tz = tmp_tz;
+ }
+
+ if (resources_get_int("WIC64DHCP", &tmp_dhcp) == -1) {
+ current_dhcp = 1;
+ } else {
+ current_dhcp = tmp_dhcp;
+ }
+
+ if ((resources_get_string("WIC64MACAddress", (const char **)&tmp) == -1) ||
+ (tmp == NULL) ||
+ (strcmp((const char*)tmp, MACADDR_INVALID) == 0)) {
+ /* if MAC is empty in the config, then generate a random one and save it
+ in the resource */
+ wic64_mac_address = lib_malloc(32);
+ snprintf(wic64_mac_address, 32, "08:d1:f9:%02x:%02x:%02x",
+ lib_unsigned_rand(0, 15),
+ lib_unsigned_rand(0, 15),
+ lib_unsigned_rand(0, 15));
+ debug_log(CONS_COL_NO, 2, "WIC64: generated MAC: %s", wic64_mac_address);
+ } else {
+ wic64_mac_address = tmp;
+ debug_log(CONS_COL_NO, 2, "WIC64: using saved MAC: %s", wic64_mac_address);
+ }
+
+ if (current_dhcp) {
+ if (wic64_internal_ip == NULL) {
+ wic64_internal_ip = lib_malloc(16);
+ }
+ getlocalip(wic64_internal_ip);
+ debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
+ }
+
+ if ((resources_get_string("WIC64IPAddress", (const char **)&tmp) == -1) ||
+ (tmp == NULL) ||
+ (strcmp((const char *)tmp, IPADDR_INVALID) == 0)) {
+ /* ip is empty */
+ if (wic64_internal_ip == NULL) {
+ wic64_internal_ip = lib_malloc(16);
+ }
+ getlocalip(wic64_internal_ip);
+ debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
+ } else {
+ /* use saved ip */
+ wic64_internal_ip = tmp;
+ }
+
+
/* wic64_set_status("RESET"); real HW doesn't tell this */
wic64_log(LOG_COL_LBLUE, "cyan color: host -> WiC64 communication");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-31 00:33:48
|
Revision: 45610
http://sourceforge.net/p/vice-emu/code/45610
Author: empathicqubit
Date: 2025-03-31 00:33:42 +0000 (Mon, 31 Mar 2025)
Log Message:
-----------
Fix null free in console close in SDL2 when binary monitor disconnects
Modified Paths:
--------------
trunk/vice/src/arch/shared/console_unix.c
Modified: trunk/vice/src/arch/shared/console_unix.c
===================================================================
--- trunk/vice/src/arch/shared/console_unix.c 2025-03-30 20:36:09 UTC (rev 45609)
+++ trunk/vice/src/arch/shared/console_unix.c 2025-03-31 00:33:42 UTC (rev 45610)
@@ -108,8 +108,10 @@
int native_console_close(console_t *log)
{
- lib_free(log->private);
- lib_free(log);
+ if(log != NULL) {
+ lib_free(log->private);
+ lib_free(log);
+ }
linenoiseHistoryFree();
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-03-30 20:36:21
|
Revision: 45609
http://sourceforge.net/p/vice-emu/code/45609
Author: gpz
Date: 2025-03-30 20:36:09 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
update readme
Modified Paths:
--------------
testprogs/drive/openbus/readme.txt
Modified: testprogs/drive/openbus/readme.txt
===================================================================
--- testprogs/drive/openbus/readme.txt 2025-03-30 13:54:11 UTC (rev 45608)
+++ testprogs/drive/openbus/readme.txt 2025-03-30 20:36:09 UTC (rev 45609)
@@ -5,3 +5,5 @@
Returns green on my OC118, expected to work on real 1541s too,
but not yet tested. Will fail on a 1581.
+
+(gpz 30/3/2025) works on my 1541(old), fails on 1570
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-30 13:54:13
|
Revision: 45608
http://sourceforge.net/p/vice-emu/code/45608
Author: compyx
Date: 2025-03-30 13:54:11 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
Joystick: Update docs with driver example
Contains some pseudo code, FOO everywhere =)
Modified Paths:
--------------
branches/compyx/joymap-001/vice/doc/joystick.md
Modified: branches/compyx/joymap-001/vice/doc/joystick.md
===================================================================
--- branches/compyx/joymap-001/vice/doc/joystick.md 2025-03-30 06:31:10 UTC (rev 45607)
+++ branches/compyx/joymap-001/vice/doc/joystick.md 2025-03-30 13:54:11 UTC (rev 45608)
@@ -1,6 +1,11 @@
# VICE Joystick API
+> To get a nicely formatted HTML version of this document, including syntax
+> highlighting, use:
+>
+> `pandoc -s -t html -f gfm joystick.md > joystick.html`
+
## Preface
This document describes the updated joystick API, which currently is a **work in
@@ -57,5 +62,208 @@
**TODO**: Proper (simple) description of `joystick_device_t` and its members
`joystick_axis_t`, `joystick_button_t` and `joystick_hat_t`.
+
**TODO**: Explain ownership of objects (container assumes ownership of its
elements and is responsible for freeing them after use, etc).
+
+
+## Implementing a driver
+
+Implementing a driver should be fairly straightforward. A driver registers
+itself with the joystick system and adds host devices it has detected.
+
+During joystick system initialization an arch-specific initialization function
+is called (and expected to be implemented by the driver), where the driver
+registers itself and adds host devices:
+
+```C
+void joystick_arch_init(void)
+```
+
+The function to register the driver is:
+
+```C
+void joystick_driver_register(const joystick_driver_t *driver)
+```
+
+Where `joystick_driver_t` is defined as:
+```C
+typedef struct joystick_driver_s {
+ /** \brief Open host device for use */
+ bool (*open) (joystick_device_t *);
+
+ /** \brief Poll host device */
+ void (*poll) (joystick_device_t *);
+
+ /** \brief Close host device */
+ void (*close) (joystick_device_t *);
+
+ /** \brief Optional method to free arch-specific device data */
+ void (*priv_free)(void *);
+
+ /** \brief Function to call after registering a device
+ *
+ * This function is called after #joystick_device_register has processed
+ * its argument. It can be used to customize mappings or calibration if so
+ * required.
+ */
+ void (*customize)(joystick_device_t *);
+
+} joystick_driver_t;
+```
+
+> Currently (re)opening a device hasn't been implemented yet, so the `open()`
+> method can be ignored, for now.
+
+### Driver methods
+
+The `poll()` method is called by the emulation at the end of *every emulated
+scanline*, and is expected to process any pending event data and pass that
+along to `joy_axis_event()`, `joy_button_event()` or `joy_hat_event()`.
+
+The `close()` method should close the host device (e.g. close file descriptor)
+and put the device in a proper state for opening again. It should **not** free
+its private data in the `priv` member of the `joystick_device_t`, that is done
+in the `priv_free()` method, called by the joystick system on shutdown.
+It should also **not** free the joystick device instance, that again is done by
+the joystick system.
+
+The `priv_free()` method (if used) is, as mentioned above, called on emulator
+shutdown (or once we implement plug-n-pray, on device unplugging), and can be
+used to free any arch-specific resources that cannot be contained in the
+`joystick_device_t` instance or its members.
+> For example: the DirectInput driver for Windows stores a `GUID` and an
+> `LPDIRECTINPUTDEVICE8` instance in `priv`.
+
+The `customize()` method can be used to customize the default mapping and
+calibration applied by the joystick system when `joystick_device_register()` is
+called.
+
+
+### Example of driver implementation
+
+The basic structure of a driver is the following:
+
+```C
+
+/* Some arch-specific data of a device (obvious pseudo code) */
+typedef struct foo_priv_s {
+ FOO_DEVICE *foodev;
+} foo_priv_t;
+
+
+/* Declaration of driver methods */
+static joystick_driver_t foo_driver = {
+ .poll = foo_poll,
+ .close = foo_close
+ .priv_free = foo_priv_free
+};
+
+
+/*
+ * Called after the joystick system has initialized during emulator boot
+ */
+void joystick_arch_init(void)
+{
+ /* Arch-specific initialization, if required */
+ FOO_JOYSTICK_SYSTEM_INIT();
+
+ /* Register driver */
+ joystick_driver_register(&foo_driver);
+
+ /* Iterate devices and register them with the joystick system */
+ for (int i = 0; i < NUM_HOST_DEVICES; i++) {
+
+ joystick_device_t *joydev = joystick_device_new();
+
+ FOO_DEVICE *foodev = OPEN_FOO_DEVICE(i);
+
+ joystick_device_set_name(joydev, foodev->name);
+ joystick_device_set_node(joydev, foodev->...); /* filesystem node of
+ device, GUID string,
+ whatever */
+ joydev->vendor = foodev->vendor_id; /* USB HID vendor ID */
+ joydev->product = foodev->product_id; /* USB HID product ID */
+
+ /* Iterate axes, buttons and perhaps hats of a device and add them */
+ for (int a = 0; a < NUM_AXES(foodev); a++) {
+
+ joystick_axis_t *axis = joystick_axis_new(foodev->AXES[a].name);
+ axis->code = foodev->AXES[a].code; /* some unique event code, can
+ be HID usage, or just index
+ of axis */
+ /* set limits if available */
+ axis->minimum = foodev->AXES[a].min; /* default is INT16_MIN */
+ axis->maximum = foodev->AXES[a].max; /* default is INT16_MAX */
+
+ /* store arch-specific data in `priv` member */
+ foo_priv_t *priv = lib_malloc(sizeof *priv);
+ priv->foodev = foodev;
+ joydev->priv = priv;
+
+ /* add axis to device: device takes ownership */
+ joystick_device_add_axis(joydev, axis);
+ }
+
+ /*
+ * ... Do the same for buttons and hats, if available ...
+ */
+
+ /* Now register the device with the joystick system: the joystick
+ * system takes ownership of the device and its members
+ */
+ joystick_device_register(joydev);
+ }
+}
+
+
+/*
+ * Clean up any arch-specific resources here on emulator shutdown
+ */
+void joystick_arch_shutdown(void)
+{
+ FOO_JOYSTICK_SYSTEM_CLOSE();
+}
+
+
+static void foo_poll(joystick_device_t *joydev)
+{
+ foo_priv_t *priv = joydev->priv;
+
+ while (HAS_EVENT_PENDING(priv->foodev) {
+ FOO_EVENT event = GET_EVENT(priv->foodev);
+
+ switch (event.type) {
+ case FOO_AXIS:
+ joystick_axis_t *axis = joystick_axis_from_code(joydev, event.code);
+ joy_axis_event(axis, event.value);
+ break;
+ case FOO_BUTTON:
+ joystick_button_t *button = joystick_button_from_code(joydev, event.code);
+ joy_button_event(button, event.value);
+ break;
+ }
+ }
+}
+
+
+static void foo_close(joystick_device_t *joydev)
+{
+ foo_priv_t *priv = joydev->priv;
+
+ if (priv->foodev != NULL) {
+ FOO_DEVICE_CLOSE(priv->foodev);
+ priv->foodev = NULL;
+ }
+}
+
+
+static void foo_priv_free(void *priv)
+{
+ foo_priv_t *p = priv;
+
+ FOO_DEVICE_FREE(p->foodev);
+ lib_free(p);
+}
+```
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-30 06:31:21
|
Revision: 45607
http://sourceforge.net/p/vice-emu/code/45607
Author: compyx
Date: 2025-03-30 06:31:10 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
Joystick: update Windows driver
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-30 06:06:21 UTC (rev 45606)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-30 06:31:10 UTC (rev 45607)
@@ -177,7 +177,7 @@
}
priv->prev_buttons[i] = (BYTE)value;
- joy_button_event(joydev, button, value);
+ joy_button_event(button, value);
}
/* handle axes */
@@ -191,7 +191,7 @@
if (value != prev) {
priv->prev_axes[i] = value;
- joy_axis_event(joydev, axis, (int32_t)value);
+ joy_axis_event(axis, (int32_t)value);
}
}
}
@@ -241,7 +241,7 @@
/* Northwest */
direction = JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_LEFT;
}
- joy_hat_event(joydev, hat, direction);
+ joy_hat_event(hat, direction);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-30 06:06:33
|
Revision: 45606
http://sourceforge.net/p/vice-emu/code/45606
Author: compyx
Date: 2025-03-30 06:06:21 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
Joystick: update NetBSD/FreeBSD driver
Update `joy_axis_event()`, `joy_button_event()` and `joy_hat_event()` calls
in line with latest API change.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-30 06:01:28 UTC (rev 45605)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-30 06:06:21 UTC (rev 45606)
@@ -234,7 +234,7 @@
prev = priv->prev_axes[axis->index];
if (value != prev) {
priv->prev_axes[axis->index] = value;
- joy_axis_event(joydev, axis, (int32_t)value);
+ joy_axis_event(axis, (int32_t)value);
}
}
break;
@@ -246,7 +246,7 @@
prev = priv->prev_hats[hat->index];
if (prev != value) {
priv->prev_hats[hat->index] = value;
- joy_hat_event(joydev, hat, (int32_t)value);
+ joy_hat_event(hat, (int32_t)value);
}
}
break;
@@ -261,7 +261,7 @@
prev = priv->prev_buttons[button->index];
if (prev != value) {
priv->prev_buttons[button->index] = value;
- joy_button_event(joydev, button, (int32_t)value);
+ joy_button_event(button, (int32_t)value);
}
}
break;
@@ -276,7 +276,7 @@
prev = priv->prev_buttons[button->index];
if (prev != value) {
priv->prev_buttons[button->index] = value;
- joy_button_event(joydev, button, (int32_t)value);
+ joy_button_event(button, (int32_t)value);
}
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-30 06:01:36
|
Revision: 45605
http://sourceforge.net/p/vice-emu/code/45605
Author: compyx
Date: 2025-03-30 06:01:28 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
Joystick: store parent device reference in axis, button and hat objects
Further simplify API by storing the parent device of axes, buttons and hats in
the respective objects. Makes event handlers accept (event-object, event-value).
Windows and Free/NetBSD drivers will need updating.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
branches/compyx/joymap-001/vice/src/arch/sdl/ui.c
branches/compyx/joymap-001/vice/src/arch/sdl/uimenu.c
branches/compyx/joymap-001/vice/src/joyport/joystick.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-30 05:37:26 UTC (rev 45604)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-30 06:01:28 UTC (rev 45605)
@@ -145,7 +145,7 @@
button = joystick_button_from_code(joydev, event->code);
if (button != NULL) {
- joy_button_event(joydev, button, event->value);
+ joy_button_event(button, event->value);
}
} else if (event->type == EV_ABS) {
@@ -157,7 +157,7 @@
#endif
axis = joystick_axis_from_code(joydev, event->code);
if (axis != NULL) {
- joy_axis_event(joydev, axis, event->value);
+ joy_axis_event(axis, event->value);
}
}
}
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-30 05:37:26 UTC (rev 45604)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-30 06:01:28 UTC (rev 45605)
@@ -684,7 +684,7 @@
cur = sdljoy_axis_direction(value, prev);
#endif
- joy_axis_event(joydev, axis, value);
+ joy_axis_event(axis, value);
}
static ui_menu_action_t sdljoy_perform_event_for_menu_action(joystick_mapping_t* event, Sint16 value)
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/ui.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/ui.c 2025-03-30 05:37:26 UTC (rev 45604)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/ui.c 2025-03-30 06:01:28 UTC (rev 45605)
@@ -283,12 +283,12 @@
case SDL_JOYBUTTONUP:
if (sdljoy_get_joy_for_event((VICE_SDL_JoystickID)e.jbutton.which, &joydev, &joynum)) {
button = joydev->buttons[e.jbutton.button];
- joy_button_event(joydev, button, e.type == SDL_JOYBUTTONDOWN ? 1: 0);
+ joy_button_event(button, e.type == SDL_JOYBUTTONDOWN ? 1: 0);
}
break;
case SDL_JOYHATMOTION:
if (sdljoy_get_joy_for_event((VICE_SDL_JoystickID)e.jaxis.which, &joydev, &joynum)) {
- joy_hat_event(joydev, joydev->hats[e.jhat.hat], hat_map[e.jhat.value]);
+ joy_hat_event(joydev->hats[e.jhat.hat], hat_map[e.jhat.value]);
}
break;
#endif
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/uimenu.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/uimenu.c 2025-03-30 05:37:26 UTC (rev 45604)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/uimenu.c 2025-03-30 06:01:28 UTC (rev 45605)
@@ -1208,14 +1208,13 @@
case SDL_JOYBUTTONDOWN: /* fall through */
case SDL_JOYBUTTONUP:
if (sdljoy_get_joy_for_event(e.jbutton.which, &joydev, &joynum)) {
- joy_button_event(joydev,
- joydev->buttons[e.jbutton.button],
+ joy_button_event(joydev->buttons[e.jbutton.button],
e.type == SDL_JOYBUTTONDOWN ? 1 : 0);
}
break;
case SDL_JOYHATMOTION:
if (sdljoy_get_joy_for_event(e.jhat.which, &joydev, &joynum)) {
- joy_hat_event(joydev, joydev->hats[e.jhat.hat], e.jhat.value);
+ joy_hat_event(joydev->hats[e.jhat.hat], e.jhat.value);
}
break;
#endif
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-30 05:37:26 UTC (rev 45604)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-30 06:01:28 UTC (rev 45605)
@@ -2988,13 +2988,16 @@
}
-void joy_axis_event(joystick_device_t *joydev,
- joystick_axis_t *axis,
- int32_t value)
+/** \brief Handle joystick axis event
+ *
+ * \param[in] axis joystick axis
+ * \param[in] value raw value for \a axis
+ */
+void joy_axis_event(joystick_axis_t *axis, int32_t value)
{
joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
joystick_axis_value_t prev = axis->prev;
- int joyport = joydev->joyport;
+ int joyport = axis->device->joyport;
/* digital axes don't require calibration: */
@@ -3041,7 +3044,7 @@
}
DBG(("joy_axis_event: joy: %s axis: %d value: %d: direction: %d prev: %d\n",
- joydev->name, axis->index, value, direction, prev));
+ axis->device->name, axis->index, value, direction, prev));
/* release directions first if needed */
if (prev == JOY_AXIS_POSITIVE) {
@@ -3062,9 +3065,13 @@
axis->prev = direction;
}
-void joy_button_event(joystick_device_t *joydev,
- joystick_button_t *button,
- int32_t value)
+
+/** \brief Handle joystick button event
+ *
+ * \param[in] button joystick button
+ * \param[in] value raw value for \a button
+ */
+void joy_button_event(joystick_button_t *button, int32_t value)
{
int32_t pressed = value ? 1 : 0;
#if 0
@@ -3082,18 +3089,21 @@
#endif
if (value != button->prev) {
DBG(("joy_button_event: joy: %s, button: %d (%s) pressed: %d\n",
- joydev->name, button->index, button->name, pressed));
- joy_perform_event(&button->mapping, joydev->joyport, pressed);
+ button->device->name, button->index, button->name, pressed));
+ joy_perform_event(&button->mapping, button->device->joyport, pressed);
button->prev = value;
}
}
-void joy_hat_event(joystick_device_t *joydev,
- joystick_hat_t *hat,
- int32_t value)
+/** \brief Handle joystick hat event
+ *
+ * \param[in] hat joystick hat
+ * \param[in] value direction bitmask for \a hat
+ */
+void joy_hat_event(joystick_hat_t *hat, int32_t value)
{
- int joyport = joydev->joyport;
+ int joyport = hat->device->joyport;
int32_t prev = hat->prev;
if (value == prev) {
@@ -3802,6 +3812,7 @@
axis->minimum = INT16_MIN;
axis->maximum = INT16_MAX;
axis->digital = false;
+ axis->device = NULL;
joystick_mapping_init(&axis->mapping.negative);
joystick_mapping_init(&axis->mapping.positive);
axis->mapping.pot = 0; /* no POT mapped */
@@ -3817,10 +3828,11 @@
*/
static void joystick_button_init(joystick_button_t *button)
{
- button->code = 0;
- button->name = NULL;
- button->prev = 0;
- button->index = -1;
+ button->code = 0;
+ button->name = NULL;
+ button->prev = 0;
+ button->index = -1;
+ button->device = NULL;
joystick_mapping_init(&button->mapping);
joystick_calibration_init(&button->calibration);
}
@@ -3834,10 +3846,11 @@
*/
static void joystick_hat_init(joystick_hat_t *hat)
{
- hat->code = 0;
- hat->name = NULL;
- hat->prev = 0;
- hat->index = -1;
+ hat->code = 0;
+ hat->name = NULL;
+ hat->prev = 0;
+ hat->index = -1;
+ hat->device = NULL;
joystick_mapping_init(&hat->mapping.up);
joystick_mapping_init(&hat->mapping.down);
joystick_mapping_init(&hat->mapping.left);
@@ -3972,10 +3985,14 @@
/* set default calibration */
joystick_calibration_default_for_axis(axis);
+#if 0
printf("AXIS %d: min: %d, N-threshold: %d, P-threshold: %d, max: %d\n",
joydev->num_axes,
axis->minimum, axis->calibration.threshold.negative,
axis->calibration.threshold.positive, axis->maximum);
+#endif
+ /* store parent device */
+ axis->device = joydev;
joydev->axes[joydev->num_axes++] = axis;
}
@@ -4005,6 +4022,8 @@
joydev->buttons = lib_realloc(joydev->buttons,
sizeof *joydev->buttons * (size_t)joydev->max_buttons);
}
+
+ button->device = joydev;
joydev->buttons[joydev->num_buttons++] = button;
}
@@ -4033,6 +4052,8 @@
joydev->hats = lib_realloc(joydev->hats,
sizeof *joydev->hats * (size_t)joydev->max_hats);
}
+
+ hat->device = joydev;
joydev->hats[joydev->num_hats++] = hat;
}
@@ -4050,9 +4071,6 @@
for (i = 0; i < joydev->num_axes; i++) {
if (joydev->axes[i]->code == code) {
return joydev->axes[i];
- } else if (joydev->axes[i]->code > code) {
- /* codes are in-order: done */
- return NULL;
}
}
return NULL;
@@ -4072,9 +4090,6 @@
for (i = 0; i < joydev->num_buttons; i++) {
if (joydev->buttons[i]->code == code) {
return joydev->buttons[i];
- } else if (joydev->buttons[i]->code > code) {
- /* codes are in-order: done */
- return NULL;
}
}
return NULL;
@@ -4094,9 +4109,6 @@
for (i = 0; i < joydev->num_hats; i++) {
if (joydev->hats[i]->code == code) {
return joydev->hats[i];
- } else if (joydev->hats[i]->code > code) {
- /* codes are in-order: done */
- return NULL;
}
}
return NULL;
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-30 05:37:26 UTC (rev 45604)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-30 06:01:28 UTC (rev 45605)
@@ -191,12 +191,13 @@
* Information on a host device button input.
*/
typedef struct joystick_button_s {
- uint32_t code; /**< event code */
- char *name; /**< button name */
- int32_t prev; /**< previous polled value */
- int32_t index; /**< index in buttons array */
- joystick_mapping_t mapping; /**< button mapping */
- joystick_calibration_t calibration; /**< button calibration */
+ uint32_t code; /**< event code */
+ char *name; /**< button name */
+ int32_t prev; /**< previous polled value */
+ int32_t index; /**< index in buttons array */
+ joystick_mapping_t mapping; /**< button mapping */
+ joystick_calibration_t calibration; /**< button calibration */
+ struct joystick_device_s *device; /**< parent joystick device */
} joystick_button_t;
@@ -213,7 +214,6 @@
int32_t minimum; /**< minimum axis value */
int32_t maximum; /**< maximum axis value */
bool digital; /**< axis is digital (reports -1, 0, 1) */
-
struct {
joystick_mapping_t negative; /**< negative direction */
joystick_mapping_t positive; /**< positive direction */
@@ -221,9 +221,9 @@
} mapping; /**< mapping for negative and positive directions, and
pot. TODO: support pot values other than on/off so
emulated paddles and mice can be mapped to axes. */
+ joystick_calibration_t calibration; /**< axis calibration */
+ struct joystick_device_s *device; /**< parent joystick device */
- joystick_calibration_t calibration; /**< axis calibration */
-
} joystick_axis_t;
@@ -242,8 +242,9 @@
joystick_mapping_t left; /**< mapping for 'left' direction */
joystick_mapping_t right; /**< mapping for 'right' direction */
} mapping; /**< mappings per direction */
- joystick_calibration_t calibration; /* XXX: no idea if this makes sense
+ joystick_calibration_t calibration; /* XXX: no idea if this makes sense
for hats */
+ struct joystick_device_s *device; /**< parent joystick device */
} joystick_hat_t;
@@ -394,9 +395,9 @@
void joystick_set_snes_mapping(int port);
-void joy_axis_event (joystick_device_t *joydev, joystick_axis_t *axis, int32_t value);
-void joy_button_event(joystick_device_t *joydev, joystick_button_t *button, int32_t value);
-void joy_hat_event (joystick_device_t *joydev, joystick_hat_t *hat, int32_t value);
+void joy_axis_event (joystick_axis_t *axis, int32_t value);
+void joy_button_event(joystick_button_t *button, int32_t value);
+void joy_hat_event (joystick_hat_t *hat, int32_t value);
void joystick(void);
void joystick_close(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-30 05:37:27
|
Revision: 45604
http://sourceforge.net/p/vice-emu/code/45604
Author: compyx
Date: 2025-03-30 05:37:26 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
Start documenting the changes in joystick API
Create `doc/joystick.md` to document the joystick API and provide instructions
on how to create an arch-specific driver. WIP, subject to change.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/doc/Makefile.am
Added Paths:
-----------
branches/compyx/joymap-001/vice/doc/joystick.md
Modified: branches/compyx/joymap-001/vice/doc/Makefile.am
===================================================================
--- branches/compyx/joymap-001/vice/doc/Makefile.am 2025-03-29 18:03:17 UTC (rev 45603)
+++ branches/compyx/joymap-001/vice/doc/Makefile.am 2025-03-30 05:37:26 UTC (rev 45604)
@@ -6,6 +6,7 @@
Documentation-Howto.txt \
Doxygen-Howto.txt \
iec-bus.txt \
+ joystick.md \
Release-Howto.txt \
vice.texi \
gpl.texi
Added: branches/compyx/joymap-001/vice/doc/joystick.md
===================================================================
--- branches/compyx/joymap-001/vice/doc/joystick.md (rev 0)
+++ branches/compyx/joymap-001/vice/doc/joystick.md 2025-03-30 05:37:26 UTC (rev 45604)
@@ -0,0 +1,61 @@
+# VICE Joystick API
+
+
+## Preface
+
+This document describes the updated joystick API, which currently is a **work in
+progress**. All information herein is subject to change while the joystick code
+is being worked on. The inner workings of the actual emulation of the I/O system
+will not be described, just the translation of host device input to emulated
+joystick device, so no actual CIA/VIA emulation.
+
+
+## Overview of the joystick system in VICE
+
+The joystick system in VICE is split into two parts: **common code** and
+**driver code**. The driver code is specific to an OS/UI, while the common code,
+as the name implies, is used for every OS/UI.
+
+### Common code
+
+The common code (in `src/joyport/`) is responsible for interpreting data from
+the drivers and passing that to the emulation, as well as handling mapping and
+calibration of host inputs to emulated inputs. It is also responsible for
+providing the UI with information on host and emulated devices, and at a later
+point, passing host input to the UI for mapping and calibration dialogs.
+
+### Driver code
+
+The driver code is responsible for reading data from a host device and passing
+that back to the common code, as well as providing the common code with a list
+of available host devices and their properties.
+
+
+## Changes in the separation of driver and common code
+
+I've tried to keep the code required to implement a driver as small as possible,
+moving a number of responsibilities from the drivers to the common code.
+
+* The old code would let the driver interpret raw axis and button values and
+ send that back to the emulation (during the `poll()` callback). The drivers
+ now simply pass the raw values to the common code, and the common code
+ interprets those values with the help of the information on the host devices
+ provided by the driver (while also doing calibration).
+
+* A driver no longer needs to concern itself with ordering inputs, the common
+ code handles that.
+
+* Every input now has a unique *code*, which can be an event code (like with
+ Linux' evdev), a simple index of the input (as in SDL) or a HID usage code
+ (as on FreeBSD/NetBSD). The API provides drivers with methods of looking up
+ axis, button and hat objects through their respective code.
+
+* Event handlers in the common code now refer to inputs by instance, not index.
+ So for an axis event a driver would call `joy_axis_event()` with a host device
+ instance, axis instance and raw axis value.
+
+
+**TODO**: Proper (simple) description of `joystick_device_t` and its members
+ `joystick_axis_t`, `joystick_button_t` and `joystick_hat_t`.
+**TODO**: Explain ownership of objects (container assumes ownership of its
+ elements and is responsible for freeing them after use, etc).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-03-29 18:03:20
|
Revision: 45603
http://sourceforge.net/p/vice-emu/code/45603
Author: gpz
Date: 2025-03-29 18:03:17 +0000 (Sat, 29 Mar 2025)
Log Message:
-----------
remove support for ancient libnet, remove VICE_USE_LIBNET_1_1, fix HAVE_LIBNET logic so it even might get used now :)
Modified Paths:
--------------
trunk/vice/configure.ac
trunk/vice/src/arch/shared/rawnetarch_unix.c
trunk/vice/src/vicefeatures.c
Modified: trunk/vice/configure.ac
===================================================================
--- trunk/vice/configure.ac 2025-03-29 13:27:28 UTC (rev 45602)
+++ trunk/vice/configure.ac 2025-03-29 18:03:17 UTC (rev 45603)
@@ -2433,7 +2433,7 @@
AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
HAVE_RAWNET_SUPPORT="yes";
- AC_DEFINE(VICE_USE_LIBNET_1_1,,[Support for The Final Ethernet])
+ AC_DEFINE(HAVE_LIBNET,,[Support for libnet library])
TFE_LIBS="-lpcap `libnet-config --libs`"
libnet_cflags="`libnet-config --defines`"
],,$LIBS)],,$LIBS)
@@ -2444,6 +2444,7 @@
AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
HAVE_RAWNET_SUPPORT="yes";
+ AC_DEFINE(HAVE_LIBNET,,[Support for libnet library])
TFE_LIBS="-lpcap `libnet-config --libs`"
libnet_cflags="`libnet-config --defines`"
],,$LIBS)],,$LIBS)
Modified: trunk/vice/src/arch/shared/rawnetarch_unix.c
===================================================================
--- trunk/vice/src/arch/shared/rawnetarch_unix.c 2025-03-29 13:27:28 UTC (rev 45602)
+++ trunk/vice/src/arch/shared/rawnetarch_unix.c 2025-03-29 18:03:17 UTC (rev 45603)
@@ -96,14 +96,8 @@
static pcap_t *rawnet_pcap_fp = NULL;
#ifdef HAVE_LIBNET
-#ifdef VICE_USE_LIBNET_1_1
static libnet_t *TfeLibnetFP = NULL;
-#else /* VICE_USE_LIBNET_1_1 */
-static struct libnet_link_int *TfeLibnetFP = NULL;
-#endif /* VICE_USE_LIBNET_1_1 */
-
static char TfeLibnetErrBuf[LIBNET_ERRBUF_SIZE];
-
#endif /* HAVE_LIBNET */
@@ -202,11 +196,7 @@
#ifdef HAVE_LIBNET
/* now, open the libnet device to be able to send afterwards */
-#ifdef VICE_USE_LIBNET_1_1
TfeLibnetFP = libnet_init(LIBNET_LINK, (char *)interface_name, TfeLibnetErrBuf);
-#else /* VICE_USE_LIBNET_1_1 */
- TfeLibnetFP = libnet_open_link_interface(interface_name, TfeLibnetErrBuf);
-#endif /* VICE_USE_LIBNET_1_1 */
if (TfeLibnetFP == NULL) {
log_message(rawnet_arch_log, "Libnet interface could not be opened: '%s'", TfeLibnetErrBuf);
@@ -334,10 +324,8 @@
#ifdef HAVE_LIBNET
-# ifdef VICE_USE_LIBNET_1_1
+#define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_libnet_1_1
-# define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_libnet_1_1
-
static void rawnet_arch_transmit_libnet_1_1(int force, int onecoll,
int inhibit_crc, int tx_pad_dis, int txlength, uint8_t *txframe)
{
@@ -373,35 +361,6 @@
} while (0);
}
-# else /* VICE_USE_LIBNET_1_1 */
-
-# define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_libnet_1_0
-
-static void rawnet_arch_transmit_libnet_1_0(int force, int onecoll,
- int inhibit_crc, int tx_pad_dis, int txlength, uint8_t *txframe)
-{
- u_char *plibnet_buffer = NULL;
-
- /* we want to send via libnet 1.0 */
-
- if (libnet_init_packet(txlength, &plibnet_buffer)==-1) {
- log_message(rawnet_arch_log, "WARNING! Could not send packet!");
- } else {
- if (plibnet_buffer) {
- memcpy(plibnet_buffer, txframe, txlength);
- libnet_write_link_layer(TfeLibnetFP, "eth0", plibnet_buffer, txlength);
- libnet_destroy_packet(&plibnet_buffer);
- } else {
- log_message(rawnet_arch_log,
- "WARNING! Could not send packet: plibnet_buffer==NULL, "
- "but libnet_init_packet() did NOT fail!!");
- }
- }
-
-}
-
-# endif
-
#else /* HAVE_LIBNET */
# define RAWNET_ARCH_TRANSMIT rawnet_arch_transmit_pcap
Modified: trunk/vice/src/vicefeatures.c
===================================================================
--- trunk/vice/src/vicefeatures.c 2025-03-29 13:27:28 UTC (rev 45602)
+++ trunk/vice/src/vicefeatures.c 2025-03-29 18:03:17 UTC (rev 45603)
@@ -196,16 +196,6 @@
1 },
#endif
-/* FIXME: support for libnet < 1.1 should get removed */
-#if defined(UNIX_COMPILE) /* (unix) */
- { "VICE_USE_LIBNET_1_1", "Enable support for libnet 1.1",
-#ifndef VICE_USE_LIBNET_1_1
- 0 },
-#else
- 1 },
-#endif
-#endif
-
#if defined(UNIX_COMPILE) || defined(WINDOWS_COMPILE) /* (unix/windows) */
{ "HAVE_REALDEVICE", "Support for OpenCBM", /* (former CBM4Linux). */
#ifndef HAVE_REALDEVICE
@@ -324,6 +314,15 @@
1 },
#endif
+#if defined(UNIX_COMPILE) /* (unix) */
+ { "HAVE_LIBNET", "Use the libnet library.",
+#ifndef HAVE_LIBNET
+ 0 },
+#else
+ 1 },
+#endif
+#endif
+
#if !defined(WINDOWS_COMPILE) /* not windows */
{ "HAVE_TUNTAP", "Support for TUN/TAP virtual network interface.",
#ifndef HAVE_TUNTAP
@@ -485,29 +484,12 @@
#if 0
/* FIXME: appear in config.h but are not used in code: */
-/* Support for direct PCI I/O access Catweasel MKIII. */
-#define HAVE_CATWEASELMKIII_IO /**/
-/* Enable Fullscreen support. */
-/* #undef HAVE_FULLSCREEN */
-/* Support for PCI/ISA HardSID. */
-#define HAVE_HARDSID_IO /**/
-/* Enable support for BSD style joysticks. */
-/* #undef BSD_JOYSTICK */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
-/* WARNING win32 and osx bindist greps for this in config.h! */
+/* WARNING osx bindist greps for this in config.h! */
/* External FFMPEG libraries are used */
#define EXTERNAL_FFMPEG /**/
/* WARNING osx bindist greps for this in config.h! */
/* External linking for lame libs */
#define HAVE_EXTERNAL_LAME /**/
-/* WARNING: seems to be used in makefiles all over the place */
-/* Enable the readline library */
-/* #undef HAVE_READLINE */
-
-/* appear in code, but should get removed */
-
-/* FIXME: support for libnet < 1.1 should get removed (unix) */
-/* Enable support for libnet 1.1 */
-#define VICE_USE_LIBNET_1_1
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|