vice-emu-commit Mailing List for VICE (Page 12)
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
(28) |
Nov
(12) |
Dec
|
|
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.
|
|
From: <co...@us...> - 2025-03-14 18:26:21
|
Revision: 45531
http://sourceforge.net/p/vice-emu/code/45531
Author: compyx
Date: 2025-03-14 18:26:09 +0000 (Fri, 14 Mar 2025)
Log Message:
-----------
Joystick: fix shared joystick code which is mysteriously SDL-only
Fix code in `src/joyport/joystick.c` to use the updated data structures. The
code is guarded by `#ifdef HAVE_SDL_NUMJOYSTICKS` for unknown (undocumented)
reasons. SDL's driver in `src/arch/sdl/joy.c` will be fixed next.
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-14 12:03:50 UTC (rev 45530)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-14 18:26:09 UTC (rev 45531)
@@ -1203,49 +1203,56 @@
#if (defined USE_SDLUI ||defined USE_SDL2UI)
void joy_delete_extra_mapping(int type)
{
- int i, j;
- joystick_action_t t;
+ int i;
for (i = 0; i < num_joystick_devices; i++) {
- for (j = 0; j < joystick_devices[i]->num_axes; j++) {
- t = joystick_devices[i]->axis_mapping[j].positive_direction.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->axis_mapping[j].positive_direction.action = JOY_ACTION_NONE;
- joystick_devices[i]->axis_mapping[j].positive_direction.value.ui_action = ACTION_NONE;
+ joystick_device_t *joydev = joystick_devices[i];
+ int j;
+
+ for (j = 0; j < joydev->num_axes; j++) {
+ joystick_mapping_t *positive = &joydev->axes[j]->mapping.positive;
+ joystick_mapping_t *negative = &joydev->axes[j]->mapping.negative;
+
+ if (positive->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ positive->action = JOY_ACTION_NONE;
+ positive->value.ui_action = ACTION_NONE;
}
- t = joystick_devices[i]->axis_mapping[j].negative_direction.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->axis_mapping[j].negative_direction.action = JOY_ACTION_NONE;
- joystick_devices[i]->axis_mapping[j].negative_direction.value.ui_action = ACTION_NONE;
+ if (negative->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ negative->action = JOY_ACTION_NONE;
+ negative->value.ui_action = ACTION_NONE;
}
}
- for (j = 0; j < joystick_devices[i]->num_buttons; j++) {
- t = joystick_devices[i]->button_mapping[j].mapping.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->button_mapping[j].mapping.action = JOY_ACTION_NONE;
- joystick_devices[i]->button_mapping[j].mapping.value.ui_action = ACTION_NONE;
+
+ for (j = 0; j < joydev->num_buttons; j++) {
+ joystick_mapping_t *mapping = &joydev->buttons[j]->mapping;
+
+ if (mapping->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ mapping->action = JOY_ACTION_NONE;
+ mapping->value.ui_action = ACTION_NONE;
}
}
+
for (j = 0; j < joystick_devices[i]->num_hats; j++) {
- t = joystick_devices[i]->hat_mapping[j].up.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->hat_mapping[j].up.action = JOY_ACTION_NONE;
- joystick_devices[i]->hat_mapping[j].up.value.ui_action = ACTION_NONE;
+ joystick_mapping_t *up = &joydev->hats[j]->mapping.up;
+ joystick_mapping_t *down = &joydev->hats[j]->mapping.down;
+ joystick_mapping_t *left = &joydev->hats[j]->mapping.left;
+ joystick_mapping_t *right = &joydev->hats[j]->mapping.right;
+
+ if (up->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ up->action = JOY_ACTION_NONE;
+ up->value.ui_action = ACTION_NONE;
}
- t = joystick_devices[i]->hat_mapping[j].down.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->hat_mapping[j].down.action = JOY_ACTION_NONE;
- joystick_devices[i]->hat_mapping[j].down.value.ui_action = ACTION_NONE;
+ if (down->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ down->action = JOY_ACTION_NONE;
+ down->value.ui_action = ACTION_NONE;
}
- t = joystick_devices[i].hat_mapping[j].left.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->hat_mapping[j].left.action = JOY_ACTION_NONE;
- joystick_devices[i]->hat_mapping[j].left.value.ui_action = ACTION_NONE;
+ if (left->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ left->action = JOY_ACTION_NONE;
+ left->value.ui_action = ACTION_NONE;
}
- t = joystick_devices[i]->hat_mapping[j].right.action;
- if (t == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
- joystick_devices[i]->hat_mapping[j].right.action = JOY_ACTION_NONE;
- joystick_devices[i]->hat_mapping[j].right.value.ui_action = ACTION_NONE;
+ if (right->action == (type ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
+ right->action = JOY_ACTION_NONE;
+ right->value.ui_action = ACTION_NONE;
}
}
}
@@ -3096,7 +3103,7 @@
#ifdef HAVE_SDL_NUMJOYSTICKS
joystick_axis_value_t joy_axis_prev(uint8_t joynum, uint8_t axis)
{
- return joystick_devices[joynum].axis_mapping[axis].prev;
+ return joystick_devices[joynum]->axes[axis]->prev;
}
joystick_mapping_t *joy_get_axis_mapping(uint8_t joynum,
@@ -3105,10 +3112,10 @@
joystick_axis_value_t *prev)
{
joystick_mapping_t *retval = joy_get_axis_mapping_not_setting_value(
- joynum, axis, joystick_devices[joynum].axis_mapping[axis].prev);
+ joynum, axis, joystick_devices[joynum]->axes[axis]->prev);
if (prev)
- *prev = joystick_devices[joynum].axis_mapping[axis].prev;
- joystick_devices[joynum].axis_mapping[axis].prev = value;
+ *prev = joystick_devices[joynum]->axes[axis]->prev;
+ joystick_devices[joynum]->axes[axis]->prev = value;
return retval;
}
@@ -3117,10 +3124,10 @@
joystick_axis_value_t value)
{
if (value == JOY_AXIS_POSITIVE) {
- return &joystick_devices[joynum].axis_mapping[axis].positive_direction;
+ return &joystick_devices[joynum]->axes[axis]->mapping.positive;
}
if (value == JOY_AXIS_NEGATIVE) {
- return &joystick_devices[joynum].axis_mapping[axis].negative_direction;
+ return &joystick_devices[joynum]->axes[axis]->mapping.negative;
}
return NULL;
}
@@ -3131,10 +3138,10 @@
uint8_t *prev)
{
joystick_mapping_t *retval = joy_get_button_mapping_not_setting_value(
- joynum, button, joystick_devices[joynum].button_mapping[button].prev);
+ joynum, button, joystick_devices[joynum]->buttons[button]->prev);
if (prev)
- *prev = joystick_devices[joynum].button_mapping[button].prev;
- joystick_devices[joynum].button_mapping[button].prev = value;
+ *prev = joystick_devices[joynum]->buttons[button]->prev;
+ joystick_devices[joynum]->buttons[button]->prev = value;
return retval;
}
@@ -3143,12 +3150,13 @@
uint8_t value)
{
if (value)
- return &joystick_devices[joynum].button_mapping[button].mapping;
+ return &joystick_devices[joynum]->buttons[button]->mapping;
return NULL;
}
-joystick_axis_value_t joy_hat_prev(uint8_t joynum, uint8_t hat) {
- return joystick_devices[joynum].hat_mapping[hat].prev;
+joystick_axis_value_t joy_hat_prev(uint8_t joynum, uint8_t hat)
+{
+ return joystick_devices[joynum]->hats[hat]->prev;
}
joystick_mapping_t *joy_get_hat_mapping(uint8_t joynum,
@@ -3157,26 +3165,28 @@
uint8_t *prev)
{
joystick_mapping_t *retval = joy_get_hat_mapping_not_setting_value(
- joynum, hat, joystick_devices[joynum].hat_mapping[hat].prev);
+ joynum, hat, joystick_devices[joynum]->hats[hat]->prev);
if (prev)
- *prev = joystick_devices[joynum].hat_mapping[hat].prev;
- joystick_devices[joynum].hat_mapping[hat].prev = value;
+ *prev = joystick_devices[joynum]->hats[hat]->prev;
+ joystick_devices[joynum]->hats[hat]->prev = value;
return retval;
}
joystick_mapping_t *joy_get_hat_mapping_not_setting_value(uint8_t joynum,
uint8_t hat,
- uint8_t value) {
+ uint8_t value)
+{
+ joystick_device_t *joydev = joystick_devices[joynum];
joystick_mapping_t *mapping = NULL;
if (value & JOYSTICK_DIRECTION_UP) {
- mapping = &joystick_devices[joynum].hat_mapping[hat].up;
+ mapping = &joydev->hats[hat]->mapping.up;
} else if (value & JOYSTICK_DIRECTION_DOWN) {
- mapping = &joystick_devices[joynum].hat_mapping[hat].down;
+ mapping = &joydev->hats[hat]->mapping.down;
} else if (value & JOYSTICK_DIRECTION_LEFT) {
- mapping = &joystick_devices[joynum].hat_mapping[hat].left;
+ mapping = &joydev->hats[hat]->mapping.left;
} else if (value & JOYSTICK_DIRECTION_RIGHT) {
- mapping = &joystick_devices[joynum].hat_mapping[hat].right;
+ mapping = &joydev->hats[hat]->mapping.right;
}
return mapping;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-14 12:04:05
|
Revision: 45530
http://sourceforge.net/p/vice-emu/code/45530
Author: compyx
Date: 2025-03-14 12:03:50 +0000 (Fri, 14 Mar 2025)
Log Message:
-----------
Merge trunk (r45512:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/actions-clipboard.c
branches/compyx/joymap-001/vice/src/arch/sdl/menu_joystick.c
branches/compyx/joymap-001/vice/src/diskconstants.h
branches/compyx/joymap-001/vice/src/diskimage/fsimage-dxx.c
branches/compyx/joymap-001/vice/src/monitor/mon_memory.c
branches/compyx/joymap-001/vice/src/resid/filter8580new.h
branches/compyx/joymap-001/vice/src/vdrive/vdrive.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/actions-clipboard.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/actions-clipboard.c 2025-03-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/actions-clipboard.c 2025-03-14 12:03:50 UTC (rev 45530)
@@ -80,6 +80,7 @@
tmp,
(gint)len);
lib_free(tmp);
+ lib_free(text);
}
}
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-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/menu_joystick.c 2025-03-14 12:03:50 UTC (rev 45530)
@@ -59,7 +59,9 @@
UI_MENU_DEFINE_RADIO(JoyDevice10)
UI_MENU_DEFINE_RADIO(JoyDevice11)
-static ui_menu_entry_t joystick_device_dyn_menu[JOYPORT_MAX_PORTS][6];
+/* FIXME: proper solution would be to dynamically allocate the array of menu
+ * items per port, for now we stick with max. 16 controllers */
+static ui_menu_entry_t joystick_device_dyn_menu[JOYPORT_MAX_PORTS][5 + 16];
static int joystick_device_dyn_menu_init[JOYPORT_MAX_PORTS] = { 0 };
static void sdl_menu_joystick_device_free(int port)
@@ -135,7 +137,7 @@
#ifdef HAVE_SDL_NUMJOYSTICKS
n = 0;
joystick_ui_reset_device_list();
- while (j < JOYPORT_MAX_PORTS - 1 && (device_name = joystick_ui_get_next_device_name(&id)) != NULL) {
+ while (n < 16 && (device_name = joystick_ui_get_next_device_name(&id)) != NULL) {
entry[j].action = ACTION_NONE;
entry[j].string = lib_strdup(device_name);
entry[j].type = MENU_ENTRY_RESOURCE_RADIO;
Modified: branches/compyx/joymap-001/vice/src/diskconstants.h
===================================================================
--- branches/compyx/joymap-001/vice/src/diskconstants.h 2025-03-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/diskconstants.h 2025-03-14 12:03:50 UTC (rev 45530)
@@ -146,8 +146,8 @@
#define HDR_SECTOR_8050 0 /* block w/disk name */
#define BAM_TRACK_8050 38
#define BAM_SECTOR_8050 0
-#define BAM_NAME_8050 6 /* pos. of disk name in header blk */
-#define BAM_ID_8050 24 /* pos. of disk id in header blk */
+#define HDR_NAME_8050 6 /* pos. of disk name in header blk */
+#define HDR_ID_8050 24 /* pos. of disk id in header blk */
#define DIR_TRACK_8050 39
#define DIR_SECTOR_8050 1
@@ -159,8 +159,8 @@
#define HDR_SECTOR_8250 HDR_SECTOR_8050
#define BAM_TRACK_8250 BAM_TRACK_8050
#define BAM_SECTOR_8250 BAM_SECTOR_8050
-#define BAM_NAME_8250 BAM_NAME_8050 /* pos. of disk name in hdr blk */
-#define BAM_ID_8250 BAM_ID_8050 /* pos. of disk id in hdr blk */
+#define HDR_NAME_8250 HDR_NAME_8050 /* pos. of disk name in hdr blk */
+#define HDR_ID_8250 HDR_ID_8050 /* pos. of disk id in hdr blk */
#define DIR_TRACK_8250 DIR_TRACK_8050
#define DIR_SECTOR_8250 DIR_SECTOR_8050
Modified: branches/compyx/joymap-001/vice/src/diskimage/fsimage-dxx.c
===================================================================
--- branches/compyx/joymap-001/vice/src/diskimage/fsimage-dxx.c 2025-03-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/diskimage/fsimage-dxx.c 2025-03-14 12:03:50 UTC (rev 45530)
@@ -166,8 +166,8 @@
if (image->type == DISK_IMAGE_TYPE_D80
|| image->type == DISK_IMAGE_TYPE_D82) {
- sectors = disk_image_check_sector(image, BAM_TRACK_8050, BAM_SECTOR_8050);
- bam_id = &buffer[BAM_ID_8050];
+ sectors = disk_image_check_sector(image, HDR_TRACK_8050, HDR_SECTOR_8050);
+ bam_id = &buffer[HDR_ID_8050];
} else {
sectors = disk_image_check_sector(image, BAM_TRACK_1541, BAM_SECTOR_1541);
bam_id = &buffer[BAM_ID_1541];
Modified: branches/compyx/joymap-001/vice/src/monitor/mon_memory.c
===================================================================
--- branches/compyx/joymap-001/vice/src/monitor/mon_memory.c 2025-03-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/monitor/mon_memory.c 2025-03-14 12:03:50 UTC (rev 45530)
@@ -282,7 +282,16 @@
int bank;
mem_get_screen_parameter(&base, &rows, &screen_width, &bank);
+ /* HACK: mem_get_screen_parameter() returns actual screen size from the
+ video chip registers - this can be zero rows or zero columns! If
+ width is 0, use last known terminal width instead, to avoid division
+ by 0 further below. */
+ if (screen_width == 0) {
+ screen_width = last_known_xres;
+ }
+
max_width = screen_width;
+
if (max_width > (last_known_xres - (7 + 2))) {
max_width = (last_known_xres - (7 + 2));
/* to make the output easier to read, make sure the number of items
Modified: branches/compyx/joymap-001/vice/src/resid/filter8580new.h
===================================================================
--- branches/compyx/joymap-001/vice/src/resid/filter8580new.h 2025-03-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/resid/filter8580new.h 2025-03-14 12:03:50 UTC (rev 45530)
@@ -23,6 +23,7 @@
#include "resid-config.h"
#include <cassert>
+#include <cstdlib>
namespace reSID
{
@@ -648,6 +649,23 @@
static model_filter_t model_filter[2];
friend class SID;
+
+private:
+ class Randomnoise
+ {
+ private:
+ int buffer[1024];
+ mutable int index = 0;
+ public:
+ Randomnoise()
+ {
+ for (int i=0; i<1024; i++)
+ buffer[i] = rand() % (1<<19);
+ }
+ int getNoise() const { index = (index + 1) & 0x3ff; return buffer[index]; }
+ };
+
+ Randomnoise rnd;
};
@@ -667,9 +685,9 @@
{
model_filter_t& f = model_filter[sid_model];
- v1 = (voice1*f.voice_scale_s14 >> 18) + f.voice_DC;
- v2 = (voice2*f.voice_scale_s14 >> 18) + f.voice_DC;
- v3 = (voice3*f.voice_scale_s14 >> 18) + f.voice_DC;
+ v1 = ((voice1*f.voice_scale_s14 + rnd.getNoise()) >> 18) + f.voice_DC;
+ v2 = ((voice2*f.voice_scale_s14 + rnd.getNoise()) >> 18) + f.voice_DC;
+ v3 = ((voice3*f.voice_scale_s14 + rnd.getNoise()) >> 18) + f.voice_DC;
// Sum inputs routed into the filter.
int Vi = 0;
@@ -768,9 +786,9 @@
{
model_filter_t& f = model_filter[sid_model];
- v1 = (voice1*f.voice_scale_s14 >> 18) + f.voice_DC;
- v2 = (voice2*f.voice_scale_s14 >> 18) + f.voice_DC;
- v3 = (voice3*f.voice_scale_s14 >> 18) + f.voice_DC;
+ v1 = ((voice1*f.voice_scale_s14 + rnd.getNoise()) >> 18) + f.voice_DC;
+ v2 = ((voice2*f.voice_scale_s14 + rnd.getNoise()) >> 18) + f.voice_DC;
+ v3 = ((voice3*f.voice_scale_s14 + rnd.getNoise()) >> 18) + f.voice_DC;
// Enable filter on/off.
// This is not really part of SID, but is useful for testing.
Modified: branches/compyx/joymap-001/vice/src/vdrive/vdrive.c
===================================================================
--- branches/compyx/joymap-001/vice/src/vdrive/vdrive.c 2025-03-14 11:49:58 UTC (rev 45529)
+++ branches/compyx/joymap-001/vice/src/vdrive/vdrive.c 2025-03-14 12:03:50 UTC (rev 45530)
@@ -650,8 +650,8 @@
vdrive->Bam_Sector = BAM_SECTOR_8050;
vdrive->Header_Track = HDR_TRACK_8050;
vdrive->Header_Sector = HDR_SECTOR_8050;
- vdrive->bam_name = BAM_NAME_8050;
- vdrive->bam_id = BAM_ID_8050;
+ vdrive->bam_name = HDR_NAME_8050;
+ vdrive->bam_id = HDR_ID_8050;
vdrive->Dir_Track = DIR_TRACK_8050;
vdrive->Dir_Sector = DIR_SECTOR_8050;
break;
@@ -660,8 +660,8 @@
vdrive->Bam_Sector = BAM_SECTOR_8250;
vdrive->Header_Track = HDR_TRACK_8250;
vdrive->Header_Sector = HDR_SECTOR_8250;
- vdrive->bam_name = BAM_NAME_8250;
- vdrive->bam_id = BAM_ID_8250;
+ vdrive->bam_name = HDR_NAME_8250;
+ vdrive->bam_id = HDR_ID_8250;
vdrive->Dir_Track = DIR_TRACK_8250;
vdrive->Dir_Sector = DIR_SECTOR_8250;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-14 11:50:10
|
Revision: 45529
http://sourceforge.net/p/vice-emu/code/45529
Author: compyx
Date: 2025-03-14 11:49:58 +0000 (Fri, 14 Mar 2025)
Log Message:
-----------
SDL: "Fix" overflow of controller list in joystick menu
See bug #2092.
Modified Paths:
--------------
trunk/vice/src/arch/sdl/menu_joystick.c
Modified: trunk/vice/src/arch/sdl/menu_joystick.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_joystick.c 2025-03-13 14:33:32 UTC (rev 45528)
+++ trunk/vice/src/arch/sdl/menu_joystick.c 2025-03-14 11:49:58 UTC (rev 45529)
@@ -59,7 +59,9 @@
UI_MENU_DEFINE_RADIO(JoyDevice10)
UI_MENU_DEFINE_RADIO(JoyDevice11)
-static ui_menu_entry_t joystick_device_dyn_menu[JOYPORT_MAX_PORTS][6];
+/* FIXME: proper solution would be to dynamically allocate the array of menu
+ * items per port, for now we stick with max. 16 controllers */
+static ui_menu_entry_t joystick_device_dyn_menu[JOYPORT_MAX_PORTS][5 + 16];
static int joystick_device_dyn_menu_init[JOYPORT_MAX_PORTS] = { 0 };
static void sdl_menu_joystick_device_free(int port)
@@ -135,7 +137,7 @@
#ifdef HAVE_SDL_NUMJOYSTICKS
n = 0;
joystick_ui_reset_device_list();
- while (j < JOYPORT_MAX_PORTS - 1 && (device_name = joystick_ui_get_next_device_name(&id)) != NULL) {
+ while (n < 16 && (device_name = joystick_ui_get_next_device_name(&id)) != NULL) {
entry[j].action = ACTION_NONE;
entry[j].string = lib_strdup(device_name);
entry[j].type = MENU_ENTRY_RESOURCE_RADIO;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-13 14:33:39
|
Revision: 45528
http://sourceforge.net/p/vice-emu/code/45528
Author: compyx
Date: 2025-03-13 14:33:32 +0000 (Thu, 13 Mar 2025)
Log Message:
-----------
Joystick: log joystick registation with proper signular/plural nouns
Avoid things like "1 buttons", right-trim device names and limit names of
idiotic length (>255 chars) so the UI doesn't have to trim names.
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-13 08:34:04 UTC (rev 45527)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-13 14:33:32 UTC (rev 45528)
@@ -422,21 +422,21 @@
for (i = 0; i < sd_result; i++) {
joystick_device_t *joydev;
- log_message(joy_evdev_log, "Possible device '%s'", namelist[i]->d_name);
+ //log_message(joy_evdev_log, "Possible device '%s'", namelist[i]->d_name);
joydev = scan_device(namelist[i]->d_name);
if (joydev != NULL) {
if (joydev->num_axes < 2u || joydev->num_buttons < 1u) {
/* reject device */
- log_message(joy_evdev_log,
- "Invalid geometry for %s: axes: %d, buttons: %d",
- joydev->name, joydev->num_axes, joydev->num_buttons);
+ //log_message(joy_evdev_log,
+ // "Invalid geometry for %s: axes: %d, buttons: %d",
+ // joydev->name, joydev->num_axes, joydev->num_buttons);
joystick_device_free(joydev);
} else {
- log_message(joy_evdev_log,
- "Adding device: %s [%04x:%04x] (%d axes, %d buttons)",
- joydev->name,
- (unsigned int)joydev->vendor, (unsigned int)joydev->product,
- joydev->num_axes, joydev->num_buttons);
+ //log_message(joy_evdev_log,
+ // "Adding device: %s [%04x:%04x] (%d axes, %d buttons)",
+ // joydev->name,
+ // (unsigned int)joydev->vendor, (unsigned int)joydev->product,
+ // joydev->num_axes, joydev->num_buttons);
if (!joystick_device_register(joydev)) {
log_message(joy_evdev_log,
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-13 08:34:04 UTC (rev 45527)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-13 14:33:32 UTC (rev 45528)
@@ -3309,6 +3309,26 @@
}
+/** \brief Right-trim name and limit to 255 chars max
+ *
+ * Right-trim name (at least one device reports a name with trailing spaces on
+ * Linux) and limit length to 255 characters to avoid bizarre behaviour in UIs.
+ *
+ * \param[in] joydev joystick device
+ */
+static void joystick_device_trim_name(joystick_device_t *joydev)
+{
+ char *p = joydev->name + strlen(joydev->name) - 1;
+
+ while (p >= joydev->name && isspace((unsigned int)*p)) {
+ *p-- = '\0';
+ }
+ /* limit name to 255 max to guard against weird broken names */
+ if (p - joydev->name + 1 > 255) {
+ joydev->name[255] = '\0';
+ }
+}
+
/** \brief Apply default minimal mapping to joystick device
*
* Map input for four directions and up to three fire buttons. If the device
@@ -3393,7 +3413,48 @@
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.
@@ -3419,11 +3480,14 @@
sizeof *joystick_devices * max_joystick_devices);
}
+ joystick_device_trim_name(joydev);
joystick_device_apply_default_mapping(joydev);
joystick_devices[num_joystick_devices] = joydev;
joystick_devices[++num_joystick_devices] = NULL;
+ /* log device registration */
+ joy_log_registration(joydev);
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-13 08:34:15
|
Revision: 45527
http://sourceforge.net/p/vice-emu/code/45527
Author: compyx
Date: 2025-03-13 08:34:04 +0000 (Thu, 13 Mar 2025)
Log Message:
-----------
Joystick: BSD: clean up ordered inputs code, properly document said code
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-12 20:52:19 UTC (rev 45526)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-13 08:34:04 UTC (rev 45527)
@@ -92,22 +92,57 @@
int fd;
} joy_priv_t;
+/** \brief Function to free data in a input node list
+ *
+ * Function to call on the \c data member of an #input_node_t if #input_list_free()
+ * is called with \c with_data set to <tt>true</tt>.
+ * This typedef allows us to cast #joystick_axis_free(). #joystick_button_free()
+ * and #joystick_hat_free() to the type expected by #input_list_init(), avoiding
+ * wrapper functions.
+ */
+typedef void (*data_free_t)(void*);
+/** \brief Node in an ordered linked list of inputs
+ */
typedef struct input_node_s {
- struct input_node_s *next;
- void *data;
+ struct input_node_s *next; /**< next node */
+ void *data; /**< data (axis/button/hat object pointer) */
} input_node_t;
+/** \brief Ordered list of inputs
+ */
typedef struct input_list_s {
- input_node_t *head;
- void (*data_free)(void *);
- int (*data_comp)(void *, void *);
+ /** \brief Head node */
+ input_node_t *head;
+
+ /** \brief Function to call to free the data of a node
+ *
+ * This function is called on the \c data member of a node if #input_list_free()
+ * is called with its \c with_data argument set to <tt>true</tt>. This
+ * allows cleaning up the list and its data when an error occurs during
+ * scanning.
+ */
+ void (*data_free)(void *);
+
+ /** \brief Comparison function for ordered insertion
+ *
+ * Return 0 when the codes of both arguments are equal, return < 0 when
+ * \c arg1->code < \c arg2->code, return > 0 when \c arg1->code
+ * > \c arg2->code.
+ */
+ int (*data_comp)(const void *, const void *);
} input_list_t;
+/** \brief Initialize ordered input list
+ *
+ * \param[in] list input list
+ * \param[in] data_free function to free the \c data member of the list nodes
+ * \param[in] data_comp function to compare two \c data members
+ */
static void input_list_init(input_list_t *list,
void (*data_free)(void *),
- int (*data_comp)(void *, void *))
+ int (*data_comp)(const void *, const void *))
{
list->head = NULL;
list->data_free = data_free;
@@ -114,6 +149,13 @@
list->data_comp = data_comp;
}
+/** \brief Free input list
+ *
+ * Free input list node and optionally free each node's \c data member.
+ *
+ * \param[in] list input list
+ * \param[in] with_data also free the \c data member of each node
+ */
static void input_list_free(input_list_t *list, bool with_data)
{
input_node_t *node = list->head;
@@ -128,6 +170,17 @@
list->head = NULL;
}
+/** \brief Insert data into input list in-order
+ *
+ * Insert \a data into \a list, using the \c data_comp function specified in
+ * #input_list_init() to determine its location in the list.
+ *
+ * \param[in] list input list
+ * \param[in] data input object to insert into \a list
+ *
+ * \return <tt>true</tt> on success, <tt>false</tt> if an input with the same
+ * code is already present (which should not happen)
+ */
static bool input_list_insert(input_list_t *list, void *data)
{
input_node_t *node = lib_malloc(sizeof *node);
@@ -182,10 +235,16 @@
/** \brief Log for BSD joystick driver */
static log_t bsd_joy_log;
+/** \brief Temporary ordered list of axes */
static input_list_t axis_list;
+
+/** \brief Temporary ordered list of buttons */
static input_list_t button_list;
+
+/** \brief Temporary ordered list of hats */
static input_list_t hat_list;
+
/** \brief BSD joystick driver declaration */
static joystick_driver_t driver = {
.open = bsd_joy_open,
@@ -500,7 +559,7 @@
axis->maximum = item->logical_maximum;
log_message(bsd_joy_log, "axis %u: %s", axis->code, axis->name);
- joystick_device_add_axis(joydev, axis);
+ input_list_insert(&axis_list, axis);
}
/** \brief Add button to joystick device
@@ -515,10 +574,9 @@
button = joystick_button_new(hid_usage_in_page(item->usage));
button->code = (uint32_t)HID_USAGE(item->usage);
+
log_message(bsd_joy_log, "button %u: %s", button->code, button->name);
-
input_list_insert(&button_list, button);
-// joystick_device_add_button(joydev, button);
}
/** \brief Add hat to joystick device
@@ -533,8 +591,9 @@
hat = joystick_hat_new(hid_usage_in_page(item->usage));
hat->code = (uint32_t)HID_USAGE(item->usage);
+
log_message(bsd_joy_log, "hat %u: %s", hat->code, hat->name);
- joystick_device_add_hat(joydev, hat);
+ input_list_insert(&hat_list, hat);
}
/** \brief Scan device for inputs
@@ -608,9 +667,6 @@
*
* \param[in] node device node to scan
*
- * \todo Order axes, buttons and hats by HID_USAGE() (event code), otherwise
- * our default mappings fail spectacularly =D
- *
* \return new joystick device instance or <tt>NULL</tt> on error
*/
static joystick_device_t *scan_device(const char *node)
@@ -650,11 +706,19 @@
return joydev;
}
-
-static int axis_comp(void *a1, void *a2)
+/** \brief Ordered list comparison callback for axes
+ *
+ * Compare code of axis \a a1 with code of axis \a a2.
+ *
+ * \param[in] a1 joystick axis object
+ * \param[in] a2 joystick axis object
+ *
+ * \return 0 if equal, < 0 if \a a1 < \a a2, > 0 if \a a1 > \a a2
+ */
+static int axis_comp(const void *a1, const void *a2)
{
- joystick_axis_t *axis1 = a1;
- joystick_axis_t *axis2 = a2;
+ const joystick_axis_t *axis1 = a1;
+ const joystick_axis_t *axis2 = a2;
if (axis1->code == axis2->code) {
return 0;
@@ -665,16 +729,20 @@
}
}
-static void axis_free(void *a)
+/** \brief Ordered list comparison callback for buttons
+ *
+ * Compare code of button \a b1 with code of button \a b2.
+ *
+ * \param[in] b1 joystick button object
+ * \param[in] b2 joystick button object
+ *
+ * \return 0 if equal, < 0 if \a b1 < \a b2, > 0 if \a b1 > \a b2
+ */
+static int button_comp(const void *b1, const void *b2)
{
- joystick_axis_free(a);
-}
+ const joystick_button_t *btn1 = b1;
+ const joystick_button_t *btn2 = b2;
-static int button_comp(void *b1, void *b2)
-{
- joystick_button_t *btn1 = b1;
- joystick_button_t *btn2 = b2;
-
if (btn1->code == btn2->code) {
return 0;
} else if (btn1->code < btn2->code) {
@@ -684,14 +752,19 @@
}
}
-static void button_free(void *b)
+/** \brief Ordered list comparison callback for hats
+ *
+ * Compare code of hat \a h1 with code of hat \a h2.
+ *
+ * \param[in] h1 joystick hat object
+ * \param[in] h2 joystick hat object
+ *
+ * \return 0 if equal, < 0 if \a h1 < \a h2, > 0 if \a h1 > \a h2
+ */
+static int hat_comp(const void *h1, const void *h2)
{
- joystick_button_free(b);
-}
-static int hat_comp(void *h1, void *h2)
-{
- joystick_hat_t *hat1 = h1;
- joystick_hat_t *hat2 = h2;
+ const joystick_hat_t *hat1 = h1;
+ const joystick_hat_t *hat2 = h2;
if (hat1->code == hat2->code) {
return 0;
@@ -702,47 +775,44 @@
}
}
-static void hat_free(void *h)
+/* kept for debugging */
+#if 0
+static void add_ordered_buttons(joystick_device_t *joydev)
{
- joystick_hat_free(h);
-}
+ input_node_t *node;
+ int num = 0;
+ for (node = button_list.head; node != NULL; node = node->next) {
+ joystick_button_t *button = node->data;
-static void add_ordered_axes(joystick_device_t *joydev)
-{
- input_node_t *node = axis_list.head;
- while (node != NULL) {
- joystick_device_add_axis(joydev, node->data);
- node = node->next;
+ printf("BUTTON LIST: %d: 0x%04x \"%s\"\n", num++, button->code, button->name);
+ joystick_device_add_button(joydev, node->data);
}
}
+#endif
-static void add_ordered_buttons(joystick_device_t *joydev)
+/** \brief Add inputs ordered by code
+ *
+ * Add axes, buttons and hats ordered by their code (hid usage) to \a joydev.
+ *
+ * \param[in] joydev joystick device
+ */
+static void add_ordered_inputs(joystick_device_t *joydev)
{
- input_node_t *node = button_list.head;
- int num = 0;
- while (node != NULL) {
- joystick_button_t *button = node->data;
+ input_node_t *node;
- printf("BUTTON LIST: %d: 0x%04x \"%s\"\n", num, button->code, button->name);
- joystick_device_add_button(joydev, button);
- num++;
- node = node->next;
+ for (node = axis_list.head; node != NULL; node = node->next) {
+ joystick_device_add_axis(joydev, node->data);
}
-}
-
-static void add_ordered_hats(joystick_device_t *joydev)
-{
- input_node_t *node = hat_list.head;
- while (node != NULL) {
+ for (node = button_list.head; node != NULL; node = node->next) {
+ joystick_device_add_button(joydev, node->data);
+ }
+ for (node = hat_list.head; node != NULL; node = node->next) {
joystick_device_add_hat(joydev, node->data);
- node = node->next;
}
}
-
-
/** \brief Initialize BSD joystick driver and add available devices
*/
void bsd_joystick_init(void)
@@ -784,16 +854,14 @@
log_message(bsd_joy_log, "%s: %s", joydev->node, joydev->name);
/* initialize lists to sort inputs on code */
- input_list_init(&axis_list, axis_free, axis_comp);
- input_list_init(&button_list, button_free, button_comp);
- input_list_init(&hat_list, hat_free, hat_comp);
+ input_list_init(&axis_list, (data_free_t)joystick_axis_free, axis_comp);
+ input_list_init(&button_list, (data_free_t)joystick_button_free, button_comp);
+ input_list_init(&hat_list, (data_free_t)joystick_hat_free, hat_comp);
/* scan axes, buttons and hats */
if (scan_inputs(joydev)) {
/* add inputs to device in-order */
- add_ordered_axes (joydev);
- add_ordered_buttons(joydev);
- add_ordered_hats (joydev);
+ add_ordered_inputs(joydev);
/* OK: try to register */
if (!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-12 20:52:31
|
Revision: 45526
http://sourceforge.net/p/vice-emu/code/45526
Author: compyx
Date: 2025-03-12 20:52:19 +0000 (Wed, 12 Mar 2025)
Log Message:
-----------
Joystick: BSD: add axes, buttons and hats in-order
Use naive insertion sort to generate ordered lists of axes, buttons and
hats while scanning a device and add those in-order after scanning has
completed.
TODO: document linked list objects and 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-12 13:31:54 UTC (rev 45525)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-12 20:52:19 UTC (rev 45526)
@@ -93,6 +93,85 @@
} joy_priv_t;
+typedef struct input_node_s {
+ struct input_node_s *next;
+ void *data;
+} input_node_t;
+
+typedef struct input_list_s {
+ input_node_t *head;
+ void (*data_free)(void *);
+ int (*data_comp)(void *, void *);
+} input_list_t;
+
+
+static void input_list_init(input_list_t *list,
+ void (*data_free)(void *),
+ int (*data_comp)(void *, void *))
+{
+ list->head = NULL;
+ list->data_free = data_free;
+ list->data_comp = data_comp;
+}
+
+static void input_list_free(input_list_t *list, bool with_data)
+{
+ input_node_t *node = list->head;
+ while (node != NULL) {
+ input_node_t *next = node->next;
+ if (with_data) {
+ list->data_free(node->data);
+ }
+ lib_free(node);
+ node = next;
+ }
+ list->head = NULL;
+}
+
+static bool input_list_insert(input_list_t *list, void *data)
+{
+ input_node_t *node = lib_malloc(sizeof *node);
+
+ node->next = NULL;
+ node->data = data;
+
+ if (list->head == NULL) {
+ list->head = node;
+ return true;
+ } else {
+ input_node_t *curr = list->head;
+ input_node_t *prev = NULL;
+
+ while (curr != NULL) {
+ int cmp = list->data_comp(node->data, curr->data);
+
+ if (cmp == 0) {
+ /* error: duplicate code */
+ return false;
+ } else if (cmp < 0) {
+ /* insert before curr */
+ if (prev == NULL) {
+ /* no previous items */
+ node->next = curr;
+ list->head = node;
+ } else {
+ prev->next = node;
+ node->next = curr;
+ }
+ return true;
+ } else {
+ /* keep going */
+ prev = curr;
+ curr = curr->next;
+ }
+ }
+ /* append to tail of list */
+ prev->next = node;
+ return true;
+ }
+}
+
+
/* Forward declarations */
static bool bsd_joy_open (int joyport, joystick_device_t *joydev);
static void bsd_joy_poll (int joyport, joystick_device_t *joydev);
@@ -103,6 +182,10 @@
/** \brief Log for BSD joystick driver */
static log_t bsd_joy_log;
+static input_list_t axis_list;
+static input_list_t button_list;
+static input_list_t hat_list;
+
/** \brief BSD joystick driver declaration */
static joystick_driver_t driver = {
.open = bsd_joy_open,
@@ -155,6 +238,7 @@
}
}
+
static bool bsd_joy_open (int joyport, joystick_device_t *joydev)
{
return true; /* NOP */
@@ -432,7 +516,9 @@
button = joystick_button_new(hid_usage_in_page(item->usage));
button->code = (uint32_t)HID_USAGE(item->usage);
log_message(bsd_joy_log, "button %u: %s", button->code, button->name);
- joystick_device_add_button(joydev, button);
+
+ input_list_insert(&button_list, button);
+// joystick_device_add_button(joydev, button);
}
/** \brief Add hat to joystick device
@@ -565,18 +651,111 @@
}
+static int axis_comp(void *a1, void *a2)
+{
+ joystick_axis_t *axis1 = a1;
+ joystick_axis_t *axis2 = a2;
+
+ if (axis1->code == axis2->code) {
+ return 0;
+ } else if (axis1->code < axis2->code) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+static void axis_free(void *a)
+{
+ joystick_axis_free(a);
+}
+
+static int button_comp(void *b1, void *b2)
+{
+ joystick_button_t *btn1 = b1;
+ joystick_button_t *btn2 = b2;
+
+ if (btn1->code == btn2->code) {
+ return 0;
+ } else if (btn1->code < btn2->code) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+static void button_free(void *b)
+{
+ joystick_button_free(b);
+}
+static int hat_comp(void *h1, void *h2)
+{
+ joystick_hat_t *hat1 = h1;
+ joystick_hat_t *hat2 = h2;
+
+ if (hat1->code == hat2->code) {
+ return 0;
+ } else if (hat1->code < hat2->code) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+static void hat_free(void *h)
+{
+ joystick_hat_free(h);
+}
+
+
+static void add_ordered_axes(joystick_device_t *joydev)
+{
+ input_node_t *node = axis_list.head;
+ while (node != NULL) {
+ joystick_device_add_axis(joydev, node->data);
+ node = node->next;
+ }
+}
+
+static void add_ordered_buttons(joystick_device_t *joydev)
+{
+ input_node_t *node = button_list.head;
+ int num = 0;
+ while (node != NULL) {
+ joystick_button_t *button = node->data;
+
+ printf("BUTTON LIST: %d: 0x%04x \"%s\"\n", num, button->code, button->name);
+ joystick_device_add_button(joydev, button);
+ num++;
+ node = node->next;
+ }
+}
+
+static void add_ordered_hats(joystick_device_t *joydev)
+{
+ input_node_t *node = hat_list.head;
+ while (node != NULL) {
+ joystick_device_add_hat(joydev, node->data);
+ node = node->next;
+ }
+}
+
+
+
+
/** \brief Initialize BSD joystick driver and add available devices
*/
void bsd_joystick_init(void)
{
-struct dirent **namelist = NULL;
+ struct dirent **namelist = NULL;
int nl_count;
-int n;
+ int n;
bsd_joy_log = log_open("BSD Joystick");
log_message(bsd_joy_log, "Registering driver.");
joystick_driver_register(&driver);
+
/* Initialize HID library so we can retrieve strings for page and usage;
* without this button names will be "0x00001" etc, not very informative.
*/
@@ -603,8 +782,19 @@
joydev = scan_device(node);
if (joydev != NULL) {
log_message(bsd_joy_log, "%s: %s", joydev->node, joydev->name);
+
+ /* initialize lists to sort inputs on code */
+ input_list_init(&axis_list, axis_free, axis_comp);
+ input_list_init(&button_list, button_free, button_comp);
+ input_list_init(&hat_list, hat_free, hat_comp);
+
/* scan axes, buttons and hats */
if (scan_inputs(joydev)) {
+ /* add inputs to device in-order */
+ add_ordered_axes (joydev);
+ add_ordered_buttons(joydev);
+ add_ordered_hats (joydev);
+
/* OK: try to register */
if (!joystick_device_register(joydev)) {
/* failure */
@@ -613,6 +803,11 @@
joydev->node, joydev->name);
joystick_device_free(joydev);
}
+
+ /* free lists, but not their data */
+ input_list_free(&axis_list, false);
+ input_list_free(&button_list, false);
+ input_list_free(&hat_list, false);
} else {
log_warning(bsd_joy_log,
"failed to scan inputs for device %s (\"%s\")",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-12 13:31:57
|
Revision: 45525
http://sourceforge.net/p/vice-emu/code/45525
Author: compyx
Date: 2025-03-12 13:31:54 +0000 (Wed, 12 Mar 2025)
Log Message:
-----------
Joystick: Fix BSD driver to use new functions
Use the `joystick_[axis|button|hat]()` functions in the NetBSD/FreeBSD
joystick driver.
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-12 08:53:39 UTC (rev 45524)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-12 13:31:54 UTC (rev 45525)
@@ -166,7 +166,7 @@
int i;
for (i = 0; i < joydev->num_axes; i++) {
- if (joydev->axes[i].code == code) {
+ if (joydev->axes[i]->code == code) {
return i;
}
/* axis codes are *not* stored in-order like with Linux evdev, so we
@@ -180,7 +180,7 @@
int i;
for (i = 0; i < joydev->num_buttons; i++) {
- if (joydev->buttons[i].code == code) {
+ if (joydev->buttons[i]->code == code) {
return i;
}
/* button codes are *not* stored in-order like with Linux evdev, so we
@@ -194,7 +194,7 @@
int i;
for (i = 0; i < joydev->num_hats; i++) {
- if (joydev->hats[i].code == code) {
+ if (joydev->hats[i]->code == code) {
return i;
}
/* hat codes are *not* stored in-order like with Linux evdev, so we
@@ -408,17 +408,15 @@
static void add_joy_axis(joystick_device_t *joydev,
const struct hid_item *item)
{
- joystick_axis_t axis;
+ joystick_axis_t *axis;
- joystick_axis_init(&axis);
- axis.code = (uint16_t)HID_USAGE(item->usage);
- axis.name = lib_strdup(hid_usage_in_page(item->usage));
- axis.minimum = item->logical_minimum;
- axis.maximum = item->logical_maximum;
+ axis = joystick_axis_new(hid_usage_in_page(item->usage));
+ axis->code = (uint32_t)HID_USAGE(item->usage);
+ axis->minimum = item->logical_minimum;
+ axis->maximum = item->logical_maximum;
- log_message(bsd_joy_log, "axis %u: %s", (unsigned int)axis.code, axis.name);
- joystick_device_add_axis(joydev, &axis);
- lib_free(axis.name);
+ log_message(bsd_joy_log, "axis %u: %s", axis->code, axis->name);
+ joystick_device_add_axis(joydev, axis);
}
/** \brief Add button to joystick device
@@ -429,17 +427,12 @@
static void add_joy_button(joystick_device_t *joydev,
const struct hid_item *item)
{
- joystick_button_t button;
+ joystick_button_t *button;
- joystick_button_init(&button);
- button.code = (uint16_t)HID_USAGE(item->usage);
- /* NetBSD usbhid man page lies, function below returns `const char *`,
- * not `char *`, so we need a temporary copy:
- */
- button.name = lib_strdup(hid_usage_in_page(item->usage));
- log_message(bsd_joy_log, "button %u: %s", (unsigned int)button.code, button.name);
- joystick_device_add_button(joydev, &button);
- lib_free(button.name);
+ button = joystick_button_new(hid_usage_in_page(item->usage));
+ button->code = (uint32_t)HID_USAGE(item->usage);
+ log_message(bsd_joy_log, "button %u: %s", button->code, button->name);
+ joystick_device_add_button(joydev, button);
}
/** \brief Add hat to joystick device
@@ -450,14 +443,12 @@
static void add_joy_hat(joystick_device_t *joydev,
const struct hid_item *item)
{
- joystick_hat_t hat;
+ joystick_hat_t *hat;
- joystick_hat_init(&hat);
- hat.code = (uint16_t)HID_USAGE(item->usage);
- hat.name = lib_strdup(hid_usage_in_page(item->usage));
- log_message(bsd_joy_log, "hat %u: %s", (unsigned int)hat.code, hat.name);
- joystick_device_add_hat(joydev, &hat);
- lib_free(hat.name);
+ hat = joystick_hat_new(hid_usage_in_page(item->usage));
+ hat->code = (uint32_t)HID_USAGE(item->usage);
+ log_message(bsd_joy_log, "hat %u: %s", hat->code, hat->name);
+ joystick_device_add_hat(joydev, hat);
}
/** \brief Scan device for inputs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-12 08:53:41
|
Revision: 45524
http://sourceforge.net/p/vice-emu/code/45524
Author: compyx
Date: 2025-03-12 08:53:39 +0000 (Wed, 12 Mar 2025)
Log Message:
-----------
Joystick: turn axis, button and hat arrays into arrays of pointers
Reduce code complexity by using arrays of pointers to input objects instead of
arrays of input objects, and reduce number of allocations and deallocations
when adding inputs to joystick devices.
The `joystick_[axis|button|hat]_new()` functions now make a copy of the input's
name (if given) and the `joystick_device_add_[axis|button|hat]()` functions now
take ownership of the objects given.
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-11 17:32:47 UTC (rev 45523)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-12 08:53:39 UTC (rev 45524)
@@ -165,8 +165,8 @@
#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 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;
@@ -298,16 +298,14 @@
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;
+ joystick_button_t *button;
- joystick_button_init(&button);
- button.code = code;
- /* need to copy since event_code_get_name() returns const char* */
- button.name = lib_strdup(libevdev_event_code_get_name(EV_KEY, code));
+ 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;
- joystick_device_add_button(joydev, &button);
- lib_free(button.name);
+ /* joydev takes ownership of button */
+ joystick_device_add_button(joydev, button);
}
}
}
@@ -327,19 +325,18 @@
for (code = AXIS_CODE_MIN; code <= AXIS_CODE_MAX; code++) {
if (libevdev_has_event_code(evdev, EV_ABS, code)) {
const struct input_absinfo *info;
- joystick_axis_t axis;
+ joystick_axis_t *axis;
info = libevdev_get_abs_info(evdev, code);
- joystick_axis_init(&axis);
- axis.code = code;
- axis.name = lib_strdup(libevdev_event_code_get_name(EV_ABS, code));
+ axis = joystick_axis_new(libevdev_event_code_get_name(EV_ABS, code));
+ axis->code = code;
if (info != NULL) {
- axis.minimum = info->minimum;
- axis.maximum = info->maximum;
+ axis->minimum = info->minimum;
+ axis->maximum = info->maximum;
}
priv->axis_index[code - AXIS_CODE_MIN] = joydev->num_axes;
- joystick_device_add_axis(joydev, &axis);
- lib_free(axis.name);
+ /* 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-11 17:32:47 UTC (rev 45523)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-12 08:53:39 UTC (rev 45524)
@@ -853,7 +853,7 @@
{
if (joynum < num_joystick_devices) {
joystick_device_t *joydev = joystick_devices[joynum];
- joystick_axis_t *axis = &joydev->axes[axis_idx];
+ joystick_axis_t *axis = joydev->axes[axis_idx];
if ((joydev->joyport == 0 || joydev->joyport == 1) && (axis->mapping.pot > 0)) {
joystick_axis_value[joydev->joyport][axis->mapping.pot- 1] = value;
@@ -870,7 +870,9 @@
if (joystick_device_num >= 0 && joystick_device_num < num_joystick_devices) {
for (j = 0; j < joystick_devices[joystick_device_num]->num_axes; j++) {
- if (joystick_devices[joystick_device_num]->axes[j].mapping.pot - 1 == pot) {
+ joystick_device_t *joydev = joystick_devices[joystick_device_num];
+
+ if (joydev->axes[j]->mapping.pot - 1 == pot) {
snprintf(mapping_retval, sizeof mapping_retval, "Ax%d", j);
retval = mapping_retval;
}
@@ -890,12 +892,13 @@
char *index_string = NULL;
if (joystick_device_num >= 0 && joystick_device_num < num_joystick_devices) {
- for (j = 0; j < joystick_devices[joystick_device_num]->num_axes; j++) {
- joystick_mapping_t *positive;
- joystick_mapping_t *negative;
- joystick_axis_t *axis = &joystick_devices[joystick_device_num]->axes[j];
+ joystick_device_t *joydev = joystick_devices[joystick_device_num];
- positive = &axis->mapping.positive;
+ for (j = 0; j < joydev->num_axes; j++) {
+ joystick_axis_t *axis = joydev->axes[j];
+ joystick_mapping_t *positive = &axis->mapping.positive;
+ joystick_mapping_t *negative = &axis->mapping.negative;
+
if (positive->action == JOY_ACTION_JOYSTICK && positive->value.joy_pin == pin) {
valid++;
type_string = "Ax";
@@ -904,7 +907,6 @@
sub_index = 0;
}
- negative = &axis->mapping.negative;
if (negative->action == JOY_ACTION_JOYSTICK && negative->value.joy_pin == pin) {
valid++;
type_string = "Ax";
@@ -914,9 +916,10 @@
}
}
- for (j = 0; j < joystick_devices[joystick_device_num]->num_buttons; j++) {
- joystick_button_t *button = &joystick_devices[joystick_device_num]->buttons[j];
+ for (j = 0; j < joydev->num_buttons; j++) {
+ joystick_button_t *button = joydev->buttons[j];
joystick_mapping_t *mapping = &button->mapping;
+
if (mapping->action == JOY_ACTION_JOYSTICK) {
if (mapping->value.joy_pin == pin) {
valid++;
@@ -928,14 +931,13 @@
}
}
- for (j = 0; j < joystick_devices[joystick_device_num]->num_hats; j++) {
- joystick_mapping_t *up;
- joystick_mapping_t *down;
- joystick_mapping_t *left;
- joystick_mapping_t *right;
- joystick_hat_t *hat = &joystick_devices[joystick_device_num]->hats[j];
+ for (j = 0; j < joydev->num_hats; j++) {
+ joystick_hat_t *hat = joydev->hats[j];
+ joystick_mapping_t *up = &hat->mapping.up;
+ joystick_mapping_t *down = &hat->mapping.down;
+ joystick_mapping_t *left = &hat->mapping.left;
+ joystick_mapping_t *right = &hat->mapping.right;
- up = &hat->mapping.up;
if (up->action == JOY_ACTION_JOYSTICK) {
if (up->value.joy_pin == pin) {
valid++;
@@ -946,7 +948,6 @@
}
}
- down = &hat->mapping.down;
if (down->action == JOY_ACTION_JOYSTICK) {
if (down->value.joy_pin == pin) {
valid++;
@@ -957,7 +958,6 @@
}
}
- left = &hat->mapping.left;
if (left->action == JOY_ACTION_JOYSTICK) {
if (left->value.joy_pin == pin) {
valid++;
@@ -968,7 +968,6 @@
}
}
- right = &hat->mapping.right;
if (right->action == JOY_ACTION_JOYSTICK) {
if (right->value.joy_pin == pin) {
valid++;
@@ -1012,8 +1011,8 @@
joystick_device_t *joydev = joystick_devices[i];
for (j = 0; j < joystick_devices[i]->num_axes; j++) {
- joystick_mapping_t *positive = &joydev->axes[j].mapping.positive;
- joystick_mapping_t *negative = &joydev->axes[j].mapping.negative;
+ joystick_mapping_t *positive = &joydev->axes[j]->mapping.positive;
+ joystick_mapping_t *negative = &joydev->axes[j]->mapping.negative;
if (positive->action == (which ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
valid++;
@@ -1035,7 +1034,7 @@
}
for (j = 0; j < joystick_devices[i]->num_buttons; j++) {
- joystick_mapping_t *mapping = &joydev->buttons[j].mapping;
+ joystick_mapping_t *mapping = &joydev->buttons[j]->mapping;
if (mapping->action == (which ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
valid++;
@@ -1048,10 +1047,10 @@
}
for (j = 0; j < joystick_devices[i]->num_hats; j++) {
- joystick_mapping_t *up = &joydev->hats[j].mapping.up;
- joystick_mapping_t *down = &joydev->hats[j].mapping.down;
- joystick_mapping_t *left = &joydev->hats[j].mapping.left;
- joystick_mapping_t *right = &joydev->hats[j].mapping.right;
+ joystick_mapping_t *up = &joydev->hats[j]->mapping.up;
+ joystick_mapping_t *down = &joydev->hats[j]->mapping.down;
+ joystick_mapping_t *left = &joydev->hats[j]->mapping.left;
+ joystick_mapping_t *right = &joydev->hats[j]->mapping.right;
if (up->action == (which ? JOY_ACTION_MAP : JOY_ACTION_UI_ACTIVATE)) {
valid++;
@@ -1111,7 +1110,7 @@
void joy_set_pot_mapping(int joystick_device_num, int axis, int pot)
{
- joystick_devices[joystick_device_num]->axes[axis].mapping.pot = pot + 1;
+ joystick_devices[joystick_device_num]->axes[axis]->mapping.pot = pot + 1;
}
void joy_delete_pot_mapping(int joystick_device_num, int pot)
@@ -1122,7 +1121,7 @@
joystick_device_t *joydev = joystick_devices[joystick_device_num];
for (j = 0; j < joydev->num_axes; j++) {
- joystick_axis_t *axis = &joydev->axes[j];
+ joystick_axis_t *axis = joydev->axes[j];
if (axis->mapping.pot - 1 == pot) {
axis->mapping.pot = 0;
}
@@ -1138,8 +1137,8 @@
joystick_device_t *joydev = joystick_devices[joystick_device_num];
for (j = 0; j < joydev->num_axes; j++) {
- joystick_mapping_t *negative = &joydev->axes[j].mapping.negative;
- joystick_mapping_t *positive = &joydev->axes[j].mapping.positive;
+ joystick_mapping_t *negative = &joydev->axes[j]->mapping.negative;
+ joystick_mapping_t *positive = &joydev->axes[j]->mapping.positive;
if (positive->action == JOY_ACTION_JOYSTICK) {
if (positive->value.joy_pin == pin) {
@@ -1157,7 +1156,7 @@
}
for (j = 0; j < joydev->num_buttons; j++) {
- joystick_mapping_t *mapping = &joydev->buttons[j].mapping;
+ joystick_mapping_t *mapping = &joydev->buttons[j]->mapping;
if (mapping->action == JOY_ACTION_JOYSTICK) {
if (mapping->value.joy_pin == pin) {
@@ -1168,10 +1167,10 @@
}
for (j = 0; j < joydev->num_hats; j++) {
- joystick_mapping_t *up = &joydev->hats[j].mapping.up;
- joystick_mapping_t *down = &joydev->hats[j].mapping.down;
- joystick_mapping_t *left = &joydev->hats[j].mapping.left;
- joystick_mapping_t *right = &joydev->hats[j].mapping.right;
+ joystick_mapping_t *up = &joydev->hats[j]->mapping.up;
+ joystick_mapping_t *down = &joydev->hats[j]->mapping.down;
+ joystick_mapping_t *left = &joydev->hats[j]->mapping.left;
+ joystick_mapping_t *right = &joydev->hats[j]->mapping.right;
if (up->action == JOY_ACTION_JOYSTICK) {
if (up->value.joy_pin == pin) {
@@ -1358,7 +1357,7 @@
/* dump axis mappings */
for (inp_idx = 0; inp_idx < joydev->num_axes; inp_idx++) {
- joystick_axis_t *axis = &joydev->axes[inp_idx];
+ joystick_axis_t *axis = joydev->axes[inp_idx];
if (axis->mapping.pot > 0) {
fprintf(fp, "%i %i %i %i %u\n",
@@ -1373,7 +1372,7 @@
/* dump button mappings */
for (inp_idx = 0; inp_idx < joydev->num_buttons; inp_idx++) {
- joystick_button_t *button = &joydev->buttons[inp_idx];
+ joystick_button_t *button = joydev->buttons[inp_idx];
mapping_dump_map(fp, dev_idx, JOY_INPUT_BUTTON, inp_idx, &button->mapping);
}
@@ -1382,7 +1381,7 @@
/* dump hat mappings */
row = 0;
for (inp_idx = 0; inp_idx < joydev->num_hats; inp_idx++) {
- joystick_hat_t *hat = &joydev->hats[inp_idx];
+ joystick_hat_t *hat = joydev->hats[inp_idx];
/* indexes 0-3 are hardcoded to up, down, left and right */
mapping_dump_map(fp, dev_idx, JOY_INPUT_HAT, row + 0, &hat->mapping.up);
@@ -1411,17 +1410,17 @@
joystick_device_t *joydev = joystick_devices[i];
for (k = 0; k < joydev->num_axes; ++k) {
- joydev->axes[k].mapping.positive.action = JOY_ACTION_NONE;
- joydev->axes[k].mapping.negative.action = JOY_ACTION_NONE;
+ joydev->axes[k]->mapping.positive.action = JOY_ACTION_NONE;
+ joydev->axes[k]->mapping.negative.action = JOY_ACTION_NONE;
}
for (k = 0; k < joystick_devices[i]->num_buttons; ++k) {
- joydev->buttons[k].mapping.action = JOY_ACTION_NONE;
+ joydev->buttons[k]->mapping.action = JOY_ACTION_NONE;
}
for (k = 0; k < joystick_devices[i]->num_hats; ++k) {
- joydev->hats[k].mapping.up.action = JOY_ACTION_NONE;
- joydev->hats[k].mapping.down.action = JOY_ACTION_NONE;
- joydev->hats[k].mapping.left.action = JOY_ACTION_NONE;
- joydev->hats[k].mapping.right.action = JOY_ACTION_NONE;
+ joydev->hats[k]->mapping.up.action = JOY_ACTION_NONE;
+ joydev->hats[k]->mapping.down.action = JOY_ACTION_NONE;
+ joydev->hats[k]->mapping.left.action = JOY_ACTION_NONE;
+ joydev->hats[k]->mapping.right.action = JOY_ACTION_NONE;
}
}
}
@@ -1598,7 +1597,7 @@
if (state->action == JOY_ACTION_POT_AXIS) {
/* map to potentiometer */
if (state->input_index < joydev->num_axes) {
- joydev->axes[state->input_index].mapping.pot = state->args.pot;
+ joydev->axes[state->input_index]->mapping.pot = state->args.pot;
} else {
result = false;
}
@@ -1612,7 +1611,7 @@
__func__, index, direction == 0 ? "positive" : "negative");
#endif
if (index < joydev->num_axes) {
- joystick_axis_t *axis = &joydev->axes[index];
+ joystick_axis_t *axis = joydev->axes[index];
joystick_mapping_t *mapping;
/* select directional mapping */
@@ -1648,7 +1647,7 @@
bool result = true;
if (index < joydev->num_buttons) {
- joystick_mapping_t *mapping = &joydev->buttons[index].mapping;
+ joystick_mapping_t *mapping = &joydev->buttons[index]->mapping;
parser_set_mapping(state, mapping);
} else {
parser_log_error(state,
@@ -1672,7 +1671,7 @@
joystick_device_t *joydev = joystick_devices[state->joy_index];
if (index < joydev->num_hats) {
- joystick_hat_t *hat = &joydev->hats[index];
+ joystick_hat_t *hat = joydev->hats[index];
joystick_mapping_t *mapping;
switch (direction) {
@@ -2994,7 +2993,7 @@
void joy_axis_event(uint8_t joynum, uint8_t axis_index, joystick_axis_value_t value)
{
joystick_device_t *joydev = joystick_devices[joynum];
- joystick_axis_t *axis = &joydev->axes[axis_index];
+ joystick_axis_t *axis = joydev->axes[axis_index];
joystick_axis_value_t prev = axis->prev;
int joyport = joydev->joyport;
@@ -3040,13 +3039,13 @@
}
}
#endif
- if (pressed != joydev->buttons[button].prev) {
+ 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,
+ joy_perform_event(&joydev->buttons[button]->mapping,
joydev->joyport,
pressed);
- joydev->buttons[button].prev = pressed;
+ joydev->buttons[button]->prev = pressed;
}
}
@@ -3053,7 +3052,7 @@
void joy_hat_event(uint8_t joynum, uint8_t hat_idx, uint8_t value)
{
joystick_device_t *joydev = joystick_devices[joynum];
- joystick_hat_t *hat = &joydev->hats[hat_idx];
+ joystick_hat_t *hat = joydev->hats[hat_idx];
int joyport = joydev->joyport;
int32_t prev = hat->prev;
@@ -3287,17 +3286,17 @@
lib_free(joydev->node);
for (i = 0; i < joydev->num_axes; i++) {
- lib_free(joydev->axes[i].name);
+ joystick_axis_free(joydev->axes[i]);
}
lib_free(joydev->axes);
for (i = 0; i < joydev->num_buttons; i++) {
- lib_free(joydev->buttons[i].name);
+ joystick_button_free(joydev->buttons[i]);
}
lib_free(joydev->buttons);
for (i = 0; i < joydev->num_hats; i++) {
- lib_free(joydev->hats[i].name);
+ joystick_hat_free(joydev->hats[i]);
}
lib_free(joydev->hats);
@@ -3326,15 +3325,15 @@
{
if (joydev->num_hats > 0) {
/* if the controller as a "hat", use that for joystick directions */
- joystick_hat_t *hat = &joydev->hats[0];
+ joystick_hat_t *hat = joydev->hats[0];
- hat->mapping.up.action = JOY_ACTION_JOYSTICK;
- hat->mapping.up.value.joy_pin = JOYSTICK_DIRECTION_UP;
- hat->mapping.down.action = JOY_ACTION_JOYSTICK;
- hat->mapping.down.value.joy_pin = JOYSTICK_DIRECTION_DOWN;
- hat->mapping.left.action = JOY_ACTION_JOYSTICK;
- hat->mapping.left.value.joy_pin = JOYSTICK_DIRECTION_LEFT;
- hat->mapping.right.action = JOY_ACTION_JOYSTICK;
+ hat->mapping.up.action = JOY_ACTION_JOYSTICK;
+ hat->mapping.up.value.joy_pin = JOYSTICK_DIRECTION_UP;
+ hat->mapping.down.action = JOY_ACTION_JOYSTICK;
+ hat->mapping.down.value.joy_pin = JOYSTICK_DIRECTION_DOWN;
+ hat->mapping.left.action = JOY_ACTION_JOYSTICK;
+ hat->mapping.left.value.joy_pin = JOYSTICK_DIRECTION_LEFT;
+ hat->mapping.right.action = JOY_ACTION_JOYSTICK;
hat->mapping.right.value.joy_pin = JOYSTICK_DIRECTION_RIGHT;
} else if (joydev->num_axes > 1) {
@@ -3341,8 +3340,8 @@
/* If no hat exists, but we have at least two axes, we use those for
* joystick directions. We assume the first axis is horizontal and the
* next one vertical, controlling the same (thumb)stick. */
- joystick_axis_t *x = &joydev->axes[0];
- joystick_axis_t *y = &joydev->axes[1];
+ joystick_axis_t *x = joydev->axes[0];
+ joystick_axis_t *y = joydev->axes[1];
x->mapping.negative.action = JOY_ACTION_JOYSTICK;
x->mapping.negative.value.joy_pin = JOYSTICK_DIRECTION_LEFT;
@@ -3372,13 +3371,13 @@
joystick_button_t *button;
/* primary fire button */
- button = &joydev->buttons[0];
+ button = joydev->buttons[0];
button->mapping.action = JOY_ACTION_JOYSTICK;
button->mapping.value.joy_pin = 16;
if (joydev->num_buttons > 1) {
/* secondary fire button */
- button = &joydev->buttons[1];
+ button = joydev->buttons[1];
button->mapping.action = JOY_ACTION_JOYSTICK;
button->mapping.value.joy_pin = 32;
}
@@ -3385,7 +3384,7 @@
if (joydev->num_buttons > 2) {
/* ternary fire button */
- button = &joydev->buttons[2];
+ button = joydev->buttons[2];
button->mapping.action = JOY_ACTION_JOYSTICK;
button->mapping.value.joy_pin = 64;
}
@@ -3435,7 +3434,7 @@
}
-void joystick_axis_init(joystick_axis_t *axis)
+static void joystick_axis_init(joystick_axis_t *axis)
{
axis->code = 0;
axis->name = NULL;
@@ -3448,8 +3447,7 @@
joystick_mapping_init(&axis->mapping.positive);
}
-
-void joystick_button_init(joystick_button_t *button)
+static void joystick_button_init(joystick_button_t *button)
{
button->code = 0;
button->name = NULL;
@@ -3458,8 +3456,7 @@
joystick_mapping_init(&button->mapping);
}
-
-void joystick_hat_init(joystick_hat_t *hat)
+static void joystick_hat_init(joystick_hat_t *hat)
{
hat->code = 0;
hat->name = NULL;
@@ -3472,34 +3469,75 @@
}
+joystick_axis_t *joystick_axis_new(const char *name)
+{
+ joystick_axis_t *axis = lib_malloc(sizeof *axis);
+ joystick_axis_init(axis);
+ if (name != NULL) {
+ axis->name = lib_strdup(name);
+ }
+ return axis;
+}
-void joystick_device_add_button(joystick_device_t *joydev,
- joystick_button_t *button)
+
+void joystick_axis_free(joystick_axis_t *axis)
{
- joystick_button_t *new_button;
+ if (axis != NULL) {
+ lib_free(axis->name);
+ lib_free(axis);
+ }
+}
- if (joydev->num_buttons == joydev->max_buttons) {
- joydev->max_buttons *= 2;
- joydev->buttons = lib_realloc(joydev->buttons,
- sizeof *joydev->buttons * (size_t)joydev->max_buttons);
+
+joystick_button_t *joystick_button_new(const char *name)
+{
+ joystick_button_t *button = lib_malloc(sizeof *button);
+
+ joystick_button_init(button);
+ if (name != NULL) {
+ button->name = lib_strdup(name);
}
+ return button;
+}
- new_button = &joydev->buttons[joydev->num_buttons];
- joystick_button_init(new_button);
- new_button->code = button->code;
- new_button->name = lib_strdup(button->name);
- new_button->index = joydev->num_buttons;
- joydev->num_buttons++;
+void joystick_button_free(joystick_button_t *button)
+{
+ if (button != NULL) {
+ lib_free(button->name);
+ lib_free(button);
+ }
}
-/** \@brief Add axis data to joystick device
+joystick_hat_t *joystick_hat_new(const char *name)
+{
+ joystick_hat_t *hat = lib_malloc(sizeof *hat);
+
+ joystick_hat_init(hat);
+ if (name != NULL) {
+ hat->name = lib_strdup(name);
+ }
+ return hat;
+}
+
+
+void joystick_hat_free(joystick_hat_t *hat)
+{
+ if (hat != NULL) {
+ lib_free(hat->name);
+ lib_free(hat);
+ }
+}
+
+
+
+/** \@brief Add axis object to joystick device
*
- * Adds \a axis to the \c axes array in \c joydev, making a deep copy of the
- * data in \a axis. Also determines if \a axis is digital or not (minimum == -1,
- * maximum == 1).
+ * Adds \a axis to the \c axes array in \a joydev, with ownership of \a axis
+ * transfered to \a joydev.
+ * Also determines if \a axis is digital or not (minimum == -1, maximum == 1).
*
* \param[in] joydev joystick device
* \param[in] axis axis object
@@ -3507,43 +3545,50 @@
void joystick_device_add_axis(joystick_device_t *joydev,
joystick_axis_t *axis)
{
- joystick_axis_t *new_axis;
-
if (joydev->num_axes == joydev->max_axes) {
joydev->max_axes *= 2;
joydev->axes = lib_realloc(joydev->axes,
sizeof *joydev->axes * (size_t)joydev->max_axes);
}
+ joydev->axes[joydev->num_axes++] = axis;
+}
- new_axis = &joydev->axes[joydev->num_axes];
- joystick_axis_init(new_axis);
- new_axis->code = axis->code;
- new_axis->name = lib_strdup(axis->name);
- new_axis->index = joydev->num_axes;
- new_axis->minimum = axis->minimum;
- new_axis->maximum = axis->maximum;
- new_axis->digital = (bool)((axis->minimum == -1) && (axis->maximum == 1));
- joydev->num_axes++;
+/** \brief Add button object to joystick device
+ *
+ * Adds \a button to the \c buttons array in \a joydev, with ownership of
+ * \a button transfered to \a joydev.
+ *
+ * \param[in] joydev joystick device
+ * \param[in] button button object
+ */
+void joystick_device_add_button(joystick_device_t *joydev,
+ joystick_button_t *button)
+{
+ if (joydev->num_buttons == joydev->max_buttons) {
+ joydev->max_buttons *= 2;
+ joydev->buttons = lib_realloc(joydev->buttons,
+ sizeof *joydev->buttons * (size_t)joydev->max_buttons);
+ }
+ joydev->buttons[joydev->num_buttons++] = button;
}
+/** \brief Add hat object to joystick device
+ *
+ * Adds \a hat to the \c hats array in \a joydev, with ownership of \a hat
+ * transfered to \a joydev.
+ *
+ * \param[in] joydev joystick device
+ * \param[in] hat hat object
+ */
void joystick_device_add_hat(joystick_device_t *joydev,
joystick_hat_t *hat)
{
- joystick_hat_t *new_hat;
-
if (joydev->num_hats == joydev->max_hats) {
joydev->num_hats *= 2;
joydev->hats = lib_realloc(joydev->hats,
sizeof *joydev->hats * (size_t)joydev->max_hats);
}
-
- new_hat = &joydev->hats[joydev->num_hats];
- joystick_hat_init(new_hat);
- new_hat->code = hat->code;
- new_hat->name = lib_strdup(hat->name);
- new_hat->index = joydev->num_hats;
-
- joydev->num_hats++;
+ joydev->hats[joydev->num_hats++] = hat;
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-11 17:32:47 UTC (rev 45523)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-12 08:53:39 UTC (rev 45524)
@@ -240,7 +240,7 @@
*/
typedef struct joystick_device_s {
/** \brief Device name ("<vendor-name> <product-name>") */
- char *name;
+ char *name;
/** \brief Arch-specific device identifier
*
@@ -249,39 +249,39 @@
* For example on Linux this will be a "file" in the <tt>/dev/input/</tt>
* directory.
*/
- char *node;
+ char *node;
/** \brief HID vendor ID */
- uint16_t vendor;
+ uint16_t vendor;
/** \brief HID product ID */
- uint16_t product;
+ uint16_t product;
/** \brief List of axes */
- joystick_axis_t *axes;
+ joystick_axis_t **axes;
/** \brief List of buttons */
- joystick_button_t *buttons;
+ joystick_button_t **buttons;
/** \brief List of hats */
- joystick_hat_t *hats;
+ joystick_hat_t **hats;
/** \brief Number of axes */
- int num_axes;
+ int num_axes;
/** \brief Number of buttons */
- int num_buttons;
+ int num_buttons;
/** \brief Number of hats */
- int num_hats;
+ int num_hats;
/* bookkeeping for resizing arrays when adding elements */
- size_t max_axes; /**< size of \c axes array */
- size_t max_buttons; /**< size of \c buttons array */
- size_t max_hats; /**< size of \c hats array */
+ size_t max_axes; /**< size of \c axes array */
+ size_t max_buttons; /**< size of \c buttons array */
+ size_t max_hats; /**< size of \c hats array */
/** \brief Emulated machine's joystick port associated with host device */
- int joyport;
+ int joyport;
/** \brief Private arch-specific data
*
@@ -293,7 +293,7 @@
* For example: the Linux driver stores a \c joy_priv_t object here that
* contains a file descriptor and a \c struct libevdev instance.
*/
- void *priv;
+ void *priv;
} joystick_device_t;
@@ -409,8 +409,12 @@
joystick_hat_t *hat);
void joystick_mapping_init (joystick_mapping_t *mapping);
-void joystick_axis_init (joystick_axis_t *axis);
-void joystick_button_init (joystick_button_t *button);
-void joystick_hat_init (joystick_hat_t *hat);
+joystick_axis_t *joystick_axis_new (const char *name);
+void joystick_axis_free (joystick_axis_t *axis);
+joystick_button_t *joystick_button_new (const char *name);
+void joystick_button_free (joystick_button_t *button);
+joystick_hat_t *joystick_hat_new (const char *name);
+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-11 17:32:55
|
Revision: 45523
http://sourceforge.net/p/vice-emu/code/45523
Author: compyx
Date: 2025-03-11 17:32:47 +0000 (Tue, 11 Mar 2025)
Log Message:
-----------
Joystick: Linux: avoid iteration in input index lookups
Keep maps of event codes to indexes in `joy_priv_t` to avoid having to iterate
over arrays of axes or buttons to determine their index based on the event code
obtained during polling. Adds array of 63 integers [0x100..0x13e] for buttons,
41 integers [0x00..0x28] for axes (per joystick device), removes two functions.
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-11 12:11:53 UTC (rev 45522)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-11 17:32:47 UTC (rev 45523)
@@ -91,16 +91,8 @@
typedef struct joy_priv_s {
struct libevdev *evdev; /**< evdev instance */
int fd; /**< file descriptor */
-#if 0
- char *name; /**< device name */
- uint16_t vendor; /**< vendor ID */
- uint16_t product; /**< product ID */
- uint16_t version; /**< product version */
- uint32_t num_axes; /**< number of axes */
- uint32_t num_buttons; /**< number of buttons */
- joy_axis_t axes[NUM_AXES_MAX]; /**< list of axes */
- uint16_t buttons[NUM_BUTTONS_MAX]; /**< list of buttons */
-#endif
+ 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;
@@ -108,68 +100,6 @@
static log_t joy_evdev_log;
-#if 0
-/** \brief Initialize joystick axis data
- *
- * \param[in] axis joystick axis data
- */
-static void joy_axis_init(joy_axis_t *axis)
-{
- axis->code = 0;
- axis->minimum = INT16_MIN;
- axis->maximum = INT16_MAX;
-}
-#endif
-
-/** \brief Get index of axis event code
- *
- * \param[in] priv driver-specific joystick data
- * \param[in] code axis event code
- *
- * \return index in axes array or -1 when not found
- */
-static int joy_axis_index(joystick_device_t *joydev, uint32_t code)
-{
- int i;
-
- /* ABS_X (AXIS_CODE_MIN) is 0 and comparing unsigned for < 0 is alway false */
- if (code > AXIS_CODE_MAX) {
- return -1;
- }
- 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 stored in order */
- }
- }
- return -1;
-}
-
-/** \brief Get index of button event code
- *
- * \param[in] priv driver-specific joystick data
- * \param[in] code button event code
- *
- * \return index in buttons array or -1 when not found
- */
-static int joy_button_index(joystick_device_t *joydev, uint32_t code)
-{
- int i;
-
- if (code < BUTTON_CODE_MIN || code > BUTTON_CODE_MAX) {
- return -1;
- }
- 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 stored in order */
- }
- }
- return -1;
-}
-
/** \brief Allocate and initialize driver-specific joystick data
*
* \return new data instance, free with \c lib_free()
@@ -181,6 +111,8 @@
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;
}
@@ -212,15 +144,16 @@
joystick_device_t *joydev,
struct input_event *event)
{
- int index;
+ joy_priv_t *priv = joydev->priv;
+ int index;
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);
-
- index = joy_button_index(joydev, event->code);
+#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);
}
@@ -230,7 +163,7 @@
event->code, libevdev_event_code_get_name(EV_ABS, event->code),
event->value);
#endif
- index = joy_axis_index(joydev, event->code);
+ 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;
@@ -360,16 +293,19 @@
static void scan_buttons(joystick_device_t *joydev, struct libevdev *evdev)
{
if (libevdev_has_event_type(evdev, EV_KEY)) {
- unsigned int code;
+ uint32_t code;
for (code = BUTTON_CODE_MIN; code <= BUTTON_CODE_MAX; code++) {
if (libevdev_has_event_code(evdev, EV_KEY, code)) {
- joystick_button_t button;
+ joy_priv_t *priv = joydev->priv;
+ joystick_button_t button;
joystick_button_init(&button);
- button.code = (uint16_t)code;
+ button.code = code;
/* need to copy since event_code_get_name() returns const char* */
button.name = lib_strdup(libevdev_event_code_get_name(EV_KEY, code));
+ /* store index in buttons array */
+ priv->button_index[code - BUTTON_CODE_MIN] = joydev->num_buttons;
joystick_device_add_button(joydev, &button);
lib_free(button.name);
}
@@ -385,7 +321,8 @@
static void scan_axes(joystick_device_t *joydev, struct libevdev *evdev)
{
if (libevdev_has_event_type(evdev, EV_ABS)) {
- unsigned int code;
+ joy_priv_t *priv = joydev->priv;
+ uint32_t code;
for (code = AXIS_CODE_MIN; code <= AXIS_CODE_MAX; code++) {
if (libevdev_has_event_code(evdev, EV_ABS, code)) {
@@ -394,12 +331,13 @@
info = libevdev_get_abs_info(evdev, code);
joystick_axis_init(&axis);
- axis.code = (uint16_t)code;
+ axis.code = code;
axis.name = lib_strdup(libevdev_event_code_get_name(EV_ABS, code));
if (info != NULL) {
axis.minimum = info->minimum;
axis.maximum = info->maximum;
}
+ priv->axis_index[code - AXIS_CODE_MIN] = joydev->num_axes;
joystick_device_add_axis(joydev, &axis);
lib_free(axis.name);
}
@@ -407,55 +345,6 @@
}
}
-#if 0
-/** \brief Scan possible joystick device for capabilities
- *
- * Try to open \a node and process with libevdev to determine its capabilities.
- *
- * Determines supported button event codes and axis event codes, along with
- * axis minimum/maximum values for correct translation into axis direction.
- *
- * \param[in] node node name in \c /dev/input/
- *
- * \return new \c joy_priv_t instance on success, \c NULL on failure
- */
-static joy_priv_t *scan_device(const char *node)
-{
- struct libevdev *evdev;
- joy_priv_t *priv;
- char path[256];
- int fd;
- int rc;
-
- snprintf(path, sizeof path, "/dev/input/%s", node);
-
- fd = open(path, O_RDONLY|O_NONBLOCK);
- if (fd < 0) {
- return NULL;
- }
-
- rc = libevdev_new_from_fd(fd, &evdev);
- if (rc < 0) {
- log_error(LOG_DEFAULT, "failed to initialize libevdev: %s", strerror(rc));
- close(fd);
- return NULL;
- }
-
- priv = joy_priv_new();
- priv->name = lib_strdup(libevdev_get_name(evdev));
- priv->vendor = (uint16_t)libevdev_get_id_vendor(evdev);
- priv->product = (uint16_t)libevdev_get_id_product(evdev);
- priv->version = (uint16_t)libevdev_get_id_version(evdev);
- priv->evdev = evdev;
- priv->fd = fd;
-
- scan_axes(priv, evdev);
- scan_buttons(priv, evdev);
-
- return priv;
-}
-#endif
-
static joystick_device_t *scan_device(const char *node)
{
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-11 12:11:56
|
Revision: 45522
http://sourceforge.net/p/vice-emu/code/45522
Author: compyx
Date: 2025-03-11 12:11:53 +0000 (Tue, 11 Mar 2025)
Log Message:
-----------
Joystick: add `index` field to axis, button and hat objects
Store object's index in its container in the object, to keep the current
index-based object passing intact while working towards passing objects to
event handlers instead of simple indexes.
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-10 20:58:55 UTC (rev 45521)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-11 12:11:53 UTC (rev 45522)
@@ -77,14 +77,6 @@
#define NUM_BUTTONS_MAX (BUTTON_CODE_MAX - BUTTON_CODE_MIN + 1u)
-/** \brief Joystick axis object
- */
-typedef struct joy_axis_s {
- uint16_t code; /**< event code */
- int32_t minimum; /**< minimum value */
- int32_t maximum; /**< maximum value */
-} joy_axis_t;
-
/** \brief Driver-specific joystick data
*
* Contains data required by the evdev driver that isn't stored in the generic
@@ -136,7 +128,7 @@
*
* \return index in axes array or -1 when not found
*/
-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;
@@ -161,7 +153,7 @@
*
* \return index in buttons array or -1 when not found
*/
-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;
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-10 20:58:55 UTC (rev 45521)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-11 12:11:53 UTC (rev 45522)
@@ -3440,6 +3440,7 @@
axis->code = 0;
axis->name = NULL;
axis->prev = 0;
+ axis->index = -1;
axis->minimum = INT16_MIN;
axis->maximum = INT16_MAX;
axis->digital = false;
@@ -3450,9 +3451,10 @@
void joystick_button_init(joystick_button_t *button)
{
- button->code = 0;
- button->name = NULL;
- button->prev = 0;
+ button->code = 0;
+ button->name = NULL;
+ button->prev = 0;
+ button->index = -1;
joystick_mapping_init(&button->mapping);
}
@@ -3459,9 +3461,10 @@
void joystick_hat_init(joystick_hat_t *hat)
{
- hat->code = 0;
- hat->name = NULL;
- hat->prev = 0;
+ hat->code = 0;
+ hat->name = NULL;
+ hat->prev = 0;
+ hat->index = -1;
joystick_mapping_init(&hat->mapping.up);
joystick_mapping_init(&hat->mapping.down);
joystick_mapping_init(&hat->mapping.left);
@@ -3484,8 +3487,9 @@
new_button = &joydev->buttons[joydev->num_buttons];
joystick_button_init(new_button);
- new_button->code = button->code;
- new_button->name = lib_strdup(button->name);
+ new_button->code = button->code;
+ new_button->name = lib_strdup(button->name);
+ new_button->index = joydev->num_buttons;
joydev->num_buttons++;
}
@@ -3515,6 +3519,7 @@
joystick_axis_init(new_axis);
new_axis->code = axis->code;
new_axis->name = lib_strdup(axis->name);
+ new_axis->index = joydev->num_axes;
new_axis->minimum = axis->minimum;
new_axis->maximum = axis->maximum;
new_axis->digital = (bool)((axis->minimum == -1) && (axis->maximum == 1));
@@ -3536,8 +3541,9 @@
new_hat = &joydev->hats[joydev->num_hats];
joystick_hat_init(new_hat);
- new_hat->code = hat->code;
- new_hat->name = lib_strdup(hat->name);
+ new_hat->code = hat->code;
+ new_hat->name = lib_strdup(hat->name);
+ new_hat->index = joydev->num_hats;
joydev->num_hats++;
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-10 20:58:55 UTC (rev 45521)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-11 12:11:53 UTC (rev 45522)
@@ -180,9 +180,10 @@
* Information on a host device button input.
*/
typedef struct joystick_button_s {
- uint16_t code; /**< event code */
+ uint32_t code; /**< event code */
char *name; /**< button name */
int32_t prev; /**< previous polled value */
+ int32_t index; /**< index in buttons array */
joystick_mapping_t mapping; /**< button mapping */
/* TODO: add calibration data struct */
} joystick_button_t;
@@ -193,8 +194,9 @@
* Information on a host device axis input.
*/
typedef struct joystick_axis_s {
- uint16_t code; /**< axis event code */
+ uint32_t code; /**< axis event code */
char *name; /**< axis name */
+ int32_t index; /**< index in hats array */
int32_t prev; /**< previous polled value */
/* capabilities (TODO: more data like fuzz, flat) */
int32_t minimum; /**< minimum axis value */
@@ -219,8 +221,9 @@
* Information on a host device hat input.
*/
typedef struct joystick_hat_s {
- uint16_t code; /**< hat event code */
+ uint32_t code; /**< hat event code */
char *name; /**< hat name */
+ int32_t index; /**< index in hats array (for the old API) */
int32_t prev; /**< previous polled value */
struct {
joystick_mapping_t up; /**< mapping for 'up' direction */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-10 20:59:03
|
Revision: 45521
http://sourceforge.net/p/vice-emu/code/45521
Author: compyx
Date: 2025-03-10 20:58:55 +0000 (Mon, 10 Mar 2025)
Log Message:
-----------
Joystick: BSD: implement rudimentary polling
Polling "works", except apparently hid reports on inputs come in some
undefined order, so our default mappings fail horribly.
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-10 16:38:39 UTC (rev 45520)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-10 20:58:55 UTC (rev 45521)
@@ -145,7 +145,9 @@
if (p->fd >= 0) {
close(p->fd);
}
- lib_free(p->buffer);
+ if (p->buffer != NULL) {
+ lib_free(p->buffer);
+ }
if (p->rep_desc != NULL) {
hid_dispose_report_desc(p->rep_desc);
}
@@ -158,16 +160,142 @@
return true; /* NOP */
}
-static void bsd_joy_poll (int joyport, joystick_device_t *joydev)
+
+static int joy_axis_index(joystick_device_t *joydev, uint16_t code)
{
- /* NOP */
+ int i;
+
+ for (i = 0; i < joydev->num_axes; i++) {
+ if (joydev->axes[i].code == code) {
+ return i;
+ }
+ /* 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)
+{
+ int i;
+
+ for (i = 0; i < joydev->num_buttons; i++) {
+ if (joydev->buttons[i].code == code) {
+ return i;
+ }
+ /* 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)
+{
+ int i;
+
+ for (i = 0; i < joydev->num_hats; i++) {
+ if (joydev->hats[i].code == code) {
+ return i;
+ }
+ /* 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)
+{
+ joy_priv_t *priv = joydev->priv;
+
+ if (priv != NULL && priv->fd >= 0) {
+ ssize_t rsize;
+
+ while ((rsize = read(priv->fd, priv->buffer, (size_t)priv->rep_size)) == priv->rep_size) {
+ struct hid_data *data;
+ struct hid_item item;
+ int index;
+
+ data = hid_start_parse(priv->rep_desc, 1 << hid_input, priv->rep_id);
+ if (data == NULL) {
+ return;
+ }
+
+ while (hid_get_item(data, &item) > 0) {
+ int value = hid_get_data(priv->buffer, &item);
+ int usage = HID_USAGE(item.usage);
+ unsigned int page = HID_PAGE(item.usage);
+
+ switch (page) {
+ case HUP_GENERIC_DESKTOP:
+ switch (usage) {
+ case HUG_X: /* fall through */
+ case HUG_Y: /* fall through */
+ case HUG_Z: /* fall through */
+ case HUG_RX: /* fall through */
+ case HUG_RY: /* fall through */
+ case HUG_RZ: /* fall through */
+ case HUG_SLIDER:
+ /* axis */
+ index = joy_axis_index(joydev, (uint16_t)usage);
+ if (index >= 0) {
+ //joy_axis_event(joyport, (uint8_t)index, (uint8_t)value);
+ }
+ break;
+
+ case HUG_HAT_SWITCH:
+ /* hat */
+ index = joy_hat_index(joydev, (uint16_t)usage);
+ if (index >= 0) {
+ //joy_hat_event(joyport, (uint8_t)index, (uint8_t)value);
+ }
+ break;
+
+ case HUG_D_PAD_UP: /* fall through */
+ case HUG_D_PAD_DOWN: /* fall through */
+ case HUG_D_PAD_LEFT: /* fall through */
+ case HUG_D_PAD_RIGHT:
+ /* D-Pad is mapped as buttons */
+ index = joy_button_index(joydev, (uint16_t)usage);
+ if (index >= 0) {
+ joy_button_event(joyport, (uint8_t)index, (uint8_t)value);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case HUP_BUTTON:
+ /* button event */
+ index = joy_button_index(joydev, (uint16_t)usage);
+ if (index >= 0) {
+ joy_button_event(joyport, (uint8_t)index, (uint8_t)value);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ hid_end_parse(data);
+ }
+
+ if (rsize != -1 && errno != EAGAIN) {
+ log_warning(bsd_joy_log,
+ "weird report size: %zd: %s",
+ rsize, strerror(errno));
+ }
+ }
+}
+
static void bsd_joy_close(joystick_device_t *joydev)
{
- /* NOP */
+ if (joydev != NULL && joydev->priv != NULL) {
+ joy_priv_free(joydev->priv);
+ joydev->priv = NULL;
+ }
}
+
/** \brief scandir select callback
*
* Check if name matches "uhid?*".
@@ -283,7 +411,7 @@
joystick_axis_t axis;
joystick_axis_init(&axis);
- axis.code = (uint16_t)HID_USAGE(item->usage);
+ axis.code = (uint16_t)HID_USAGE(item->usage);
axis.name = lib_strdup(hid_usage_in_page(item->usage));
axis.minimum = item->logical_minimum;
axis.maximum = item->logical_maximum;
@@ -403,6 +531,9 @@
*
* \param[in] node device node to scan
*
+ * \todo Order axes, buttons and hats by HID_USAGE() (event code), otherwise
+ * our default mappings fail spectacularly =D
+ *
* \return new joystick device instance or <tt>NULL</tt> on error
*/
static joystick_device_t *scan_device(const char *node)
@@ -447,9 +578,9 @@
*/
void bsd_joystick_init(void)
{
- struct dirent **namelist = NULL;
+struct dirent **namelist = NULL;
int nl_count;
- int n;
+int n;
bsd_joy_log = log_open("BSD Joystick");
log_message(bsd_joy_log, "Registering driver.");
@@ -472,6 +603,7 @@
return;
}
+ /* scan uhid device nodes and register valid joystick devices */
for (n = 0; n < nl_count; n++) {
joystick_device_t *joydev;
char *node;
@@ -480,11 +612,22 @@
joydev = scan_device(node);
if (joydev != NULL) {
log_message(bsd_joy_log, "%s: %s", joydev->node, joydev->name);
- if (!scan_inputs(joydev)) {
+ /* scan axes, buttons and hats */
+ if (scan_inputs(joydev)) {
+ /* OK: try to register */
+ if (!joystick_device_register(joydev)) {
+ /* failure */
+ log_warning(bsd_joy_log,
+ "failed to register device %s (\"%s\")",
+ joydev->node, joydev->name);
+ joystick_device_free(joydev);
+ }
+ } else {
+ log_warning(bsd_joy_log,
+ "failed to scan inputs for device %s (\"%s\")",
+ joydev->node, joydev->name);
joystick_device_free(joydev);
}
-
- joystick_device_free(joydev);
}
lib_free(node);
free(namelist[n]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|