vice-emu-commit Mailing List for VICE (Page 11)
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
(26) |
Nov
|
Dec
|
|
From: <co...@us...> - 2025-03-22 04:40:09
|
Revision: 45556
http://sourceforge.net/p/vice-emu/code/45556
Author: compyx
Date: 2025-03-22 04:39:53 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Joystick: Windows: implement driver's open() and close() methods
Implement `open()` and `close()` methods of the driver, for now just call
`open()` for each device (calling IDirectInputDevice8::Acquire() just like the
old code has done), once the "JoyDevice{N}" resource setters actually close()
their old device and open() their new one this can be removed.
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-21 19:46:33 UTC (rev 45555)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-22 04:39:53 UTC (rev 45556)
@@ -406,8 +406,9 @@
{
joy_priv_t *pr = priv;
if (pr->didev != NULL) {
- IDirectInputDevice_Unacquire(pr->didev);
- IDirectInputDevice_Release(pr->didev);
+ /* it's safe to call Unacquire() on an unacquired device */
+ IDirectInputDevice8_Unacquire(pr->didev);
+ IDirectInputDevice8_Release(pr->didev);
}
lib_free(priv);
}
@@ -414,13 +415,46 @@
/*
- * Driver methods: NOPs for now
+ * Driver methods
*/
-static bool win32_joy_open(joystick_device_t *joydev) { return true; }
-static void win32_joy_poll(joystick_device_t *joydev) {}
-static void win32_joy_close(joystick_device_t *joydev) {}
+/** \brief Open joystick device for polling
+ *
+ * \param[in] joydev joystick device
+ *
+ * \return \c true on success, \c false on failure
+ */
+static bool win32_joy_open(joystick_device_t *joydev)
+{
+ joy_priv_t *priv = joydev->priv;
+ HRESULT result;
+ result = IDirectInputDevice8_Acquire(priv->didev);
+ if (SUCCEEDED(result)) {
+ return true;
+ }
+ log_error(winjoy_log, "failed to acquire device \"%s\": error 0x%08lx",
+ joydev->name, (unsigned long)result);
+ return false;
+}
+
+static void win32_joy_poll(joystick_device_t *joydev)
+{
+ /* TODO */
+}
+
+/** \brief Close joystick device
+ *
+ * \param[in] joydev joystick device
+ */
+static void win32_joy_close(joystick_device_t *joydev)
+{
+ joy_priv_t *priv = joydev->priv;
+
+ IDirectInputDevice8_Unacquire(priv->didev);
+}
+
+
/** \brief Driver definition */
static joystick_driver_t win32_joy_driver = {
.open = win32_joy_open,
@@ -688,8 +722,11 @@
(LPVOID)joydev,
DIDFT_ABSAXIS|DIDFT_BUTTON|DIDFT_POV);
#endif
- /* TODO: Open device for polling (until the driver's open() method has been
- * properly implemented and tested. */
+ /* Open device manually for polling, until the driver's open() method has
+ * been properly implemented and tested (changing resource "JoyDeviceN"
+ * should close the old device and open the new one)
+ */
+ win32_joy_open(joydev);
/* register device and continue */
joystick_device_register(joydev);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-21 19:46:40
|
Revision: 45555
http://sourceforge.net/p/vice-emu/code/45555
Author: compyx
Date: 2025-03-21 19:46:33 +0000 (Fri, 21 Mar 2025)
Log Message:
-----------
joystick: Windows still doesn't know "%z" *sigh*
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/joyport/joystick.c
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-21 19:39:37 UTC (rev 45554)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-21 19:46:33 UTC (rev 45555)
@@ -3630,7 +3630,7 @@
if (index < 0 || index >= num_joystick_devices) {
/* normally we wouldn't pass an invalid index, so log a warning */
log_warning(joy_log,
- "%s(): joystick index out of range (0-%zu)",
+ "%s(): joystick index out of range (0-%" PRI_SIZE_T ")",
__func__, num_joystick_devices);
return NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-21 19:39:50
|
Revision: 45554
http://sourceforge.net/p/vice-emu/code/45554
Author: compyx
Date: 2025-03-21 19:39:37 +0000 (Fri, 21 Mar 2025)
Log Message:
-----------
Joystick: make `joystick_device_register()` order its inputs on (event) code
Instead of relying on the drivers to provide us with ordered inputs, we have
`joystick_device_register()` order the axes, buttons and hats after they've
been added by the driver to the device and the device is registered.
Leads to less burden on the drivers: just add axes, buttons and hats in whatever
order the OS/library presents them, let the common joystick code sort (heh) it
out.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
branches/compyx/joymap-001/vice/src/joyport/joystick.c
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-21 12:52:24 UTC (rev 45553)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-21 19:39:37 UTC (rev 45554)
@@ -91,8 +91,6 @@
typedef struct joy_priv_s {
struct libevdev *evdev; /**< evdev instance */
int fd; /**< file descriptor */
- int32_t axis_index[NUM_AXES_MAX]; /**< axis indexes per code [0x00..0x28] */
- int32_t button_index[NUM_BUTTONS_MAX]; /**< button indexes per code [0x100-0x13e] */
} joy_priv_t;
@@ -111,9 +109,6 @@
priv = lib_malloc(sizeof *priv);
priv->fd = -1;
priv->evdev = NULL;
- memset(&priv->axis_index, -1, sizeof *priv->axis_index);
- memset(&priv->button_index, -1, sizeof *priv->button_index);
-
return priv;
}
@@ -141,28 +136,27 @@
*/
static void dispatch_event(joystick_device_t *joydev, struct input_event *event)
{
- joy_priv_t *priv = joydev->priv;
- int index;
+ if (event->type == EV_KEY) {
+ joystick_button_t *button;
- if (event->type == EV_KEY) {
-#if 0
printf("button %02x (%s): %d\n",
event->code, libevdev_event_code_get_name(EV_KEY, event->code),
event->value);
-#endif
- index = priv->button_index[event->code - BUTTON_CODE_MIN];
- if (index >= 0) {
- joy_button_event(joydev, joydev->buttons[index], event->value);
+
+ button = joystick_button_from_code(joydev, event->code);
+ if (button != NULL) {
+ joy_button_event(joydev, button, event->value);
}
+
} else if (event->type == EV_ABS) {
+ joystick_axis_t *axis;
#if 0
printf("axis %02x (%s): %d\n",
event->code, libevdev_event_code_get_name(EV_ABS, event->code),
event->value);
#endif
- index = priv->axis_index[event->code - AXIS_CODE_MIN];
- if (index >= 0) {
- joystick_axis_t *axis = joydev->axes[index];
+ axis = joystick_axis_from_code(joydev, event->code);
+ if (axis != NULL) {
int32_t minimum = axis->minimum;
int32_t maximum = axis->maximum;
int32_t range = maximum - minimum;
@@ -294,13 +288,10 @@
for (code = BUTTON_CODE_MIN; code <= BUTTON_CODE_MAX; code++) {
if (libevdev_has_event_code(evdev, EV_KEY, code)) {
- joy_priv_t *priv = joydev->priv;
joystick_button_t *button;
button = joystick_button_new(libevdev_event_code_get_name(EV_KEY, code));
button->code = code;
- /* store index in buttons array */
- priv->button_index[code - BUTTON_CODE_MIN] = joydev->num_buttons;
/* joydev takes ownership of button */
joystick_device_add_button(joydev, button);
}
@@ -316,8 +307,7 @@
static void scan_axes(joystick_device_t *joydev, struct libevdev *evdev)
{
if (libevdev_has_event_type(evdev, EV_ABS)) {
- joy_priv_t *priv = joydev->priv;
- uint32_t code;
+ uint32_t code;
for (code = AXIS_CODE_MIN; code <= AXIS_CODE_MAX; code++) {
if (libevdev_has_event_code(evdev, EV_ABS, code)) {
@@ -331,7 +321,6 @@
axis->minimum = info->minimum;
axis->maximum = info->maximum;
}
- priv->axis_index[code - AXIS_CODE_MIN] = joydev->num_axes;
/* joydev takes ownership of axis */
joystick_device_add_axis(joydev, axis);
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-21 12:52:24 UTC (rev 45553)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-21 19:39:37 UTC (rev 45554)
@@ -3471,6 +3471,101 @@
}
+#if 0
+static void dump_axes(joystick_device_t *joydev)
+{
+ for (int i = 0; i < joydev->num_axes; i++) {
+ joystick_axis_t *axis = joydev->axes[i];
+ printf("axis %02d: \"%s\" => %04x\n", i, axis->name, axis->code);
+ }
+}
+
+static void dump_buttons(joystick_device_t *joydev)
+{
+ for (int i = 0; i < joydev->num_buttons; i++) {
+ joystick_button_t *button = joydev->buttons[i];
+ printf("button %02d: \"%s\" => %04x\n", i, button->name, button->code);
+ }
+}
+
+static void dump_hats(joystick_device_t *joydev)
+{
+ for (int i = 0; i < joydev->num_hats; i++) {
+ joystick_hat_t *hat = joydev->hats[i];
+ printf("hat %02d: \"%s\" => %04x\n", i, hat->name, hat->code);
+ }
+}
+#endif
+
+static int cmp_axes(const void *a1, const void *a2)
+{
+ const joystick_axis_t *axis1 = *(const joystick_axis_t **)a1;
+ const joystick_axis_t *axis2 = *(const joystick_axis_t **)a2;
+
+ if (axis1->code < axis2->code) {
+ return -1;
+ } else if (axis1->code > axis2->code) {
+ return 1;
+ }
+ return 0;
+}
+
+static int cmp_buttons(const void *b1, const void *b2)
+{
+ const joystick_button_t *button1 = *(const joystick_button_t **)b1;
+ const joystick_button_t *button2 = *(const joystick_button_t **)b2;
+
+ if (button1->code < button2->code) {
+ return -1;
+ } else if (button1->code > button2->code) {
+ return 1;
+ }
+ return 0;
+}
+
+static int cmp_hats(const void *h1, const void *h2)
+{
+ const joystick_hat_t *hat1 = *(const joystick_hat_t **)h1;
+ const joystick_hat_t *hat2 = *(const joystick_hat_t **)h2;
+
+ if (hat1->code < hat2->code) {
+ return -1;
+ } else if (hat1->code > hat2->code) {
+ return 1;
+ }
+ return 0;
+}
+
+/** \brief Order axes, buttons and hats on event code
+ *
+ * \param[in] joydev joystick device
+ */
+static void order_inputs_on_code(joystick_device_t *joydev)
+{
+#if 0
+ printf("%s(): == BEFORE SORTING ==\n", __func__);
+ dump_axes(joydev);
+ dump_buttons(joydev);
+ dump_hats(joydev);
+#endif
+ if (joydev->num_axes > 1) {
+ qsort(joydev->axes, (size_t)(joydev->num_axes), sizeof joydev->axes[0], cmp_axes);
+ }
+ if (joydev->num_buttons > 1) {
+ qsort(joydev->buttons, (size_t)(joydev->num_buttons), sizeof joydev->buttons[0], cmp_buttons);
+ }
+ if (joydev->num_hats > 1) {
+ qsort(joydev->hats, (size_t)(joydev->num_hats), sizeof joydev->hats[0], cmp_hats);
+ }
+#if 0
+ printf("%s(): == AFTER SORTING ==\n", __func__);
+ dump_axes(joydev);
+ dump_buttons(joydev);
+ dump_hats(joydev);
+#endif
+}
+
+
/** \brief Register joystick device
*
* Add \a joydev to the list of available joystick devices.
@@ -3496,7 +3591,17 @@
sizeof *joystick_devices * max_joystick_devices);
}
+ /* Right-trim name: some drivers provide with padded strings, which will
+ * look weird in the UI */
joystick_device_trim_name(joydev);
+
+ /* Order axes, buttons and hats on event code: some drivers/APIs do not
+ * 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);
+
+ /* Now we can try to apply a default mapping */
joystick_device_apply_default_mapping(joydev);
joystick_devices[num_joystick_devices] = joydev;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-21 12:52:31
|
Revision: 45553
http://sourceforge.net/p/vice-emu/code/45553
Author: compyx
Date: 2025-03-21 12:52:24 +0000 (Fri, 21 Mar 2025)
Log Message:
-----------
Joystick: Win32: use single EnumObjectsCallback callback to enumerate inputs
Instead of using seperate callbacks and invocations of
`IDirectInputDevice8::EnumCallback()`, use a single invocation and pass a bitmask
of the objects required (axis, button, POV).
TODO: axes don't arrive inorder, so we need to order then for easier lookup
of event code (e.g. Saitek ST50 reports "X" (0), "Y" (1), "Throttle" (5), and
"Rudder" (2), in that order). Buttons and POVs *appear* to arrive in order and
have undescriptive names (e.g. "Button 0", "Button 1" and "POV 0").
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-21 11:04:22 UTC (rev 45552)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-21 12:52:24 UTC (rev 45553)
@@ -471,6 +471,54 @@
buffer[GUIDSTR_BUFSIZE - 1] = '\0';
}
+
+static BOOL enum_objects_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
+{
+ joystick_device_t *joydev = pvref;
+ joy_priv_t *priv = joydev->priv;
+ DWORD type = lpddoi->dwType;
+
+ if (type & DIDFT_ABSAXIS) {
+ /* Got (absolute) axis */
+ joystick_axis_t *axis;
+ DIPROPRANGE range;
+ HRESULT result;
+
+ axis = joystick_axis_new(lpddoi->tszName);
+ axis->code = DIDFT_GETINSTANCE(lpddoi->dwType);
+
+ /* obtain logical range of axis */
+ range.diph.dwSize = sizeof(DIPROPRANGE);
+ range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ range.diph.dwObj = lpddoi->dwType;
+ range.diph.dwHow = DIPH_BYID;
+ result = IDirectInputDevice8_GetProperty(priv->didev,
+ DIPROP_LOGICALRANGE,
+ &range.diph);
+ if (SUCCEEDED(result)) {
+ axis->minimum = range.lMin;
+ axis->maximum = range.lMax;
+ }
+ joystick_device_add_axis(joydev, axis);
+
+ } else if (type & DIDFT_BUTTON) {
+ /* Got regular (non-toggle) button */
+ joystick_button_t *button = joystick_button_new(lpddoi->tszName);
+
+ button->code = DIDFT_GETINSTANCE(lpddoi->dwType);
+ joystick_device_add_button(joydev, button);
+
+ } else if (type & DIDFT_POV) {
+ /* Got hat (POV) */
+ joystick_hat_t *hat = joystick_hat_new(lpddoi->tszName);
+
+ hat->code = DIDFT_GETINSTANCE(lpddoi->dwType);
+ joystick_device_add_hat(joydev, hat);
+ }
+ return DIENUM_CONTINUE;
+}
+
+#if 0
/** \brief Callback for EnumObjects to enumerate axes
*
* \param[in] lpddoi direct input device object instance
@@ -547,6 +595,7 @@
// log_message(winjoy_log, "POV %d: %s (%u)", joydev->num_hats - 1, hat->name, hat->code);
return DIENUM_CONTINUE;
}
+#endif
/** \brief Callback for IDirectInput8_EnumDevices()
*
@@ -616,7 +665,7 @@
priv->guid = lpddi->guidInstance;
priv->didev = didev;
joydev->priv = priv;
-
+#if 0
/* enumerate (absolute) axes */
IDirectInputDevice8_EnumObjects(didev,
enum_axes_callback,
@@ -633,7 +682,12 @@
enum_hats_callback,
(LPVOID)joydev,
DIDFT_POV);
-
+#else
+ IDirectInputDevice8_EnumObjects(didev,
+ enum_objects_callback,
+ (LPVOID)joydev,
+ DIDFT_ABSAXIS|DIDFT_BUTTON|DIDFT_POV);
+#endif
/* TODO: Open device for polling (until the driver's open() method has been
* properly implemented and tested. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-21 11:04:32
|
Revision: 45552
http://sourceforge.net/p/vice-emu/code/45552
Author: compyx
Date: 2025-03-21 11:04:22 +0000 (Fri, 21 Mar 2025)
Log Message:
-----------
Joystick: reimplement Win32 DirectInput driver
Rewrite DirectInput8 joystick driver. So far the driver enumerates devices and
their axes, buttons and hats (POVs in MS parlance) and their capabilities. The
driver's `open()`, `poll()` and `close()` methods are stubs at the moment.
Also use `DIJOYSTATE2` rather than `DIJOYSTATE` as the data format for the
devices so we can use more axes, buttons and hats if a has them (e.g. XBOX360,
PS4/PS5 controllers).
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.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_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-20 08:37:23 UTC (rev 45551)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-21 11:04:22 UTC (rev 45552)
@@ -33,9 +33,11 @@
#include "lib.h"
#define DIRECTINPUT_VERSION 0x0800
+/* required for any GUID stuff, spectacular linker errors on MSYS2 without it */
#define INITGUID
#include <dinput.h>
+#if 0
typedef struct _JoyAxis {
struct _JoyAxis *next;
DWORD id;
@@ -351,3 +353,331 @@
IDirectInput8_EnumDevices(di, DIDEVTYPE_JOYSTICK, EnumCallBack, NULL, DIEDFL_ALLDEVICES);
return 1;
}
+#endif
+
+/*
+ * New API
+ */
+
+/** \brief Private data object
+ *
+ * Contains arch-specific data of a joystick device.
+ */
+typedef struct joy_priv_s {
+ GUID guid; /**< GUID */
+ LPDIRECTINPUTDEVICE8 didev; /**< DirectInput device instance */
+} joy_priv_t;
+
+
+/** \brief DirectInput8 handle
+ *
+ * Initialized during subsystem init.
+ */
+static LPDIRECTINPUT8 dinput_handle = NULL;
+
+/** \brief Window handle */
+static HINSTANCE window_handle = NULL;
+
+/** \brief Log destination for the driver */
+static log_t winjoy_log = LOG_DEFAULT;
+
+
+/** \brief Allocate and initialize private data object
+ *
+ * \return new private data object
+ */
+static joy_priv_t *joy_priv_new(void)
+{
+ joy_priv_t *priv = lib_malloc(sizeof *priv);
+
+ memset(&priv->guid, 0, sizeof(priv->guid));
+ priv->didev = NULL;
+ return priv;
+}
+
+/** \brief Free private data object and its resources
+ *
+ * Unacquire() and Release() the DirectInput device inside \a priv and free
+ * \a priv.
+ *
+ * \param[in] priv private data object
+ */
+static void joy_priv_free(void *priv)
+{
+ joy_priv_t *pr = priv;
+ if (pr->didev != NULL) {
+ IDirectInputDevice_Unacquire(pr->didev);
+ IDirectInputDevice_Release(pr->didev);
+ }
+ lib_free(priv);
+}
+
+
+/*
+ * Driver methods: NOPs for now
+ */
+static bool win32_joy_open(joystick_device_t *joydev) { return true; }
+static void win32_joy_poll(joystick_device_t *joydev) {}
+static void win32_joy_close(joystick_device_t *joydev) {}
+
+
+/** \brief Driver definition */
+static joystick_driver_t win32_joy_driver = {
+ .open = win32_joy_open,
+ .poll = win32_joy_poll,
+ .close = win32_joy_close,
+ .priv_free = joy_priv_free
+};
+
+
+/** \brief Helper for logging errors with DirectInput
+ *
+ * Log error message in the form "<tt>{msg}</tt>: error 0x<tt>{result}</tt>".
+ *
+ * \param[in] msg message
+ * \param[in] result error code
+ */
+static void log_err_helper(const char *msg, HRESULT result)
+{
+ log_error(winjoy_log, "%s: error 0x%08lx", msg, (unsigned long)result);
+}
+
+/** \brief Size of buffer required to store a GUID as string */
+#define GUIDSTR_BUFSIZE 37
+
+/** \brief Generate string from GUID
+ *
+ * Generate string of \a guid and place in \a buffer.
+ * The \a buffer is expected to be at least #GUIDSTR_BUFSIZE bytes, which allows
+ * for the string and its nul terminator.
+ * Format of the string is "01234567-89AB-CDEF-0123-456789ABCDEF".
+ *
+ * \param[in] guid GUID reference
+ * \param[out] buffer destination of GUID string
+ *
+ * \note There is a \c StringFromGUID2() function in \c combaseapi.h, but
+ * that function expects an OLE string, some kind of wide string thing,
+ * so we just do it ourselves here.
+ */
+static void guid_to_str(const GUID *guid, char *buffer)
+{
+ snprintf(buffer, GUIDSTR_BUFSIZE,
+ "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ guid->Data1,
+ guid->Data2,
+ guid->Data3,
+ guid->Data4[0], guid->Data4[1],
+ guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+ buffer[GUIDSTR_BUFSIZE - 1] = '\0';
+}
+
+/** \brief Callback for EnumObjects to enumerate axes
+ *
+ * \param[in] lpddoi direct input device object instance
+ * \param[in] pvref joystick device
+ *
+ * \return \c DIENUM_CONTINUE
+ */
+static BOOL enum_axes_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
+{
+ joystick_device_t *joydev = pvref;
+ joy_priv_t *priv = joydev->priv;
+ joystick_axis_t *axis;
+ DIPROPRANGE range;
+ HRESULT result;
+
+ axis = joystick_axis_new(lpddoi->tszName);
+ axis->code = DIDFT_GETINSTANCE(lpddoi->dwType);
+
+ /* get logical range */
+ range.diph.dwSize = sizeof(DIPROPRANGE);
+ range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ range.diph.dwObj = lpddoi->dwType;
+ range.diph.dwHow = DIPH_BYID;
+ result = IDirectInputDevice8_GetProperty(priv->didev,
+ DIPROP_LOGICALRANGE,
+ &range.diph);
+ if (SUCCEEDED(result)) {
+ axis->minimum = (int32_t)range.lMin;
+ axis->maximum = (int32_t)range.lMax;
+ }
+
+ /* add axis and continue */
+ joystick_device_add_axis(joydev, axis);
+ // log_message(winjoy_log, "axis %d: %s (%u): [%d - %d]",
+ // joydev->num_axes - 1, axis->name, axis->code, axis->minimum, axis->maximum);
+ return DIENUM_CONTINUE;
+}
+
+/** \brief Callback for EnumObjects to enumerate buttons
+ *
+ * \param[in] lpddoi direct input device object instance
+ * \param[in] pvref joystick device
+ *
+ * \return \c DIENUM_CONTINUE
+ */
+static BOOL enum_buttons_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
+{
+ joystick_device_t *joydev = pvref;
+ joystick_button_t *button;
+
+ button = joystick_button_new(lpddoi->tszName);
+ button->code = DIDFT_GETINSTANCE(lpddoi->dwType);
+ joystick_device_add_button(joydev, button);
+ // log_message(winjoy_log, "button %d: %s (%d)", joydev->num_buttons - 1, button->name, button->code);
+ return DIENUM_CONTINUE;
+}
+
+/** \brief Callback for EnumObjects to enumerate hats (POVs)
+ *
+ * \param[in] lpddoi direct input device object instance
+ * \param[in] pvref joystick device
+ *
+ * \return \c DIENUM_CONTINUE
+ */
+static BOOL enum_hats_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
+{
+ joystick_device_t *joydev = pvref;
+ joystick_hat_t *hat;
+
+ hat = joystick_hat_new(lpddoi->tszName);
+ hat->code = DIDFT_GETINSTANCE(lpddoi->dwType);
+
+ joystick_device_add_hat(joydev, hat);
+ // log_message(winjoy_log, "POV %d: %s (%u)", joydev->num_hats - 1, hat->name, hat->code);
+ return DIENUM_CONTINUE;
+}
+
+/** \brief Callback for IDirectInput8_EnumDevices()
+ *
+ *
+ * \param[in] lpddi DirectInput device instance
+ * \param[in] pvref extra data for callback
+ *
+ * \return \c DIENUM_CONTINUE on success, \c DIENUM_STOP on failure
+ */
+static BOOL enum_devices_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvref)
+{
+ LPDIRECTINPUTDEVICE8 didev;
+ DIDEVCAPS caps;
+ joystick_device_t *joydev;
+ joy_priv_t *priv;
+ HRESULT result;
+ int raxes; /* reported number of axes */
+ int rbuttons; /* reported number of buttons */
+ int rpovs; /* reported number of POVs */
+
+ /* create device instance */
+ result = IDirectInput8_CreateDevice(dinput_handle,
+ &lpddi->guidInstance,
+ &didev,
+ NULL);
+ if (result != DI_OK) {
+ log_err_helper("IDirectInput8::CreateDevice() failed", result);
+ return DIENUM_STOP;
+ }
+
+ /* we want the extended DIJOYSTATE2 data format */
+ IDirectInputDevice8_SetDataFormat(didev, &c_dfDIJoystick2);
+ IDirectInputDevice8_SetCooperativeLevel(didev,
+ (HWND)window_handle,
+ DISCL_NONEXCLUSIVE|DISCL_BACKGROUND);
+
+ /* get capabilities of device */
+ caps.dwSize = sizeof(DIDEVCAPS);
+ result = IDirectInputDevice8_GetCapabilities(didev, &caps);
+ if (result != DI_OK) {
+ log_err_helper("IDirectInput8::GetCapabilities() failed", result);
+ return DIENUM_STOP;
+ }
+
+ /* create VICE device instance */
+ joydev = joystick_device_new();
+ joydev->name = lib_strdup(lpddi->tszProductName);
+ joydev->vendor = (uint16_t)(lpddi->guidProduct.Data1 & 0xffff);
+ joydev->product = (uint16_t)((lpddi->guidProduct.Data1 > 16u) & 0xffff);
+ /* don't set num axes etc here, the joystick_device_add_foo() functions
+ * update the number of inputs when called. */
+ raxes = caps.dwAxes;
+ rbuttons = caps.dwButtons;
+ rpovs = caps.dwPOVs;
+
+ /* generate GUID as string for the node member */
+ joydev->node = lib_calloc(GUIDSTR_BUFSIZE, 1);
+ guid_to_str(&lpddi->guidInstance, joydev->node);
+
+ log_message(winjoy_log,
+ "got device \"%s\" [%04x:%04x] GUID: %s, axes: %d, buttons: %d, POVs: %d",
+ joydev->name, (unsigned int)joydev->vendor, (unsigned int)joydev->product,
+ joydev->node, raxes, rbuttons, rpovs);
+
+ /* store arch-specific data */
+ priv = joy_priv_new();
+ priv->guid = lpddi->guidInstance;
+ priv->didev = didev;
+ joydev->priv = priv;
+
+ /* enumerate (absolute) axes */
+ IDirectInputDevice8_EnumObjects(didev,
+ enum_axes_callback,
+ (LPVOID)joydev,
+ DIDFT_ABSAXIS);
+
+ /* enumerate buttons */
+ IDirectInputDevice8_EnumObjects(didev,
+ enum_buttons_callback,
+ (LPVOID)joydev,
+ DIDFT_BUTTON);
+ /* enumerate POVs */
+ IDirectInputDevice8_EnumObjects(didev,
+ enum_hats_callback,
+ (LPVOID)joydev,
+ DIDFT_POV);
+
+ /* TODO: Open device for polling (until the driver's open() method has been
+ * properly implemented and tested. */
+
+ /* register device and continue */
+ joystick_device_register(joydev);
+ return DIENUM_CONTINUE;
+}
+
+
+/** \brief Initialize driver and enumerate and register devices
+ */
+void win32_joystick_init(void)
+{
+ HRESULT result;
+
+ /* initialize DirectInput for use */
+ winjoy_log = log_open("Joystick");
+ log_message(winjoy_log, "Initializing DirectInput8:");
+ window_handle = GetModuleHandle(NULL);
+ result = DirectInput8Create(window_handle,
+ DIRECTINPUT_VERSION,
+ &IID_IDirectInput8,
+ (void *)&dinput_handle,
+ NULL);
+ if (result != DI_OK) {
+ log_error(winjoy_log,
+ "failed to initialize DirectInput8: 0x%08lx, giving up.",
+ (unsigned long)result);
+ log_close(winjoy_log);
+ return;
+ }
+ log_message(winjoy_log, "OK.");
+
+ /* register driver */
+ joystick_driver_register(&win32_joy_driver);
+
+ /* enumerate devices */
+ log_message(winjoy_log, "Obtaining devices list:");
+ result = IDirectInput8_EnumDevices(dinput_handle,
+ DIDEVTYPE_JOYSTICK,
+ enum_devices_callback,
+ NULL,
+ DIEDFL_ATTACHEDONLY);
+ if (result != DI_OK) {
+ log_err_helper("IDirectInput8::EnumDevices() failed", result);
+ }
+}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-20 08:37:23 UTC (rev 45551)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-21 11:04:22 UTC (rev 45552)
@@ -2732,8 +2732,7 @@
#elif defined MAC_JOYSTICK
joy_hidlib_init();
#elif defined HAVE_DINPUT
- if (win32_directinput_joystick_init()) {
- }
+ win32_joystick_init();
#elif defined HAVE_SDL_NUMJOYSTICKS
joy_sdl_init();
#endif
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-20 08:37:23 UTC (rev 45551)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-21 11:04:22 UTC (rev 45552)
@@ -354,7 +354,7 @@
void bsd_joystick_init(void);
void joy_hidlib_init(void);
void joy_hidlib_exit(void);
-int win32_directinput_joystick_init(void);
+void win32_joystick_init(void);
uint16_t get_joystick_value(int index);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-20 08:37:36
|
Revision: 45551
http://sourceforge.net/p/vice-emu/code/45551
Author: compyx
Date: 2025-03-20 08:37:23 +0000 (Thu, 20 Mar 2025)
Log Message:
-----------
Joystick: fix indentation
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
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-20 08:33:21 UTC (rev 45550)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-20 08:37:23 UTC (rev 45551)
@@ -189,8 +189,8 @@
{
struct libevdev *evdev;
joy_priv_t *priv;
- int fd;
- int rc;
+ int fd;
+ int rc;
if (joydev == NULL || joydev->node == NULL) {
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-20 08:33:42
|
Revision: 45550
http://sourceforge.net/p/vice-emu/code/45550
Author: compyx
Date: 2025-03-20 08:33:21 +0000 (Thu, 20 Mar 2025)
Log Message:
-----------
Joystick: add accessor functions for axes, buttons hats by event code
Add `joystick_axis_from_code()`, `joystick_button_from_code()` and
`joystick_hat_from_code()`, which look up event sources by event code for a
given joystick device.
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-20 08:04:27 UTC (rev 45549)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-20 08:33:21 UTC (rev 45550)
@@ -3794,3 +3794,69 @@
}
joydev->hats[joydev->num_hats++] = hat;
}
+
+
+/** \brief Look up axis by code
+ *
+ * Look up axis in \a joydev by event \a code.
+ *
+ * \return axis or \c NULL when \a code isn't found
+ */
+joystick_axis_t *joystick_axis_from_code(joystick_device_t *joydev, uint32_t code)
+{
+ int i;
+
+ 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;
+}
+
+
+/** \brief Look up button by code
+ *
+ * Look up button in \a joydev by event \a code.
+ *
+ * \return button or \c NULL when \a code isn't found
+ */
+joystick_button_t *joystick_button_from_code(joystick_device_t *joydev, uint32_t code)
+{
+ int i;
+
+ 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;
+}
+
+
+/** \brief Look up hat by code
+ *
+ * Look up hat in \a joydev by event \a code.
+ *
+ * \return hat or \c NULL when \a code isn't found
+ */
+joystick_hat_t *joystick_hat_from_code(joystick_device_t *joydev, uint32_t code)
+{
+ int i;
+
+ 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-20 08:04:27 UTC (rev 45549)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-20 08:33:21 UTC (rev 45550)
@@ -422,10 +422,18 @@
void joystick_mapping_init (joystick_mapping_t *mapping);
joystick_axis_t *joystick_axis_new (const char *name);
+joystick_axis_t *joystick_axis_from_code (joystick_device_t *joydev,
+ uint32_t code);
void joystick_axis_free (joystick_axis_t *axis);
+
joystick_button_t *joystick_button_new (const char *name);
+joystick_button_t *joystick_button_from_code (joystick_device_t *joydev,
+ uint32_t code);
void joystick_button_free (joystick_button_t *button);
+
joystick_hat_t *joystick_hat_new (const char *name);
+joystick_hat_t *joystick_hat_from_code (joystick_device_t *joydev,
+ uint32_t code);
void joystick_hat_free (joystick_hat_t *hat);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-20 08:04:48
|
Revision: 45549
http://sourceforge.net/p/vice-emu/code/45549
Author: compyx
Date: 2025-03-20 08:04:27 +0000 (Thu, 20 Mar 2025)
Log Message:
-----------
Joystick: update BSD code to use updated driver methods
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-19 22:48:49 UTC (rev 45548)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-20 08:04:27 UTC (rev 45549)
@@ -226,8 +226,8 @@
/* Forward declarations */
-static bool bsd_joy_open (int joyport, joystick_device_t *joydev);
-static void bsd_joy_poll (int joyport, joystick_device_t *joydev);
+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);
@@ -298,13 +298,13 @@
}
-static bool bsd_joy_open (int joyport, joystick_device_t *joydev)
+static bool bsd_joy_open (joystick_device_t *joydev)
{
return true; /* NOP */
}
-static int joy_axis_index(joystick_device_t *joydev, uint16_t code)
+static int joy_axis_index(joystick_device_t *joydev, uint32_t code)
{
int i;
@@ -311,14 +311,14 @@
for (i = 0; i < joydev->num_axes; i++) {
if (joydev->axes[i]->code == code) {
return i;
+ } else if (joydev->axes[i]->code > code) {
+ return -1;
}
- /* axis codes are *not* stored in-order like with Linux evdev, so we
- * must finish the loop */
}
return -1;
}
-static int joy_button_index(joystick_device_t *joydev, uint16_t code)
+static int joy_button_index(joystick_device_t *joydev, uint32_t code)
{
int i;
@@ -325,14 +325,14 @@
for (i = 0; i < joydev->num_buttons; i++) {
if (joydev->buttons[i]->code == code) {
return i;
+ } else if (joydev->buttons[i]->code > code) {
+ return -1;
}
- /* button codes are *not* stored in-order like with Linux evdev, so we
- * must finish the loop */
}
return -1;
}
-static int joy_hat_index(joystick_device_t *joydev, uint16_t code)
+static int joy_hat_index(joystick_device_t *joydev, uint32_t code)
{
int i;
@@ -339,15 +339,15 @@
for (i = 0; i < joydev->num_hats; i++) {
if (joydev->hats[i]->code == code) {
return i;
+ } else if (joydev->hats[i]->code > code) {
+ return -1;
}
- /* hat codes are *not* stored in-order like with Linux evdev, so we
- * must finish the loop */
}
return -1;
}
-static void bsd_joy_poll(int joyport, joystick_device_t *joydev)
+static void bsd_joy_poll(joystick_device_t *joydev)
{
joy_priv_t *priv = joydev->priv;
@@ -381,7 +381,7 @@
case HUG_RZ: /* fall through */
case HUG_SLIDER:
/* axis */
- index = joy_axis_index(joydev, (uint16_t)usage);
+ index = joy_axis_index(joydev, (uint32_t)usage);
if (index >= 0) {
joystick_axis_t *axis = joydev->axes[index];
joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
@@ -390,21 +390,27 @@
printf("%s(): AXIS: index = %d, usage = %d, value = %d\n",
__func__, index, usage, value);
#endif
- /* FIXME: some on my Logitech F710 the Y axis is inverted */
+ /* 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.
+ */
if (value <= (axis->minimum + (range / 4))) {
direction = JOY_AXIS_NEGATIVE;
} else if (value >= (axis->maximum - (range / 4))) {
direction = JOY_AXIS_POSITIVE;
}
- joy_axis_event(joyport, (uint8_t)index, direction);
+ joy_axis_event(joydev, axis, direction);
}
break;
case HUG_HAT_SWITCH:
/* hat */
- index = joy_hat_index(joydev, (uint16_t)usage);
+ index = joy_hat_index(joydev, (uint32_t)usage);
if (index >= 0) {
- joy_hat_event(joyport, (uint8_t)index, (uint8_t)value);
+ joy_hat_event(joydev,
+ joydev->hats[index],
+ (int32_t)value);
}
break;
@@ -413,9 +419,11 @@
case HUG_D_PAD_LEFT: /* fall through */
case HUG_D_PAD_RIGHT:
/* D-Pad is mapped as buttons */
- index = joy_button_index(joydev, (uint16_t)usage);
+ index = joy_button_index(joydev, (uint32_t)usage);
if (index >= 0) {
- joy_button_event(joyport, (uint8_t)index, (uint8_t)value);
+ joy_button_event(joydev,
+ joydev->buttons[index],
+ (int32_t)value);
}
break;
default:
@@ -424,9 +432,11 @@
break;
case HUP_BUTTON:
/* button event */
- index = joy_button_index(joydev, (uint16_t)usage);
+ index = joy_button_index(joydev, (uint32_t)usage);
if (index >= 0) {
- joy_button_event(joyport, (uint8_t)index, (uint8_t)value);
+ joy_button_event(joydev,
+ joydev->buttons[index],
+ (int32_t)value);
}
break;
default:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-19 22:49:01
|
Revision: 45548
http://sourceforge.net/p/vice-emu/code/45548
Author: compyx
Date: 2025-03-19 22:48:49 +0000 (Wed, 19 Mar 2025)
Log Message:
-----------
joystick: SDL: make building against SDL 1.2 work again
Work around limited features of ancient SDL 1.2.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
branches/compyx/joymap-001/vice/src/arch/sdl/ui.c
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-19 21:46:40 UTC (rev 45547)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-19 22:48:49 UTC (rev 45548)
@@ -185,7 +185,6 @@
typedef struct joy_priv_s {
- SDL_JoystickGUID guid;
SDL_Joystick *sdldev;
VICE_SDL_JoystickID id;
int joynum;
@@ -198,8 +197,11 @@
priv->sdldev = sdldev;
priv->joynum = joynum;
- priv->guid = SDL_JoystickGetGUID(sdldev);
+#ifdef USE_SDL2UI
priv->id = SDL_JoystickInstanceID(sdldev);
+#else
+ priv->id = (VICE_SDL_JoystickID)joynum;
+#endif
return priv;
}
@@ -251,7 +253,11 @@
char buffer[64];
int i;
+#ifdef USE_SDL2UI
name = SDL_JoystickName(sdldev);
+#else
+ name = SDL_JoystickName(index);
+#endif
if (name != NULL) {
joydev->name = lib_strdup(name);
} else {
@@ -259,8 +265,10 @@
"couldn't retrieve joystick name: %s.", SDL_GetError());
joydev->name = lib_msprintf("Joystick_%d", index + 1);
}
+#ifdef USE_SDL2UI
joydev->vendor = SDL_JoystickGetVendor(sdldev);
joydev->product = SDL_JoystickGetProduct(sdldev);
+#endif
joydev->priv = priv;
/* enumerate axes */
@@ -270,8 +278,10 @@
snprintf(buffer, sizeof buffer, "Axis_%d", i + 1);
axis = joystick_axis_new(buffer);
axis->code = i;
+#ifdef USE_SDL2UI
axis->minimum = SDL_JOYSTICK_AXIS_MIN;
axis->maximum = SDL_JOYSTICK_AXIS_MAX;
+#endif
joystick_device_add_axis(joydev, axis);
}
@@ -312,9 +322,11 @@
log_message(sdljoy_log, "Got %d potential devices.", njoys);
for (num = 0; num < njoys; num++) {
+#ifdef USE_SDL2UI
log_message(sdljoy_log,
"SDL_JoystickNameForIndex(%d) = \"%s\"",
num, SDL_JoystickNameForIndex(num));
+#endif
}
for (num = 0; num < njoys; num++) {
SDL_Joystick *sdldev = SDL_JoystickOpen(num);
@@ -469,6 +481,7 @@
int count = joystick_device_count();
if (count > 0) {
+#ifdef USE_SDL2UI
int i;
for (i = 0; i < count; i++) {
@@ -485,6 +498,14 @@
return true;
}
}
+#else
+ if (joy_device != NULL) {
+ *joy_device = joystick_device_by_index((int)device_id);
+ }
+ if (joy_index != NULL) {
+ *joy_index = (int)device_id;
+ }
+#endif
}
return false;
}
@@ -492,26 +513,35 @@
joystick_device_t *sdljoy_get_joydev_for_event(VICE_SDL_JoystickID event_device_id)
{
- int i;
int count;
count = joystick_device_count();
- for (i = 0; i < count; i++) {
- joystick_device_t *joydev = joystick_device_by_index(i);
+ if (count > 0) {
+#ifdef USE_SDL2UI
+ int i;
- if (joydev != NULL) {
- joy_priv_t *priv = joydev->priv;
+ for (i = 0; i < count; i++) {
+ joystick_device_t *joydev = joystick_device_by_index(i);
- if (priv->id == event_device_id) {
- return joydev;
+ if (joydev != NULL) {
+ joy_priv_t *priv = joydev->priv;
+
+ if (priv->id == event_device_id) {
+ return joydev;
+ }
}
}
+#else
+ return joystick_device_by_index((int)event_device_id);
+#endif
}
+ return NULL;
}
int sdljoy_get_joynum_for_event(VICE_SDL_JoystickID event_device_id)
{
+#ifdef USE_SDL2UI
int i;
int count;
@@ -528,6 +558,10 @@
}
}
return -1;
+#else
+ /* SDL 1.2 doesn't have instance IDs, just indexes */
+ return (int)event_device_id;
+#endif
}
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/ui.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/ui.c 2025-03-19 21:46:40 UTC (rev 45547)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/ui.c 2025-03-19 22:48:49 UTC (rev 45548)
@@ -262,7 +262,6 @@
while (SDL_PollEvent(&e)) {
joystick_device_t *joydev = NULL;
joystick_button_t *button = NULL;
- joystick_hat_t *hat = NULL;
switch (e.type) {
case SDL_KEYDOWN:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-19 21:46:42
|
Revision: 45547
http://sourceforge.net/p/vice-emu/code/45547
Author: compyx
Date: 2025-03-19 21:46:40 +0000 (Wed, 19 Mar 2025)
Log Message:
-----------
Joystick: fix SDL UI to use updated joystick event functions
Only tested with SDL 2.x so far.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
branches/compyx/joymap-001/vice/src/arch/sdl/joy.h
branches/compyx/joymap-001/vice/src/arch/sdl/ui.c
branches/compyx/joymap-001/vice/src/arch/sdl/uimenu.c
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-19 15:39:19 UTC (rev 45546)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-19 21:46:40 UTC (rev 45547)
@@ -164,12 +164,12 @@
/* ------------------------------------------------------------------------- */
-static bool sdl_joystick_open(int joyport, joystick_device_t *joydev)
+static bool sdl_joystick_open(joystick_device_t *joydev)
{
return true;
}
-static void sdl_joystick_poll(int joyport, joystick_device_t *joydev)
+static void sdl_joystick_poll(joystick_device_t *joydev)
{
/* NOP: handled in SDL event loop */
}
@@ -461,6 +461,55 @@
return 0;
}
+
+bool sdljoy_get_joy_for_event(VICE_SDL_JoystickID device_id,
+ joystick_device_t **joy_device,
+ int *joy_index)
+{
+ int count = joystick_device_count();
+
+ if (count > 0) {
+ int i;
+
+ for (i = 0; i < count; i++) {
+ joystick_device_t *joydev = joystick_device_by_index(i);
+ joy_priv_t *priv = joydev->priv;
+
+ if (priv->id == device_id) {
+ if (joy_device != NULL) {
+ *joy_device = joydev;
+ }
+ if (joy_index != NULL) {
+ *joy_index = i;
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+joystick_device_t *sdljoy_get_joydev_for_event(VICE_SDL_JoystickID event_device_id)
+{
+ int i;
+ int count;
+
+ count = joystick_device_count();
+ for (i = 0; i < count; i++) {
+ joystick_device_t *joydev = joystick_device_by_index(i);
+
+ if (joydev != NULL) {
+ joy_priv_t *priv = joydev->priv;
+
+ if (priv->id == event_device_id) {
+ return joydev;
+ }
+ }
+ }
+}
+
+
int sdljoy_get_joynum_for_event(VICE_SDL_JoystickID event_device_id)
{
int i;
@@ -481,6 +530,9 @@
return -1;
}
+
+
+
static joystick_mapping_t *sdljoy_get_mapping(SDL_Event e)
{
joystick_mapping_t *retval = NULL;
@@ -593,15 +645,17 @@
return cur;
}
-void sdljoy_axis_event(Uint8 joynum, Uint8 axis, Sint16 value)
+void sdljoy_axis_event(Uint8 joynum, Uint8 axisnum, Sint16 value)
{
+ joystick_device_t *joydev = joystick_device_by_index(joynum);
+ joystick_axis_t *axis = joydev->axes[axisnum];
joystick_axis_value_t cur, prev;
- prev = joy_axis_prev(joynum, axis);
+ prev = joy_axis_prev(joynum, axisnum);
cur = sdljoy_axis_direction(value, prev);
- joy_axis_event(joynum, axis, cur);
+ joy_axis_event(joydev, axis, cur);
}
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/joy.h
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.h 2025-03-19 15:39:19 UTC (rev 45546)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.h 2025-03-19 21:46:40 UTC (rev 45547)
@@ -34,7 +34,7 @@
#include "types.h"
#include "vice_sdl.h"
-
+#include "joystick.h"
#include "uimenu.h"
void joystick_close(void);
@@ -59,7 +59,12 @@
void sdljoy_unset(SDL_Event e);
void sdljoy_set_joystick_axis(SDL_Event e, int pot);
void sdljoy_delete_extra_mapping(int type);
+joystick_device_t *sdljoy_get_joydev_for_event(VICE_SDL_JoystickID event_device_id);
int sdljoy_get_joynum_for_event(VICE_SDL_JoystickID event_device_id);
+bool sdljoy_get_joy_for_event(VICE_SDL_JoystickID device_id,
+ joystick_device_t **joy_device,
+ int *joy_index);
+
int sdljoy_rescan(void);
void sdljoy_clear_presses(void);
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/ui.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/ui.c 2025-03-19 15:39:19 UTC (rev 45546)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/ui.c 2025-03-19 21:46:40 UTC (rev 45547)
@@ -260,6 +260,10 @@
int joynum;
while (SDL_PollEvent(&e)) {
+ joystick_device_t *joydev = NULL;
+ joystick_button_t *button = NULL;
+ joystick_hat_t *hat = NULL;
+
switch (e.type) {
case SDL_KEYDOWN:
ui_display_kbd_status(&e);
@@ -271,28 +275,21 @@
break;
#ifdef HAVE_SDL_NUMJOYSTICKS
case SDL_JOYAXISMOTION:
- joynum = sdljoy_get_joynum_for_event((VICE_SDL_JoystickID)e.jaxis.which);
- if (joynum != -1) {
+ if (sdljoy_get_joy_for_event((VICE_SDL_JoystickID)e.jaxis.which, &joydev, &joynum)) {
sdljoy_axis_event(joynum, e.jaxis.axis, e.jaxis.value);
joystick_set_axis_value(joynum, e.jaxis.axis, (uint8_t)((~e.jaxis.value + 32768) >> 8));
}
break;
- case SDL_JOYBUTTONDOWN:
- joynum = sdljoy_get_joynum_for_event((VICE_SDL_JoystickID)e.jaxis.which);
- if (joynum != -1) {
- joy_button_event(joynum, e.jbutton.button, 1);
- }
- break;
+ case SDL_JOYBUTTONDOWN: /* fall through */
case SDL_JOYBUTTONUP:
- joynum = sdljoy_get_joynum_for_event((VICE_SDL_JoystickID)e.jaxis.which);
- if (joynum != -1) {
- joy_button_event(joynum, e.jbutton.button, 0);
+ 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);
}
break;
case SDL_JOYHATMOTION:
- joynum = sdljoy_get_joynum_for_event((VICE_SDL_JoystickID)e.jaxis.which);
- if (joynum != -1) {
- joy_hat_event(joynum, e.jhat.hat, hat_map[e.jhat.value]);
+ 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]);
}
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-19 15:39:19 UTC (rev 45546)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/uimenu.c 2025-03-19 21:46:40 UTC (rev 45547)
@@ -1163,6 +1163,9 @@
#endif
do {
+ joystick_device_t *joydev = NULL;
+ int joynum = -1;
+
SDL_WaitEvent(&e);
switch (e.type) {
@@ -1198,13 +1201,22 @@
#ifdef HAVE_SDL_NUMJOYSTICKS
case SDL_JOYAXISMOTION:
- sdljoy_axis_event(e.jaxis.which, e.jaxis.axis, e.jaxis.value);
+ if (sdljoy_get_joy_for_event(e.jaxis.which, &joydev, &joynum)) {
+ sdljoy_axis_event(joynum, e.jaxis.axis, e.jaxis.value);
+ }
break;
- case SDL_JOYBUTTONDOWN:
- joy_button_event(e.jbutton.which, e.jbutton.button, 1);
+ 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],
+ e.type == SDL_JOYBUTTONDOWN ? 1 : 0);
+ }
break;
case SDL_JOYHATMOTION:
- joy_hat_event(e.jhat.which, e.jhat.hat, e.jhat.value);
+ if (sdljoy_get_joy_for_event(e.jhat.which, &joydev, &joynum)) {
+ joy_hat_event(joydev, joydev->hats[e.jhat.hat], e.jhat.value);
+ }
break;
#endif
default:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-19 15:39:22
|
Revision: 45546
http://sourceforge.net/p/vice-emu/code/45546
Author: compyx
Date: 2025-03-19 15:39:19 +0000 (Wed, 19 Mar 2025)
Log Message:
-----------
Joystick: get rid of `joyport` argument in driver methods, pass objects, not indexes
The `joyport` argument to `poll()` and `open()` was not actually a joystick port
number, but the index of the joystick device in the registered devices list.
We already pass the device, so no need to do indexed lookups for something we
already have.
Also change the joy event handlers to accept (joystick-device, event-object,
event-value) instead of indexes requiring more lookups. The event values are
still "cooked" by the drivers and should be passed raw so the common joystick
code becomes responsible for determining the right value (inside the event
objects is all the data required for this). This should result in simpler and
easier to maintain drivers.
So far only the Linux evdev driver has been updated the changed methods, the
rest will follow soon.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.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-18 21:16:53 UTC (rev 45545)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-19 15:39:19 UTC (rev 45546)
@@ -136,13 +136,10 @@
/** \brief Dispatcher for joystick events
*
- * \param[in] joyport joystick port index
* \param[in] joydev joystick device instance
* \param[in] event event data
*/
-static void dispatch_event(int joyport,
- joystick_device_t *joydev,
- struct input_event *event)
+static void dispatch_event(joystick_device_t *joydev, struct input_event *event)
{
joy_priv_t *priv = joydev->priv;
int index;
@@ -155,7 +152,7 @@
#endif
index = priv->button_index[event->code - BUTTON_CODE_MIN];
if (index >= 0) {
- joy_button_event((uint8_t)joyport, (uint8_t)index, (uint8_t)event->value);
+ joy_button_event(joydev, joydev->buttons[index], event->value);
}
} else if (event->type == EV_ABS) {
#if 0
@@ -165,10 +162,11 @@
#endif
index = priv->axis_index[event->code - AXIS_CODE_MIN];
if (index >= 0) {
- int32_t minimum = joydev->axes[index]->minimum;
- int32_t maximum = joydev->axes[index]->maximum;
- int32_t range = maximum - minimum + 1;
- joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
+ joystick_axis_t *axis = joydev->axes[index];
+ int32_t minimum = axis->minimum;
+ int32_t maximum = axis->maximum;
+ int32_t range = maximum - minimum;
+ joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
/* ABS_HAT[0-3]XY axes return -1, 0 or 1: */
if (minimum == -1 && maximum == 1) {
@@ -182,12 +180,12 @@
} else if (event->value > (maximum - (range / 4))) {
direction = JOY_AXIS_POSITIVE;
}
- joy_axis_event((uint8_t)joyport, (uint8_t)index, direction);
+ joy_axis_event(joydev, axis, direction);
}
}
}
-static bool linux_joystick_evdev_open(int joyport, joystick_device_t *joydev)
+static bool linux_joystick_evdev_open(joystick_device_t *joydev)
{
struct libevdev *evdev;
joy_priv_t *priv;
@@ -220,10 +218,9 @@
/** \brief Poll callback for the joystick system
*
- * \param[in] joyport joystick port index
* \param[in] priv driver-specific joystick data
*/
-static void linux_joystick_evdev_poll(int joyport, joystick_device_t *joydev)
+static void linux_joystick_evdev_poll(joystick_device_t *joydev)
{
struct libevdev *evdev;
joy_priv_t *priv;
@@ -243,7 +240,7 @@
}
} else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) {
if (event.type == EV_ABS || event.type == EV_KEY) {
- dispatch_event(joyport, joydev, &event);
+ dispatch_event(joydev, &event);
}
}
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-18 21:16:53 UTC (rev 45545)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-19 15:39:19 UTC (rev 45546)
@@ -2998,10 +2998,10 @@
}
-void joy_axis_event(uint8_t joynum, uint8_t axis_index, joystick_axis_value_t value)
+void joy_axis_event(joystick_device_t *joydev,
+ joystick_axis_t *axis,
+ joystick_axis_value_t value)
{
- joystick_device_t *joydev = joystick_devices[joynum];
- joystick_axis_t *axis = joydev->axes[axis_index];
joystick_axis_value_t prev = axis->prev;
int joyport = joydev->joyport;
@@ -3009,7 +3009,8 @@
return;
}
- DBG(("joy_axis_event: joynum: %d axis: %d value: %u prev: %u\n", joynum, axis, value, prev));
+ DBG(("joy_axis_event: joy: %s axis: %d value: %d prev: %u\n",
+ joydev->name, axis->index, value, prev));
/* release directions first if needed */
if (prev == JOY_AXIS_POSITIVE) {
@@ -3030,10 +3031,11 @@
axis->prev = value;
}
-void joy_button_event(uint8_t joynum, uint8_t button, uint8_t value)
+void joy_button_event(joystick_device_t *joydev,
+ joystick_button_t *button,
+ int32_t value)
{
- joystick_device_t *joydev = joystick_devices[joynum];
- int32_t pressed = value ? 1 : 0;
+ int32_t pressed = value ? 1 : 0;
#if 0
int num_buttons = joystick_devices[joynum].num_buttons;
int joy_pin = joystick_devices[joynum].button_mapping[button].value.joy_pin;
@@ -3047,29 +3049,27 @@
}
}
#endif
- if (pressed != joydev->buttons[button]->prev) {
- DBG(("joy_button_event: joynum: %d, button: %d pressed: %d\n",
- joynum, button, pressed));
- joy_perform_event(&joydev->buttons[button]->mapping,
- joydev->joyport,
- pressed);
- joydev->buttons[button]->prev = pressed;
+ if (pressed != 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->prev = pressed;
}
}
-void joy_hat_event(uint8_t joynum, uint8_t hat_idx, uint8_t value)
+
+void joy_hat_event(joystick_device_t *joydev,
+ joystick_hat_t *hat,
+ int32_t value)
{
- joystick_device_t *joydev = joystick_devices[joynum];
- joystick_hat_t *hat = joydev->hats[hat_idx];
- int joyport = joydev->joyport;
- int32_t prev = hat->prev;
+ int joyport = joydev->joyport;
+ int32_t prev = hat->prev;
if (value == prev) {
return;
}
- joyport = joystick_devices[joynum]->joyport;
- DBG(("joy_hat_event:\n"));
+ DBG(("joy_hat_event (%s): %d\n", hat->name, value));
/* release directions first if needed */
if (prev & JOYSTICK_DIRECTION_UP && !(value & JOYSTICK_DIRECTION_UP)) {
joy_perform_event(&hat->mapping.up, joyport, 0);
@@ -3216,7 +3216,7 @@
int i;
for (i = 0; i < num_joystick_devices; i++) {
- joy_driver.poll(i, joystick_devices[i]);
+ joy_driver.poll(joystick_devices[i]);
}
}
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-18 21:16:53 UTC (rev 45545)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-19 15:39:19 UTC (rev 45546)
@@ -307,11 +307,11 @@
* this somehow?).
*/
typedef struct joystick_driver_s {
- /** \brief Open host device for specific machine port */
- bool (*open) (int, joystick_device_t *);
+ /** \brief Open host device for use */
+ bool (*open) (joystick_device_t *);
- /** \brief Poll host device for specific machine port */
- void (*poll) (int, joystick_device_t *);
+ /** \brief Poll host device */
+ void (*poll) (joystick_device_t *);
/** \brief Close host device */
void (*close) (joystick_device_t *);
@@ -366,9 +366,17 @@
extern int joystick_port_map[JOYPORT_MAX_PORTS];
void joystick_set_snes_mapping(int port);
-void joy_axis_event(uint8_t joynum, uint8_t axis, joystick_axis_value_t value);
-void joy_button_event(uint8_t joynum, uint8_t button, uint8_t value);
-void joy_hat_event(uint8_t joynum, uint8_t button, uint8_t value);
+
+/* TODO: Pass raw value to joy_axis_event(), let the joystick code figure out
+ * what the axis value should be, based on limits and calibration data
+ * inside the axis object.
+ * Same for buttons and hats: let the joystick code decide what to do,
+ * not the driver.
+ */
+void joy_axis_event (joystick_device_t *joydev, joystick_axis_t *axis, joystick_axis_value_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 joystick(void);
void joystick_close(void);
void joystick_resources_shutdown(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-18 21:17:00
|
Revision: 45545
http://sourceforge.net/p/vice-emu/code/45545
Author: compyx
Date: 2025-03-18 21:16:53 +0000 (Tue, 18 Mar 2025)
Log Message:
-----------
Joystick: make axes work, sort of
Axis events are now passed to `joy_axis_event()`, with the logic translating
raw values to `joystick_axis_value_t` still inside the driver. At a later
point I'll let the common code translate raw(-ish) values, along with any
calibration I'll be adding later.
Need to check axis behaviour on NetBSD and Linux, also perhaps check SDL2 on
FreeBSD, see what happens there.
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-18 15:42:19 UTC (rev 45544)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-18 21:16:53 UTC (rev 45545)
@@ -364,6 +364,7 @@
return;
}
+
while (hid_get_item(data, &item) > 0) {
int value = hid_get_data(priv->buffer, &item);
int usage = HID_USAGE(item.usage);
@@ -382,7 +383,20 @@
/* axis */
index = joy_axis_index(joydev, (uint16_t)usage);
if (index >= 0) {
- //joy_axis_event(joyport, (uint8_t)index, (uint8_t)value);
+ joystick_axis_t *axis = joydev->axes[index];
+ joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
+ int32_t range = axis->maximum - axis->minimum;
+#if 0
+ printf("%s(): AXIS: index = %d, usage = %d, value = %d\n",
+ __func__, index, usage, value);
+#endif
+ /* FIXME: some on my Logitech F710 the Y axis is inverted */
+ if (value <= (axis->minimum + (range / 4))) {
+ direction = JOY_AXIS_NEGATIVE;
+ } else if (value >= (axis->maximum - (range / 4))) {
+ direction = JOY_AXIS_POSITIVE;
+ }
+ joy_axis_event(joyport, (uint8_t)index, direction);
}
break;
@@ -390,7 +404,7 @@
/* hat */
index = joy_hat_index(joydev, (uint16_t)usage);
if (index >= 0) {
- //joy_hat_event(joyport, (uint8_t)index, (uint8_t)value);
+ joy_hat_event(joyport, (uint8_t)index, (uint8_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-18 15:42:25
|
Revision: 45544
http://sourceforge.net/p/vice-emu/code/45544
Author: compyx
Date: 2025-03-18 15:42:19 +0000 (Tue, 18 Mar 2025)
Log Message:
-----------
Joystick: update Doxygen docblocks
Also use `JOYPORT_FIRE`, `JOYPORT_POTX` and `JOYPORT_POTY` instead of literal
16, 32 and 48 when creating default mapping.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/joyport/joystick.c
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-18 06:11:47 UTC (rev 45543)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-18 15:42:19 UTC (rev 45544)
@@ -3284,6 +3284,12 @@
#define NUM_HATS_MAX 1024
+/** \brief Register joystick driver
+ *
+ * Register driver to be used by the joystick system.
+ *
+ * \param[in] driver driver definition
+ */
void joystick_driver_register(const joystick_driver_t *driver)
{
joy_driver = *driver;
@@ -3290,6 +3296,13 @@
}
+/** \brief Allocate and initialize joystick device
+ *
+ * Allocate new device and initialize its members for use. The arch-specific
+ * driver is expected to fill in the members when registering devices.
+ *
+ * \return new joystick device
+ */
joystick_device_t *joystick_device_new(void)
{
joystick_device_t *joydev = lib_malloc(sizeof *joydev);
@@ -3314,6 +3327,14 @@
}
+/** \brief Free joystick device and its data
+ *
+ * Frees all data in \a joydev, and calls the driver's \a priv_free() method
+ * on \c joydev->priv. It does \b >not close the device, to close a device
+ * the \a close() method of the driver is used.
+ *
+ * \param[in] joydev joystick device
+ */
void joystick_device_free(joystick_device_t *joydev)
{
if (joydev != NULL) {
@@ -3430,13 +3451,13 @@
/* primary fire button */
button = joydev->buttons[0];
button->mapping.action = JOY_ACTION_JOYSTICK;
- button->mapping.value.joy_pin = 16;
+ button->mapping.value.joy_pin = JOYPORT_FIRE;
if (joydev->num_buttons > 1) {
/* secondary fire button */
button = joydev->buttons[1];
button->mapping.action = JOY_ACTION_JOYSTICK;
- button->mapping.value.joy_pin = 32;
+ button->mapping.value.joy_pin = JOYPORT_FIRE_POTX;
}
if (joydev->num_buttons > 2) {
@@ -3443,7 +3464,7 @@
/* ternary fire button */
button = joydev->buttons[2];
button->mapping.action = JOY_ACTION_JOYSTICK;
- button->mapping.value.joy_pin = 64;
+ button->mapping.value.joy_pin = JOYPORT_FIRE_POTY;
}
}
@@ -3450,48 +3471,7 @@
return true;
}
-/** \brief Log registration of device
- *
- * Log message with proper singular/plural nouns for number of axes, buttons
- * and hats.
- *
- * \param[in] joydev joystick device
- */
-static void joy_log_registration(const joystick_device_t *joydev)
-{
- char msg[1024];
- int ret;
- ret = snprintf(msg, sizeof msg,
- "Registered device \"%s\" [%04x:%04x] (",
- joydev->name, joydev->vendor, joydev->product);
- if (joydev->num_axes == 1) {
- strcpy(msg + ret, "1 axis, ");
- ret += 8;
- } else {
- ret += snprintf(msg + ret, sizeof msg - (size_t)ret,
- "%d axes, ", joydev->num_axes);
- }
-
- if (joydev->num_buttons == 1) {
- strcpy(msg + ret, "1 button, ");
- ret += 10;
- } else {
- ret += snprintf(msg + ret, sizeof msg - (size_t)ret,
- "%d buttons, ", joydev->num_buttons);
- }
-
- if (joydev->num_hats == 1) {
- strcpy(msg + ret, "1 hat)");
- } else {
- snprintf(msg + ret, sizeof msg - (size_t) ret,
- "%d hats)", joydev->num_hats);
- }
-
- log_message(joy_log, "%s", msg);
-}
-
-
/** \brief Register joystick device
*
* Add \a joydev to the list of available joystick devices.
@@ -3524,7 +3504,13 @@
joystick_devices[++num_joystick_devices] = NULL;
/* log device registration */
- joy_log_registration(joydev);
+ log_message(joy_log,
+ "Registered device \"%s\" [%04x:%04x] (%d %s, %d %s, %d %s)",
+ joydev->name, (unsigned int)joydev->vendor, (unsigned int)joydev->product,
+ joydev->num_axes, joydev->num_axes == 1 ? "axis" : "axes",
+ joydev->num_buttons, joydev->num_buttons == 1 ? "button" : "buttons",
+ joydev->num_hats, joydev->num_hats == 1 ? "hat" : "hats");
+
return true;
}
@@ -3533,7 +3519,7 @@
*
* \param[in] index index in the devices list
*
- * \return joystick device or <tt>NULL</tt> when index is out of bounds
+ * \return joystick device or \c NULL when index is out of bounds
*/
joystick_device_t *joystick_device_by_index(int index)
{
@@ -3558,6 +3544,10 @@
}
+/** \brief Initialize joystick mapping
+ *
+ * \param[in] mapping joystick mapping
+ */
void joystick_mapping_init(joystick_mapping_t *mapping)
{
mapping->action = JOY_ACTION_NONE;
@@ -3564,6 +3554,16 @@
}
+/** \brief Initialize joystick axis
+ *
+ * Intialize \a axis to default values, including its \c positive and \c negative
+ * mappings.
+ * Most members are initialized to \c 0, \c false or \c NULL, the axis range is
+ * initialized to \c INT_MIN to \c INT_MAX. The \c index member is set to \c -1
+ * (invalid).
+ *
+ * \param[in] axis joystick axis
+ */
static void joystick_axis_init(joystick_axis_t *axis)
{
axis->code = 0;
@@ -3577,6 +3577,13 @@
joystick_mapping_init(&axis->mapping.positive);
}
+/** \brief Initialize joystick button
+ *
+ * Initialize \a button and its mapping.
+ * Members are set to \c 0 or \c NULL, the \c index member is set to -1 (invalid).
+ *
+ * \param[in] button joystick button
+ */
static void joystick_button_init(joystick_button_t *button)
{
button->code = 0;
@@ -3586,6 +3593,13 @@
joystick_mapping_init(&button->mapping);
}
+/** \brief Initialize joystick hat
+ *
+ * Initialize \a hat and its mappings (\c up, \c down, \c left and \c right).
+ * Members are set to \c 0 or \c NULL, the \c index member is set to -1 (invalid).
+ *
+ * \param[in] hat joystick hat
+ */
static void joystick_hat_init(joystick_hat_t *hat)
{
hat->code = 0;
@@ -3599,6 +3613,15 @@
}
+/** \brief Allocate and initialize joystick axis
+ *
+ * Allocate new joystick axis and initialize it. If \a name is not \c NULL it
+ * is used to initialize the \c name member using \c lib_strdup().
+ *
+ * \param[in] name axis name (optional)
+ *
+ * \return new joystick axis
+ */
joystick_axis_t *joystick_axis_new(const char *name)
{
joystick_axis_t *axis = lib_malloc(sizeof *axis);
@@ -3611,6 +3634,10 @@
}
+/** \brief Free joystick axis and its members
+ *
+ * \param[in] axis joystick axis
+ */
void joystick_axis_free(joystick_axis_t *axis)
{
if (axis != NULL) {
@@ -3620,6 +3647,13 @@
}
+/** \brief Allocate and initialize joystick button
+ *
+ * Allocate new joystick button and initialize it. If \a name is not \c NULL it
+ * is used to initialize the \c name member using \c lib_strdup().
+ *
+ * \param[in] name button name (optional)
+ */
joystick_button_t *joystick_button_new(const char *name)
{
joystick_button_t *button = lib_malloc(sizeof *button);
@@ -3632,6 +3666,10 @@
}
+/** \brief Free joystick button and its members
+ *
+ * \param[in] button joystick button
+ */
void joystick_button_free(joystick_button_t *button)
{
if (button != NULL) {
@@ -3641,6 +3679,13 @@
}
+/** \brief Allocate and initialize joystick hat
+ *
+ * Allocate new joystick hat and initialize it. If \a name is not \c NULL it
+ * is used to initialize the \c name member using \c lib_strdup().
+ *
+ * \param[in] name hat name (optional)
+ */
joystick_hat_t *joystick_hat_new(const char *name)
{
joystick_hat_t *hat = lib_malloc(sizeof *hat);
@@ -3653,6 +3698,10 @@
}
+/** \brief Free joystick hat and its members
+ *
+ * \param[in] hat joystick hat
+ */
void joystick_hat_free(joystick_hat_t *hat)
{
if (hat != NULL) {
@@ -3662,8 +3711,7 @@
}
-
-/** \@brief Add axis object to joystick device
+/** \brief Add axis to joystick device
*
* Adds \a axis to the \c axes array in \a joydev, with ownership of \a axis
* transfered to \a joydev.
@@ -3692,7 +3740,7 @@
}
-/** \brief Add button object to joystick device
+/** \brief Add button to joystick device
*
* Adds \a button to the \c buttons array in \a joydev, with ownership of
* \a button transfered to \a joydev.
@@ -3720,7 +3768,7 @@
}
-/** \brief Add hat object to joystick device
+/** \brief Add hat to joystick device
*
* Adds \a hat to the \c hats array in \a joydev, with ownership of \a hat
* transfered to \a joydev.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-18 06:11:58
|
Revision: 45543
http://sourceforge.net/p/vice-emu/code/45543
Author: compyx
Date: 2025-03-18 06:11:47 +0000 (Tue, 18 Mar 2025)
Log Message:
-----------
Joystick: set limit on number of axes, buttons and hats per device
Set arbitrary (1024) limit on number of axes, buttons and hats that can be
added to a device when calling `joystick_device_add_[axis|button|hat]()`.
Log a warning when the maximum is reached, so we can identify what's happening
rather than VICE eating memory and swap space.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/joyport/joystick.c
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-17 21:29:53 UTC (rev 45542)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-18 06:11:47 UTC (rev 45543)
@@ -3253,13 +3253,37 @@
/* NEW shit */
+/** \brief Initial size of the axes array of a joystick device */
+#define NUM_AXES_INITIAL 8
-#define NUM_AXES_INITIAL 8
+/** \brief Initial size of the buttons array of a joystick device */
#define NUM_BUTTONS_INITIAL 32
+
+/** \brief Initial size of the hats array of a joystick device */
#define NUM_HATS_INITIAL 4
+/** \brief Maximum number of axes allowed
+ *
+ * When this number of axes for a device is reached further axes added via
+ * #joystick_device_add_axis() will be ignored (and freed).
+ */
+#define NUM_AXES_MAX 1024
+/** \brief Maximum number of buttons allowed
+ *
+ * When this number of buttons for a device is reached further buttons added via
+ * #joystick_device_add_button() will be ignored (and freed).
+ */
+#define NUM_BUTTONS_MAX 1024
+/** \brief Maximum number of hat allowed
+ *
+ * When this number of hat for a device is reached further hats added via
+ * #joystick_device_add_hat() will be ignored (and freed).
+ */
+#define NUM_HATS_MAX 1024
+
+
void joystick_driver_register(const joystick_driver_t *driver)
{
joy_driver = *driver;
@@ -3651,6 +3675,14 @@
void joystick_device_add_axis(joystick_device_t *joydev,
joystick_axis_t *axis)
{
+ if (joydev->max_axes >= NUM_AXES_MAX) {
+ log_warning(joy_log,
+ "maximum (%d) number of axes reached, ignoring axis '%s'",
+ NUM_AXES_MAX, axis->name);
+ joystick_axis_free(axis);
+ return;
+ }
+
if (joydev->num_axes == joydev->max_axes) {
joydev->max_axes *= 2;
joydev->axes = lib_realloc(joydev->axes,
@@ -3671,6 +3703,14 @@
void joystick_device_add_button(joystick_device_t *joydev,
joystick_button_t *button)
{
+ if (joydev->max_buttons >= NUM_BUTTONS_MAX) {
+ log_warning(joy_log,
+ "maximum (%d) number of buttons reached, ignoring button '%s'",
+ NUM_BUTTONS_MAX, button->name);
+ joystick_button_free(button);
+ return;
+ }
+
if (joydev->num_buttons == joydev->max_buttons) {
joydev->max_buttons *= 2;
joydev->buttons = lib_realloc(joydev->buttons,
@@ -3691,6 +3731,14 @@
void joystick_device_add_hat(joystick_device_t *joydev,
joystick_hat_t *hat)
{
+ if (joydev->max_hats >= NUM_HATS_MAX) {
+ log_warning(joy_log,
+ "maximum (%d) number of hats reached, ignoring hat '%s'",
+ NUM_HATS_MAX, hat->name);
+ joystick_hat_free(hat);
+ return;
+ }
+
if (joydev->num_hats == joydev->max_hats) {
joydev->num_hats *= 2;
joydev->hats = lib_realloc(joydev->hats,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 21:29:54
|
Revision: 45542
http://sourceforge.net/p/vice-emu/code/45542
Author: compyx
Date: 2025-03-17 21:29:53 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Merge trunk (r45537:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh
branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh
branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh
Modified: branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 21:27:10 UTC (rev 45541)
+++ branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 21:29:53 UTC (rev 45542)
@@ -410,7 +410,7 @@
fi
decodedall=`$ECHO "$i" | sed 's/+/ /g'`
splititem4 $decodedall
- decodedname=`$ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
+ decodedname=$($ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g")
done
$ECHO "$decodedname."
$ECHO "</p>"
@@ -434,7 +434,7 @@
$ECHO "$decodedname,"
fi
if test x"$i" != "x"; then
- decodedname=`$ECHO "$i" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
+ decodedname=$($ECHO "$i" | sed "s/_/ /g;s/\xC8/\\\é/g;s/\\\'e/\\\é/g")
fi
done
$ECHO "$decodedname."
Modified: branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh 2025-03-17 21:27:10 UTC (rev 45541)
+++ branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh 2025-03-17 21:29:53 UTC (rev 45542)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/bash
###############################################################################
# updateindex.sh - update VICE version / date in the index.html file
@@ -70,40 +70,31 @@
YEAR=`grep "VICEDATE_YEAR " $VICEDATE | cut -d " " -f 3`
if [ "x$VERBOSE" = "x1" ]; then
-echo day $DAY
-echo month: $MONTH
-echo year: $YEAR
+ echo "day $DAY"
+ echo "month: $MONTH"
+ echo "year: $YEAR"
fi
# "(24 January 2022) Version 3.6.1 released"
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 1 old: $TOPLINE
+ echo "line 1 old: $TOPLINE"
fi
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: patch line 1 of index.html not found, version/date NOT updated."
else
- TOPLINE="("
- TOPLINE+=$DAY
- TOPLINE+=" "
- TOPLINE+=$MONTH
- TOPLINE+=" "
- TOPLINE+=$YEAR
- TOPLINE+=") Version "
- TOPLINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- TOPLINE+=""
- else
- TOPLINE+=.$VBUILD
+ TOPLINE="($DAY $MONTH $YEAR) Version $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ TOPLINE="$TOPLINE.$VBUILD"
fi
- TOPLINE+=" released"
+ TOPLINE="$TOPLINE released"
LC_ALL=C $SED_I -e "s:[\(][0-9]\+ [A-Z][a-z]* 20[0-9][0-9][\)] Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released:$TOPLINE:g" $README
fi
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 1 new: $TOPLINE
+ echo "line 1 new: $TOPLINE"
fi
# <a href="https://sourceforge.net/projects/vice-emu/files/releases/vice-3.6.1.tar.gz/download">vice-3.6.1.tar.gz</a>
@@ -110,26 +101,23 @@
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 2 old: $LINE
+ echo "line 2 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 2 of index.html not found, version/date NOT updated."
else
- LINE="vice-"
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="vice-$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+=".tar.gz"
+ LINE="$LINE.tar.gz"
LC_ALL=C $SED_I -e "s:vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz:$LINE:g" $README
fi
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 2 new: $LINE
+ echo "line 2 new: $LINE"
fi
# <li>Download <a href="https://sourceforge.net/projects/vice-emu/files/releases/binaries/windows/GTK3VICE-3.6.1-win64.zip/download">VICE 3.6.1</a> (64bit GTK3)</li>
@@ -136,42 +124,36 @@
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 3 old: $LINE
+ echo "line 3 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 3 of index.html not found, version/date NOT updated."
else
- LINE="VICE-"
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="VICE-$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+="-win"
+ LINE="$LINE-win"
LC_ALL=C $SED_I -e "s:VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win:$LINE:g" $README
fi
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 3 new: $LINE
+ echo "line 3 new: $LINE"
fi
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 4 old: $LINE
+ echo "line 4 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 4 of index.html not found, version/date NOT updated."
else
- LINE="VICE "
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="VICE $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
LC_ALL=C $SED_I -e "s:VICE [0-9]\+\.[0-9]\+\.*[0-9]*:$LINE:g" $README
fi
@@ -178,29 +160,26 @@
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 4 new: $LINE
+ echo "line 4 new: $LINE"
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 5 old: $LINE
+ echo "line 5 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 5 of index.html not found, version/date NOT updated."
else
- LINE=""
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+=".dmg"
+ LINE="$LINE.dmg"
LC_ALL=C $SED_I -e "s:[0-9]\+\.[0-9]\+\.*[0-9]*.dmg:$LINE:g" $README
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 5 new: $LINE
+ echo "line 5 new: $LINE"
fi
Modified: branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh 2025-03-17 21:27:10 UTC (rev 45541)
+++ branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh 2025-03-17 21:29:53 UTC (rev 45542)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/bash
###############################################################################
# updatereadme.sh - update VICE version / date in the README file
@@ -83,17 +83,14 @@
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: top line of README not found, version/date NOT updated."
else
- TOPLINE=" VICE "
- TOPLINE+=$VMAJOR.$VMINOR
+ TOPLINE=" VICE $VMAJOR.$VMINOR"
if [ "$VBUILD" = "0" ]; then
- TOPLINE+=" "
+ TOPLINE="$TOPLINE "
else
- TOPLINE+=.$VBUILD
+ TOPLINE="$TOPLINE.$VBUILD"
fi
- TOPLINE+=" "
- TOPLINE+=$MONTH
- TOPLINE+=" "
- TOPLINE+=$YEAR
+ TOPLINE="$TOPLINE "
+ TOPLINE="$TOPLINE$MONTH $YEAR"
LC_ALL=C $SED_I -e "s: \+VICE \+[0-9]\+\.[0-9]\+[\.]*[0-9]* \+[A-Z][a-z][a-z] 20[0-9][0-9]:$TOPLINE:g" $README
fi
@@ -112,15 +109,11 @@
if [ "x$LINE" = "x" ]; then
echo "WARNING: second patch line of README not found, version NOT updated."
else
- LINE="This is version "
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=" "
- else
- LINE+=.$VBUILD
- LINE+=" "
+ LINE="This is version $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+="of VICE"
+ LINE="$LINE of VICE"
LC_ALL=C $SED_I -e "s:This is version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+of VICE:$LINE:g" $README
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 21:27:12
|
Revision: 45541
http://sourceforge.net/p/vice-emu/code/45541
Author: compyx
Date: 2025-03-17 21:27:10 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Buildsystem: fix mistakes in "fixed" `updatereadme.sh` script
Modified Paths:
--------------
trunk/vice/src/buildtools/updatereadme.sh
Modified: trunk/vice/src/buildtools/updatereadme.sh
===================================================================
--- trunk/vice/src/buildtools/updatereadme.sh 2025-03-17 21:17:39 UTC (rev 45540)
+++ trunk/vice/src/buildtools/updatereadme.sh 2025-03-17 21:27:10 UTC (rev 45541)
@@ -90,7 +90,7 @@
TOPLINE="$TOPLINE.$VBUILD"
fi
TOPLINE="$TOPLINE "
- TOPLINE="$MONTH $YEAR"
+ TOPLINE="$TOPLINE$MONTH $YEAR"
LC_ALL=C $SED_I -e "s: \+VICE \+[0-9]\+\.[0-9]\+[\.]*[0-9]* \+[A-Z][a-z][a-z] 20[0-9][0-9]:$TOPLINE:g" $README
fi
@@ -110,9 +110,8 @@
echo "WARNING: second patch line of README not found, version NOT updated."
else
LINE="This is version $VMAJOR.$VMINOR"
- if [ "$VBUILD" = "0" ]; then
- else
- LINE="$LINE.$VBUILD"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
LINE="$LINE of VICE"
LC_ALL=C $SED_I -e "s:This is version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+of VICE:$LINE:g" $README
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 21:17:41
|
Revision: 45540
http://sourceforge.net/p/vice-emu/code/45540
Author: compyx
Date: 2025-03-17 21:17:39 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Buildsystem: fix scripts to work on NetBSD (in trunk this time)
Avoid bash-isms in `updateindex.sh` and `updatereadme.sh`, use $() command
substitution instead of `` for certain sed invocations (BSD sed mysteriously
choked on patterns, warning about trailing backslashes).
Thanks Rhialto :)
Modified Paths:
--------------
trunk/vice/src/buildtools/geninfocontrib_h.sh
trunk/vice/src/buildtools/updateindex.sh
trunk/vice/src/buildtools/updatereadme.sh
Modified: trunk/vice/src/buildtools/geninfocontrib_h.sh
===================================================================
--- trunk/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 21:05:54 UTC (rev 45539)
+++ trunk/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 21:17:39 UTC (rev 45540)
@@ -410,7 +410,7 @@
fi
decodedall=`$ECHO "$i" | sed 's/+/ /g'`
splititem4 $decodedall
- decodedname=`$ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
+ decodedname=$($ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g")
done
$ECHO "$decodedname."
$ECHO "</p>"
@@ -434,7 +434,7 @@
$ECHO "$decodedname,"
fi
if test x"$i" != "x"; then
- decodedname=`$ECHO "$i" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
+ decodedname=$($ECHO "$i" | sed "s/_/ /g;s/\xC8/\\\é/g;s/\\\'e/\\\é/g")
fi
done
$ECHO "$decodedname."
Modified: trunk/vice/src/buildtools/updateindex.sh
===================================================================
--- trunk/vice/src/buildtools/updateindex.sh 2025-03-17 21:05:54 UTC (rev 45539)
+++ trunk/vice/src/buildtools/updateindex.sh 2025-03-17 21:17:39 UTC (rev 45540)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/bash
###############################################################################
# updateindex.sh - update VICE version / date in the index.html file
@@ -70,40 +70,31 @@
YEAR=`grep "VICEDATE_YEAR " $VICEDATE | cut -d " " -f 3`
if [ "x$VERBOSE" = "x1" ]; then
-echo day $DAY
-echo month: $MONTH
-echo year: $YEAR
+ echo "day $DAY"
+ echo "month: $MONTH"
+ echo "year: $YEAR"
fi
# "(24 January 2022) Version 3.6.1 released"
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 1 old: $TOPLINE
+ echo "line 1 old: $TOPLINE"
fi
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: patch line 1 of index.html not found, version/date NOT updated."
else
- TOPLINE="("
- TOPLINE+=$DAY
- TOPLINE+=" "
- TOPLINE+=$MONTH
- TOPLINE+=" "
- TOPLINE+=$YEAR
- TOPLINE+=") Version "
- TOPLINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- TOPLINE+=""
- else
- TOPLINE+=.$VBUILD
+ TOPLINE="($DAY $MONTH $YEAR) Version $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ TOPLINE="$TOPLINE.$VBUILD"
fi
- TOPLINE+=" released"
+ TOPLINE="$TOPLINE released"
LC_ALL=C $SED_I -e "s:[\(][0-9]\+ [A-Z][a-z]* 20[0-9][0-9][\)] Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released:$TOPLINE:g" $README
fi
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 1 new: $TOPLINE
+ echo "line 1 new: $TOPLINE"
fi
# <a href="https://sourceforge.net/projects/vice-emu/files/releases/vice-3.6.1.tar.gz/download">vice-3.6.1.tar.gz</a>
@@ -110,26 +101,23 @@
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 2 old: $LINE
+ echo "line 2 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 2 of index.html not found, version/date NOT updated."
else
- LINE="vice-"
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="vice-$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+=".tar.gz"
+ LINE="$LINE.tar.gz"
LC_ALL=C $SED_I -e "s:vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz:$LINE:g" $README
fi
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 2 new: $LINE
+ echo "line 2 new: $LINE"
fi
# <li>Download <a href="https://sourceforge.net/projects/vice-emu/files/releases/binaries/windows/GTK3VICE-3.6.1-win64.zip/download">VICE 3.6.1</a> (64bit GTK3)</li>
@@ -136,42 +124,36 @@
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 3 old: $LINE
+ echo "line 3 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 3 of index.html not found, version/date NOT updated."
else
- LINE="VICE-"
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="VICE-$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+="-win"
+ LINE="$LINE-win"
LC_ALL=C $SED_I -e "s:VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win:$LINE:g" $README
fi
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 3 new: $LINE
+ echo "line 3 new: $LINE"
fi
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 4 old: $LINE
+ echo "line 4 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 4 of index.html not found, version/date NOT updated."
else
- LINE="VICE "
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="VICE $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
LC_ALL=C $SED_I -e "s:VICE [0-9]\+\.[0-9]\+\.*[0-9]*:$LINE:g" $README
fi
@@ -178,29 +160,26 @@
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 4 new: $LINE
+ echo "line 4 new: $LINE"
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 5 old: $LINE
+ echo "line 5 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 5 of index.html not found, version/date NOT updated."
else
- LINE=""
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+=".dmg"
+ LINE="$LINE.dmg"
LC_ALL=C $SED_I -e "s:[0-9]\+\.[0-9]\+\.*[0-9]*.dmg:$LINE:g" $README
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 5 new: $LINE
+ echo "line 5 new: $LINE"
fi
Modified: trunk/vice/src/buildtools/updatereadme.sh
===================================================================
--- trunk/vice/src/buildtools/updatereadme.sh 2025-03-17 21:05:54 UTC (rev 45539)
+++ trunk/vice/src/buildtools/updatereadme.sh 2025-03-17 21:17:39 UTC (rev 45540)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/bash
###############################################################################
# updatereadme.sh - update VICE version / date in the README file
@@ -83,17 +83,14 @@
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: top line of README not found, version/date NOT updated."
else
- TOPLINE=" VICE "
- TOPLINE+=$VMAJOR.$VMINOR
+ TOPLINE=" VICE $VMAJOR.$VMINOR"
if [ "$VBUILD" = "0" ]; then
- TOPLINE+=" "
+ TOPLINE="$TOPLINE "
else
- TOPLINE+=.$VBUILD
+ TOPLINE="$TOPLINE.$VBUILD"
fi
- TOPLINE+=" "
- TOPLINE+=$MONTH
- TOPLINE+=" "
- TOPLINE+=$YEAR
+ TOPLINE="$TOPLINE "
+ TOPLINE="$MONTH $YEAR"
LC_ALL=C $SED_I -e "s: \+VICE \+[0-9]\+\.[0-9]\+[\.]*[0-9]* \+[A-Z][a-z][a-z] 20[0-9][0-9]:$TOPLINE:g" $README
fi
@@ -112,15 +109,12 @@
if [ "x$LINE" = "x" ]; then
echo "WARNING: second patch line of README not found, version NOT updated."
else
- LINE="This is version "
- LINE+=$VMAJOR.$VMINOR
+ LINE="This is version $VMAJOR.$VMINOR"
if [ "$VBUILD" = "0" ]; then
- LINE+=" "
else
- LINE+=.$VBUILD
- LINE+=" "
+ LINE="$LINE.$VBUILD"
fi
- LINE+="of VICE"
+ LINE="$LINE of VICE"
LC_ALL=C $SED_I -e "s:This is version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+of VICE:$LINE:g" $README
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 21:05:57
|
Revision: 45539
http://sourceforge.net/p/vice-emu/code/45539
Author: compyx
Date: 2025-03-17 21:05:54 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Revert previous commit
Accidentally changed files in my branch, not trunk =D
Modified Paths:
--------------
branches/compyx/joymap-001/vice/doc/html/index.html
branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh
branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh
branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh
Modified: branches/compyx/joymap-001/vice/doc/html/index.html
===================================================================
--- branches/compyx/joymap-001/vice/doc/html/index.html 2025-03-17 20:57:16 UTC (rev 45538)
+++ branches/compyx/joymap-001/vice/doc/html/index.html 2025-03-17 21:05:54 UTC (rev 45539)
@@ -371,24 +371,7 @@
<!--teamstart-->
<p>
Current VICE team members:
-Pottendo,
-Marco van den Heuvel,
-Fabrizio Gennari,
-Groepaz,
-Errol Smith,
-Ingo Korb,
-Olaf Seibert,
-Marcus Sutton,
-Kajtar Zsolt,
-AreaScout,
-Bas Wassink,
-Michael C. Martin,
-Christopher Phillips,
-David Hogan,
-Empathic Qubit,
-Roberto Muscedere,
-June Tate-Gans,
-Pablo Roldan.
+.
</p>
<p>Of course our warm thanks go to everyone who has helped us in developing
@@ -402,60 +385,7 @@
<p>
The VICE is copyrighted to:
-Pottendo,
-Marco van den Heuvel,
-Fabrizio Gennari,
-Groepaz,
-Errol Smith,
-Ingo Korb,
-Olaf Seibert,
-Marcus Sutton,
-Kajtar Zsolt,
-AreaScout,
-Bas Wassink,
-Michael C. Martin,
-Christopher Phillips,
-David Hogan,
-Empathic Qubit,
-Roberto Muscedere,
-June Tate-Gans,
-Pablo Roldan,
-Stefan Haubenthal,
-BSzili,
-Andreas Matthies,
-Daniel Kahlin,
-Benjamin 'BeRo' Rosseaux,
-Ulrich Schulz,
-Thomas Giesel,
-Antti S. Lankila,
-Christian Vogelgsang,
-Dag Lem,
-Spiro Trikaliotis,
-Hannu Nuotio,
-Andreas Boose,
-Tibor Biczo,
-M. Kiesel,
-Andreas Dehmel,
-David Hansel,
-Markus Brenner,
-Thomas Bretz,
-Daniel Sladic,
-Andre Fachat,
-Ettore Perazzoli,
-Teemu Rantanen,
-Jouko Valta,
-Jarkko Sonninen,
-Mikkel Holm Olsen,
-Manuel Antonio Rodriguez Bas,
-Paul Dube,
-Czirkos Zoltan,
-Karai Csaba,
-Andrea Musuruane,
-Jesse Lee,
-Jarek Sobolewski,
-Michael Litvinov,
-Peter Krefting,
-Emir Akaydin.
+.
<!--teamend-->
</p><p>
<b>VICE</b> is free software; you can redistribute it and/or modify it
Modified: branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 20:57:16 UTC (rev 45538)
+++ branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 21:05:54 UTC (rev 45539)
@@ -410,7 +410,7 @@
fi
decodedall=`$ECHO "$i" | sed 's/+/ /g'`
splititem4 $decodedall
- decodedname=$($ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g")
+ decodedname=`$ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
done
$ECHO "$decodedname."
$ECHO "</p>"
@@ -434,7 +434,7 @@
$ECHO "$decodedname,"
fi
if test x"$i" != "x"; then
- decodedname=$($ECHO "$i" | sed "s/_/ /g;s/\xC8/\\\é/g;s/\\\'e/\\\é/g")
+ decodedname=`$ECHO "$i" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
fi
done
$ECHO "$decodedname."
Modified: branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh 2025-03-17 20:57:16 UTC (rev 45538)
+++ branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh 2025-03-17 21:05:54 UTC (rev 45539)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /bin/bash
###############################################################################
# updateindex.sh - update VICE version / date in the index.html file
@@ -70,31 +70,40 @@
YEAR=`grep "VICEDATE_YEAR " $VICEDATE | cut -d " " -f 3`
if [ "x$VERBOSE" = "x1" ]; then
- echo "day $DAY"
- echo "month: $MONTH"
- echo "year: $YEAR"
+echo day $DAY
+echo month: $MONTH
+echo year: $YEAR
fi
# "(24 January 2022) Version 3.6.1 released"
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 1 old: $TOPLINE"
+echo line 1 old: $TOPLINE
fi
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: patch line 1 of index.html not found, version/date NOT updated."
else
- TOPLINE="($DAY $MONTH $YEAR) Version $VMAJOR.$VMINOR"
- if [ "$VBUILD" != "0" ]; then
- TOPLINE="$TOPLINE.$VBUILD"
+ TOPLINE="("
+ TOPLINE+=$DAY
+ TOPLINE+=" "
+ TOPLINE+=$MONTH
+ TOPLINE+=" "
+ TOPLINE+=$YEAR
+ TOPLINE+=") Version "
+ TOPLINE+=$VMAJOR.$VMINOR
+ if [ "$VBUILD" = "0" ]; then
+ TOPLINE+=""
+ else
+ TOPLINE+=.$VBUILD
fi
- TOPLINE="$TOPLINE released"
+ TOPLINE+=" released"
LC_ALL=C $SED_I -e "s:[\(][0-9]\+ [A-Z][a-z]* 20[0-9][0-9][\)] Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released:$TOPLINE:g" $README
fi
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 1 new: $TOPLINE"
+echo line 1 new: $TOPLINE
fi
# <a href="https://sourceforge.net/projects/vice-emu/files/releases/vice-3.6.1.tar.gz/download">vice-3.6.1.tar.gz</a>
@@ -101,23 +110,26 @@
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 2 old: $LINE"
+echo line 2 old: $LINE
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 2 of index.html not found, version/date NOT updated."
else
- LINE="vice-$VMAJOR.$VMINOR"
- if [ "$VBUILD" != "0" ]; then
- LINE="$LINE.$VBUILD"
+ LINE="vice-"
+ LINE+=$VMAJOR.$VMINOR
+ if [ "$VBUILD" = "0" ]; then
+ LINE+=""
+ else
+ LINE+=.$VBUILD
fi
- LINE="$LINE.tar.gz"
+ LINE+=".tar.gz"
LC_ALL=C $SED_I -e "s:vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz:$LINE:g" $README
fi
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 2 new: $LINE"
+echo line 2 new: $LINE
fi
# <li>Download <a href="https://sourceforge.net/projects/vice-emu/files/releases/binaries/windows/GTK3VICE-3.6.1-win64.zip/download">VICE 3.6.1</a> (64bit GTK3)</li>
@@ -124,36 +136,42 @@
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 3 old: $LINE"
+echo line 3 old: $LINE
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 3 of index.html not found, version/date NOT updated."
else
- LINE="VICE-$VMAJOR.$VMINOR"
- if [ "$VBUILD" != "0" ]; then
- LINE="$LINE.$VBUILD"
+ LINE="VICE-"
+ LINE+=$VMAJOR.$VMINOR
+ if [ "$VBUILD" = "0" ]; then
+ LINE+=""
+ else
+ LINE+=.$VBUILD
fi
- LINE="$LINE-win"
+ LINE+="-win"
LC_ALL=C $SED_I -e "s:VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win:$LINE:g" $README
fi
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 3 new: $LINE"
+echo line 3 new: $LINE
fi
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 4 old: $LINE"
+echo line 4 old: $LINE
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 4 of index.html not found, version/date NOT updated."
else
- LINE="VICE $VMAJOR.$VMINOR"
- if [ "$VBUILD" != "0" ]; then
- LINE="$LINE.$VBUILD"
+ LINE="VICE "
+ LINE+=$VMAJOR.$VMINOR
+ if [ "$VBUILD" = "0" ]; then
+ LINE+=""
+ else
+ LINE+=.$VBUILD
fi
LC_ALL=C $SED_I -e "s:VICE [0-9]\+\.[0-9]\+\.*[0-9]*:$LINE:g" $README
fi
@@ -160,26 +178,29 @@
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 4 new: $LINE"
+echo line 4 new: $LINE
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 5 old: $LINE"
+echo line 5 old: $LINE
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 5 of index.html not found, version/date NOT updated."
else
- LINE="$VMAJOR.$VMINOR"
- if [ "$VBUILD" != "0" ]; then
- LINE="$LINE.$VBUILD"
+ LINE=""
+ LINE+=$VMAJOR.$VMINOR
+ if [ "$VBUILD" = "0" ]; then
+ LINE+=""
+ else
+ LINE+=.$VBUILD
fi
- LINE="$LINE.dmg"
+ LINE+=".dmg"
LC_ALL=C $SED_I -e "s:[0-9]\+\.[0-9]\+\.*[0-9]*.dmg:$LINE:g" $README
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
- echo "line 5 new: $LINE"
+echo line 5 new: $LINE
fi
Modified: branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh 2025-03-17 20:57:16 UTC (rev 45538)
+++ branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh 2025-03-17 21:05:54 UTC (rev 45539)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /bin/bash
###############################################################################
# updatereadme.sh - update VICE version / date in the README file
@@ -83,14 +83,17 @@
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: top line of README not found, version/date NOT updated."
else
- TOPLINE=" VICE $VMAJOR.$VMINOR"
+ TOPLINE=" VICE "
+ TOPLINE+=$VMAJOR.$VMINOR
if [ "$VBUILD" = "0" ]; then
- TOPLINE="$TOPLINE "
+ TOPLINE+=" "
else
- TOPLINE="$TOPLINE.$VBUILD"
+ TOPLINE+=.$VBUILD
fi
- TOPLINE="$TOPLINE "
- TOPLINE="$MONTH $YEAR"
+ TOPLINE+=" "
+ TOPLINE+=$MONTH
+ TOPLINE+=" "
+ TOPLINE+=$YEAR
LC_ALL=C $SED_I -e "s: \+VICE \+[0-9]\+\.[0-9]\+[\.]*[0-9]* \+[A-Z][a-z][a-z] 20[0-9][0-9]:$TOPLINE:g" $README
fi
@@ -109,12 +112,15 @@
if [ "x$LINE" = "x" ]; then
echo "WARNING: second patch line of README not found, version NOT updated."
else
- LINE="This is version $VMAJOR.$VMINOR"
+ LINE="This is version "
+ LINE+=$VMAJOR.$VMINOR
if [ "$VBUILD" = "0" ]; then
+ LINE+=" "
else
- LINE="$LINE.$VBUILD"
+ LINE+=.$VBUILD
+ LINE+=" "
fi
- LINE="$LINE of VICE"
+ LINE+="of VICE"
LC_ALL=C $SED_I -e "s:This is version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+of VICE:$LINE:g" $README
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 20:57:18
|
Revision: 45538
http://sourceforge.net/p/vice-emu/code/45538
Author: compyx
Date: 2025-03-17 20:57:16 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Buildsystem: update scripts to work on NetBSD
NetBSD's `sed` choked on command substitution using backticks, so the offending
line were changed to use the $() syntax.
Also the scripts `updateindex.sh` and `updatereadme.sh` have a bash shebang,
but on NetBSD (at least my system) bash lives in `/usr/pkg/bin/`, so the normal
shell (/bin/sh) is used and that shell chokes on the `VAR+=...` bash-isms, so
we use good old `VAR="$VAR...`.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh
branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh
branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh
Modified: branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 10:58:56 UTC (rev 45537)
+++ branches/compyx/joymap-001/vice/src/buildtools/geninfocontrib_h.sh 2025-03-17 20:57:16 UTC (rev 45538)
@@ -410,7 +410,7 @@
fi
decodedall=`$ECHO "$i" | sed 's/+/ /g'`
splititem4 $decodedall
- decodedname=`$ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
+ decodedname=$($ECHO "$item3" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g")
done
$ECHO "$decodedname."
$ECHO "</p>"
@@ -434,7 +434,7 @@
$ECHO "$decodedname,"
fi
if test x"$i" != "x"; then
- decodedname=`$ECHO "$i" | sed "s/_/ /g;s/\xC8/\é/g;s/\\\'e/\é/g"`
+ decodedname=$($ECHO "$i" | sed "s/_/ /g;s/\xC8/\\\é/g;s/\\\'e/\\\é/g")
fi
done
$ECHO "$decodedname."
Modified: branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh 2025-03-17 10:58:56 UTC (rev 45537)
+++ branches/compyx/joymap-001/vice/src/buildtools/updateindex.sh 2025-03-17 20:57:16 UTC (rev 45538)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/bash
###############################################################################
# updateindex.sh - update VICE version / date in the index.html file
@@ -70,40 +70,31 @@
YEAR=`grep "VICEDATE_YEAR " $VICEDATE | cut -d " " -f 3`
if [ "x$VERBOSE" = "x1" ]; then
-echo day $DAY
-echo month: $MONTH
-echo year: $YEAR
+ echo "day $DAY"
+ echo "month: $MONTH"
+ echo "year: $YEAR"
fi
# "(24 January 2022) Version 3.6.1 released"
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 1 old: $TOPLINE
+ echo "line 1 old: $TOPLINE"
fi
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: patch line 1 of index.html not found, version/date NOT updated."
else
- TOPLINE="("
- TOPLINE+=$DAY
- TOPLINE+=" "
- TOPLINE+=$MONTH
- TOPLINE+=" "
- TOPLINE+=$YEAR
- TOPLINE+=") Version "
- TOPLINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- TOPLINE+=""
- else
- TOPLINE+=.$VBUILD
+ TOPLINE="($DAY $MONTH $YEAR) Version $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ TOPLINE="$TOPLINE.$VBUILD"
fi
- TOPLINE+=" released"
+ TOPLINE="$TOPLINE released"
LC_ALL=C $SED_I -e "s:[\(][0-9]\+ [A-Z][a-z]* 20[0-9][0-9][\)] Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released:$TOPLINE:g" $README
fi
TOPLINE=`grep "([0-9]\+ [A-Z][a-z]* 20[0-9][0-9]) Version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+released" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 1 new: $TOPLINE
+ echo "line 1 new: $TOPLINE"
fi
# <a href="https://sourceforge.net/projects/vice-emu/files/releases/vice-3.6.1.tar.gz/download">vice-3.6.1.tar.gz</a>
@@ -110,26 +101,23 @@
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 2 old: $LINE
+ echo "line 2 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 2 of index.html not found, version/date NOT updated."
else
- LINE="vice-"
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="vice-$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+=".tar.gz"
+ LINE="$LINE.tar.gz"
LC_ALL=C $SED_I -e "s:vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz:$LINE:g" $README
fi
LINE=`grep "vice-[0-9]\+\.[0-9]\+\.*[0-9]*\.tar\.gz" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 2 new: $LINE
+ echo "line 2 new: $LINE"
fi
# <li>Download <a href="https://sourceforge.net/projects/vice-emu/files/releases/binaries/windows/GTK3VICE-3.6.1-win64.zip/download">VICE 3.6.1</a> (64bit GTK3)</li>
@@ -136,42 +124,36 @@
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 3 old: $LINE
+ echo "line 3 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 3 of index.html not found, version/date NOT updated."
else
- LINE="VICE-"
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="VICE-$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+="-win"
+ LINE="$LINE-win"
LC_ALL=C $SED_I -e "s:VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win:$LINE:g" $README
fi
LINE=`grep "VICE-[0-9]\+\.[0-9]\+\.*[0-9]*-win" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 3 new: $LINE
+ echo "line 3 new: $LINE"
fi
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 4 old: $LINE
+ echo "line 4 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 4 of index.html not found, version/date NOT updated."
else
- LINE="VICE "
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="VICE $VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
LC_ALL=C $SED_I -e "s:VICE [0-9]\+\.[0-9]\+\.*[0-9]*:$LINE:g" $README
fi
@@ -178,29 +160,26 @@
LINE=`grep "VICE [0-9]\+\.[0-9]\+\.*[0-9]*" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 4 new: $LINE
+ echo "line 4 new: $LINE"
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 5 old: $LINE
+ echo "line 5 old: $LINE"
fi
if [ "x$LINE" = "x" ]; then
echo "WARNING: patch line 5 of index.html not found, version/date NOT updated."
else
- LINE=""
- LINE+=$VMAJOR.$VMINOR
- if [ "$VBUILD" = "0" ]; then
- LINE+=""
- else
- LINE+=.$VBUILD
+ LINE="$VMAJOR.$VMINOR"
+ if [ "$VBUILD" != "0" ]; then
+ LINE="$LINE.$VBUILD"
fi
- LINE+=".dmg"
+ LINE="$LINE.dmg"
LC_ALL=C $SED_I -e "s:[0-9]\+\.[0-9]\+\.*[0-9]*.dmg:$LINE:g" $README
fi
LINE=`grep "[0-9]\+\.[0-9]\+\.*[0-9]*.dmg" < $README`
if [ "x$VERBOSE" = "x1" ]; then
-echo line 5 new: $LINE
+ echo "line 5 new: $LINE"
fi
Modified: branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh
===================================================================
--- branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh 2025-03-17 10:58:56 UTC (rev 45537)
+++ branches/compyx/joymap-001/vice/src/buildtools/updatereadme.sh 2025-03-17 20:57:16 UTC (rev 45538)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/bash
###############################################################################
# updatereadme.sh - update VICE version / date in the README file
@@ -83,17 +83,14 @@
if [ "x$TOPLINE" = "x" ]; then
echo "WARNING: top line of README not found, version/date NOT updated."
else
- TOPLINE=" VICE "
- TOPLINE+=$VMAJOR.$VMINOR
+ TOPLINE=" VICE $VMAJOR.$VMINOR"
if [ "$VBUILD" = "0" ]; then
- TOPLINE+=" "
+ TOPLINE="$TOPLINE "
else
- TOPLINE+=.$VBUILD
+ TOPLINE="$TOPLINE.$VBUILD"
fi
- TOPLINE+=" "
- TOPLINE+=$MONTH
- TOPLINE+=" "
- TOPLINE+=$YEAR
+ TOPLINE="$TOPLINE "
+ TOPLINE="$MONTH $YEAR"
LC_ALL=C $SED_I -e "s: \+VICE \+[0-9]\+\.[0-9]\+[\.]*[0-9]* \+[A-Z][a-z][a-z] 20[0-9][0-9]:$TOPLINE:g" $README
fi
@@ -112,15 +109,12 @@
if [ "x$LINE" = "x" ]; then
echo "WARNING: second patch line of README not found, version NOT updated."
else
- LINE="This is version "
- LINE+=$VMAJOR.$VMINOR
+ LINE="This is version $VMAJOR.$VMINOR"
if [ "$VBUILD" = "0" ]; then
- LINE+=" "
else
- LINE+=.$VBUILD
- LINE+=" "
+ LINE="$LINE.$VBUILD"
fi
- LINE+="of VICE"
+ LINE="$LINE of VICE"
LC_ALL=C $SED_I -e "s:This is version [0-9]\+\.[0-9]\+[\.]*[0-9]* \+of VICE:$LINE:g" $README
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 10:59:08
|
Revision: 45537
http://sourceforge.net/p/vice-emu/code/45537
Author: compyx
Date: 2025-03-17 10:58:56 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Joystick: allow all driver callbacks to be `NULL`
Allow ports to use their own polling and other driver methods (which is how the
SDL joystick code currently works).
Remove asserts on open(), close() and poll() callbacks when registering driver.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/joyport/joystick.c
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-17 07:25:04 UTC (rev 45536)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-17 10:58:56 UTC (rev 45537)
@@ -174,7 +174,9 @@
*/
static char *joymap_factory = NULL;
-
+/** \brief Joystick driver callbacks
+ *
+ */
static joystick_driver_t joy_driver = {
.open = NULL,
.poll = NULL,
@@ -182,8 +184,7 @@
.priv_free = NULL
};
-
-
+/** \brief Joystick subsystem log */
static log_t joy_log = LOG_DEFAULT;
static void joystick_latch_matrix(CLOCK offset)
@@ -3211,9 +3212,12 @@
void joystick(void)
{
- int i;
- for (i = 0; i < num_joystick_devices; i++) {
- joy_driver.poll(i, joystick_devices[i]);
+ if (joy_driver.poll != NULL) {
+ int i;
+
+ for (i = 0; i < num_joystick_devices; i++) {
+ joy_driver.poll(i, joystick_devices[i]);
+ }
}
}
@@ -3224,7 +3228,9 @@
for (i = 0; i < num_joystick_devices; i++) {
joystick_device_t *joydev = joystick_devices[i];
- joy_driver.close(joydev);
+ if (joy_driver.close != NULL) {
+ joy_driver.close(joydev);
+ }
joystick_device_free(joydev);
}
@@ -3256,9 +3262,6 @@
void joystick_driver_register(const joystick_driver_t *driver)
{
- assert(driver->open != NULL);
- assert(driver->poll != NULL);
- assert(driver->close != NULL);
joy_driver = *driver;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 07:25:15
|
Revision: 45536
http://sourceforge.net/p/vice-emu/code/45536
Author: compyx
Date: 2025-03-17 07:25:04 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Merge trunk (r45531:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/shared/hotkeys/vhkkeysyms.h
Modified: branches/compyx/joymap-001/vice/src/arch/shared/hotkeys/vhkkeysyms.h
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/shared/hotkeys/vhkkeysyms.h 2025-03-17 07:22:17 UTC (rev 45535)
+++ branches/compyx/joymap-001/vice/src/arch/shared/hotkeys/vhkkeysyms.h 2025-03-17 07:25:04 UTC (rev 45536)
@@ -358,6 +358,170 @@
#define VHK_KEY_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */
#define VHK_KEY_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+/* Special "multimedia" keys, not present in the X11 header, but present in the
+ * GDk header. See https://sourceforge.net/p/vice-emu/bugs/2132/
+ */
+#define VHK_KEY_ModeLock 0x1008ff01
+#define VHK_KEY_MonBrightnessUp 0x1008ff02
+#define VHK_KEY_MonBrightnessDown 0x1008ff03
+#define VHK_KEY_KbdLightOnOff 0x1008ff04
+#define VHK_KEY_KbdBrightnessUp 0x1008ff05
+#define VHK_KEY_KbdBrightnessDown 0x1008ff06
+#define VHK_KEY_Standby 0x1008ff10
+#define VHK_KEY_AudioLowerVolume 0x1008ff11
+#define VHK_KEY_AudioMute 0x1008ff12
+#define VHK_KEY_AudioRaiseVolume 0x1008ff13
+#define VHK_KEY_AudioPlay 0x1008ff14
+#define VHK_KEY_AudioStop 0x1008ff15
+#define VHK_KEY_AudioPrev 0x1008ff16
+#define VHK_KEY_AudioNext 0x1008ff17
+#define VHK_KEY_HomePage 0x1008ff18
+#define VHK_KEY_Mail 0x1008ff19
+#define VHK_KEY_Start 0x1008ff1a
+#define VHK_KEY_Search 0x1008ff1b
+#define VHK_KEY_AudioRecord 0x1008ff1c
+#define VHK_KEY_Calculator 0x1008ff1d
+#define VHK_KEY_Memo 0x1008ff1e
+#define VHK_KEY_ToDoList 0x1008ff1f
+#define VHK_KEY_Calendar 0x1008ff20
+#define VHK_KEY_PowerDown 0x1008ff21
+#define VHK_KEY_ContrastAdjust 0x1008ff22
+#define VHK_KEY_RockerUp 0x1008ff23
+#define VHK_KEY_RockerDown 0x1008ff24
+#define VHK_KEY_RockerEnter 0x1008ff25
+#define VHK_KEY_Back 0x1008ff26
+#define VHK_KEY_Forward 0x1008ff27
+#define VHK_KEY_Stop 0x1008ff28
+#define VHK_KEY_Refresh 0x1008ff29
+#define VHK_KEY_PowerOff 0x1008ff2a
+#define VHK_KEY_WakeUp 0x1008ff2b
+#define VHK_KEY_Eject 0x1008ff2c
+#define VHK_KEY_ScreenSaver 0x1008ff2d
+#define VHK_KEY_WWW 0x1008ff2e
+#define VHK_KEY_Sleep 0x1008ff2f
+#define VHK_KEY_Favorites 0x1008ff30
+#define VHK_KEY_AudioPause 0x1008ff31
+#define VHK_KEY_AudioMedia 0x1008ff32
+#define VHK_KEY_MyComputer 0x1008ff33
+#define VHK_KEY_VendorHome 0x1008ff34
+#define VHK_KEY_LightBulb 0x1008ff35
+#define VHK_KEY_Shop 0x1008ff36
+#define VHK_KEY_History 0x1008ff37
+#define VHK_KEY_OpenURL 0x1008ff38
+#define VHK_KEY_AddFavorite 0x1008ff39
+#define VHK_KEY_HotLinks 0x1008ff3a
+#define VHK_KEY_BrightnessAdjust 0x1008ff3b
+#define VHK_KEY_Finance 0x1008ff3c
+#define VHK_KEY_Community 0x1008ff3d
+#define VHK_KEY_AudioRewind 0x1008ff3e
+#define VHK_KEY_BackForward 0x1008ff3f
+#define VHK_KEY_Launch0 0x1008ff40
+#define VHK_KEY_Launch1 0x1008ff41
+#define VHK_KEY_Launch2 0x1008ff42
+#define VHK_KEY_Launch3 0x1008ff43
+#define VHK_KEY_Launch4 0x1008ff44
+#define VHK_KEY_Launch5 0x1008ff45
+#define VHK_KEY_Launch6 0x1008ff46
+#define VHK_KEY_Launch7 0x1008ff47
+#define VHK_KEY_Launch8 0x1008ff48
+#define VHK_KEY_Launch9 0x1008ff49
+#define VHK_KEY_LaunchA 0x1008ff4a
+#define VHK_KEY_LaunchB 0x1008ff4b
+#define VHK_KEY_LaunchC 0x1008ff4c
+#define VHK_KEY_LaunchD 0x1008ff4d
+#define VHK_KEY_LaunchE 0x1008ff4e
+#define VHK_KEY_LaunchF 0x1008ff4f
+#define VHK_KEY_ApplicationLeft 0x1008ff50
+#define VHK_KEY_ApplicationRight 0x1008ff51
+#define VHK_KEY_Book 0x1008ff52
+#define VHK_KEY_CD 0x1008ff53
+#define VHK_KEY_WindowClear 0x1008ff55
+#define VHK_KEY_Close 0x1008ff56
+#define VHK_KEY_Copy 0x1008ff57
+#define VHK_KEY_Cut 0x1008ff58
+#define VHK_KEY_Display 0x1008ff59
+#define VHK_KEY_DOS 0x1008ff5a
+#define VHK_KEY_Documents 0x1008ff5b
+#define VHK_KEY_Excel 0x1008ff5c
+#define VHK_KEY_Explorer 0x1008ff5d
+#define VHK_KEY_Game 0x1008ff5e
+#define VHK_KEY_Go 0x1008ff5f
+#define VHK_KEY_iTouch 0x1008ff60
+#define VHK_KEY_LogOff 0x1008ff61
+#define VHK_KEY_Market 0x1008ff62
+#define VHK_KEY_Meeting 0x1008ff63
+#define VHK_KEY_MenuKB 0x1008ff65
+#define VHK_KEY_MenuPB 0x1008ff66
+#define VHK_KEY_MySites 0x1008ff67
+#define VHK_KEY_New 0x1008ff68
+#define VHK_KEY_News 0x1008ff69
+#define VHK_KEY_OfficeHome 0x1008ff6a
+#define VHK_KEY_Open 0x1008ff6b
+#define VHK_KEY_Option 0x1008ff6c
+#define VHK_KEY_Paste 0x1008ff6d
+#define VHK_KEY_Phone 0x1008ff6e
+#define VHK_KEY_Reply 0x1008ff72
+#define VHK_KEY_Reload 0x1008ff73
+#define VHK_KEY_RotateWindows 0x1008ff74
+#define VHK_KEY_RotationPB 0x1008ff75
+#define VHK_KEY_RotationKB 0x1008ff76
+#define VHK_KEY_Save 0x1008ff77
+#define VHK_KEY_ScrollUp 0x1008ff78
+#define VHK_KEY_ScrollDown 0x1008ff79
+#define VHK_KEY_ScrollClick 0x1008ff7a
+#define VHK_KEY_Send 0x1008ff7b
+#define VHK_KEY_Spell 0x1008ff7c
+#define VHK_KEY_SplitScreen 0x1008ff7d
+#define VHK_KEY_Support 0x1008ff7e
+#define VHK_KEY_TaskPane 0x1008ff7f
+#define VHK_KEY_Terminal 0x1008ff80
+#define VHK_KEY_Tools 0x1008ff81
+#define VHK_KEY_Travel 0x1008ff82
+#define VHK_KEY_UserPB 0x1008ff84
+#define VHK_KEY_User1KB 0x1008ff85
+#define VHK_KEY_User2KB 0x1008ff86
+#define VHK_KEY_Video 0x1008ff87
+#define VHK_KEY_WheelButton 0x1008ff88
+#define VHK_KEY_Word 0x1008ff89
+#define VHK_KEY_Xfer 0x1008ff8a
+#define VHK_KEY_ZoomIn 0x1008ff8b
+#define VHK_KEY_ZoomOut 0x1008ff8c
+#define VHK_KEY_Away 0x1008ff8d
+#define VHK_KEY_Messenger 0x1008ff8e
+#define VHK_KEY_WebCam 0x1008ff8f
+#define VHK_KEY_MailForward 0x1008ff90
+#define VHK_KEY_Pictures 0x1008ff91
+#define VHK_KEY_Music 0x1008ff92
+#define VHK_KEY_Battery 0x1008ff93
+#define VHK_KEY_Bluetooth 0x1008ff94
+#define VHK_KEY_WLAN 0x1008ff95
+#define VHK_KEY_UWB 0x1008ff96
+#define VHK_KEY_AudioForward 0x1008ff97
+#define VHK_KEY_AudioRepeat 0x1008ff98
+#define VHK_KEY_AudioRandomPlay 0x1008ff99
+#define VHK_KEY_Subtitle 0x1008ff9a
+#define VHK_KEY_AudioCycleTrack 0x1008ff9b
+#define VHK_KEY_CycleAngle 0x1008ff9c
+#define VHK_KEY_FrameBack 0x1008ff9d
+#define VHK_KEY_FrameForward 0x1008ff9e
+#define VHK_KEY_Time 0x1008ff9f
+#define VHK_KEY_SelectButton 0x1008ffa0
+#define VHK_KEY_View 0x1008ffa1
+#define VHK_KEY_TopMenu 0x1008ffa2
+#define VHK_KEY_Red 0x1008ffa3
+#define VHK_KEY_Green 0x1008ffa4
+#define VHK_KEY_Yellow 0x1008ffa5
+#define VHK_KEY_Blue 0x1008ffa6
+#define VHK_KEY_Suspend 0x1008ffa7
+#define VHK_KEY_Hibernate 0x1008ffa8
+#define VHK_KEY_TouchpadToggle 0x1008ffa9
+#define VHK_KEY_TouchpadOn 0x1008ffb0
+#define VHK_KEY_TouchpadOff 0x1008ffb1
+#define VHK_KEY_AudioMicMute 0x1008ffb2
+#define VHK_KEY_Keyboard 0x1008ffb3
+#define VHK_KEY_WWAN 0x1008ffb4
+#define VHK_KEY_RFKill 0x1008ffb5
+#define VHK_KEY_AudioPreset 0x1008ffb6
/* Key modifier masks */
#define VHK_MOD_NONE 0x0000
#define VHK_MOD_ALT 0x0001
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-17 07:22:20
|
Revision: 45535
http://sourceforge.net/p/vice-emu/code/45535
Author: compyx
Date: 2025-03-17 07:22:17 +0000 (Mon, 17 Mar 2025)
Log Message:
-----------
Joystick: SDL: turn global array `joy_ordinal_to_id` into function
Use the generic joystick API to iterate the list of registered devices to obtain
the SDL-specific joystick ID instead of keeping a separate list of IDs.
The `SDL_JoystickID` (or Sint16 in case of SDL1) is now stored in
`joydev->priv->id` and set during device instance creation.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
branches/compyx/joymap-001/vice/src/arch/sdl/joy.h
branches/compyx/joymap-001/vice/src/arch/sdl/menu_joystick.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/sdl/joy.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-16 17:07:32 UTC (rev 45534)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-17 07:22:17 UTC (rev 45535)
@@ -337,13 +337,25 @@
}
+/** \brief Get SDL joystick ID for joystick device by index
+ *
+ * \param[in] ordinal index in the register devices list
+ *
+ * \return SDL joystick ID or -1 when \a ordinal is out of bounds
+ * \todo Perhaps rename?
+ */
+VICE_SDL_JoystickID joy_ordinal_to_id(int ordinal)
+{
+ joystick_device_t *joydev = joystick_device_by_index(ordinal);
+ if (joydev != NULL) {
+ joy_priv_t *priv = joydev->priv;
+ return priv->id;
+ }
+ return -1;
+}
-/* TODO: Get rid of this, use the generic joystick API to obtain the SDL-specific
- * joystick ID.
- */
-VICE_SDL_JoystickID *joy_ordinal_to_id = NULL;
int sdljoy_rescan(void)
{
@@ -451,15 +463,21 @@
int sdljoy_get_joynum_for_event(VICE_SDL_JoystickID event_device_id)
{
- int i = 0;
+ int i;
+ int count;
- while (joy_ordinal_to_id[i] != -1) {
- if (joy_ordinal_to_id[i] == event_device_id) {
- return i;
+ count = joystick_device_count();
+ for (i = 0; i < count; i++) {
+ joystick_device_t *joydev = joystick_device_by_index(i);
+
+ if (joydev != NULL) {
+ joy_priv_t *priv = joydev->priv;
+
+ if (priv->id == event_device_id) {
+ return i;
+ }
}
- i++;
}
-
return -1;
}
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.h
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.h 2025-03-16 17:07:32 UTC (rev 45534)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.h 2025-03-17 07:22:17 UTC (rev 45535)
@@ -68,7 +68,7 @@
void sdljoy_swap_ports(void);
int sdljoy_get_swap_ports(void) ;
-extern VICE_SDL_JoystickID *joy_ordinal_to_id;
+VICE_SDL_JoystickID joy_ordinal_to_id(int ordinal);
#define JOYDEV_NONE 0
#define JOYDEV_NUMPAD 1
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/menu_joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/menu_joystick.c 2025-03-16 17:07:32 UTC (rev 45534)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/menu_joystick.c 2025-03-17 07:22:17 UTC (rev 45535)
@@ -546,7 +546,7 @@
pin = (vice_ptr_to_int(param)) & 15;
port = (vice_ptr_to_int(param)) >> 5;
if (joystick_port_map[port] >= JOYDEV_REALJOYSTICK_MIN) {
- joystick_device = joy_ordinal_to_id[joystick_port_map[port] - JOYDEV_REALJOYSTICK_MIN];
+ joystick_device = joy_ordinal_to_id(joystick_port_map[port] - JOYDEV_REALJOYSTICK_MIN);
}
if (activated) {
@@ -582,7 +582,7 @@
port = (vice_ptr_to_int(param)) >> 5;
if (activated && joystick_port_map[port] >= JOYDEV_REALJOYSTICK_MIN) {
- joystick_device = joy_ordinal_to_id[joystick_port_map[port] - JOYDEV_REALJOYSTICK_MIN];
+ joystick_device = joy_ordinal_to_id(joystick_port_map[port] - JOYDEV_REALJOYSTICK_MIN);
for (pin = 0; pin < JOYPORT_MAX_PINS; pin++) {
joy_delete_pin_mapping(joystick_device, 1 << pin);
}
@@ -601,7 +601,7 @@
pot = (vice_ptr_to_int(param)) & 15;
port = (vice_ptr_to_int(param)) >> 5;
if (joystick_port_map[port] >= JOYDEV_REALJOYSTICK_MIN) {
- joystick_device = joy_ordinal_to_id[joystick_port_map[port] - JOYDEV_REALJOYSTICK_MIN];
+ joystick_device = joy_ordinal_to_id(joystick_port_map[port] - JOYDEV_REALJOYSTICK_MIN);
}
if (activated) {
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-16 17:07:32 UTC (rev 45534)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-17 07:22:17 UTC (rev 45535)
@@ -3506,7 +3506,7 @@
*
* \param[in] index index in the devices list
*
- * \return joystick device or <tt>NULL</tt> on error
+ * \return joystick device or <tt>NULL</tt> when index is out of bounds
*/
joystick_device_t *joystick_device_by_index(int index)
{
@@ -3521,6 +3521,16 @@
}
+/** \brief Get number of registered joystick devices
+ *
+ * \return number of devices
+ */
+int joystick_device_count(void)
+{
+ return (int)num_joystick_devices;
+}
+
+
void joystick_mapping_init(joystick_mapping_t *mapping)
{
mapping->action = JOY_ACTION_NONE;
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-16 17:07:32 UTC (rev 45534)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-17 07:22:17 UTC (rev 45535)
@@ -402,6 +402,7 @@
bool joystick_device_register (joystick_device_t *joydev);
joystick_device_t *joystick_device_by_index (int index);
+int joystick_device_count (void);
void joystick_device_add_axis (joystick_device_t *joydev,
joystick_axis_t *axis);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-16 17:07:39
|
Revision: 45534
http://sourceforge.net/p/vice-emu/code/45534
Author: compyx
Date: 2025-03-16 17:07:32 +0000 (Sun, 16 Mar 2025)
Log Message:
-----------
Joystick: add `joystick_device_by_index()`
Get joystick device object by index in the registered devices list.
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-16 16:20:07 UTC (rev 45533)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-16 17:07:32 UTC (rev 45534)
@@ -3502,6 +3502,25 @@
}
+/** \brief Get joystick device by index
+ *
+ * \param[in] index index in the devices list
+ *
+ * \return joystick device or <tt>NULL</tt> on error
+ */
+joystick_device_t *joystick_device_by_index(int index)
+{
+ if (index < 0 || index >= num_joystick_devices) {
+ /* normally we wouldn't pass an invalid index, so log a warning */
+ log_warning(joy_log,
+ "%s(): joystick index out of range (0-%zu)",
+ __func__, num_joystick_devices);
+ return NULL;
+ }
+ return joystick_devices[index];
+}
+
+
void joystick_mapping_init(joystick_mapping_t *mapping)
{
mapping->action = JOY_ACTION_NONE;
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-16 16:20:07 UTC (rev 45533)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-16 17:07:32 UTC (rev 45534)
@@ -401,6 +401,8 @@
void joystick_device_free (joystick_device_t *joydev);
bool joystick_device_register (joystick_device_t *joydev);
+joystick_device_t *joystick_device_by_index (int index);
+
void joystick_device_add_axis (joystick_device_t *joydev,
joystick_axis_t *axis);
void joystick_device_add_button(joystick_device_t *joydev,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-16 16:20:10
|
Revision: 45533
http://sourceforge.net/p/vice-emu/code/45533
Author: compyx
Date: 2025-03-16 16:20:07 +0000 (Sun, 16 Mar 2025)
Log Message:
-----------
Joystick: SDL: use new API to register devices
Still need to get rid of SDL-specific things like `extern VICE_SDL_JoystickID
*joy_ordinal_to_id` (we store the SDL joystick instance ID in the `priv` member
of the joystick devices now).
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-16 08:19:14 UTC (rev 45532)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-16 16:20:07 UTC (rev 45533)
@@ -164,17 +164,56 @@
/* ------------------------------------------------------------------------- */
-static void sdl_joystick_poll(int joyport, void* joystick) {}
-static void sdl_joystick_close(void* joystick)
+static bool sdl_joystick_open(int joyport, joystick_device_t *joydev)
{
+ return true;
+}
+
+static void sdl_joystick_poll(int joyport, joystick_device_t *joydev)
+{
+ /* NOP: handled in SDL event loop */
+}
+
+static void sdl_joystick_close(joystick_device_t *joystick)
+{
+#if 0
SDL_JoystickClose(joystick);
lib_free(joy_ordinal_to_id);
joy_ordinal_to_id = NULL;
+#endif
}
+
+typedef struct joy_priv_s {
+ SDL_JoystickGUID guid;
+ SDL_Joystick *sdldev;
+ VICE_SDL_JoystickID id;
+ int joynum;
+} joy_priv_t;
+
+
+static joy_priv_t *joy_priv_new(SDL_Joystick *sdldev, int joynum)
+{
+ joy_priv_t *priv = lib_malloc(sizeof *priv);
+
+ priv->sdldev = sdldev;
+ priv->joynum = joynum;
+ priv->guid = SDL_JoystickGetGUID(sdldev);
+ priv->id = SDL_JoystickInstanceID(sdldev);
+ return priv;
+}
+
+static void joy_priv_free(void *priv)
+{
+ lib_free(priv);
+}
+
+
static joystick_driver_t sdl_joystick_driver = {
- .poll = sdl_joystick_poll,
- .close = sdl_joystick_close
+ .open = sdl_joystick_open,
+ .poll = sdl_joystick_poll,
+ .close = sdl_joystick_close,
+ .priv_free = joy_priv_free
};
#ifdef HAVE_SDL_NUMJOYSTICKS
@@ -182,6 +221,9 @@
/**********************************************************
* Generic high level joy routine *
**********************************************************/
+
+static bool sdljoy_get_devices(void);
+
int joy_sdl_init(void)
{
sdljoy_log = log_open("SDLJoystick");
@@ -191,15 +233,121 @@
return -1;
}
- sdljoy_rescan();
+ joystick_driver_register(&sdl_joystick_driver);
+ sdljoy_get_devices();
+
+
+// sdljoy_rescan();
+
return 0;
}
+static joystick_device_t *scan_device(SDL_Joystick *sdldev, int index)
+{
+ joystick_device_t *joydev = joystick_device_new();
+ joy_priv_t *priv = joy_priv_new(sdldev, index);
+ const char *name;
+ char buffer[64];
+ int i;
+
+ name = SDL_JoystickName(sdldev);
+ if (name != NULL) {
+ joydev->name = lib_strdup(name);
+ } else {
+ log_warning(sdljoy_log,
+ "couldn't retrieve joystick name: %s.", SDL_GetError());
+ joydev->name = lib_msprintf("Joystick_%d", index + 1);
+ }
+ joydev->vendor = SDL_JoystickGetVendor(sdldev);
+ joydev->product = SDL_JoystickGetProduct(sdldev);
+ joydev->priv = priv;
+
+ /* enumerate axes */
+ for (i = 0; i < SDL_JoystickNumAxes(sdldev); i++) {
+ joystick_axis_t *axis;
+
+ snprintf(buffer, sizeof buffer, "Axis_%d", i + 1);
+ axis = joystick_axis_new(buffer);
+ axis->code = i;
+ axis->minimum = SDL_JOYSTICK_AXIS_MIN;
+ axis->maximum = SDL_JOYSTICK_AXIS_MAX;
+ joystick_device_add_axis(joydev, axis);
+ }
+
+ /* enumerate buttons */
+ for (i = 0; i < SDL_JoystickNumButtons(sdldev); i++) {
+ joystick_button_t *button;
+
+ snprintf(buffer, sizeof buffer, "Button_%d", i + 1);
+ button = joystick_button_new(buffer);
+ button->code = i;
+ joystick_device_add_button(joydev, button);
+ }
+
+ /* enumerate hats */
+ for (i = 0; i < SDL_JoystickNumHats(sdldev); i++) {
+ joystick_hat_t *hat;
+
+ snprintf(buffer, sizeof buffer, "Hat_%d", i + 1);
+ hat = joystick_hat_new(buffer);
+ hat->code = i;
+ joystick_device_add_hat(joydev, hat);
+ }
+ return joydev;
+}
+
+static bool sdljoy_get_devices(void)
+{
+ int num;
+ int njoys = SDL_NumJoysticks();
+
+ if (njoys < 0) {
+ log_error(sdljoy_log, "Could not get number of joysticks: %s.", SDL_GetError());
+ return false;
+ } else if (njoys == 0) {
+ log_message(sdljoy_log, "No joysticks found.");
+ return true;
+ }
+
+ log_message(sdljoy_log, "Got %d potential devices.", njoys);
+ for (num = 0; num < njoys; num++) {
+ log_message(sdljoy_log,
+ "SDL_JoystickNameForIndex(%d) = \"%s\"",
+ num, SDL_JoystickNameForIndex(num));
+ }
+ for (num = 0; num < njoys; num++) {
+ SDL_Joystick *sdldev = SDL_JoystickOpen(num);
+
+ if (sdldev == NULL) {
+ log_warning(sdljoy_log, "failed to open device %d: %s", num, SDL_GetError());
+ } else {
+ joystick_device_t *joydev = scan_device(sdldev, num);
+
+ if (joydev != NULL) {
+ joystick_device_register(joydev);
+ }
+#if 0
+ SDL_JoystickClose(sdldev);
+#endif
+ }
+
+ }
+ return true;
+}
+
+
+
+
+
+/* TODO: Get rid of this, use the generic joystick API to obtain the SDL-specific
+ * joystick ID.
+ */
VICE_SDL_JoystickID *joy_ordinal_to_id = NULL;
int sdljoy_rescan(void)
{
+#if 0
int i, axis, button, hat, ball;
SDL_Joystick *joy;
char *name;
@@ -249,6 +397,7 @@
joy_ordinal_to_id[num_valid_joysticks] = -1;
SDL_JoystickEventState(SDL_ENABLE);
+#endif
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-16 08:19:26
|
Revision: 45532
http://sourceforge.net/p/vice-emu/code/45532
Author: compyx
Date: 2025-03-16 08:19:14 +0000 (Sun, 16 Mar 2025)
Log Message:
-----------
Hotkeys: add key codes for special multimedia keys
See bug #2132.
Modified Paths:
--------------
trunk/vice/src/arch/shared/hotkeys/vhkkeysyms.h
Modified: trunk/vice/src/arch/shared/hotkeys/vhkkeysyms.h
===================================================================
--- trunk/vice/src/arch/shared/hotkeys/vhkkeysyms.h 2025-03-14 18:26:09 UTC (rev 45531)
+++ trunk/vice/src/arch/shared/hotkeys/vhkkeysyms.h 2025-03-16 08:19:14 UTC (rev 45532)
@@ -358,6 +358,170 @@
#define VHK_KEY_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */
#define VHK_KEY_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+/* Special "multimedia" keys, not present in the X11 header, but present in the
+ * GDk header. See https://sourceforge.net/p/vice-emu/bugs/2132/
+ */
+#define VHK_KEY_ModeLock 0x1008ff01
+#define VHK_KEY_MonBrightnessUp 0x1008ff02
+#define VHK_KEY_MonBrightnessDown 0x1008ff03
+#define VHK_KEY_KbdLightOnOff 0x1008ff04
+#define VHK_KEY_KbdBrightnessUp 0x1008ff05
+#define VHK_KEY_KbdBrightnessDown 0x1008ff06
+#define VHK_KEY_Standby 0x1008ff10
+#define VHK_KEY_AudioLowerVolume 0x1008ff11
+#define VHK_KEY_AudioMute 0x1008ff12
+#define VHK_KEY_AudioRaiseVolume 0x1008ff13
+#define VHK_KEY_AudioPlay 0x1008ff14
+#define VHK_KEY_AudioStop 0x1008ff15
+#define VHK_KEY_AudioPrev 0x1008ff16
+#define VHK_KEY_AudioNext 0x1008ff17
+#define VHK_KEY_HomePage 0x1008ff18
+#define VHK_KEY_Mail 0x1008ff19
+#define VHK_KEY_Start 0x1008ff1a
+#define VHK_KEY_Search 0x1008ff1b
+#define VHK_KEY_AudioRecord 0x1008ff1c
+#define VHK_KEY_Calculator 0x1008ff1d
+#define VHK_KEY_Memo 0x1008ff1e
+#define VHK_KEY_ToDoList 0x1008ff1f
+#define VHK_KEY_Calendar 0x1008ff20
+#define VHK_KEY_PowerDown 0x1008ff21
+#define VHK_KEY_ContrastAdjust 0x1008ff22
+#define VHK_KEY_RockerUp 0x1008ff23
+#define VHK_KEY_RockerDown 0x1008ff24
+#define VHK_KEY_RockerEnter 0x1008ff25
+#define VHK_KEY_Back 0x1008ff26
+#define VHK_KEY_Forward 0x1008ff27
+#define VHK_KEY_Stop 0x1008ff28
+#define VHK_KEY_Refresh 0x1008ff29
+#define VHK_KEY_PowerOff 0x1008ff2a
+#define VHK_KEY_WakeUp 0x1008ff2b
+#define VHK_KEY_Eject 0x1008ff2c
+#define VHK_KEY_ScreenSaver 0x1008ff2d
+#define VHK_KEY_WWW 0x1008ff2e
+#define VHK_KEY_Sleep 0x1008ff2f
+#define VHK_KEY_Favorites 0x1008ff30
+#define VHK_KEY_AudioPause 0x1008ff31
+#define VHK_KEY_AudioMedia 0x1008ff32
+#define VHK_KEY_MyComputer 0x1008ff33
+#define VHK_KEY_VendorHome 0x1008ff34
+#define VHK_KEY_LightBulb 0x1008ff35
+#define VHK_KEY_Shop 0x1008ff36
+#define VHK_KEY_History 0x1008ff37
+#define VHK_KEY_OpenURL 0x1008ff38
+#define VHK_KEY_AddFavorite 0x1008ff39
+#define VHK_KEY_HotLinks 0x1008ff3a
+#define VHK_KEY_BrightnessAdjust 0x1008ff3b
+#define VHK_KEY_Finance 0x1008ff3c
+#define VHK_KEY_Community 0x1008ff3d
+#define VHK_KEY_AudioRewind 0x1008ff3e
+#define VHK_KEY_BackForward 0x1008ff3f
+#define VHK_KEY_Launch0 0x1008ff40
+#define VHK_KEY_Launch1 0x1008ff41
+#define VHK_KEY_Launch2 0x1008ff42
+#define VHK_KEY_Launch3 0x1008ff43
+#define VHK_KEY_Launch4 0x1008ff44
+#define VHK_KEY_Launch5 0x1008ff45
+#define VHK_KEY_Launch6 0x1008ff46
+#define VHK_KEY_Launch7 0x1008ff47
+#define VHK_KEY_Launch8 0x1008ff48
+#define VHK_KEY_Launch9 0x1008ff49
+#define VHK_KEY_LaunchA 0x1008ff4a
+#define VHK_KEY_LaunchB 0x1008ff4b
+#define VHK_KEY_LaunchC 0x1008ff4c
+#define VHK_KEY_LaunchD 0x1008ff4d
+#define VHK_KEY_LaunchE 0x1008ff4e
+#define VHK_KEY_LaunchF 0x1008ff4f
+#define VHK_KEY_ApplicationLeft 0x1008ff50
+#define VHK_KEY_ApplicationRight 0x1008ff51
+#define VHK_KEY_Book 0x1008ff52
+#define VHK_KEY_CD 0x1008ff53
+#define VHK_KEY_WindowClear 0x1008ff55
+#define VHK_KEY_Close 0x1008ff56
+#define VHK_KEY_Copy 0x1008ff57
+#define VHK_KEY_Cut 0x1008ff58
+#define VHK_KEY_Display 0x1008ff59
+#define VHK_KEY_DOS 0x1008ff5a
+#define VHK_KEY_Documents 0x1008ff5b
+#define VHK_KEY_Excel 0x1008ff5c
+#define VHK_KEY_Explorer 0x1008ff5d
+#define VHK_KEY_Game 0x1008ff5e
+#define VHK_KEY_Go 0x1008ff5f
+#define VHK_KEY_iTouch 0x1008ff60
+#define VHK_KEY_LogOff 0x1008ff61
+#define VHK_KEY_Market 0x1008ff62
+#define VHK_KEY_Meeting 0x1008ff63
+#define VHK_KEY_MenuKB 0x1008ff65
+#define VHK_KEY_MenuPB 0x1008ff66
+#define VHK_KEY_MySites 0x1008ff67
+#define VHK_KEY_New 0x1008ff68
+#define VHK_KEY_News 0x1008ff69
+#define VHK_KEY_OfficeHome 0x1008ff6a
+#define VHK_KEY_Open 0x1008ff6b
+#define VHK_KEY_Option 0x1008ff6c
+#define VHK_KEY_Paste 0x1008ff6d
+#define VHK_KEY_Phone 0x1008ff6e
+#define VHK_KEY_Reply 0x1008ff72
+#define VHK_KEY_Reload 0x1008ff73
+#define VHK_KEY_RotateWindows 0x1008ff74
+#define VHK_KEY_RotationPB 0x1008ff75
+#define VHK_KEY_RotationKB 0x1008ff76
+#define VHK_KEY_Save 0x1008ff77
+#define VHK_KEY_ScrollUp 0x1008ff78
+#define VHK_KEY_ScrollDown 0x1008ff79
+#define VHK_KEY_ScrollClick 0x1008ff7a
+#define VHK_KEY_Send 0x1008ff7b
+#define VHK_KEY_Spell 0x1008ff7c
+#define VHK_KEY_SplitScreen 0x1008ff7d
+#define VHK_KEY_Support 0x1008ff7e
+#define VHK_KEY_TaskPane 0x1008ff7f
+#define VHK_KEY_Terminal 0x1008ff80
+#define VHK_KEY_Tools 0x1008ff81
+#define VHK_KEY_Travel 0x1008ff82
+#define VHK_KEY_UserPB 0x1008ff84
+#define VHK_KEY_User1KB 0x1008ff85
+#define VHK_KEY_User2KB 0x1008ff86
+#define VHK_KEY_Video 0x1008ff87
+#define VHK_KEY_WheelButton 0x1008ff88
+#define VHK_KEY_Word 0x1008ff89
+#define VHK_KEY_Xfer 0x1008ff8a
+#define VHK_KEY_ZoomIn 0x1008ff8b
+#define VHK_KEY_ZoomOut 0x1008ff8c
+#define VHK_KEY_Away 0x1008ff8d
+#define VHK_KEY_Messenger 0x1008ff8e
+#define VHK_KEY_WebCam 0x1008ff8f
+#define VHK_KEY_MailForward 0x1008ff90
+#define VHK_KEY_Pictures 0x1008ff91
+#define VHK_KEY_Music 0x1008ff92
+#define VHK_KEY_Battery 0x1008ff93
+#define VHK_KEY_Bluetooth 0x1008ff94
+#define VHK_KEY_WLAN 0x1008ff95
+#define VHK_KEY_UWB 0x1008ff96
+#define VHK_KEY_AudioForward 0x1008ff97
+#define VHK_KEY_AudioRepeat 0x1008ff98
+#define VHK_KEY_AudioRandomPlay 0x1008ff99
+#define VHK_KEY_Subtitle 0x1008ff9a
+#define VHK_KEY_AudioCycleTrack 0x1008ff9b
+#define VHK_KEY_CycleAngle 0x1008ff9c
+#define VHK_KEY_FrameBack 0x1008ff9d
+#define VHK_KEY_FrameForward 0x1008ff9e
+#define VHK_KEY_Time 0x1008ff9f
+#define VHK_KEY_SelectButton 0x1008ffa0
+#define VHK_KEY_View 0x1008ffa1
+#define VHK_KEY_TopMenu 0x1008ffa2
+#define VHK_KEY_Red 0x1008ffa3
+#define VHK_KEY_Green 0x1008ffa4
+#define VHK_KEY_Yellow 0x1008ffa5
+#define VHK_KEY_Blue 0x1008ffa6
+#define VHK_KEY_Suspend 0x1008ffa7
+#define VHK_KEY_Hibernate 0x1008ffa8
+#define VHK_KEY_TouchpadToggle 0x1008ffa9
+#define VHK_KEY_TouchpadOn 0x1008ffb0
+#define VHK_KEY_TouchpadOff 0x1008ffb1
+#define VHK_KEY_AudioMicMute 0x1008ffb2
+#define VHK_KEY_Keyboard 0x1008ffb3
+#define VHK_KEY_WWAN 0x1008ffb4
+#define VHK_KEY_RFKill 0x1008ffb5
+#define VHK_KEY_AudioPreset 0x1008ffb6
/* Key modifier masks */
#define VHK_MOD_NONE 0x0000
#define VHK_MOD_ALT 0x0001
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|