Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] dosbox: patch to support full mapping of joysticks
@ 2019-09-15 18:41 voidlinux-github
  2019-09-15 19:02 ` [PR PATCH] [Updated] " voidlinux-github
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: voidlinux-github @ 2019-09-15 18:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

There is a new pull request by joshuakraemer against master on the void-packages repository

https://github.com/joshuakraemer/void-packages dosbox-joystick-patch
https://github.com/void-linux/void-packages/pull/14474

dosbox: patch to support full mapping of joysticks
Without this patch, dosbox is only able to use:
- either 2 joysticks/gamepads with 1 analog stick each (no hat switches/d-pads)
- or 1 joystick/gamepad with 1 analog stick and 1 hat switch/d-pad (with `joysticktype=fcs`)

This patch allows full mapping of 2 joysticks/gamepads with 2 analog sticks and 1 hat switch/d-pad, which means modern joysticks and gamepads can be fully used to play dos games in 2-player mode.

A patch file from https://github.com/void-linux/void-packages/pull/14474.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dosbox-joystick-patch-14474.patch --]
[-- Type: text/x-diff, Size: 4764 bytes --]

From abfb2477b0565fba3e21867d8151c698c0fb963b Mon Sep 17 00:00:00 2001
From: Joshua Kraemer <joshua@kraemer.link>
Date: Sun, 15 Sep 2019 20:29:45 +0200
Subject: [PATCH] dosbox: patch to support full mapping of joysticks

---
 .../patches/fully-mappable-joystick.patch     | 125 ++++++++++++++++++
 srcpkgs/dosbox/template                       |   2 +-
 2 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/dosbox/patches/fully-mappable-joystick.patch

diff --git a/srcpkgs/dosbox/patches/fully-mappable-joystick.patch b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
new file mode 100644
index 00000000000..ae4e40e3daa
--- /dev/null
+++ b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
@@ -0,0 +1,125 @@
+This patch by cfoesch allows mapping of up to 8 axes and 2 hat switches.
+The emulated joystick remains unchanged.
+Discussion: https://www.vogons.org/viewtopic.php?t=27452
+
+--- src/gui/sdl_mapper.cpp	2010-10-30 05:10:05.000000000 -0600
++++ src/gui/sdl_mapper.cpp	2011-02-14 09:29:43.251163300 -0700
+@@ -68,6 +68,8 @@
+ #define MAXACTIVE 16
+ #define MAXBUTTON 32
+ #define MAXBUTTON_CAP 16
++#define MAXAXIS 8
++#define MAXHAT 2
+
+ class CEvent;
+ class CHandlerEvent;
+@@ -521,10 +523,11 @@
+ };
+
+ #define MAX_VJOY_BUTTONS 8
++#define MAX_VJOY_AXES 8
+
+ static struct {
+ 	bool button_pressed[MAX_VJOY_BUTTONS];
+-	Bit16s axis_pos[8];
++	Bit16s axis_pos[MAX_VJOY_AXES];
+ 	bool hat_pressed[16];
+ } virtual_joysticks[2];
+
+@@ -615,8 +618,8 @@
+ 		if (_dummy) return;
+
+ 		// initialize binding lists and position data
+-		pos_axis_lists=new CBindList[4];
+-		neg_axis_lists=new CBindList[4];
++		pos_axis_lists=new CBindList[MAXAXIS];
++		neg_axis_lists=new CBindList[MAXAXIS];
+ 		button_lists=new CBindList[MAXBUTTON];
+ 		hat_lists=new CBindList[4];
+ 		Bitu i;
+@@ -625,7 +628,7 @@
+ 			old_button_state[i]=0;
+ 		}
+ 		for(i=0;i<16;i++) old_hat_state[i]=0;
+-		for (i=0; i<4; i++) {
++		for (i=0; i<MAXAXIS; i++) {
+ 			old_pos_axis_state[i]=false;
+ 			old_neg_axis_state[i]=false;
+ 		}
+@@ -643,8 +646,16 @@
+ 		}
+
+ 		axes=SDL_JoystickNumAxes(sdl_joystick);
+-		buttons=SDL_JoystickNumButtons(sdl_joystick);
++		if (axes > MAXAXIS) axes = MAXAXIS;
++		axes_cap=emulated_axes;
++		if (axes_cap>axes) axes_cap=axes;
++
+ 		hats=SDL_JoystickNumHats(sdl_joystick);
++		if (hats > MAXHAT) hats = MAXHAT;
++		hats_cap=emulated_hats;
++		if (hats_cap>hats) hats_cap=hats;
++
++		buttons=SDL_JoystickNumButtons(sdl_joystick);
+ 		button_wrap=buttons;
+ 		button_cap=buttons;
+ 		if (button_wrapping_enabled) {
+@@ -652,10 +663,7 @@
+ 			if (buttons>MAXBUTTON_CAP) button_cap = MAXBUTTON_CAP;
+ 		}
+ 		if (button_wrap > MAXBUTTON) button_wrap = MAXBUTTON;
+-		axes_cap=emulated_axes;
+-		if (axes_cap>axes) axes_cap=axes;
+-		hats_cap=emulated_hats;
+-		if (hats_cap>hats) hats_cap=hats;
++
+ 		LOG_MSG("Using joystick %s with %d axes, %d buttons and %d hat(s)",SDL_JoystickName(stick),axes,buttons,hats);
+ 	}
+ 	~CStickBindGroup() {
+@@ -688,7 +696,7 @@
+ 		if (event->type==SDL_JOYAXISMOTION) {
+ 			if (event->jaxis.which!=stick) return 0;
+ #if defined (REDUCE_JOYSTICK_POLLING)
+-			if (event->jaxis.axis>=emulated_axes) return 0;
++			if (event->jaxis.axis>=axes) return 0;
+ #endif
+ 			if (abs(event->jaxis.value)<25000) return 0;
+ 			return CreateAxisBind(event->jaxis.axis,event->jaxis.value>0);
+@@ -780,7 +788,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<axes_cap; i++) {
++		for (i=0; i<axes; i++) {
+ 			Sint16 caxis_pos=SDL_JoystickGetAxis(sdl_joystick,i);
+ 			/* activate bindings for joystick position */
+ 			if (caxis_pos>1) {
+@@ -812,7 +820,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<hats_cap; i++) {
++		for (i=0; i<hats; i++) {
+ 			Uint8 chat_state=SDL_JoystickGetHat(sdl_joystick,i);
+
+ 			/* activate binding if hat state has changed */
+@@ -838,7 +846,7 @@
+
+ private:
+ 	CBind * CreateAxisBind(Bitu axis,bool positive) {
+-		if (axis<emulated_axes) {
++		if (axis<axes) {
+ 			if (positive) return new CJAxisBind(&pos_axis_lists[axis],this,axis,positive);
+ 			else return new CJAxisBind(&neg_axis_lists[axis],this,axis,positive);
+ 		}
+@@ -877,8 +885,8 @@
+ 	char configname[10];
+ 	Bitu button_autofire[MAXBUTTON];
+ 	bool old_button_state[MAXBUTTON];
+-	bool old_pos_axis_state[16];
+-	bool old_neg_axis_state[16];
++	bool old_pos_axis_state[MAXAXIS];
++	bool old_neg_axis_state[MAXAXIS];
+ 	Uint8 old_hat_state[16];
+ 	bool is_dummy;
+ };
diff --git a/srcpkgs/dosbox/template b/srcpkgs/dosbox/template
index f9ecd89eefc..d69f6e964b6 100644
--- a/srcpkgs/dosbox/template
+++ b/srcpkgs/dosbox/template
@@ -1,7 +1,7 @@
 # Template file for 'dosbox'
 pkgname=dosbox
 version=0.74.3
-revision=1
+revision=2
 wrksrc=${pkgname}-0.74-3
 build_style=gnu-configure
 hostmakedepends="pkg-config"

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PR PATCH] [Updated] dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
@ 2019-09-15 19:02 ` voidlinux-github
  2019-09-15 19:02 ` voidlinux-github
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: voidlinux-github @ 2019-09-15 19:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

There is an updated pull request by joshuakraemer against master on the void-packages repository

https://github.com/joshuakraemer/void-packages dosbox-joystick-patch
https://github.com/void-linux/void-packages/pull/14474

dosbox: patch to support full mapping of joysticks
Without this patch, dosbox is only able to use:
- either 2 joysticks/gamepads with 1 analog stick each (no hat switches/d-pads)
- or 1 joystick/gamepad with 1 analog stick and 1 hat switch/d-pad (with `joysticktype=fcs`)

This patch allows full mapping of 2 joysticks/gamepads with 2 analog sticks and 1 hat switch/d-pad, which means modern joysticks and gamepads can be fully used to play dos games in 2-player mode.

This patch is also used by Recalbox OS, see https://github.com/recalbox/recalbox-buildroot/blob/master/package/dosbox/dosbox-003-joystick-8axis.patch

A patch file from https://github.com/void-linux/void-packages/pull/14474.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dosbox-joystick-patch-14474.patch --]
[-- Type: text/x-diff, Size: 4934 bytes --]

From 7ac09ec0e5ca29dba4c598138f5efa6d58fd56b8 Mon Sep 17 00:00:00 2001
From: Joshua Kraemer <joshua@kraemer.link>
Date: Sun, 15 Sep 2019 20:29:45 +0200
Subject: [PATCH] dosbox: patch to support full mapping of joysticks

---
 .../patches/fully-mappable-joystick.patch     | 125 ++++++++++++++++++
 srcpkgs/dosbox/template                       |   3 +-
 2 files changed, 126 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/dosbox/patches/fully-mappable-joystick.patch

diff --git a/srcpkgs/dosbox/patches/fully-mappable-joystick.patch b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
new file mode 100644
index 00000000000..ae4e40e3daa
--- /dev/null
+++ b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
@@ -0,0 +1,125 @@
+This patch by cfoesch allows mapping of up to 8 axes and 2 hat switches.
+The emulated joystick remains unchanged.
+Discussion: https://www.vogons.org/viewtopic.php?t=27452
+
+--- src/gui/sdl_mapper.cpp	2010-10-30 05:10:05.000000000 -0600
++++ src/gui/sdl_mapper.cpp	2011-02-14 09:29:43.251163300 -0700
+@@ -68,6 +68,8 @@
+ #define MAXACTIVE 16
+ #define MAXBUTTON 32
+ #define MAXBUTTON_CAP 16
++#define MAXAXIS 8
++#define MAXHAT 2
+
+ class CEvent;
+ class CHandlerEvent;
+@@ -521,10 +523,11 @@
+ };
+
+ #define MAX_VJOY_BUTTONS 8
++#define MAX_VJOY_AXES 8
+
+ static struct {
+ 	bool button_pressed[MAX_VJOY_BUTTONS];
+-	Bit16s axis_pos[8];
++	Bit16s axis_pos[MAX_VJOY_AXES];
+ 	bool hat_pressed[16];
+ } virtual_joysticks[2];
+
+@@ -615,8 +618,8 @@
+ 		if (_dummy) return;
+
+ 		// initialize binding lists and position data
+-		pos_axis_lists=new CBindList[4];
+-		neg_axis_lists=new CBindList[4];
++		pos_axis_lists=new CBindList[MAXAXIS];
++		neg_axis_lists=new CBindList[MAXAXIS];
+ 		button_lists=new CBindList[MAXBUTTON];
+ 		hat_lists=new CBindList[4];
+ 		Bitu i;
+@@ -625,7 +628,7 @@
+ 			old_button_state[i]=0;
+ 		}
+ 		for(i=0;i<16;i++) old_hat_state[i]=0;
+-		for (i=0; i<4; i++) {
++		for (i=0; i<MAXAXIS; i++) {
+ 			old_pos_axis_state[i]=false;
+ 			old_neg_axis_state[i]=false;
+ 		}
+@@ -643,8 +646,16 @@
+ 		}
+
+ 		axes=SDL_JoystickNumAxes(sdl_joystick);
+-		buttons=SDL_JoystickNumButtons(sdl_joystick);
++		if (axes > MAXAXIS) axes = MAXAXIS;
++		axes_cap=emulated_axes;
++		if (axes_cap>axes) axes_cap=axes;
++
+ 		hats=SDL_JoystickNumHats(sdl_joystick);
++		if (hats > MAXHAT) hats = MAXHAT;
++		hats_cap=emulated_hats;
++		if (hats_cap>hats) hats_cap=hats;
++
++		buttons=SDL_JoystickNumButtons(sdl_joystick);
+ 		button_wrap=buttons;
+ 		button_cap=buttons;
+ 		if (button_wrapping_enabled) {
+@@ -652,10 +663,7 @@
+ 			if (buttons>MAXBUTTON_CAP) button_cap = MAXBUTTON_CAP;
+ 		}
+ 		if (button_wrap > MAXBUTTON) button_wrap = MAXBUTTON;
+-		axes_cap=emulated_axes;
+-		if (axes_cap>axes) axes_cap=axes;
+-		hats_cap=emulated_hats;
+-		if (hats_cap>hats) hats_cap=hats;
++
+ 		LOG_MSG("Using joystick %s with %d axes, %d buttons and %d hat(s)",SDL_JoystickName(stick),axes,buttons,hats);
+ 	}
+ 	~CStickBindGroup() {
+@@ -688,7 +696,7 @@
+ 		if (event->type==SDL_JOYAXISMOTION) {
+ 			if (event->jaxis.which!=stick) return 0;
+ #if defined (REDUCE_JOYSTICK_POLLING)
+-			if (event->jaxis.axis>=emulated_axes) return 0;
++			if (event->jaxis.axis>=axes) return 0;
+ #endif
+ 			if (abs(event->jaxis.value)<25000) return 0;
+ 			return CreateAxisBind(event->jaxis.axis,event->jaxis.value>0);
+@@ -780,7 +788,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<axes_cap; i++) {
++		for (i=0; i<axes; i++) {
+ 			Sint16 caxis_pos=SDL_JoystickGetAxis(sdl_joystick,i);
+ 			/* activate bindings for joystick position */
+ 			if (caxis_pos>1) {
+@@ -812,7 +820,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<hats_cap; i++) {
++		for (i=0; i<hats; i++) {
+ 			Uint8 chat_state=SDL_JoystickGetHat(sdl_joystick,i);
+
+ 			/* activate binding if hat state has changed */
+@@ -838,7 +846,7 @@
+
+ private:
+ 	CBind * CreateAxisBind(Bitu axis,bool positive) {
+-		if (axis<emulated_axes) {
++		if (axis<axes) {
+ 			if (positive) return new CJAxisBind(&pos_axis_lists[axis],this,axis,positive);
+ 			else return new CJAxisBind(&neg_axis_lists[axis],this,axis,positive);
+ 		}
+@@ -877,8 +885,8 @@
+ 	char configname[10];
+ 	Bitu button_autofire[MAXBUTTON];
+ 	bool old_button_state[MAXBUTTON];
+-	bool old_pos_axis_state[16];
+-	bool old_neg_axis_state[16];
++	bool old_pos_axis_state[MAXAXIS];
++	bool old_neg_axis_state[MAXAXIS];
+ 	Uint8 old_hat_state[16];
+ 	bool is_dummy;
+ };
diff --git a/srcpkgs/dosbox/template b/srcpkgs/dosbox/template
index f9ecd89eefc..bef2333206f 100644
--- a/srcpkgs/dosbox/template
+++ b/srcpkgs/dosbox/template
@@ -1,7 +1,7 @@
 # Template file for 'dosbox'
 pkgname=dosbox
 version=0.74.3
-revision=1
+revision=2
 wrksrc=${pkgname}-0.74-3
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -23,4 +23,3 @@ post_install() {
 	vinstall ${FILESDIR}/${pkgname}.png 644 usr/share/pixmaps
 	vinstall ${FILESDIR}/${pkgname}.desktop 644 usr/share/applications
 }
-

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PR PATCH] [Updated] dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
  2019-09-15 19:02 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-09-15 19:02 ` voidlinux-github
  2019-09-16 14:30 ` voidlinux-github
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: voidlinux-github @ 2019-09-15 19:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

There is an updated pull request by joshuakraemer against master on the void-packages repository

https://github.com/joshuakraemer/void-packages dosbox-joystick-patch
https://github.com/void-linux/void-packages/pull/14474

dosbox: patch to support full mapping of joysticks
Without this patch, dosbox is only able to use:
- either 2 joysticks/gamepads with 1 analog stick each (no hat switches/d-pads)
- or 1 joystick/gamepad with 1 analog stick and 1 hat switch/d-pad (with `joysticktype=fcs`)

This patch allows full mapping of 2 joysticks/gamepads with 2 analog sticks and 1 hat switch/d-pad, which means modern joysticks and gamepads can be fully used to play dos games in 2-player mode.

This patch is also used by Recalbox OS, see https://github.com/recalbox/recalbox-buildroot/blob/master/package/dosbox/dosbox-003-joystick-8axis.patch

A patch file from https://github.com/void-linux/void-packages/pull/14474.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dosbox-joystick-patch-14474.patch --]
[-- Type: text/x-diff, Size: 4934 bytes --]

From 7ac09ec0e5ca29dba4c598138f5efa6d58fd56b8 Mon Sep 17 00:00:00 2001
From: Joshua Kraemer <joshua@kraemer.link>
Date: Sun, 15 Sep 2019 20:29:45 +0200
Subject: [PATCH] dosbox: patch to support full mapping of joysticks

---
 .../patches/fully-mappable-joystick.patch     | 125 ++++++++++++++++++
 srcpkgs/dosbox/template                       |   3 +-
 2 files changed, 126 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/dosbox/patches/fully-mappable-joystick.patch

diff --git a/srcpkgs/dosbox/patches/fully-mappable-joystick.patch b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
new file mode 100644
index 00000000000..ae4e40e3daa
--- /dev/null
+++ b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
@@ -0,0 +1,125 @@
+This patch by cfoesch allows mapping of up to 8 axes and 2 hat switches.
+The emulated joystick remains unchanged.
+Discussion: https://www.vogons.org/viewtopic.php?t=27452
+
+--- src/gui/sdl_mapper.cpp	2010-10-30 05:10:05.000000000 -0600
++++ src/gui/sdl_mapper.cpp	2011-02-14 09:29:43.251163300 -0700
+@@ -68,6 +68,8 @@
+ #define MAXACTIVE 16
+ #define MAXBUTTON 32
+ #define MAXBUTTON_CAP 16
++#define MAXAXIS 8
++#define MAXHAT 2
+
+ class CEvent;
+ class CHandlerEvent;
+@@ -521,10 +523,11 @@
+ };
+
+ #define MAX_VJOY_BUTTONS 8
++#define MAX_VJOY_AXES 8
+
+ static struct {
+ 	bool button_pressed[MAX_VJOY_BUTTONS];
+-	Bit16s axis_pos[8];
++	Bit16s axis_pos[MAX_VJOY_AXES];
+ 	bool hat_pressed[16];
+ } virtual_joysticks[2];
+
+@@ -615,8 +618,8 @@
+ 		if (_dummy) return;
+
+ 		// initialize binding lists and position data
+-		pos_axis_lists=new CBindList[4];
+-		neg_axis_lists=new CBindList[4];
++		pos_axis_lists=new CBindList[MAXAXIS];
++		neg_axis_lists=new CBindList[MAXAXIS];
+ 		button_lists=new CBindList[MAXBUTTON];
+ 		hat_lists=new CBindList[4];
+ 		Bitu i;
+@@ -625,7 +628,7 @@
+ 			old_button_state[i]=0;
+ 		}
+ 		for(i=0;i<16;i++) old_hat_state[i]=0;
+-		for (i=0; i<4; i++) {
++		for (i=0; i<MAXAXIS; i++) {
+ 			old_pos_axis_state[i]=false;
+ 			old_neg_axis_state[i]=false;
+ 		}
+@@ -643,8 +646,16 @@
+ 		}
+
+ 		axes=SDL_JoystickNumAxes(sdl_joystick);
+-		buttons=SDL_JoystickNumButtons(sdl_joystick);
++		if (axes > MAXAXIS) axes = MAXAXIS;
++		axes_cap=emulated_axes;
++		if (axes_cap>axes) axes_cap=axes;
++
+ 		hats=SDL_JoystickNumHats(sdl_joystick);
++		if (hats > MAXHAT) hats = MAXHAT;
++		hats_cap=emulated_hats;
++		if (hats_cap>hats) hats_cap=hats;
++
++		buttons=SDL_JoystickNumButtons(sdl_joystick);
+ 		button_wrap=buttons;
+ 		button_cap=buttons;
+ 		if (button_wrapping_enabled) {
+@@ -652,10 +663,7 @@
+ 			if (buttons>MAXBUTTON_CAP) button_cap = MAXBUTTON_CAP;
+ 		}
+ 		if (button_wrap > MAXBUTTON) button_wrap = MAXBUTTON;
+-		axes_cap=emulated_axes;
+-		if (axes_cap>axes) axes_cap=axes;
+-		hats_cap=emulated_hats;
+-		if (hats_cap>hats) hats_cap=hats;
++
+ 		LOG_MSG("Using joystick %s with %d axes, %d buttons and %d hat(s)",SDL_JoystickName(stick),axes,buttons,hats);
+ 	}
+ 	~CStickBindGroup() {
+@@ -688,7 +696,7 @@
+ 		if (event->type==SDL_JOYAXISMOTION) {
+ 			if (event->jaxis.which!=stick) return 0;
+ #if defined (REDUCE_JOYSTICK_POLLING)
+-			if (event->jaxis.axis>=emulated_axes) return 0;
++			if (event->jaxis.axis>=axes) return 0;
+ #endif
+ 			if (abs(event->jaxis.value)<25000) return 0;
+ 			return CreateAxisBind(event->jaxis.axis,event->jaxis.value>0);
+@@ -780,7 +788,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<axes_cap; i++) {
++		for (i=0; i<axes; i++) {
+ 			Sint16 caxis_pos=SDL_JoystickGetAxis(sdl_joystick,i);
+ 			/* activate bindings for joystick position */
+ 			if (caxis_pos>1) {
+@@ -812,7 +820,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<hats_cap; i++) {
++		for (i=0; i<hats; i++) {
+ 			Uint8 chat_state=SDL_JoystickGetHat(sdl_joystick,i);
+
+ 			/* activate binding if hat state has changed */
+@@ -838,7 +846,7 @@
+
+ private:
+ 	CBind * CreateAxisBind(Bitu axis,bool positive) {
+-		if (axis<emulated_axes) {
++		if (axis<axes) {
+ 			if (positive) return new CJAxisBind(&pos_axis_lists[axis],this,axis,positive);
+ 			else return new CJAxisBind(&neg_axis_lists[axis],this,axis,positive);
+ 		}
+@@ -877,8 +885,8 @@
+ 	char configname[10];
+ 	Bitu button_autofire[MAXBUTTON];
+ 	bool old_button_state[MAXBUTTON];
+-	bool old_pos_axis_state[16];
+-	bool old_neg_axis_state[16];
++	bool old_pos_axis_state[MAXAXIS];
++	bool old_neg_axis_state[MAXAXIS];
+ 	Uint8 old_hat_state[16];
+ 	bool is_dummy;
+ };
diff --git a/srcpkgs/dosbox/template b/srcpkgs/dosbox/template
index f9ecd89eefc..bef2333206f 100644
--- a/srcpkgs/dosbox/template
+++ b/srcpkgs/dosbox/template
@@ -1,7 +1,7 @@
 # Template file for 'dosbox'
 pkgname=dosbox
 version=0.74.3
-revision=1
+revision=2
 wrksrc=${pkgname}-0.74-3
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -23,4 +23,3 @@ post_install() {
 	vinstall ${FILESDIR}/${pkgname}.png 644 usr/share/pixmaps
 	vinstall ${FILESDIR}/${pkgname}.desktop 644 usr/share/applications
 }
-

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
  2019-09-15 19:02 ` [PR PATCH] [Updated] " voidlinux-github
  2019-09-15 19:02 ` voidlinux-github
@ 2019-09-16 14:30 ` voidlinux-github
  2019-09-20 20:11 ` voidlinux-github
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: voidlinux-github @ 2019-09-16 14:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

New comment by Hoshpak on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-531803557

Comment:
What is the upstream status of this patch? We usually only patch to make packages work or fix issues, not to enhance functionality.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (2 preceding siblings ...)
  2019-09-16 14:30 ` voidlinux-github
@ 2019-09-20 20:11 ` voidlinux-github
  2020-05-02 14:15 ` [PR PATCH] [Updated] " joshuakraemer
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: voidlinux-github @ 2019-09-20 20:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

New comment by joshuakraemer on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-533693562

Comment:
I have filed a feature request to reconsider the patch upstream, which was already suggested in 2011: https://sourceforge.net/p/dosbox/feature-requests/137/

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PR PATCH] [Updated] dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (3 preceding siblings ...)
  2019-09-20 20:11 ` voidlinux-github
@ 2020-05-02 14:15 ` joshuakraemer
  2020-05-06 19:30 ` ericonr
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: joshuakraemer @ 2020-05-02 14:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

There is an updated pull request by joshuakraemer against master on the void-packages repository

https://github.com/joshuakraemer/void-packages dosbox-joystick-patch
https://github.com/void-linux/void-packages/pull/14474

dosbox: patch to support full mapping of joysticks
Without this patch, dosbox is only able to use:
- either 2 joysticks/gamepads with 1 analog stick each (no hat switches/d-pads)
- or 1 joystick/gamepad with 1 analog stick and 1 hat switch/d-pad (with `joysticktype=fcs`)

This patch allows full mapping of 2 joysticks/gamepads with 2 analog sticks and 1 hat switch/d-pad, which means modern joysticks and gamepads can be fully used to play dos games in 2-player mode.

This patch is also used by Recalbox OS, see https://github.com/recalbox/recalbox-buildroot/blob/master/package/dosbox/dosbox-003-joystick-8axis.patch

A patch file from https://github.com/void-linux/void-packages/pull/14474.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dosbox-joystick-patch-14474.patch --]
[-- Type: text/x-diff, Size: 4764 bytes --]

From 15082ba4ab18a07044018adbdc06dd7a734280da Mon Sep 17 00:00:00 2001
From: Joshua Kraemer <joshua@kraemer.link>
Date: Sun, 15 Sep 2019 20:29:45 +0200
Subject: [PATCH] dosbox: patch to support full mapping of joysticks

---
 .../patches/fully-mappable-joystick.patch     | 125 ++++++++++++++++++
 srcpkgs/dosbox/template                       |   2 +-
 2 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/dosbox/patches/fully-mappable-joystick.patch

diff --git a/srcpkgs/dosbox/patches/fully-mappable-joystick.patch b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
new file mode 100644
index 00000000000..ae4e40e3daa
--- /dev/null
+++ b/srcpkgs/dosbox/patches/fully-mappable-joystick.patch
@@ -0,0 +1,125 @@
+This patch by cfoesch allows mapping of up to 8 axes and 2 hat switches.
+The emulated joystick remains unchanged.
+Discussion: https://www.vogons.org/viewtopic.php?t=27452
+
+--- src/gui/sdl_mapper.cpp	2010-10-30 05:10:05.000000000 -0600
++++ src/gui/sdl_mapper.cpp	2011-02-14 09:29:43.251163300 -0700
+@@ -68,6 +68,8 @@
+ #define MAXACTIVE 16
+ #define MAXBUTTON 32
+ #define MAXBUTTON_CAP 16
++#define MAXAXIS 8
++#define MAXHAT 2
+
+ class CEvent;
+ class CHandlerEvent;
+@@ -521,10 +523,11 @@
+ };
+
+ #define MAX_VJOY_BUTTONS 8
++#define MAX_VJOY_AXES 8
+
+ static struct {
+ 	bool button_pressed[MAX_VJOY_BUTTONS];
+-	Bit16s axis_pos[8];
++	Bit16s axis_pos[MAX_VJOY_AXES];
+ 	bool hat_pressed[16];
+ } virtual_joysticks[2];
+
+@@ -615,8 +618,8 @@
+ 		if (_dummy) return;
+
+ 		// initialize binding lists and position data
+-		pos_axis_lists=new CBindList[4];
+-		neg_axis_lists=new CBindList[4];
++		pos_axis_lists=new CBindList[MAXAXIS];
++		neg_axis_lists=new CBindList[MAXAXIS];
+ 		button_lists=new CBindList[MAXBUTTON];
+ 		hat_lists=new CBindList[4];
+ 		Bitu i;
+@@ -625,7 +628,7 @@
+ 			old_button_state[i]=0;
+ 		}
+ 		for(i=0;i<16;i++) old_hat_state[i]=0;
+-		for (i=0; i<4; i++) {
++		for (i=0; i<MAXAXIS; i++) {
+ 			old_pos_axis_state[i]=false;
+ 			old_neg_axis_state[i]=false;
+ 		}
+@@ -643,8 +646,16 @@
+ 		}
+
+ 		axes=SDL_JoystickNumAxes(sdl_joystick);
+-		buttons=SDL_JoystickNumButtons(sdl_joystick);
++		if (axes > MAXAXIS) axes = MAXAXIS;
++		axes_cap=emulated_axes;
++		if (axes_cap>axes) axes_cap=axes;
++
+ 		hats=SDL_JoystickNumHats(sdl_joystick);
++		if (hats > MAXHAT) hats = MAXHAT;
++		hats_cap=emulated_hats;
++		if (hats_cap>hats) hats_cap=hats;
++
++		buttons=SDL_JoystickNumButtons(sdl_joystick);
+ 		button_wrap=buttons;
+ 		button_cap=buttons;
+ 		if (button_wrapping_enabled) {
+@@ -652,10 +663,7 @@
+ 			if (buttons>MAXBUTTON_CAP) button_cap = MAXBUTTON_CAP;
+ 		}
+ 		if (button_wrap > MAXBUTTON) button_wrap = MAXBUTTON;
+-		axes_cap=emulated_axes;
+-		if (axes_cap>axes) axes_cap=axes;
+-		hats_cap=emulated_hats;
+-		if (hats_cap>hats) hats_cap=hats;
++
+ 		LOG_MSG("Using joystick %s with %d axes, %d buttons and %d hat(s)",SDL_JoystickName(stick),axes,buttons,hats);
+ 	}
+ 	~CStickBindGroup() {
+@@ -688,7 +696,7 @@
+ 		if (event->type==SDL_JOYAXISMOTION) {
+ 			if (event->jaxis.which!=stick) return 0;
+ #if defined (REDUCE_JOYSTICK_POLLING)
+-			if (event->jaxis.axis>=emulated_axes) return 0;
++			if (event->jaxis.axis>=axes) return 0;
+ #endif
+ 			if (abs(event->jaxis.value)<25000) return 0;
+ 			return CreateAxisBind(event->jaxis.axis,event->jaxis.value>0);
+@@ -780,7 +788,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<axes_cap; i++) {
++		for (i=0; i<axes; i++) {
+ 			Sint16 caxis_pos=SDL_JoystickGetAxis(sdl_joystick,i);
+ 			/* activate bindings for joystick position */
+ 			if (caxis_pos>1) {
+@@ -812,7 +820,7 @@
+ 			}
+ 		}
+
+-		for (i=0; i<hats_cap; i++) {
++		for (i=0; i<hats; i++) {
+ 			Uint8 chat_state=SDL_JoystickGetHat(sdl_joystick,i);
+
+ 			/* activate binding if hat state has changed */
+@@ -838,7 +846,7 @@
+
+ private:
+ 	CBind * CreateAxisBind(Bitu axis,bool positive) {
+-		if (axis<emulated_axes) {
++		if (axis<axes) {
+ 			if (positive) return new CJAxisBind(&pos_axis_lists[axis],this,axis,positive);
+ 			else return new CJAxisBind(&neg_axis_lists[axis],this,axis,positive);
+ 		}
+@@ -877,8 +885,8 @@
+ 	char configname[10];
+ 	Bitu button_autofire[MAXBUTTON];
+ 	bool old_button_state[MAXBUTTON];
+-	bool old_pos_axis_state[16];
+-	bool old_neg_axis_state[16];
++	bool old_pos_axis_state[MAXAXIS];
++	bool old_neg_axis_state[MAXAXIS];
+ 	Uint8 old_hat_state[16];
+ 	bool is_dummy;
+ };
diff --git a/srcpkgs/dosbox/template b/srcpkgs/dosbox/template
index 4518697790a..e2f4ba586c8 100644
--- a/srcpkgs/dosbox/template
+++ b/srcpkgs/dosbox/template
@@ -1,7 +1,7 @@
 # Template file for 'dosbox'
 pkgname=dosbox
 version=0.74.3
-revision=1
+revision=2
 wrksrc=${pkgname}-0.74-3
 build_style=gnu-configure
 hostmakedepends="pkg-config"

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (4 preceding siblings ...)
  2020-05-02 14:15 ` [PR PATCH] [Updated] " joshuakraemer
@ 2020-05-06 19:30 ` ericonr
  2020-05-07  2:05 ` abenson
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ericonr @ 2020-05-06 19:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-624844803

Comment:
@joshuakraemer are you following dosbox-staging? We could package that, instead.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (5 preceding siblings ...)
  2020-05-06 19:30 ` ericonr
@ 2020-05-07  2:05 ` abenson
  2020-05-07  9:55 ` pullmoll
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: abenson @ 2020-05-07  2:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

New comment by abenson on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-624986326

Comment:
> @joshuakraemer are you following dosbox-staging? We could package that, instead.

I have a [dosbox-staging template](https://github.com/abenson/void-packages/commit/7c967db94073ecc0280946c1ac376018549d5e62) but I'm not sure if it would be wanted

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (6 preceding siblings ...)
  2020-05-07  2:05 ` abenson
@ 2020-05-07  9:55 ` pullmoll
  2020-05-07 10:49 ` abenson
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pullmoll @ 2020-05-07  9:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-625153336

Comment:
IMO we should stay with stable releases and, if absolutely necessary, backport patches. I believe this is the consesus for Void packages in general.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (7 preceding siblings ...)
  2020-05-07  9:55 ` pullmoll
@ 2020-05-07 10:49 ` abenson
  2020-05-07 11:25 ` pullmoll
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: abenson @ 2020-05-07 10:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

New comment by abenson on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-625179067

Comment:
`dosbox-staging` is a fork

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (8 preceding siblings ...)
  2020-05-07 10:49 ` abenson
@ 2020-05-07 11:25 ` pullmoll
  2020-05-09 11:27 ` joshuakraemer
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pullmoll @ 2020-05-07 11:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-625195928

Comment:
Uh, ok, that's a different story.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (9 preceding siblings ...)
  2020-05-07 11:25 ` pullmoll
@ 2020-05-09 11:27 ` joshuakraemer
  2020-05-09 11:44 ` joshuakraemer
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: joshuakraemer @ 2020-05-09 11:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

New comment by joshuakraemer on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-626153548

Comment:
Thank you @ericonr and @abenson, I did not know about dosbox-staging. I have already thought about packaging dosbox-ece (template here: https://github.com/joshuakraemer/void-packages/commit/c926d794e8e5dffb2e96aee274f6d3253da29222), but I think dosbox-staging is the better choice. I would second packaging it.

While it does not solve the original issue (full mapping of controllers), the team seems to be more open to community suggestions, so I will file an issue with them.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (10 preceding siblings ...)
  2020-05-09 11:27 ` joshuakraemer
@ 2020-05-09 11:44 ` joshuakraemer
  2021-07-16 15:29 ` ericonr
  2021-07-16 15:29 ` [PR PATCH] [Closed]: " ericonr
  13 siblings, 0 replies; 15+ messages in thread
From: joshuakraemer @ 2020-05-09 11:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

New comment by joshuakraemer on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-626153548

Comment:
Thank you @ericonr and @abenson, I did not know about dosbox-staging. I have already thought about packaging dosbox-ece (template here: https://github.com/joshuakraemer/void-packages/commit/c926d794e8e5dffb2e96aee274f6d3253da29222), but I think dosbox-staging is the better choice. I would second packaging it.

While it does not solve the original issue (full mapping of controllers), the team seems to be more open to community suggestions, so I will file an issue with them.

Edit: dosbox-staging issue: https://github.com/dosbox-staging/dosbox-staging/issues/342

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (11 preceding siblings ...)
  2020-05-09 11:44 ` joshuakraemer
@ 2021-07-16 15:29 ` ericonr
  2021-07-16 15:29 ` [PR PATCH] [Closed]: " ericonr
  13 siblings, 0 replies; 15+ messages in thread
From: ericonr @ 2021-07-16 15:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/14474#issuecomment-881533161

Comment:
Superseded by #31258 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PR PATCH] [Closed]: dosbox: patch to support full mapping of joysticks
  2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
                   ` (12 preceding siblings ...)
  2021-07-16 15:29 ` ericonr
@ 2021-07-16 15:29 ` ericonr
  13 siblings, 0 replies; 15+ messages in thread
From: ericonr @ 2021-07-16 15:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

There's a closed pull request on the void-packages repository

dosbox: patch to support full mapping of joysticks
https://github.com/void-linux/void-packages/pull/14474

Description:
Without this patch, dosbox is only able to use:
- either 2 joysticks/gamepads with 1 analog stick each (no hat switches/d-pads)
- or 1 joystick/gamepad with 1 analog stick and 1 hat switch/d-pad (with `joysticktype=fcs`)

This patch allows full mapping of 2 joysticks/gamepads with 2 analog sticks and 1 hat switch/d-pad, which means modern joysticks and gamepads can be fully used to play dos games in 2-player mode.

This patch is also used by Recalbox OS, see https://github.com/recalbox/recalbox-buildroot/blob/master/package/dosbox/dosbox-003-joystick-8axis.patch

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-07-16 15:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-15 18:41 [PR PATCH] dosbox: patch to support full mapping of joysticks voidlinux-github
2019-09-15 19:02 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-15 19:02 ` voidlinux-github
2019-09-16 14:30 ` voidlinux-github
2019-09-20 20:11 ` voidlinux-github
2020-05-02 14:15 ` [PR PATCH] [Updated] " joshuakraemer
2020-05-06 19:30 ` ericonr
2020-05-07  2:05 ` abenson
2020-05-07  9:55 ` pullmoll
2020-05-07 10:49 ` abenson
2020-05-07 11:25 ` pullmoll
2020-05-09 11:27 ` joshuakraemer
2020-05-09 11:44 ` joshuakraemer
2021-07-16 15:29 ` ericonr
2021-07-16 15:29 ` [PR PATCH] [Closed]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).