Skip to content

Commit

Permalink
(BlackBerry) Add HW Keypad support for Q10, hide default overlay.
Browse files Browse the repository at this point in the history
  • Loading branch information
CatalystG committed May 7, 2013
1 parent 0c78586 commit 89e672d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blackberry-qnx/bb10/RetroArch-Cascades.pro
Expand Up @@ -3,7 +3,7 @@ APP_NAME = RetroArch-Cascades
CONFIG += qt warn_on cascades10

LIBS += -lscreen -lbps -lOpenAL -lpng -lEGL -lGLESv2
LIBS += -lbbcascadespickers -lbbdata
LIBS += -lbbcascadespickers -lbbdata -lbbdevice

DEFINES += HAVE_RGUI HAVE_NEON \
SINC_LOWER_QUALITY HAVE_RARCH_MAIN_IMPLEMENTATION \
Expand Down
8 changes: 7 additions & 1 deletion blackberry-qnx/bb10/src/RetroArch-Cascades.cpp
Expand Up @@ -28,6 +28,7 @@
#include <bb/cascades/Window>
#include <bb/cascades/pickers/FilePicker>
#include <bb/data/JsonDataAccess>
#include <bb/device/HardwareInfo>

#include <screen/screen.h>
#include <bps/screen.h>
Expand All @@ -40,6 +41,7 @@

using namespace bb::cascades;
using namespace bb::data;
using namespace bb::device;

//Use after calling findCores
#define GET_CORE_INFO(x, y) coreInfo[coreList[x]].toMap()[y].toString()
Expand Down Expand Up @@ -306,6 +308,10 @@ void RetroArch::initRASettings()
{
strlcpy(g_settings.libretro,(char *)core.toAscii().constData(), sizeof(g_settings.libretro));
strlcpy(g_extern.fullpath, (char *)rom.toAscii().constData(), sizeof(g_extern.fullpath));
strlcpy(g_settings.input.overlay, GET_CORE_INFO(coreSelectedIndex, "default_overlay").toAscii().constData(), sizeof(g_settings.input.overlay));

HardwareInfo *hwInfo = new HardwareInfo();

if(!hwInfo->isPhysicalKeyboardDevice())
strlcpy(g_settings.input.overlay, GET_CORE_INFO(coreSelectedIndex, "default_overlay").toAscii().constData(), sizeof(g_settings.input.overlay));
}

26 changes: 25 additions & 1 deletion blackberry-qnx/playbook/qnx_input.c
Expand Up @@ -218,6 +218,8 @@ static void qnx_input_autodetect_gamepad(input_device_t* controller)
device = DEVICE_WIIMOTE;
else if (strstr(controller->id, "0A5C-8502"))
device = DEVICE_KEYBOARD;
else if (strstr(controller->id, "qwerty:bb35"))
device = DEVICE_KEYPAD;
else if (controller->id)
device = DEVICE_UNKNOWN;
else
Expand Down Expand Up @@ -502,7 +504,7 @@ static int16_t qnx_input_state(void *data, const struct retro_keybind **retro_ke
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (g_settings.input.device[port] == DEVICE_KEYBOARD)
if (g_settings.input.device[port] == DEVICE_KEYBOARD || g_settings.input.device[port] == DEVICE_KEYPAD)
return ((devices[port].buttons & (1 << id)) && (port < pads_connected));
else
return ((devices[port].buttons & retro_keybinds[port][id].joykey) && (port < pads_connected));
Expand Down Expand Up @@ -634,6 +636,28 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = SCREEN_R3_GAME_BUTTON;
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE;
break;
case DEVICE_KEYPAD:
strlcpy(g_settings.input.device_names[port], "BlackBerry Q10 Keypad",
sizeof(g_settings.input.device_names[port]));
g_settings.input.device[port] = device;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_B].def_joykey = KEYCODE_M & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_Y].def_joykey = KEYCODE_J & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_SELECT].def_joykey = KEYCODE_RIGHT_SHIFT & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_START].def_joykey = KEYCODE_RETURN & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_UP].def_joykey = KEYCODE_W & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_DOWN].def_joykey = KEYCODE_S & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_LEFT].def_joykey = KEYCODE_A & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_RIGHT].def_joykey = KEYCODE_D & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_A].def_joykey = KEYCODE_N & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_X].def_joykey = KEYCODE_K & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L].def_joykey = KEYCODE_U & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R].def_joykey = KEYCODE_I & 0xFF;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L2].def_joykey = 0;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].def_joykey = 0;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joykey = 0;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0;
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE;
break;
#endif
case DEVICE_KEYBOARD:
strlcpy(g_settings.input.device_names[port], "BlackBerry BT Keyboard",
Expand Down
1 change: 1 addition & 0 deletions driver.h
Expand Up @@ -276,6 +276,7 @@ enum input_devices
DEVICE_NONE,
DEVICE_WIIMOTE,
DEVICE_KEYBOARD,
DEVICE_KEYPAD,
DEVICE_UNKNOWN,
#endif
DEVICE_LAST
Expand Down

0 comments on commit 89e672d

Please sign in to comment.