(BlackBerry) Hide overlay on Q10 and when controllers are mapped. Add RGUI toggle to controllers.

This commit is contained in:
CatalystG 2013-06-11 23:18:06 -04:00
parent 4e0e2ff245
commit d5775ea531
4 changed files with 34 additions and 32 deletions

View File

@ -114,8 +114,8 @@ Page
onTriggered: onTriggered:
{ {
var sym, data; var sym, data;
sym = RetroArch.mapButton(0, players.selectedValue, indexPath);
data = dataModel.data(indexPath); data = dataModel.data(indexPath);
sym = RetroArch.mapButton(0, players.selectedValue, data["index"]);
data["button"] = RetroArch.buttonToString(0, sym); data["button"] = RetroArch.buttonToString(0, sym);
dataModel.replace(indexPath, data); dataModel.replace(indexPath, data);
} }

View File

@ -8,30 +8,6 @@
#include "input/input_common.h" #include "input/input_common.h"
#include "../../frontend_qnx.h" #include "../../frontend_qnx.h"
/*
ButtonMap_t buttons[] = {
{ SCREEN_A_GAME_BUTTON, "A button" },
{ SCREEN_B_GAME_BUTTON, "B button" },
{ SCREEN_C_GAME_BUTTON, "C button" },
{ SCREEN_X_GAME_BUTTON, "X button" },
{ SCREEN_Y_GAME_BUTTON, "Y button" },
{ SCREEN_Z_GAME_BUTTON, "Z button" },
{ SCREEN_MENU1_GAME_BUTTON, "Menu1 button" },
{ SCREEN_MENU2_GAME_BUTTON, "Menu2 button" },
{ SCREEN_MENU3_GAME_BUTTON, "Menu3 button" },
{ SCREEN_MENU4_GAME_BUTTON, "Menu4 button" },
{ SCREEN_L1_GAME_BUTTON, "L1 Button" },
{ SCREEN_L2_GAME_BUTTON, "L2 Button" },
{ SCREEN_L3_GAME_BUTTON, "L3 Button" },
{ SCREEN_R1_GAME_BUTTON, "R1 Button" },
{ SCREEN_R2_GAME_BUTTON, "R2 Button" },
{ SCREEN_R3_GAME_BUTTON, "R3 Button" },
{ SCREEN_DPAD_UP_GAME_BUTTON, "D-Pad Up" },
{ SCREEN_DPAD_DOWN_GAME_BUTTON, "D-Pad Down" },
{ SCREEN_DPAD_LEFT_GAME_BUTTON, "D-Pad Left" },
{ SCREEN_DPAD_RIGHT_GAME_BUTTON, "D-Pad Right" },
};*/
ButtonMap::ButtonMap(screen_context_t screen_ctx, QString groupId, int coid) ButtonMap::ButtonMap(screen_context_t screen_ctx, QString groupId, int coid)
{ {
this->screen_cxt = screen_ctx; this->screen_cxt = screen_ctx;
@ -224,8 +200,13 @@ void ButtonMap::mapDevice(int index, int player)
map.insert("label",QVariant(desc)); map.insert("label",QVariant(desc));
map.insert("button", buttonToString(g_settings.input.binds[0][i].joykey)); map.insert("button", buttonToString(g_settings.input.binds[0][i].joykey));
map.insert("type", QVariant("item")); map.insert("type", QVariant("item"));
qDebug() << map; map.insert("index", QVariant(i));
qDebug() << "Joykey: " << g_settings.input.binds[0][i].joykey;
buttonDataModel->append(map); buttonDataModel->append(map);
} }
map.insert("label",QVariant("RetroArch Menu"));
map.insert("button", buttonToString(g_settings.input.binds[0][RARCH_MENU_TOGGLE].joykey));
map.insert("type", QVariant("item"));
map.insert("index", QVariant(RARCH_MENU_TOGGLE));
buttonDataModel->append(map);
} }

View File

@ -374,9 +374,12 @@ void RetroArch::initRASettings()
HardwareInfo *hwInfo = new HardwareInfo(); HardwareInfo *hwInfo = new HardwareInfo();
//TODO: Check of we have a controller active. //If Physical keyboard or a device mapped to player 1, hide overlay
if(!hwInfo->isPhysicalKeyboardDevice()) //TODO: Should there be a minimized/quick settings only overlay?
if(!hwInfo->isPhysicalKeyboardDevice() && !port_device[0])
strlcpy(g_settings.input.overlay, GET_CORE_INFO(coreSelectedIndex, "default_overlay").toAscii().constData(), sizeof(g_settings.input.overlay)); strlcpy(g_settings.input.overlay, GET_CORE_INFO(coreSelectedIndex, "default_overlay").toAscii().constData(), sizeof(g_settings.input.overlay));
else
*g_settings.input.overlay = '\0';
} }
int RetroArch::mapButton(void* deviceVp, int player, int button) int RetroArch::mapButton(void* deviceVp, int player, int button)

View File

@ -70,6 +70,11 @@ static void process_gamepad_event(screen_event_t screen_event, int type)
if (controller->analogCount == 2) if (controller->analogCount == 2)
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ANALOG1, controller->analog1); screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ANALOG1, controller->analog1);
//Only player 1
//TODO: Am I missing something? Is there a better way?
if((controller->port == 0) && (controller->buttons & g_settings.input.binds[0][RARCH_MENU_TOGGLE].joykey))
g_extern.lifecycle_state ^= (1ULL << RARCH_MENU_TOGGLE);
} }
static void loadController(input_device_t* controller) static void loadController(input_device_t* controller)
@ -267,6 +272,10 @@ static void process_keyboard_event(screen_event_t event, int type)
} }
} }
//TODO: Am I missing something? Is there a better way?
if((controller->port == 0) && ((unsigned int)g_settings.input.binds[0][RARCH_MENU_TOGGLE].joykey == (unsigned int)(sym&0xFF)))
g_extern.lifecycle_state ^= (1ULL << RARCH_MENU_TOGGLE);
} }
static void process_touch_event(screen_event_t event, int type) static void process_touch_event(screen_event_t event, int type)
@ -503,15 +512,16 @@ static int16_t qnx_input_state(void *data, const struct retro_keybind **retro_ke
{ {
if (port_device[port]->device == DEVICE_KEYBOARD || port_device[port]->device == DEVICE_KEYPAD) if (port_device[port]->device == DEVICE_KEYBOARD || port_device[port]->device == DEVICE_KEYPAD)
return ((port_device[port]->buttons & (1 << id)) && (port < pads_connected) ); return ((port_device[port]->buttons & (1 << id)) && (port < pads_connected) );
else else{
return ((port_device[port]->buttons & retro_keybinds[port][id].joykey) && (port < pads_connected)); return ((port_device[port]->buttons & retro_keybinds[port][id].joykey) && (port < pads_connected));
}
} }
#ifdef HAVE_BB10 #ifdef HAVE_BB10
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
//Need to return [-0x8000, 0x7fff] //Need to return [-0x8000, 0x7fff]
//Gamepad API gives us [-128, 127] with (0,0) center //Gamepad API gives us [-128, 127] with (0,0) center
//Untested //Untested
if(port_device[port] != (input_device_t*)-1) if(port_device[port])
{ {
switch ((index << 1) | id) switch ((index << 1) | id)
{ {
@ -550,7 +560,7 @@ static int16_t qnx_input_state(void *data, const struct retro_keybind **retro_ke
static bool qnx_input_key_pressed(void *data, int key) static bool qnx_input_key_pressed(void *data, int key)
{ {
return ((g_extern.lifecycle_state | driver.overlay_state) & (1ULL << key)); return ((g_extern.lifecycle_state | driver.overlay_state ) & (1ULL << key));
} }
static void qnx_input_free_input(void *data) static void qnx_input_free_input(void *data)
@ -638,6 +648,7 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].def_joykey = SCREEN_R2_GAME_BUTTON; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].def_joykey = SCREEN_R2_GAME_BUTTON;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joykey = SCREEN_L3_GAME_BUTTON; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joykey = SCREEN_L3_GAME_BUTTON;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = SCREEN_R3_GAME_BUTTON; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = SCREEN_R3_GAME_BUTTON;
g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey = SCREEN_MENU3_GAME_BUTTON;
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE; g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE;
controller->port = port; controller->port = port;
port_device[port] = controller; port_device[port] = controller;
@ -662,6 +673,7 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].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_L3].def_joykey = 0;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0;
g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey = KEYCODE_P & 0xFF;
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE; g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE;
controller->port = port; controller->port = port;
port_device[port] = controller; port_device[port] = controller;
@ -687,6 +699,7 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].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_L3].def_joykey = 0;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0;
g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey = KEYCODE_TILDE;
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE; g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE;
controller->port = port; controller->port = port;
port_device[port] = controller; port_device[port] = controller;
@ -712,6 +725,7 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].def_joykey = SCREEN_R2_GAME_BUTTON; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].def_joykey = SCREEN_R2_GAME_BUTTON;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joykey = SCREEN_L3_GAME_BUTTON; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joykey = SCREEN_L3_GAME_BUTTON;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = SCREEN_R3_GAME_BUTTON; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = SCREEN_R3_GAME_BUTTON;
g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey = 0; //TODO: Find a good mappnig
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE; g_settings.input.dpad_emulation[port] = ANALOG_DPAD_NONE;
controller->port = port; controller->port = port;
port_device[port] = controller; port_device[port] = controller;
@ -737,6 +751,7 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].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_L3].def_joykey = 0;
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0; g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = 0;
g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey = 0;
controller->port = -1; controller->port = -1;
port_device[port] = 0; port_device[port] = 0;
break; break;
@ -748,6 +763,9 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
g_settings.input.binds[port][i].id = i; g_settings.input.binds[port][i].id = i;
g_settings.input.binds[port][i].joykey = g_settings.input.binds[port][i].def_joykey; g_settings.input.binds[port][i].joykey = g_settings.input.binds[port][i].def_joykey;
} }
g_settings.input.binds[port][RARCH_MENU_TOGGLE].id = RARCH_MENU_TOGGLE;
g_settings.input.binds[port][RARCH_MENU_TOGGLE].joykey = g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey;
} }
#ifdef HAVE_BB10 #ifdef HAVE_BB10