summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-27 16:25:27 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-28 18:37:20 -0300
commit735073aaa33694a683ff306a519371a3ae0c8637 (patch)
tree9dcac9ed89c5fd781b0a5fbfcb8961a11f6c23b8 /pcr
parent21b410ad00ddaf49927bf0b8726d3554df8d6c7d (diff)
pcr/reicast-git: add multiplayer support
Diffstat (limited to 'pcr')
-rw-r--r--pcr/reicast-git/PKGBUILD13
-rw-r--r--pcr/reicast-git/enable_multiplayer_support.patch37
-rw-r--r--pcr/reicast-git/enable_x11_keyboard_support.patch233
3 files changed, 44 insertions, 239 deletions
diff --git a/pcr/reicast-git/PKGBUILD b/pcr/reicast-git/PKGBUILD
index 7b49b2a69..9cff6bd35 100644
--- a/pcr/reicast-git/PKGBUILD
+++ b/pcr/reicast-git/PKGBUILD
@@ -13,13 +13,12 @@ conflicts=('reicast')
provides=('reicast')
makedepends=('git')
depends=('libgl' 'alsa-plugins' 'libpulse' 'python-evdev' )
-optdepends=('xboxdrv: Userspace gamepad driver for Xbox and Xbox360 gamepads'
- 'antimicro: Graphical program used to map keyboard keys and mouse controls to gamepad buttons')
+optdepends=('xboxdrv: Userspace gamepad driver for Xbox and Xbox360 gamepads')
source=(reicast::"git+https://github.com/reicast/reicast-emulator.git"
- 'enable_x11_keyboard_support.patch'
+ 'enable_multiplayer_support.patch'
'wait_if_two_frames_already_in_flight.patch')
sha256sums=('SKIP'
- '095961538c13208b39ebb0b9d6b6e30c1225f218dcc67239a9d938a23aec601e'
+ '12bfc58e12b3ee79b0c82159cdc70c76a4b6804f5c6986853156602bb0e6beb0'
'4e087844ed22f5a65348e6826444481e14d0409faf8dafb0c6e5284f3f2bd9f7')
pkgver() {
@@ -30,10 +29,12 @@ pkgver() {
prepare () {
cd reicast
- # remove nonfree fp.h header
+ # Remove nonfree fp.h header
rm -v core/deps/libpng/fp.h
- patch -Np1 -i "$srcdir"/enable_x11_keyboard_support.patch
+ # Add Multiplayer support
+ patch -Np1 -i "$srcdir"/enable_multiplayer_support.patch
+
patch -Np1 -i "$srcdir"/wait_if_two_frames_already_in_flight.patch
# Add experimental shadow support: http://github.com/reicast-emulator/issues/94
diff --git a/pcr/reicast-git/enable_multiplayer_support.patch b/pcr/reicast-git/enable_multiplayer_support.patch
new file mode 100644
index 000000000..57794d1eb
--- /dev/null
+++ b/pcr/reicast-git/enable_multiplayer_support.patch
@@ -0,0 +1,37 @@
+diff -Nur a/core/hw/maple/maple_cfg.cpp b/core/hw/maple/maple_cfg.cpp
+--- a/core/hw/maple/maple_cfg.cpp 2015-08-27 12:17:34.718561243 -0300
++++ b/core/hw/maple/maple_cfg.cpp 2015-08-27 15:57:10.233166402 -0300
+@@ -22,10 +22,12 @@
+ */
+ void UpdateInputState(u32 port);
+
+-extern u16 kcode[4];
+-extern u32 vks[4];
+-extern s8 joyx[4],joyy[4];
+-extern u8 rt[4],lt[4];
++#define NUM_PORTS 4
++
++extern u16 kcode[NUM_PORTS];
++extern u32 vks[NUM_PORTS];
++extern s8 joyx[NUM_PORTS],joyy[NUM_PORTS];
++extern u8 rt[NUM_PORTS],lt[NUM_PORTS];
+
+ u8 GetBtFromSgn(s8 val)
+ {
+@@ -69,10 +71,13 @@
+ void mcfg_CreateDevices()
+ {
+ #if DC_PLATFORM == DC_PLATFORM_DREAMCAST
+- mcfg_Create(MDT_SegaController,0,5);
++ for (int i = 0; i < NUM_PORTS; i++)
++ {
++ mcfg_Create(MDT_SegaController,i,5);
+
+- mcfg_Create(MDT_SegaVMU,0,0);
+- mcfg_Create(MDT_SegaVMU,0,1);
++ mcfg_Create(MDT_SegaVMU,i,0);
++ mcfg_Create(MDT_SegaVMU,i,1);
++ }
+ #else
+ mcfg_Create(MDT_NaomiJamma, 0, 5);
+ #endif
diff --git a/pcr/reicast-git/enable_x11_keyboard_support.patch b/pcr/reicast-git/enable_x11_keyboard_support.patch
deleted file mode 100644
index 1dfd41c72..000000000
--- a/pcr/reicast-git/enable_x11_keyboard_support.patch
+++ /dev/null
@@ -1,233 +0,0 @@
-diff -Nur a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp
---- a/core/linux-dist/main.cpp 2015-08-23 00:16:33.930598582 -0300
-+++ b/core/linux-dist/main.cpp 2015-08-23 18:54:25.349048701 -0300
-@@ -157,6 +157,10 @@
-
- void UpdateInputState(u32 port)
- {
-+ #if defined(SUPPORT_X11)
-+ update_x11_input_state();
-+ #endif
-+
- #if defined(TARGET_EMSCRIPTEN)
- return;
- #endif
-diff -Nur a/core/linux-dist/x11.cpp b/core/linux-dist/x11.cpp
---- a/core/linux-dist/x11.cpp 2015-08-23 00:16:33.930598582 -0300
-+++ b/core/linux-dist/x11.cpp 2015-08-23 18:50:06.875072583 -0300
-@@ -3,6 +3,7 @@
- #include <X11/Xlib.h>
- #include <X11/Xatom.h>
- #include <X11/Xutil.h>
-+#include <X11/XKBlib.h>
-
- #if !defined(GLES)
- #include <GL/gl.h>
-@@ -23,6 +24,18 @@
- #endif
- #define DEFAULT_WINDOW_HEIGHT 480
-
-+#define DC_KEY_AXIS_UP (25)
-+#define DC_KEY_AXIS_DOWN (39)
-+#define DC_KEY_AXIS_LEFT (38)
-+#define DC_KEY_AXIS_RIGHT (40)
-+#define DC_KEY_AXIS_LT (79)
-+#define DC_KEY_AXIS_RT (81)
-+
-+u8 axis_joyx = 0;
-+u8 axis_joyy = 0;
-+u8 axis_lt = 0;
-+u8 axis_rt = 0;
-+
- map<int, int> x11_keymap;
- int x11_dc_buttons = 0xFFFF;
- int x11_keyboard_input = 0;
-@@ -55,8 +68,27 @@
- XSendEvent((Display*)x11_disp, DefaultRootWindow((Display*)x11_disp), False, SubstructureNotifyMask, &xev);
- }
-
-+void update_x11_input_state()
-+{
-+ //static char key = 0;
-+
-+ //kcode[port]=0xFFFF;
-+ joyx[0] = axis_joyx;
-+ joyy[0] = axis_joyy;
-+ lt[0] = axis_lt;
-+ rt[0] = axis_rt;
-+ return;
-+
-+ //HandleEvents(port);
-+}
-+
- void input_x11_handle()
- {
-+ static bool dc_axis_up = false;
-+ static bool dc_axis_down = false;
-+ static bool dc_axis_left = false;
-+ static bool dc_axis_right = false;
-+
- if (x11_win && x11_keyboard_input)
- {
- //Handle X11
-@@ -68,6 +100,90 @@
- {
- case KeyPress:
- case KeyRelease:
-+ if (e.xkey.keycode == DC_KEY_AXIS_UP)
-+ {
-+ if (e.type == KeyPress)
-+ {
-+ dc_axis_up = true;
-+ }
-+ else if (e.type == KeyRelease)
-+ {
-+ dc_axis_up = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ if (e.xkey.keycode == DC_KEY_AXIS_DOWN)
-+ {
-+ if (e.type == KeyPress)
-+ {
-+ dc_axis_down = true;
-+ }
-+ else if (e.type == KeyRelease)
-+ {
-+ dc_axis_down = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ if (e.xkey.keycode == DC_KEY_AXIS_LEFT)
-+ {
-+ if (e.type == KeyPress)
-+ {
-+ dc_axis_left = true;
-+ }
-+ else if (e.type == KeyRelease)
-+ {
-+ dc_axis_left = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ if (e.xkey.keycode == DC_KEY_AXIS_RIGHT)
-+ {
-+ if (e.type == KeyPress)
-+ {
-+ dc_axis_right = true;
-+ }
-+ else if (e.type == KeyRelease)
-+ {
-+ dc_axis_right = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ if (e.xkey.keycode == DC_KEY_AXIS_LT)
-+ {
-+ if (e.type == KeyPress)
-+ {
-+ axis_lt = 255;
-+ }
-+ else if (e.type == KeyRelease)
-+ {
-+ axis_lt = 0;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ if (e.xkey.keycode == DC_KEY_AXIS_RT)
-+ {
-+ if (e.type == KeyPress)
-+ {
-+ axis_rt = 255;
-+ }
-+ else if (e.type == KeyRelease)
-+ {
-+ axis_rt = 0;
-+ }
-+ else
-+ {
-+ }
-+ }
- if (e.type == KeyRelease && e.xkey.keycode == 95) // F11 button
- {
- x11_fullscreen = !x11_fullscreen;
-@@ -89,26 +205,45 @@
- break;
- }
- }
-+ if ((dc_axis_up == true) && (dc_axis_down == false))
-+ {
-+ axis_joyy = -127;
-+ }
-+ else if ((dc_axis_up == false) && (dc_axis_down == true))
-+ {
-+ axis_joyy = 127;
-+ }
-+ else
-+ {
-+ axis_joyy = 0;
-+ }
-+ if ((dc_axis_left == true) && (dc_axis_right == false))
-+ {
-+ axis_joyx = -127;
-+ }
-+ else if ((dc_axis_left == false) && (dc_axis_right == true))
-+ {
-+ axis_joyx = 127;
-+ }
-+ else
-+ {
-+ axis_joyx = 0;
-+ }
- }
- }
-
- void input_x11_init()
- {
-- x11_keymap[113] = DC_DPAD_LEFT;
-- x11_keymap[114] = DC_DPAD_RIGHT;
-+ x11_keymap[44] = DC_DPAD_LEFT;
-+ x11_keymap[46] = DC_DPAD_RIGHT;
-
-- x11_keymap[111] = DC_DPAD_UP;
-- x11_keymap[116] = DC_DPAD_DOWN;
-+ x11_keymap[31] = DC_DPAD_UP;
-+ x11_keymap[45] = DC_DPAD_DOWN;
-
-- x11_keymap[53] = DC_BTN_X;
-- x11_keymap[54] = DC_BTN_B;
-- x11_keymap[55] = DC_BTN_A;
--
-- /*
-- //TODO: Fix sliders
-- x11_keymap[38] = DPad_Down;
-- x11_keymap[39] = DPad_Down;
-- */
-+ x11_keymap[80] = DC_BTN_Y;
-+ x11_keymap[83] = DC_BTN_X;
-+ x11_keymap[85] = DC_BTN_B;
-+ x11_keymap[84] = DC_BTN_A;
-
- x11_keymap[36] = DC_BTN_START;
-
-diff -Nur a/core/linux-dist/x11.h b/core/linux-dist/x11.h
---- a/core/linux-dist/x11.h 2015-08-23 00:16:33.930598582 -0300
-+++ b/core/linux-dist/x11.h 2015-08-23 18:58:04.534722602 -0300
-@@ -1,6 +1,7 @@
- #pragma once
-
- extern void* x11_glc;
-+extern void update_x11_input_state();
- extern void input_x11_init();
- extern void input_x11_handle();
- extern void x11_window_create();