summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacho Ramos <pacho@gentoo.org>2018-04-29 12:01:57 +0200
committerPacho Ramos <pacho@gentoo.org>2018-04-29 13:25:53 +0200
commitddce7324a0b8d698a544f489b1aa9d234657dfac (patch)
treed2e4adba92cf0e5fa85fd47f2df4e239500c108f /games-emulation/gngb/files/gngb-20060309-joystick.patch
parentgames-emulation/gngb: Drop old (diff)
downloadgentoo-ddce7324a0b8d698a544f489b1aa9d234657dfac.tar.gz
gentoo-ddce7324a0b8d698a544f489b1aa9d234657dfac.tar.bz2
gentoo-ddce7324a0b8d698a544f489b1aa9d234657dfac.zip
games-emulation/gngb: Drop games.eclass, add Debian fixes
Package-Manager: Portage-2.3.31, Repoman-2.3.9
Diffstat (limited to 'games-emulation/gngb/files/gngb-20060309-joystick.patch')
-rw-r--r--games-emulation/gngb/files/gngb-20060309-joystick.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/games-emulation/gngb/files/gngb-20060309-joystick.patch b/games-emulation/gngb/files/gngb-20060309-joystick.patch
new file mode 100644
index 000000000000..ec5003a52c61
--- /dev/null
+++ b/games-emulation/gngb/files/gngb-20060309-joystick.patch
@@ -0,0 +1,56 @@
+From: Markus Koschany <apo@debian.org>
+Date: Wed, 16 Aug 2017 23:25:30 +0200
+Subject: joystick axis
+
+Bug-Debian: https://bugs.debian.org/592777
+Forwarded: http://m.peponas.free.fr/gngb/news.html
+Origin: http://m.peponas.free.fr/gngb/download/memory.c.diff
+---
+ src/memory.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/src/memory.c b/src/memory.c
+index fd06738..9eaef1f 100644
+--- a/src/memory.c
++++ b/src/memory.c
+@@ -67,7 +67,11 @@ Uint8 ram_mask;
+ MEM_READ_ENTRY mem_read_tab[0x10];
+ MEM_WRITE_ENTRY mem_write_tab[0x10];
+
++/* doesn't work for negative joy_?_min */
++/*
+ Sint16 joy_x_min=0;joy_x_max=0;joy_y_min=0;joy_y_max=0;
++*/
++Sint16 joy_x_min=-32767;joy_x_max=32767;joy_y_min=-32767;joy_y_max=32767;
+
+ void (*select_rom_page)(Uint16 adr,Uint8 v);
+ void (*select_ram_page)(Uint16 adr,Uint8 v);
+@@ -755,15 +759,28 @@ extern __inline__ void update_gb_pad(void) {
+ Sint16 joy_x_pos=joy_axis[jmap[PAD_LEFT]];
+ Sint16 joy_y_pos=joy_axis[jmap[PAD_UP]];
+
++ /* unnecessary if joy_?_min and joy_?_max are minimum and maximum
++ * values of Sint16
+ if (joy_x_pos>joy_x_max) joy_x_max=joy_x_pos;
+ if (joy_x_pos<joy_x_min) joy_x_min=joy_x_pos;
+ if (joy_y_pos>joy_y_max) joy_y_max=joy_y_pos;
+ if (joy_y_pos<joy_y_min) joy_y_min=joy_y_pos;
++ */
+
++ /* this doesn't work when joy_x_min or joy_y_min < 0 (mid should be ~0),
++ * because ((+max) - (-min)) / 2 = ((+max) + (+min)) / 2
+ Sint16 joy_x_mid=(joy_x_max-joy_x_min) / 2;
+ Sint16 joy_y_mid=(joy_y_max-joy_y_min) / 2;
++ */
++ Sint16 joy_x_mid=(joy_x_max+joy_x_min) >> 1;
++ Sint16 joy_y_mid=(joy_y_max+joy_y_min) >> 1;
++ /* this doesn't work as joy_x_mid or joy_y_mid approaches 0
+ Sint16 joy_x_qua=joy_x_mid / 2;
+ Sint16 joy_y_qua=joy_y_mid / 2;
++ */
++ /* (difference) / 100 = 1% of possible values */
++ Sint16 joy_x_qua=(joy_x_max - joy_x_min) / 100;
++ Sint16 joy_y_qua=(joy_y_max - joy_y_min) / 100;
+
+ if ((joy_x_pos<(joy_x_mid-joy_x_qua)) || (key[kmap[PAD_LEFT]])) gb_pad|=0x20;
+ if ((joy_x_pos>(joy_x_mid+joy_x_qua)) || (key[kmap[PAD_RIGHT]])) gb_pad|=0x10;