From e6535c873331a54a21435d8e9450b09a596a6874 Mon Sep 17 00:00:00 2001 From: "coadde [Márcio Alexandre Silva Delgado]" Date: Sun, 23 Aug 2015 22:25:37 -0300 Subject: pcr/reicast{,-multilib}-git --- pcr/reicast-git/PKGBUILD | 27 +- pcr/reicast-git/enable_joystick_support.patch | 346 --------------------- pcr/reicast-git/enable_joystick_support_old.patch | 346 +++++++++++++++++++++ pcr/reicast-git/enable_x11_keyboard_support.patch | 233 ++++++++++++++ .../wait_if_two_frames_already_in_flight.patch | 47 +-- .../wait_if_two_frames_already_in_flight_old.patch | 70 +++++ pcr/reicast-multilib-git/PKGBUILD | 20 +- .../enable_joystick_support.patch | 346 --------------------- .../enable_joystick_support_old.patch | 346 +++++++++++++++++++++ .../enable_x11_keyboard_support.patch | 233 ++++++++++++++ .../wait_if_two_frames_already_in_flight.patch | 47 +-- .../wait_if_two_frames_already_in_flight_old.patch | 70 +++++ 12 files changed, 1350 insertions(+), 781 deletions(-) delete mode 100644 pcr/reicast-git/enable_joystick_support.patch create mode 100644 pcr/reicast-git/enable_joystick_support_old.patch create mode 100644 pcr/reicast-git/enable_x11_keyboard_support.patch create mode 100644 pcr/reicast-git/wait_if_two_frames_already_in_flight_old.patch delete mode 100644 pcr/reicast-multilib-git/enable_joystick_support.patch create mode 100644 pcr/reicast-multilib-git/enable_joystick_support_old.patch create mode 100644 pcr/reicast-multilib-git/enable_x11_keyboard_support.patch create mode 100644 pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight_old.patch diff --git a/pcr/reicast-git/PKGBUILD b/pcr/reicast-git/PKGBUILD index e10d00c34..ddd9099e1 100644 --- a/pcr/reicast-git/PKGBUILD +++ b/pcr/reicast-git/PKGBUILD @@ -3,7 +3,7 @@ # Maintainer: Márcio Silva pkgname=reicast-git -pkgver=r1322.4b94e2f +pkgver=r1546.5fd66a1 pkgrel=1 pkgdesc="A multiplatform Sega Dreamcast emulator" arch=('i686' 'x86_64') @@ -12,15 +12,15 @@ license=('GPL2') conflicts=('reicast') provides=('reicast') makedepends=('git') -depends=('libgl' 'alsa-plugins') +depends=('libgl' 'alsa-plugins' 'libpulse') optdepends=('xboxdrv: Userspace gamepad driver for Xbox and Xbox360 gamepads' 'antimicro: Graphical program used to map keyboard keys and mouse controls to gamepad buttons') source=(reicast::"git+https://github.com/reicast/reicast-emulator.git" - 'enable_joystick_support.patch' + 'enable_x11_keyboard_support.patch' 'wait_if_two_frames_already_in_flight.patch') sha256sums=('SKIP' - '464946512ca4cffac104128a85dd174520caeaa0325afbf281b6cfdbc0120fc6' - 'f4d3b4ad7703da09dc59cae839ca225e1a21b89d905ede3519bf3174b40903da') + '095961538c13208b39ebb0b9d6b6e30c1225f218dcc67239a9d938a23aec601e' + '8f7b392ac6fac2d62e078a397f6b7c29ac3a23877d5c1a4566a58710b3383aef') pkgver() { cd reicast @@ -29,20 +29,21 @@ pkgver() { prepare () { cd reicast - patch -Np1 -i "$srcdir"/enable_joystick_support.patch + patch -Np1 -i "$srcdir"/enable_x11_keyboard_support.patch patch -Np1 -i "$srcdir"/wait_if_two_frames_already_in_flight.patch - # Fix pointer size on 64 bit arch: http://github.com/reicast-emulator/pull/768 - sed -i 's|verify((int)rbi);|verify((size_t)rbi);|' core/hw/sh4/dyna/driver.cpp # Add experimental shadow support: http://github.com/reicast-emulator/issues/94 sed -i 's|//DrawModVols|DrawModVols|' core/rend/gles/gldraw.cpp + + # Fix Xbox Input Axis + sed -i 's|DC_AXIS_LT, 0, 0, DC_AXIS_RT|0, 0, DC_AXIS_RT, DC_AXIS_LT|' core/linux-dist/joystick.cpp + + # Enable Pulseaudio + sed -i 's|#USE_PULSEAUDIO|USE_PULSEAUDIO|' shell/linux/Makefile } build () { make -C reicast/shell/linux - if [[ $CARCH == x86_64 ]]; then - make -C reicast/shell/linCPP - fi } package () { @@ -50,9 +51,5 @@ package () { install -Dm755 shell/linux/reicast.elf "$pkgdir"/usr/bin/reicast install -Dm755 shell/linux/nosym-reicast.elf "$pkgdir"/usr/bin/reicast-nosym - if [[ $CARCH == x86_64 ]]; then - install -Dm755 shell/linCPP/reicast.elf "$pkgdir"/usr/bin/reicast-cpp - install -Dm755 shell/linCPP/nosym-reicast.elf "$pkgdir"/usr/bin/reicast-nosym-cpp - fi install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE } diff --git a/pcr/reicast-git/enable_joystick_support.patch b/pcr/reicast-git/enable_joystick_support.patch deleted file mode 100644 index 0fbb59ac7..000000000 --- a/pcr/reicast-git/enable_joystick_support.patch +++ /dev/null @@ -1,346 +0,0 @@ -diff -Nur reicast-emulator.orig/core/linux-dist/main.cpp reicast-emulator/core/linux-dist/main.cpp ---- reicast-emulator.orig/core/linux-dist/main.cpp 2015-06-29 21:42:22.674278849 -0300 -+++ reicast-emulator/core/linux-dist/main.cpp 2015-06-29 22:08:38.780500620 -0300 -@@ -22,6 +22,7 @@ - #include - #include - #include -+ #include - - #if !defined(GLES) - #include -@@ -49,6 +50,34 @@ - #endif - #define WINDOW_HEIGHT 480 - -+/*****************************************************************/ -+/****************** Configure Controls ***************************/ -+/*****************************************************************/ -+ -+// Use XEV in terminal window to find keycodes to configure buttons. -+#define XANA_UP (25) -+#define XANA_DOWN (39) -+#define XANA_LEFT (38) -+#define XANA_RIGHT (40) -+#define XANA_LT (79) -+#define XANA_RT (81) -+#define XDPAD_UP (31) -+#define XDPAD_DOWN (45) -+#define XDPAD_LEFT (44) -+#define XDPAD_RIGHT (46) -+#define XBTN_Y (80) -+#define XBTN_X (83) -+#define XBTN_B (85) -+#define XBTN_A (84) -+#define XBTN_START (36) -+ -+/*******************************************************************/ -+ -+u8 temp_joyx = 0; -+u8 temp_joyy = 0; -+u8 temp_lt = 0; -+u8 temp_rt = 0; -+ - void* x11_win=0,* x11_disp=0; - void* libPvr_GetRenderTarget() - { -@@ -124,8 +153,8 @@ - { Btn_A,Btn_B,Btn_X,Btn_Y,0,0,0,Btn_Start,0,0 }; - - const u32 JMapAxis_360[MAP_SIZE] = -- { Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; -- -+ //{ Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; -+ { Axis_X,Axis_Y,0,0,Axis_RT,Axis_LT,DPad_Left,DPad_Up,0,0 }; - const u32* JMapBtn=JMapBtn_USB; - const u32* JMapAxis=JMapAxis_USB; - -@@ -180,7 +209,7 @@ - - printf("SDK: Found '%s' joystick with %d axis and %d buttons\n",Name,AxisCount,ButtonCount); - -- if (strcmp(Name,"Microsoft X-Box 360 pad")==0) -+ if (strcmp(Name,"Microsoft X-Box 360 pad")==0 || strcmp(Name,"Xbox Gamepad (userspace driver)")==0) - { - JMapBtn=JMapBtn_360; - JMapAxis=JMapAxis_360; -@@ -414,9 +443,20 @@ - { - static char key = 0; - -- kcode[port]= x11_dc_buttons; -- rt[port]=0; -- lt[port]=0; -+ if (cfgLoadInt("config","usejoypad",0)==1) -+ { -+ HandleJoystick(port); -+ return; -+ } -+ else -+ { -+ kcode[port]= x11_dc_buttons; -+ joyx[0] = temp_joyx; -+ joyy[0] = temp_joyy; -+ lt[0] = temp_lt; -+ rt[0] = temp_rt; -+ return; -+ } - - #if defined(TARGET_GCW0) || defined(TARGET_PANDORA) - HandleJoystick(port); -@@ -472,7 +512,13 @@ - void os_DoEvents() - { - #if defined(SUPPORT_X11) -- if (x11_win) { -+ -+ static bool ana_up = false; -+ static bool ana_down = false; -+ static bool ana_left = false; -+ static bool ana_right = false; -+ -+ if (x11_win) { - //Handle X11 - XEvent e; - if(XCheckWindowEvent((Display*)x11_disp, (Window)x11_win, KeyPressMask | KeyReleaseMask, &e)) -@@ -483,6 +529,103 @@ - case KeyPress: - case KeyRelease: - { -+ -+ //Detect up press -+ if(e.xkey.keycode == XANA_UP) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_up = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_up = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //Detect down Press -+ if(e.xkey.keycode == XANA_DOWN) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_down = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_down = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //Detect left press -+ if(e.xkey.keycode == XANA_LEFT) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_left = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_left = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //Detect right Press -+ if(e.xkey.keycode == XANA_RIGHT) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_right = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_right = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //detect LT press -+ if (e.xkey.keycode == XANA_LT) -+ { -+ if (e.type == KeyPress) -+ { -+ temp_lt = 255; -+ } -+ else if (e.type == KeyRelease) -+ { -+ temp_lt = 0; -+ } -+ else -+ { -+ } -+ } -+ -+ //detect RT press -+ if (e.xkey.keycode == XANA_RT) -+ { -+ if (e.type == KeyPress) -+ { -+ temp_rt = 255; -+ } -+ else if (e.type == KeyRelease) -+ { -+ temp_rt = 0; -+ } -+ else -+ { -+ } -+ } -+ - int dc_key = x11_keymap[e.xkey.keycode]; - - if (e.type == KeyPress) -@@ -494,14 +637,44 @@ - } - break; - -- -+ default: - { - printf("KEYRELEASE\n"); - } - break; - - } -- } -+ } -+ -+ /* Check analogue control states (up/down) */ -+ if((ana_up == true) && (ana_down == false)) -+ { -+ temp_joyy = -127; -+ } -+ else if((ana_up == false) && (ana_down == true)) -+ { -+ temp_joyy = 127; -+ } -+ else -+ { -+ /* Either both pressed simultaniously or neither pressed */ -+ temp_joyy = 0; -+ } -+ -+ /* Check analogue control states (left/right) */ -+ if((ana_left == true) && (ana_right == false)) -+ { -+ temp_joyx = -127; -+ } -+ else if((ana_left == false) && (ana_right == true)) -+ { -+ temp_joyx = 127; -+ } -+ else -+ { -+ /* Either both pressed simultaniously or neither pressed */ -+ temp_joyx = 0; -+ } - } - #endif - } -@@ -527,6 +700,9 @@ - void os_CreateWindow() - { - #if defined(SUPPORT_X11) -+ -+ Bool ar_set, ar_supp = false; -+ - if (cfgLoadInt("pvr","nox11",0)==0) - { - XInitThreads(); -@@ -636,7 +812,8 @@ - int height=cfgLoadInt("x11","height", WINDOW_HEIGHT); - #endif - -- if (width==-1) -+ //if (width==-1) -+ if (cfgLoadInt("x11","fullscreen",0)==1) - { - width=XDisplayWidth(x11Display,x11Screen); - height=XDisplayHeight(x11Display,x11Screen); -@@ -653,8 +830,21 @@ - - XMapRaised(x11Display, x11Window); - #else -- XMapWindow(x11Display, x11Window); -- -+ -+ if (cfgLoadInt("x11","fullscreen",0)==1) -+ { -+ // fullscreen -+ Atom wmState = XInternAtom(x11Display, "_NET_WM_STATE", False); -+ Atom wmFullscreen = XInternAtom(x11Display, "_NET_WM_STATE_FULLSCREEN", False); -+ XChangeProperty(x11Display, x11Window, wmState, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wmFullscreen, 1); -+ } -+ -+ XMapWindow(x11Display, x11Window); -+ -+ //This 1 second delay is important. Without it the GLX code can execute before the window -+ //resize completes causing a black border at the top of the screen.... -+ sleep(1); -+ - #if !defined(GLES) - - #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 -@@ -690,6 +880,11 @@ - //(EGLNativeDisplayType)x11Display; - x11_disp=(void*)x11Display; - x11_win=(void*)x11Window; -+ -+ ar_set = XkbSetDetectableAutoRepeat(x11Display, True, &ar_supp); -+ printf("XkbSetDetectableAutoRepeat returns %u, supported = %u\n",ar_set, ar_supp); -+ -+ - } - else - printf("Not creating X11 window ..\n"); -@@ -805,16 +1000,16 @@ - #endif - - #if defined(SUPPORT_X11) -- x11_keymap[113] = DPad_Left; -- x11_keymap[114] = DPad_Right; -+ x11_keymap[XDPAD_LEFT] = DPad_Left; -+ x11_keymap[XDPAD_RIGHT] = DPad_Right; - -- x11_keymap[111] = DPad_Up; -- x11_keymap[116] = DPad_Down; -+ x11_keymap[XDPAD_UP] = DPad_Up; -+ x11_keymap[XDPAD_DOWN] = DPad_Down; - -- x11_keymap[52] = Btn_Y; -- x11_keymap[53] = Btn_X; -- x11_keymap[54] = Btn_B; -- x11_keymap[55] = Btn_A; -+ x11_keymap[XBTN_Y] = Btn_Y; -+ x11_keymap[XBTN_X] = Btn_X; -+ x11_keymap[XBTN_B] = Btn_B; -+ x11_keymap[XBTN_A] = Btn_A; - - /* - //TODO: Fix sliders -@@ -822,7 +1017,7 @@ - x11_keymap[39] = DPad_Down; - */ - -- x11_keymap[36] = Btn_Start; -+ x11_keymap[XBTN_START] = Btn_Start; - #endif - - printf("Home dir is: %s\n",GetPath("/").c_str()); diff --git a/pcr/reicast-git/enable_joystick_support_old.patch b/pcr/reicast-git/enable_joystick_support_old.patch new file mode 100644 index 000000000..0fbb59ac7 --- /dev/null +++ b/pcr/reicast-git/enable_joystick_support_old.patch @@ -0,0 +1,346 @@ +diff -Nur reicast-emulator.orig/core/linux-dist/main.cpp reicast-emulator/core/linux-dist/main.cpp +--- reicast-emulator.orig/core/linux-dist/main.cpp 2015-06-29 21:42:22.674278849 -0300 ++++ reicast-emulator/core/linux-dist/main.cpp 2015-06-29 22:08:38.780500620 -0300 +@@ -22,6 +22,7 @@ + #include + #include + #include ++ #include + + #if !defined(GLES) + #include +@@ -49,6 +50,34 @@ + #endif + #define WINDOW_HEIGHT 480 + ++/*****************************************************************/ ++/****************** Configure Controls ***************************/ ++/*****************************************************************/ ++ ++// Use XEV in terminal window to find keycodes to configure buttons. ++#define XANA_UP (25) ++#define XANA_DOWN (39) ++#define XANA_LEFT (38) ++#define XANA_RIGHT (40) ++#define XANA_LT (79) ++#define XANA_RT (81) ++#define XDPAD_UP (31) ++#define XDPAD_DOWN (45) ++#define XDPAD_LEFT (44) ++#define XDPAD_RIGHT (46) ++#define XBTN_Y (80) ++#define XBTN_X (83) ++#define XBTN_B (85) ++#define XBTN_A (84) ++#define XBTN_START (36) ++ ++/*******************************************************************/ ++ ++u8 temp_joyx = 0; ++u8 temp_joyy = 0; ++u8 temp_lt = 0; ++u8 temp_rt = 0; ++ + void* x11_win=0,* x11_disp=0; + void* libPvr_GetRenderTarget() + { +@@ -124,8 +153,8 @@ + { Btn_A,Btn_B,Btn_X,Btn_Y,0,0,0,Btn_Start,0,0 }; + + const u32 JMapAxis_360[MAP_SIZE] = +- { Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; +- ++ //{ Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; ++ { Axis_X,Axis_Y,0,0,Axis_RT,Axis_LT,DPad_Left,DPad_Up,0,0 }; + const u32* JMapBtn=JMapBtn_USB; + const u32* JMapAxis=JMapAxis_USB; + +@@ -180,7 +209,7 @@ + + printf("SDK: Found '%s' joystick with %d axis and %d buttons\n",Name,AxisCount,ButtonCount); + +- if (strcmp(Name,"Microsoft X-Box 360 pad")==0) ++ if (strcmp(Name,"Microsoft X-Box 360 pad")==0 || strcmp(Name,"Xbox Gamepad (userspace driver)")==0) + { + JMapBtn=JMapBtn_360; + JMapAxis=JMapAxis_360; +@@ -414,9 +443,20 @@ + { + static char key = 0; + +- kcode[port]= x11_dc_buttons; +- rt[port]=0; +- lt[port]=0; ++ if (cfgLoadInt("config","usejoypad",0)==1) ++ { ++ HandleJoystick(port); ++ return; ++ } ++ else ++ { ++ kcode[port]= x11_dc_buttons; ++ joyx[0] = temp_joyx; ++ joyy[0] = temp_joyy; ++ lt[0] = temp_lt; ++ rt[0] = temp_rt; ++ return; ++ } + + #if defined(TARGET_GCW0) || defined(TARGET_PANDORA) + HandleJoystick(port); +@@ -472,7 +512,13 @@ + void os_DoEvents() + { + #if defined(SUPPORT_X11) +- if (x11_win) { ++ ++ static bool ana_up = false; ++ static bool ana_down = false; ++ static bool ana_left = false; ++ static bool ana_right = false; ++ ++ if (x11_win) { + //Handle X11 + XEvent e; + if(XCheckWindowEvent((Display*)x11_disp, (Window)x11_win, KeyPressMask | KeyReleaseMask, &e)) +@@ -483,6 +529,103 @@ + case KeyPress: + case KeyRelease: + { ++ ++ //Detect up press ++ if(e.xkey.keycode == XANA_UP) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_up = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_up = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //Detect down Press ++ if(e.xkey.keycode == XANA_DOWN) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_down = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_down = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //Detect left press ++ if(e.xkey.keycode == XANA_LEFT) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_left = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_left = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //Detect right Press ++ if(e.xkey.keycode == XANA_RIGHT) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_right = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_right = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //detect LT press ++ if (e.xkey.keycode == XANA_LT) ++ { ++ if (e.type == KeyPress) ++ { ++ temp_lt = 255; ++ } ++ else if (e.type == KeyRelease) ++ { ++ temp_lt = 0; ++ } ++ else ++ { ++ } ++ } ++ ++ //detect RT press ++ if (e.xkey.keycode == XANA_RT) ++ { ++ if (e.type == KeyPress) ++ { ++ temp_rt = 255; ++ } ++ else if (e.type == KeyRelease) ++ { ++ temp_rt = 0; ++ } ++ else ++ { ++ } ++ } ++ + int dc_key = x11_keymap[e.xkey.keycode]; + + if (e.type == KeyPress) +@@ -494,14 +637,44 @@ + } + break; + +- ++ default: + { + printf("KEYRELEASE\n"); + } + break; + + } +- } ++ } ++ ++ /* Check analogue control states (up/down) */ ++ if((ana_up == true) && (ana_down == false)) ++ { ++ temp_joyy = -127; ++ } ++ else if((ana_up == false) && (ana_down == true)) ++ { ++ temp_joyy = 127; ++ } ++ else ++ { ++ /* Either both pressed simultaniously or neither pressed */ ++ temp_joyy = 0; ++ } ++ ++ /* Check analogue control states (left/right) */ ++ if((ana_left == true) && (ana_right == false)) ++ { ++ temp_joyx = -127; ++ } ++ else if((ana_left == false) && (ana_right == true)) ++ { ++ temp_joyx = 127; ++ } ++ else ++ { ++ /* Either both pressed simultaniously or neither pressed */ ++ temp_joyx = 0; ++ } + } + #endif + } +@@ -527,6 +700,9 @@ + void os_CreateWindow() + { + #if defined(SUPPORT_X11) ++ ++ Bool ar_set, ar_supp = false; ++ + if (cfgLoadInt("pvr","nox11",0)==0) + { + XInitThreads(); +@@ -636,7 +812,8 @@ + int height=cfgLoadInt("x11","height", WINDOW_HEIGHT); + #endif + +- if (width==-1) ++ //if (width==-1) ++ if (cfgLoadInt("x11","fullscreen",0)==1) + { + width=XDisplayWidth(x11Display,x11Screen); + height=XDisplayHeight(x11Display,x11Screen); +@@ -653,8 +830,21 @@ + + XMapRaised(x11Display, x11Window); + #else +- XMapWindow(x11Display, x11Window); +- ++ ++ if (cfgLoadInt("x11","fullscreen",0)==1) ++ { ++ // fullscreen ++ Atom wmState = XInternAtom(x11Display, "_NET_WM_STATE", False); ++ Atom wmFullscreen = XInternAtom(x11Display, "_NET_WM_STATE_FULLSCREEN", False); ++ XChangeProperty(x11Display, x11Window, wmState, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wmFullscreen, 1); ++ } ++ ++ XMapWindow(x11Display, x11Window); ++ ++ //This 1 second delay is important. Without it the GLX code can execute before the window ++ //resize completes causing a black border at the top of the screen.... ++ sleep(1); ++ + #if !defined(GLES) + + #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +@@ -690,6 +880,11 @@ + //(EGLNativeDisplayType)x11Display; + x11_disp=(void*)x11Display; + x11_win=(void*)x11Window; ++ ++ ar_set = XkbSetDetectableAutoRepeat(x11Display, True, &ar_supp); ++ printf("XkbSetDetectableAutoRepeat returns %u, supported = %u\n",ar_set, ar_supp); ++ ++ + } + else + printf("Not creating X11 window ..\n"); +@@ -805,16 +1000,16 @@ + #endif + + #if defined(SUPPORT_X11) +- x11_keymap[113] = DPad_Left; +- x11_keymap[114] = DPad_Right; ++ x11_keymap[XDPAD_LEFT] = DPad_Left; ++ x11_keymap[XDPAD_RIGHT] = DPad_Right; + +- x11_keymap[111] = DPad_Up; +- x11_keymap[116] = DPad_Down; ++ x11_keymap[XDPAD_UP] = DPad_Up; ++ x11_keymap[XDPAD_DOWN] = DPad_Down; + +- x11_keymap[52] = Btn_Y; +- x11_keymap[53] = Btn_X; +- x11_keymap[54] = Btn_B; +- x11_keymap[55] = Btn_A; ++ x11_keymap[XBTN_Y] = Btn_Y; ++ x11_keymap[XBTN_X] = Btn_X; ++ x11_keymap[XBTN_B] = Btn_B; ++ x11_keymap[XBTN_A] = Btn_A; + + /* + //TODO: Fix sliders +@@ -822,7 +1017,7 @@ + x11_keymap[39] = DPad_Down; + */ + +- x11_keymap[36] = Btn_Start; ++ x11_keymap[XBTN_START] = Btn_Start; + #endif + + printf("Home dir is: %s\n",GetPath("/").c_str()); diff --git a/pcr/reicast-git/enable_x11_keyboard_support.patch b/pcr/reicast-git/enable_x11_keyboard_support.patch new file mode 100644 index 000000000..1dfd41c72 --- /dev/null +++ b/pcr/reicast-git/enable_x11_keyboard_support.patch @@ -0,0 +1,233 @@ +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 + #include + #include ++#include + + #if !defined(GLES) + #include +@@ -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 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(); diff --git a/pcr/reicast-git/wait_if_two_frames_already_in_flight.patch b/pcr/reicast-git/wait_if_two_frames_already_in_flight.patch index ff297365c..56e774138 100644 --- a/pcr/reicast-git/wait_if_two_frames_already_in_flight.patch +++ b/pcr/reicast-git/wait_if_two_frames_already_in_flight.patch @@ -1,15 +1,15 @@ -diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/core/hw/pvr/Renderer_if.cpp ---- reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:04:02.180069939 -0300 -+++ reicast-emulator/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:10:17.831402600 -0300 -@@ -184,6 +184,7 @@ +diff -Nur a/core/hw/pvr/Renderer_if.cpp b/core/hw/pvr/Renderer_if.cpp +--- a/core/hw/pvr/Renderer_if.cpp 2015-08-23 00:16:33.916598479 -0300 ++++ b/core/hw/pvr/Renderer_if.cpp 2015-08-23 02:25:28.932602664 -0300 +@@ -187,6 +187,7 @@ bool rend_frame(TA_context* ctx, bool draw_osd) { bool proc = renderer->Process(ctx); + FinishRender(_pvrrc); + #if !defined(TARGET_NO_THREADS) re.Set(); - - bool do_swp = proc && renderer->Render(); -@@ -207,7 +208,7 @@ + #endif +@@ -213,7 +214,7 @@ bool do_swp = rend_frame(_pvrrc, true); //clear up & free data .. @@ -18,15 +18,15 @@ diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/cor _pvrrc=0; return do_swp; -@@ -260,6 +261,7 @@ - +@@ -267,6 +268,7 @@ + #endif bool pend_rend = false; +extern TA_context* rqueue; void rend_resize(int width, int height) { renderer->Resize(width, height); -@@ -268,6 +270,10 @@ +@@ -275,6 +277,10 @@ void rend_start_render() { @@ -37,29 +37,10 @@ diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/cor pend_rend = false; bool is_rtt=(FB_W_SOF1& 0x1000000)!=0; TA_context* ctx = tactx_Pop(CORE_CURRENT_CTX); -@@ -314,7 +320,6 @@ - } - } - -- - void rend_end_render() - { - #if 1 //also disabled the printf, it takes quite some time ... -@@ -325,8 +330,9 @@ - #endif - #endif - -- if (pend_rend) -+ if (pend_rend) { - re.Wait(); -+ } - } - - /* -diff -Nur reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp reicast-emulator/core/hw/pvr/ta_ctx.cpp ---- reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:04:02.186736275 -0300 -+++ reicast-emulator/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:07:44.202370584 -0300 -@@ -119,8 +119,6 @@ +diff -Nur a/core/hw/pvr/ta_ctx.cpp b/core/hw/pvr/ta_ctx.cpp +--- a/core/hw/pvr/ta_ctx.cpp 2015-08-23 00:16:33.917598487 -0300 ++++ b/core/hw/pvr/ta_ctx.cpp 2015-08-23 02:26:47.189293717 -0300 +@@ -127,8 +127,6 @@ mtx_rqueue.Lock(); rqueue = 0; mtx_rqueue.Unlock(); diff --git a/pcr/reicast-git/wait_if_two_frames_already_in_flight_old.patch b/pcr/reicast-git/wait_if_two_frames_already_in_flight_old.patch new file mode 100644 index 000000000..ff297365c --- /dev/null +++ b/pcr/reicast-git/wait_if_two_frames_already_in_flight_old.patch @@ -0,0 +1,70 @@ +diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/core/hw/pvr/Renderer_if.cpp +--- reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:04:02.180069939 -0300 ++++ reicast-emulator/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:10:17.831402600 -0300 +@@ -184,6 +184,7 @@ + + bool rend_frame(TA_context* ctx, bool draw_osd) { + bool proc = renderer->Process(ctx); ++ FinishRender(_pvrrc); + re.Set(); + + bool do_swp = proc && renderer->Render(); +@@ -207,7 +208,7 @@ + bool do_swp = rend_frame(_pvrrc, true); + + //clear up & free data .. +- FinishRender(_pvrrc); ++ tactx_Recycle(_pvrrc); + _pvrrc=0; + + return do_swp; +@@ -260,6 +261,7 @@ + + + bool pend_rend = false; ++extern TA_context* rqueue; + + void rend_resize(int width, int height) { + renderer->Resize(width, height); +@@ -268,6 +270,10 @@ + + void rend_start_render() + { ++ if (rqueue) { ++ rend_end_render(); ++ } ++ + pend_rend = false; + bool is_rtt=(FB_W_SOF1& 0x1000000)!=0; + TA_context* ctx = tactx_Pop(CORE_CURRENT_CTX); +@@ -314,7 +320,6 @@ + } + } + +- + void rend_end_render() + { + #if 1 //also disabled the printf, it takes quite some time ... +@@ -325,8 +330,9 @@ + #endif + #endif + +- if (pend_rend) ++ if (pend_rend) { + re.Wait(); ++ } + } + + /* +diff -Nur reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp reicast-emulator/core/hw/pvr/ta_ctx.cpp +--- reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:04:02.186736275 -0300 ++++ reicast-emulator/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:07:44.202370584 -0300 +@@ -119,8 +119,6 @@ + mtx_rqueue.Lock(); + rqueue = 0; + mtx_rqueue.Unlock(); +- +- tactx_Recycle(ctx); + } + + cMutex mtx_pool; diff --git a/pcr/reicast-multilib-git/PKGBUILD b/pcr/reicast-multilib-git/PKGBUILD index c675fa002..647a42e21 100644 --- a/pcr/reicast-multilib-git/PKGBUILD +++ b/pcr/reicast-multilib-git/PKGBUILD @@ -3,7 +3,7 @@ # Maintainer: Márcio Silva pkgname=reicast-multilib-git -pkgver=r1322.4b94e2f +pkgver=r1546.5fd66a1 pkgrel=1 pkgdesc="A multiplatform Sega Dreamcast emulator" arch=('x86_64') @@ -13,15 +13,15 @@ conflicts=('reicast') provides=('reicast') makedepends=('git') makedepends_x86_64=('gcc-multilib') -depends_x86_64=('lib32-libgl' 'lib32-alsa-plugins') +depends_x86_64=('lib32-libgl' 'lib32-alsa-plugins' 'lib32-libpulse') optdepends=('xboxdrv: Userspace gamepad driver for Xbox and Xbox360 gamepads' 'antimicro: Graphical program used to map keyboard keys and mouse controls to gamepad buttons') source=(reicast::"git+https://github.com/reicast/reicast-emulator.git" - 'enable_joystick_support.patch' + 'enable_x11_keyboard_support.patch' 'wait_if_two_frames_already_in_flight.patch') sha256sums=('SKIP' - '464946512ca4cffac104128a85dd174520caeaa0325afbf281b6cfdbc0120fc6' - 'f4d3b4ad7703da09dc59cae839ca225e1a21b89d905ede3519bf3174b40903da') + '095961538c13208b39ebb0b9d6b6e30c1225f218dcc67239a9d938a23aec601e' + '8f7b392ac6fac2d62e078a397f6b7c29ac3a23877d5c1a4566a58710b3383aef') pkgver() { cd reicast @@ -30,13 +30,17 @@ pkgver() { prepare () { cd reicast - patch -Np1 -i "$srcdir"/enable_joystick_support.patch + patch -Np1 -i "$srcdir"/enable_x11_keyboard_support.patch patch -Np1 -i "$srcdir"/wait_if_two_frames_already_in_flight.patch - # Fix pointer size on 64 bit arch: http://github.com/reicast-emulator/pull/768 - sed -i 's|verify((int)rbi);|verify((size_t)rbi);|' core/hw/sh4/dyna/driver.cpp # Add experimental shadow support: http://github.com/reicast-emulator/issues/94 sed -i 's|//DrawModVols|DrawModVols|' core/rend/gles/gldraw.cpp + + # Fix Xbox Input Axis + sed -i 's|DC_AXIS_LT, 0, 0, DC_AXIS_RT|0, 0, DC_AXIS_RT, DC_AXIS_LT|' core/linux-dist/joystick.cpp + + # Enable Pulseaudio + sed -i 's|#USE_PULSEAUDIO|USE_PULSEAUDIO|' shell/linux/Makefile } build () { diff --git a/pcr/reicast-multilib-git/enable_joystick_support.patch b/pcr/reicast-multilib-git/enable_joystick_support.patch deleted file mode 100644 index 0fbb59ac7..000000000 --- a/pcr/reicast-multilib-git/enable_joystick_support.patch +++ /dev/null @@ -1,346 +0,0 @@ -diff -Nur reicast-emulator.orig/core/linux-dist/main.cpp reicast-emulator/core/linux-dist/main.cpp ---- reicast-emulator.orig/core/linux-dist/main.cpp 2015-06-29 21:42:22.674278849 -0300 -+++ reicast-emulator/core/linux-dist/main.cpp 2015-06-29 22:08:38.780500620 -0300 -@@ -22,6 +22,7 @@ - #include - #include - #include -+ #include - - #if !defined(GLES) - #include -@@ -49,6 +50,34 @@ - #endif - #define WINDOW_HEIGHT 480 - -+/*****************************************************************/ -+/****************** Configure Controls ***************************/ -+/*****************************************************************/ -+ -+// Use XEV in terminal window to find keycodes to configure buttons. -+#define XANA_UP (25) -+#define XANA_DOWN (39) -+#define XANA_LEFT (38) -+#define XANA_RIGHT (40) -+#define XANA_LT (79) -+#define XANA_RT (81) -+#define XDPAD_UP (31) -+#define XDPAD_DOWN (45) -+#define XDPAD_LEFT (44) -+#define XDPAD_RIGHT (46) -+#define XBTN_Y (80) -+#define XBTN_X (83) -+#define XBTN_B (85) -+#define XBTN_A (84) -+#define XBTN_START (36) -+ -+/*******************************************************************/ -+ -+u8 temp_joyx = 0; -+u8 temp_joyy = 0; -+u8 temp_lt = 0; -+u8 temp_rt = 0; -+ - void* x11_win=0,* x11_disp=0; - void* libPvr_GetRenderTarget() - { -@@ -124,8 +153,8 @@ - { Btn_A,Btn_B,Btn_X,Btn_Y,0,0,0,Btn_Start,0,0 }; - - const u32 JMapAxis_360[MAP_SIZE] = -- { Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; -- -+ //{ Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; -+ { Axis_X,Axis_Y,0,0,Axis_RT,Axis_LT,DPad_Left,DPad_Up,0,0 }; - const u32* JMapBtn=JMapBtn_USB; - const u32* JMapAxis=JMapAxis_USB; - -@@ -180,7 +209,7 @@ - - printf("SDK: Found '%s' joystick with %d axis and %d buttons\n",Name,AxisCount,ButtonCount); - -- if (strcmp(Name,"Microsoft X-Box 360 pad")==0) -+ if (strcmp(Name,"Microsoft X-Box 360 pad")==0 || strcmp(Name,"Xbox Gamepad (userspace driver)")==0) - { - JMapBtn=JMapBtn_360; - JMapAxis=JMapAxis_360; -@@ -414,9 +443,20 @@ - { - static char key = 0; - -- kcode[port]= x11_dc_buttons; -- rt[port]=0; -- lt[port]=0; -+ if (cfgLoadInt("config","usejoypad",0)==1) -+ { -+ HandleJoystick(port); -+ return; -+ } -+ else -+ { -+ kcode[port]= x11_dc_buttons; -+ joyx[0] = temp_joyx; -+ joyy[0] = temp_joyy; -+ lt[0] = temp_lt; -+ rt[0] = temp_rt; -+ return; -+ } - - #if defined(TARGET_GCW0) || defined(TARGET_PANDORA) - HandleJoystick(port); -@@ -472,7 +512,13 @@ - void os_DoEvents() - { - #if defined(SUPPORT_X11) -- if (x11_win) { -+ -+ static bool ana_up = false; -+ static bool ana_down = false; -+ static bool ana_left = false; -+ static bool ana_right = false; -+ -+ if (x11_win) { - //Handle X11 - XEvent e; - if(XCheckWindowEvent((Display*)x11_disp, (Window)x11_win, KeyPressMask | KeyReleaseMask, &e)) -@@ -483,6 +529,103 @@ - case KeyPress: - case KeyRelease: - { -+ -+ //Detect up press -+ if(e.xkey.keycode == XANA_UP) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_up = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_up = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //Detect down Press -+ if(e.xkey.keycode == XANA_DOWN) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_down = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_down = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //Detect left press -+ if(e.xkey.keycode == XANA_LEFT) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_left = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_left = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //Detect right Press -+ if(e.xkey.keycode == XANA_RIGHT) -+ { -+ if(e.type == KeyPress) -+ { -+ ana_right = true; -+ } -+ else if(e.type == KeyRelease) -+ { -+ ana_right = false; -+ } -+ else -+ { -+ } -+ } -+ -+ //detect LT press -+ if (e.xkey.keycode == XANA_LT) -+ { -+ if (e.type == KeyPress) -+ { -+ temp_lt = 255; -+ } -+ else if (e.type == KeyRelease) -+ { -+ temp_lt = 0; -+ } -+ else -+ { -+ } -+ } -+ -+ //detect RT press -+ if (e.xkey.keycode == XANA_RT) -+ { -+ if (e.type == KeyPress) -+ { -+ temp_rt = 255; -+ } -+ else if (e.type == KeyRelease) -+ { -+ temp_rt = 0; -+ } -+ else -+ { -+ } -+ } -+ - int dc_key = x11_keymap[e.xkey.keycode]; - - if (e.type == KeyPress) -@@ -494,14 +637,44 @@ - } - break; - -- -+ default: - { - printf("KEYRELEASE\n"); - } - break; - - } -- } -+ } -+ -+ /* Check analogue control states (up/down) */ -+ if((ana_up == true) && (ana_down == false)) -+ { -+ temp_joyy = -127; -+ } -+ else if((ana_up == false) && (ana_down == true)) -+ { -+ temp_joyy = 127; -+ } -+ else -+ { -+ /* Either both pressed simultaniously or neither pressed */ -+ temp_joyy = 0; -+ } -+ -+ /* Check analogue control states (left/right) */ -+ if((ana_left == true) && (ana_right == false)) -+ { -+ temp_joyx = -127; -+ } -+ else if((ana_left == false) && (ana_right == true)) -+ { -+ temp_joyx = 127; -+ } -+ else -+ { -+ /* Either both pressed simultaniously or neither pressed */ -+ temp_joyx = 0; -+ } - } - #endif - } -@@ -527,6 +700,9 @@ - void os_CreateWindow() - { - #if defined(SUPPORT_X11) -+ -+ Bool ar_set, ar_supp = false; -+ - if (cfgLoadInt("pvr","nox11",0)==0) - { - XInitThreads(); -@@ -636,7 +812,8 @@ - int height=cfgLoadInt("x11","height", WINDOW_HEIGHT); - #endif - -- if (width==-1) -+ //if (width==-1) -+ if (cfgLoadInt("x11","fullscreen",0)==1) - { - width=XDisplayWidth(x11Display,x11Screen); - height=XDisplayHeight(x11Display,x11Screen); -@@ -653,8 +830,21 @@ - - XMapRaised(x11Display, x11Window); - #else -- XMapWindow(x11Display, x11Window); -- -+ -+ if (cfgLoadInt("x11","fullscreen",0)==1) -+ { -+ // fullscreen -+ Atom wmState = XInternAtom(x11Display, "_NET_WM_STATE", False); -+ Atom wmFullscreen = XInternAtom(x11Display, "_NET_WM_STATE_FULLSCREEN", False); -+ XChangeProperty(x11Display, x11Window, wmState, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wmFullscreen, 1); -+ } -+ -+ XMapWindow(x11Display, x11Window); -+ -+ //This 1 second delay is important. Without it the GLX code can execute before the window -+ //resize completes causing a black border at the top of the screen.... -+ sleep(1); -+ - #if !defined(GLES) - - #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 -@@ -690,6 +880,11 @@ - //(EGLNativeDisplayType)x11Display; - x11_disp=(void*)x11Display; - x11_win=(void*)x11Window; -+ -+ ar_set = XkbSetDetectableAutoRepeat(x11Display, True, &ar_supp); -+ printf("XkbSetDetectableAutoRepeat returns %u, supported = %u\n",ar_set, ar_supp); -+ -+ - } - else - printf("Not creating X11 window ..\n"); -@@ -805,16 +1000,16 @@ - #endif - - #if defined(SUPPORT_X11) -- x11_keymap[113] = DPad_Left; -- x11_keymap[114] = DPad_Right; -+ x11_keymap[XDPAD_LEFT] = DPad_Left; -+ x11_keymap[XDPAD_RIGHT] = DPad_Right; - -- x11_keymap[111] = DPad_Up; -- x11_keymap[116] = DPad_Down; -+ x11_keymap[XDPAD_UP] = DPad_Up; -+ x11_keymap[XDPAD_DOWN] = DPad_Down; - -- x11_keymap[52] = Btn_Y; -- x11_keymap[53] = Btn_X; -- x11_keymap[54] = Btn_B; -- x11_keymap[55] = Btn_A; -+ x11_keymap[XBTN_Y] = Btn_Y; -+ x11_keymap[XBTN_X] = Btn_X; -+ x11_keymap[XBTN_B] = Btn_B; -+ x11_keymap[XBTN_A] = Btn_A; - - /* - //TODO: Fix sliders -@@ -822,7 +1017,7 @@ - x11_keymap[39] = DPad_Down; - */ - -- x11_keymap[36] = Btn_Start; -+ x11_keymap[XBTN_START] = Btn_Start; - #endif - - printf("Home dir is: %s\n",GetPath("/").c_str()); diff --git a/pcr/reicast-multilib-git/enable_joystick_support_old.patch b/pcr/reicast-multilib-git/enable_joystick_support_old.patch new file mode 100644 index 000000000..0fbb59ac7 --- /dev/null +++ b/pcr/reicast-multilib-git/enable_joystick_support_old.patch @@ -0,0 +1,346 @@ +diff -Nur reicast-emulator.orig/core/linux-dist/main.cpp reicast-emulator/core/linux-dist/main.cpp +--- reicast-emulator.orig/core/linux-dist/main.cpp 2015-06-29 21:42:22.674278849 -0300 ++++ reicast-emulator/core/linux-dist/main.cpp 2015-06-29 22:08:38.780500620 -0300 +@@ -22,6 +22,7 @@ + #include + #include + #include ++ #include + + #if !defined(GLES) + #include +@@ -49,6 +50,34 @@ + #endif + #define WINDOW_HEIGHT 480 + ++/*****************************************************************/ ++/****************** Configure Controls ***************************/ ++/*****************************************************************/ ++ ++// Use XEV in terminal window to find keycodes to configure buttons. ++#define XANA_UP (25) ++#define XANA_DOWN (39) ++#define XANA_LEFT (38) ++#define XANA_RIGHT (40) ++#define XANA_LT (79) ++#define XANA_RT (81) ++#define XDPAD_UP (31) ++#define XDPAD_DOWN (45) ++#define XDPAD_LEFT (44) ++#define XDPAD_RIGHT (46) ++#define XBTN_Y (80) ++#define XBTN_X (83) ++#define XBTN_B (85) ++#define XBTN_A (84) ++#define XBTN_START (36) ++ ++/*******************************************************************/ ++ ++u8 temp_joyx = 0; ++u8 temp_joyy = 0; ++u8 temp_lt = 0; ++u8 temp_rt = 0; ++ + void* x11_win=0,* x11_disp=0; + void* libPvr_GetRenderTarget() + { +@@ -124,8 +153,8 @@ + { Btn_A,Btn_B,Btn_X,Btn_Y,0,0,0,Btn_Start,0,0 }; + + const u32 JMapAxis_360[MAP_SIZE] = +- { Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; +- ++ //{ Axis_X,Axis_Y,Axis_LT,0,0,Axis_RT,DPad_Left,DPad_Up,0,0 }; ++ { Axis_X,Axis_Y,0,0,Axis_RT,Axis_LT,DPad_Left,DPad_Up,0,0 }; + const u32* JMapBtn=JMapBtn_USB; + const u32* JMapAxis=JMapAxis_USB; + +@@ -180,7 +209,7 @@ + + printf("SDK: Found '%s' joystick with %d axis and %d buttons\n",Name,AxisCount,ButtonCount); + +- if (strcmp(Name,"Microsoft X-Box 360 pad")==0) ++ if (strcmp(Name,"Microsoft X-Box 360 pad")==0 || strcmp(Name,"Xbox Gamepad (userspace driver)")==0) + { + JMapBtn=JMapBtn_360; + JMapAxis=JMapAxis_360; +@@ -414,9 +443,20 @@ + { + static char key = 0; + +- kcode[port]= x11_dc_buttons; +- rt[port]=0; +- lt[port]=0; ++ if (cfgLoadInt("config","usejoypad",0)==1) ++ { ++ HandleJoystick(port); ++ return; ++ } ++ else ++ { ++ kcode[port]= x11_dc_buttons; ++ joyx[0] = temp_joyx; ++ joyy[0] = temp_joyy; ++ lt[0] = temp_lt; ++ rt[0] = temp_rt; ++ return; ++ } + + #if defined(TARGET_GCW0) || defined(TARGET_PANDORA) + HandleJoystick(port); +@@ -472,7 +512,13 @@ + void os_DoEvents() + { + #if defined(SUPPORT_X11) +- if (x11_win) { ++ ++ static bool ana_up = false; ++ static bool ana_down = false; ++ static bool ana_left = false; ++ static bool ana_right = false; ++ ++ if (x11_win) { + //Handle X11 + XEvent e; + if(XCheckWindowEvent((Display*)x11_disp, (Window)x11_win, KeyPressMask | KeyReleaseMask, &e)) +@@ -483,6 +529,103 @@ + case KeyPress: + case KeyRelease: + { ++ ++ //Detect up press ++ if(e.xkey.keycode == XANA_UP) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_up = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_up = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //Detect down Press ++ if(e.xkey.keycode == XANA_DOWN) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_down = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_down = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //Detect left press ++ if(e.xkey.keycode == XANA_LEFT) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_left = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_left = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //Detect right Press ++ if(e.xkey.keycode == XANA_RIGHT) ++ { ++ if(e.type == KeyPress) ++ { ++ ana_right = true; ++ } ++ else if(e.type == KeyRelease) ++ { ++ ana_right = false; ++ } ++ else ++ { ++ } ++ } ++ ++ //detect LT press ++ if (e.xkey.keycode == XANA_LT) ++ { ++ if (e.type == KeyPress) ++ { ++ temp_lt = 255; ++ } ++ else if (e.type == KeyRelease) ++ { ++ temp_lt = 0; ++ } ++ else ++ { ++ } ++ } ++ ++ //detect RT press ++ if (e.xkey.keycode == XANA_RT) ++ { ++ if (e.type == KeyPress) ++ { ++ temp_rt = 255; ++ } ++ else if (e.type == KeyRelease) ++ { ++ temp_rt = 0; ++ } ++ else ++ { ++ } ++ } ++ + int dc_key = x11_keymap[e.xkey.keycode]; + + if (e.type == KeyPress) +@@ -494,14 +637,44 @@ + } + break; + +- ++ default: + { + printf("KEYRELEASE\n"); + } + break; + + } +- } ++ } ++ ++ /* Check analogue control states (up/down) */ ++ if((ana_up == true) && (ana_down == false)) ++ { ++ temp_joyy = -127; ++ } ++ else if((ana_up == false) && (ana_down == true)) ++ { ++ temp_joyy = 127; ++ } ++ else ++ { ++ /* Either both pressed simultaniously or neither pressed */ ++ temp_joyy = 0; ++ } ++ ++ /* Check analogue control states (left/right) */ ++ if((ana_left == true) && (ana_right == false)) ++ { ++ temp_joyx = -127; ++ } ++ else if((ana_left == false) && (ana_right == true)) ++ { ++ temp_joyx = 127; ++ } ++ else ++ { ++ /* Either both pressed simultaniously or neither pressed */ ++ temp_joyx = 0; ++ } + } + #endif + } +@@ -527,6 +700,9 @@ + void os_CreateWindow() + { + #if defined(SUPPORT_X11) ++ ++ Bool ar_set, ar_supp = false; ++ + if (cfgLoadInt("pvr","nox11",0)==0) + { + XInitThreads(); +@@ -636,7 +812,8 @@ + int height=cfgLoadInt("x11","height", WINDOW_HEIGHT); + #endif + +- if (width==-1) ++ //if (width==-1) ++ if (cfgLoadInt("x11","fullscreen",0)==1) + { + width=XDisplayWidth(x11Display,x11Screen); + height=XDisplayHeight(x11Display,x11Screen); +@@ -653,8 +830,21 @@ + + XMapRaised(x11Display, x11Window); + #else +- XMapWindow(x11Display, x11Window); +- ++ ++ if (cfgLoadInt("x11","fullscreen",0)==1) ++ { ++ // fullscreen ++ Atom wmState = XInternAtom(x11Display, "_NET_WM_STATE", False); ++ Atom wmFullscreen = XInternAtom(x11Display, "_NET_WM_STATE_FULLSCREEN", False); ++ XChangeProperty(x11Display, x11Window, wmState, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wmFullscreen, 1); ++ } ++ ++ XMapWindow(x11Display, x11Window); ++ ++ //This 1 second delay is important. Without it the GLX code can execute before the window ++ //resize completes causing a black border at the top of the screen.... ++ sleep(1); ++ + #if !defined(GLES) + + #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +@@ -690,6 +880,11 @@ + //(EGLNativeDisplayType)x11Display; + x11_disp=(void*)x11Display; + x11_win=(void*)x11Window; ++ ++ ar_set = XkbSetDetectableAutoRepeat(x11Display, True, &ar_supp); ++ printf("XkbSetDetectableAutoRepeat returns %u, supported = %u\n",ar_set, ar_supp); ++ ++ + } + else + printf("Not creating X11 window ..\n"); +@@ -805,16 +1000,16 @@ + #endif + + #if defined(SUPPORT_X11) +- x11_keymap[113] = DPad_Left; +- x11_keymap[114] = DPad_Right; ++ x11_keymap[XDPAD_LEFT] = DPad_Left; ++ x11_keymap[XDPAD_RIGHT] = DPad_Right; + +- x11_keymap[111] = DPad_Up; +- x11_keymap[116] = DPad_Down; ++ x11_keymap[XDPAD_UP] = DPad_Up; ++ x11_keymap[XDPAD_DOWN] = DPad_Down; + +- x11_keymap[52] = Btn_Y; +- x11_keymap[53] = Btn_X; +- x11_keymap[54] = Btn_B; +- x11_keymap[55] = Btn_A; ++ x11_keymap[XBTN_Y] = Btn_Y; ++ x11_keymap[XBTN_X] = Btn_X; ++ x11_keymap[XBTN_B] = Btn_B; ++ x11_keymap[XBTN_A] = Btn_A; + + /* + //TODO: Fix sliders +@@ -822,7 +1017,7 @@ + x11_keymap[39] = DPad_Down; + */ + +- x11_keymap[36] = Btn_Start; ++ x11_keymap[XBTN_START] = Btn_Start; + #endif + + printf("Home dir is: %s\n",GetPath("/").c_str()); diff --git a/pcr/reicast-multilib-git/enable_x11_keyboard_support.patch b/pcr/reicast-multilib-git/enable_x11_keyboard_support.patch new file mode 100644 index 000000000..1dfd41c72 --- /dev/null +++ b/pcr/reicast-multilib-git/enable_x11_keyboard_support.patch @@ -0,0 +1,233 @@ +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 + #include + #include ++#include + + #if !defined(GLES) + #include +@@ -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 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(); diff --git a/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight.patch b/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight.patch index ff297365c..56e774138 100644 --- a/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight.patch +++ b/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight.patch @@ -1,15 +1,15 @@ -diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/core/hw/pvr/Renderer_if.cpp ---- reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:04:02.180069939 -0300 -+++ reicast-emulator/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:10:17.831402600 -0300 -@@ -184,6 +184,7 @@ +diff -Nur a/core/hw/pvr/Renderer_if.cpp b/core/hw/pvr/Renderer_if.cpp +--- a/core/hw/pvr/Renderer_if.cpp 2015-08-23 00:16:33.916598479 -0300 ++++ b/core/hw/pvr/Renderer_if.cpp 2015-08-23 02:25:28.932602664 -0300 +@@ -187,6 +187,7 @@ bool rend_frame(TA_context* ctx, bool draw_osd) { bool proc = renderer->Process(ctx); + FinishRender(_pvrrc); + #if !defined(TARGET_NO_THREADS) re.Set(); - - bool do_swp = proc && renderer->Render(); -@@ -207,7 +208,7 @@ + #endif +@@ -213,7 +214,7 @@ bool do_swp = rend_frame(_pvrrc, true); //clear up & free data .. @@ -18,15 +18,15 @@ diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/cor _pvrrc=0; return do_swp; -@@ -260,6 +261,7 @@ - +@@ -267,6 +268,7 @@ + #endif bool pend_rend = false; +extern TA_context* rqueue; void rend_resize(int width, int height) { renderer->Resize(width, height); -@@ -268,6 +270,10 @@ +@@ -275,6 +277,10 @@ void rend_start_render() { @@ -37,29 +37,10 @@ diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/cor pend_rend = false; bool is_rtt=(FB_W_SOF1& 0x1000000)!=0; TA_context* ctx = tactx_Pop(CORE_CURRENT_CTX); -@@ -314,7 +320,6 @@ - } - } - -- - void rend_end_render() - { - #if 1 //also disabled the printf, it takes quite some time ... -@@ -325,8 +330,9 @@ - #endif - #endif - -- if (pend_rend) -+ if (pend_rend) { - re.Wait(); -+ } - } - - /* -diff -Nur reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp reicast-emulator/core/hw/pvr/ta_ctx.cpp ---- reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:04:02.186736275 -0300 -+++ reicast-emulator/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:07:44.202370584 -0300 -@@ -119,8 +119,6 @@ +diff -Nur a/core/hw/pvr/ta_ctx.cpp b/core/hw/pvr/ta_ctx.cpp +--- a/core/hw/pvr/ta_ctx.cpp 2015-08-23 00:16:33.917598487 -0300 ++++ b/core/hw/pvr/ta_ctx.cpp 2015-08-23 02:26:47.189293717 -0300 +@@ -127,8 +127,6 @@ mtx_rqueue.Lock(); rqueue = 0; mtx_rqueue.Unlock(); diff --git a/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight_old.patch b/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight_old.patch new file mode 100644 index 000000000..ff297365c --- /dev/null +++ b/pcr/reicast-multilib-git/wait_if_two_frames_already_in_flight_old.patch @@ -0,0 +1,70 @@ +diff -Nur reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp reicast-emulator/core/hw/pvr/Renderer_if.cpp +--- reicast-emulator.orig/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:04:02.180069939 -0300 ++++ reicast-emulator/core/hw/pvr/Renderer_if.cpp 2015-06-20 02:10:17.831402600 -0300 +@@ -184,6 +184,7 @@ + + bool rend_frame(TA_context* ctx, bool draw_osd) { + bool proc = renderer->Process(ctx); ++ FinishRender(_pvrrc); + re.Set(); + + bool do_swp = proc && renderer->Render(); +@@ -207,7 +208,7 @@ + bool do_swp = rend_frame(_pvrrc, true); + + //clear up & free data .. +- FinishRender(_pvrrc); ++ tactx_Recycle(_pvrrc); + _pvrrc=0; + + return do_swp; +@@ -260,6 +261,7 @@ + + + bool pend_rend = false; ++extern TA_context* rqueue; + + void rend_resize(int width, int height) { + renderer->Resize(width, height); +@@ -268,6 +270,10 @@ + + void rend_start_render() + { ++ if (rqueue) { ++ rend_end_render(); ++ } ++ + pend_rend = false; + bool is_rtt=(FB_W_SOF1& 0x1000000)!=0; + TA_context* ctx = tactx_Pop(CORE_CURRENT_CTX); +@@ -314,7 +320,6 @@ + } + } + +- + void rend_end_render() + { + #if 1 //also disabled the printf, it takes quite some time ... +@@ -325,8 +330,9 @@ + #endif + #endif + +- if (pend_rend) ++ if (pend_rend) { + re.Wait(); ++ } + } + + /* +diff -Nur reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp reicast-emulator/core/hw/pvr/ta_ctx.cpp +--- reicast-emulator.orig/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:04:02.186736275 -0300 ++++ reicast-emulator/core/hw/pvr/ta_ctx.cpp 2015-06-20 02:07:44.202370584 -0300 +@@ -119,8 +119,6 @@ + mtx_rqueue.Lock(); + rqueue = 0; + mtx_rqueue.Unlock(); +- +- tactx_Recycle(ctx); + } + + cMutex mtx_pool; -- cgit v1.2.3