From 7fd8d6a239951cf143a3eb77c418edd76119db11 Mon Sep 17 00:00:00 2001 From: CatalystG Date: Tue, 18 Jun 2013 20:37:28 -0400 Subject: [PATCH 1/2] (BlackBerry) Possible fix for weird overlay issues. --- blackberry-qnx/qnx_input.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/blackberry-qnx/qnx_input.c b/blackberry-qnx/qnx_input.c index 753f2ce539..ea98f28a48 100644 --- a/blackberry-qnx/qnx_input.c +++ b/blackberry-qnx/qnx_input.c @@ -37,6 +37,8 @@ static unsigned touch_count; input_device_t devices[MAX_PADS]; input_device_t *port_device[MAX_PADS]; +static unsigned screen_width, screen_height; + unsigned pads_connected; static void qnx_input_autodetect_gamepad(input_device_t* controller); @@ -313,6 +315,18 @@ static void process_touch_event(screen_event_t event, int type) { if(touch[i].contact_id == contact_id) { + //During a move, we can go ~30 pixel into the bezel which gives negative + //numbers or numbers larger than the screen res. Normalize. + if(pos[0] < 0) + pos[0] = 0; + if(pos[0] > screen_width) + pos[0] = screen_width; + + if(pos[1] < 0) + pos[1] = 0; + if(pos[1] > screen_height) + pos[1] = screen_height; + input_translate_coord_viewport(pos[0], pos[1], &touch[i].x, &touch[i].y, &touch[i].full_x, &touch[i].full_y); @@ -468,6 +482,10 @@ static void *qnx_input_init(void) init_playbook_keyboard(); #endif + //Get screen dimensions + if(gfx_ctx_bbqnx.get_video_size) + gfx_ctx_bbqnx.get_video_size(&screen_width, &screen_height); + initialized = 1; return (void*)-1; @@ -543,10 +561,12 @@ static int16_t qnx_input_state(void *data, const struct retro_keybind **retro_ke case RARCH_DEVICE_POINTER_SCREEN: case RETRO_DEVICE_POINTER: { + const bool want_full = device == RARCH_DEVICE_POINTER_SCREEN; + switch (id) { - case RETRO_DEVICE_ID_POINTER_X: return touch[index].full_x; - case RETRO_DEVICE_ID_POINTER_Y: return touch[index].full_y; + case RETRO_DEVICE_ID_POINTER_X: return want_full ? touch[index].full_x : touch[index].x; + case RETRO_DEVICE_ID_POINTER_Y: return want_full ? touch[index].full_y : touch[index].y; case RETRO_DEVICE_ID_POINTER_PRESSED: return (touch[index].contact_id != -1); } From 820d0ab3c909c96e9e94cd764d9641bfabf45e13 Mon Sep 17 00:00:00 2001 From: CatalystG Date: Wed, 19 Jun 2013 20:33:21 -0400 Subject: [PATCH 2/2] (BlackBerry) Fix a mistake that caused random button presses on unmapped players. --- blackberry-qnx/qnx_input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/blackberry-qnx/qnx_input.c b/blackberry-qnx/qnx_input.c index ea98f28a48..7acfe5132e 100644 --- a/blackberry-qnx/qnx_input.c +++ b/blackberry-qnx/qnx_input.c @@ -535,6 +535,7 @@ static int16_t qnx_input_state(void *data, const struct retro_keybind **retro_ke return ((port_device[port]->buttons & retro_keybinds[port][id].joykey) && (port < pads_connected)); } } + break; #ifdef HAVE_BB10 case RETRO_DEVICE_ANALOG: //Need to return [-0x8000, 0x7fff]