2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2012-01-08 00:08:18 +00:00
|
|
|
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2012 - Daniel De Matteis
|
2011-11-30 16:24:18 +00:00
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2011-11-30 16:24:18 +00:00
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2011-11-30 16:24:18 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2011-11-30 16:24:18 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-03-05 15:57:43 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
2012-03-19 01:55:13 +00:00
|
|
|
|
2012-07-01 12:10:13 +00:00
|
|
|
#ifdef __PSL1GHT__
|
|
|
|
#include <io/pad.h>
|
|
|
|
#else
|
2012-03-19 01:55:13 +00:00
|
|
|
#include <cell/pad.h>
|
2012-07-01 12:10:13 +00:00
|
|
|
#endif
|
2012-06-19 03:10:42 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_MOUSE
|
2012-07-01 14:20:33 +00:00
|
|
|
#ifdef __PSL1GHT__
|
|
|
|
#include <io/mouse.h>
|
|
|
|
#else
|
2012-06-19 03:10:42 +00:00
|
|
|
#include <cell/mouse.h>
|
|
|
|
#endif
|
2012-07-01 14:20:33 +00:00
|
|
|
#endif
|
2012-06-19 03:10:42 +00:00
|
|
|
|
2012-07-01 12:10:13 +00:00
|
|
|
#ifndef __PSL1GHT__
|
2012-03-19 01:55:13 +00:00
|
|
|
#include <sdk_version.h>
|
2012-07-01 12:10:13 +00:00
|
|
|
#endif
|
|
|
|
|
2012-03-25 22:36:40 +00:00
|
|
|
#include <sys/memory.h>
|
2012-07-01 12:10:13 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_OSKUTIL
|
2012-07-01 14:20:33 +00:00
|
|
|
#ifdef __PSL1GHT__
|
|
|
|
#include <sysutil/osk.h>
|
|
|
|
#else
|
2012-03-25 22:36:40 +00:00
|
|
|
#include <sysutil/sysutil_oskdialog.h>
|
2012-07-01 12:10:13 +00:00
|
|
|
#endif
|
2012-07-01 14:20:33 +00:00
|
|
|
#endif
|
2012-07-01 12:10:13 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-03-25 22:36:40 +00:00
|
|
|
#include <sysutil/sysutil_common.h>
|
2012-07-01 12:10:13 +00:00
|
|
|
#endif
|
2012-03-19 01:55:13 +00:00
|
|
|
|
2012-07-01 14:13:25 +00:00
|
|
|
#include "sdk_defines.h"
|
|
|
|
|
2012-01-11 21:27:07 +00:00
|
|
|
#include "ps3_input.h"
|
2012-03-05 15:57:43 +00:00
|
|
|
#include "../driver.h"
|
2012-06-28 15:52:51 +00:00
|
|
|
#include "../console/retroarch_console.h"
|
2012-04-09 22:22:02 +00:00
|
|
|
#include "../libretro.h"
|
2012-01-20 23:30:01 +00:00
|
|
|
#include "../general.h"
|
2011-11-30 16:24:18 +00:00
|
|
|
|
2012-06-19 03:10:42 +00:00
|
|
|
/*============================================================
|
|
|
|
PS3 MOUSE
|
|
|
|
============================================================ */
|
|
|
|
|
|
|
|
#ifdef HAVE_MOUSE
|
|
|
|
|
|
|
|
#define MAX_MICE 7
|
|
|
|
|
|
|
|
static void ps3_mouse_input_deinit(void)
|
|
|
|
{
|
|
|
|
cellMouseEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t ps3_mouse_input_mice_connected(void)
|
|
|
|
{
|
|
|
|
CellMouseInfo mouse_info;
|
|
|
|
cellMouseGetInfo(&mouse_info);
|
|
|
|
return mouse_info.now_connect;
|
|
|
|
}
|
|
|
|
|
|
|
|
CellMouseData ps3_mouse_input_poll_device(uint32_t id)
|
|
|
|
{
|
|
|
|
CellMouseData mouse_data;
|
|
|
|
|
|
|
|
// Get new pad data
|
|
|
|
cellMouseGetData(id, &mouse_data);
|
|
|
|
|
|
|
|
return mouse_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-03-25 22:36:40 +00:00
|
|
|
/*============================================================
|
|
|
|
PS3 PAD
|
|
|
|
============================================================ */
|
2012-03-19 01:55:13 +00:00
|
|
|
|
|
|
|
#define MAP(x) (x & 0xFF)
|
|
|
|
|
2012-03-25 22:36:40 +00:00
|
|
|
static uint64_t state[MAX_PADS];
|
2012-04-10 16:07:21 +00:00
|
|
|
static unsigned pads_connected;
|
2012-07-01 13:18:26 +00:00
|
|
|
#ifdef HAVE_MOUSE
|
2012-06-19 03:10:42 +00:00
|
|
|
static unsigned mice_connected;
|
2012-07-01 13:18:26 +00:00
|
|
|
#endif
|
2012-03-25 22:36:40 +00:00
|
|
|
|
2012-03-19 01:55:13 +00:00
|
|
|
uint32_t cell_pad_input_pads_connected(void)
|
|
|
|
{
|
2012-07-01 12:10:13 +00:00
|
|
|
pPadInfo pad_info;
|
|
|
|
pPadGetInfo(&pad_info);
|
2012-03-19 01:55:13 +00:00
|
|
|
return pad_info.now_connect;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t cell_pad_input_poll_device(uint32_t id)
|
|
|
|
{
|
2012-07-01 12:10:13 +00:00
|
|
|
pPadData pad_data;
|
2012-03-19 01:55:13 +00:00
|
|
|
static uint64_t ret[MAX_PADS];
|
|
|
|
|
|
|
|
// Get new pad data
|
2012-07-01 12:10:13 +00:00
|
|
|
pPadGetData(id, &pad_data);
|
2012-03-19 01:55:13 +00:00
|
|
|
|
|
|
|
if (pad_data.len == 0)
|
|
|
|
return ret[id];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret[id] = 0;
|
|
|
|
|
|
|
|
// Build the return value.
|
|
|
|
ret[id] |= (uint64_t)MAP(pad_data.button[LOWER_BUTTONS]);
|
|
|
|
ret[id] |= (uint64_t)MAP(pad_data.button[HIGHER_BUTTONS]) << 8;
|
|
|
|
ret[id] |= (uint64_t)MAP(pad_data.button[RSTICK_X]) << 32;
|
|
|
|
ret[id] |= (uint64_t)MAP(pad_data.button[RSTICK_Y]) << 40;
|
|
|
|
ret[id] |= (uint64_t)MAP(pad_data.button[LSTICK_X]) << 16;
|
|
|
|
ret[id] |= (uint64_t)MAP(pad_data.button[LSTICK_Y]) << 24;
|
|
|
|
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_LEFT_LSTICK(ret[id])) << LSTICK_LEFT_SHIFT;
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_RIGHT_LSTICK(ret[id])) << LSTICK_RIGHT_SHIFT;
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_UP_LSTICK(ret[id])) << LSTICK_UP_SHIFT;
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_DOWN_LSTICK(ret[id])) << LSTICK_DOWN_SHIFT;
|
|
|
|
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_LEFT_RSTICK(ret[id])) << RSTICK_LEFT_SHIFT;
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_RIGHT_RSTICK(ret[id])) << RSTICK_RIGHT_SHIFT;
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_UP_RSTICK(ret[id])) << RSTICK_UP_SHIFT;
|
|
|
|
ret[id] |= (uint64_t)(PRESSED_DOWN_RSTICK(ret[id])) << RSTICK_DOWN_SHIFT;
|
|
|
|
return ret[id];
|
|
|
|
}
|
|
|
|
}
|
2011-11-30 16:24:18 +00:00
|
|
|
static void ps3_input_poll(void *data)
|
|
|
|
{
|
|
|
|
(void)data;
|
2012-03-05 06:35:50 +00:00
|
|
|
for (unsigned i = 0; i < MAX_PADS; i++)
|
2012-06-19 03:10:42 +00:00
|
|
|
{
|
2011-12-02 01:34:06 +00:00
|
|
|
state[i] = cell_pad_input_poll_device(i);
|
2012-06-19 03:10:42 +00:00
|
|
|
}
|
2012-04-10 16:07:21 +00:00
|
|
|
|
|
|
|
pads_connected = cell_pad_input_pads_connected();
|
2012-06-19 03:10:42 +00:00
|
|
|
#ifdef HAVE_MOUSE
|
|
|
|
mice_connected = ps3_mouse_input_mice_connected();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_MOUSE
|
|
|
|
|
|
|
|
static int16_t ps3_mouse_device_state(void *data, unsigned player, unsigned id)
|
|
|
|
{
|
|
|
|
CellMouseData mouse_state = ps3_mouse_input_poll_device(player);
|
|
|
|
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
|
|
|
return (!mice_connected ? 0 : mouse_state.buttons & CELL_MOUSE_BUTTON_1);
|
|
|
|
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
|
|
|
return (!mice_connected ? 0 : mouse_state.buttons & CELL_MOUSE_BUTTON_2);
|
|
|
|
case RETRO_DEVICE_ID_MOUSE_X:
|
|
|
|
return (!mice_connected ? 0 : mouse_state.x_axis);
|
|
|
|
case RETRO_DEVICE_ID_MOUSE_Y:
|
|
|
|
return (!mice_connected ? 0 : mouse_state.y_axis);
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
2011-11-30 16:24:18 +00:00
|
|
|
}
|
|
|
|
|
2012-06-19 03:10:42 +00:00
|
|
|
#endif
|
|
|
|
|
2011-12-02 01:34:06 +00:00
|
|
|
static int16_t ps3_input_state(void *data, const struct snes_keybind **binds,
|
2012-04-09 23:00:25 +00:00
|
|
|
unsigned port, unsigned device,
|
2011-12-02 01:34:06 +00:00
|
|
|
unsigned index, unsigned id)
|
2011-11-30 16:24:18 +00:00
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
|
2012-04-09 23:00:25 +00:00
|
|
|
unsigned player = port;
|
|
|
|
uint64_t button = binds[player][id].joykey;
|
2012-06-19 03:10:42 +00:00
|
|
|
int16_t retval = 0;
|
2012-04-10 16:07:21 +00:00
|
|
|
|
2012-06-19 03:10:42 +00:00
|
|
|
if(player < pads_connected)
|
|
|
|
{
|
|
|
|
switch (device)
|
|
|
|
{
|
|
|
|
case RETRO_DEVICE_JOYPAD:
|
|
|
|
retval = CTRL_MASK(state[player], button) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
#ifdef HAVE_MOUSE
|
|
|
|
case RETRO_DEVICE_MOUSE:
|
|
|
|
retval = ps3_mouse_device_state(data, player, id);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2011-11-30 16:24:18 +00:00
|
|
|
|
2012-04-10 16:07:21 +00:00
|
|
|
return retval;
|
2011-11-30 16:24:18 +00:00
|
|
|
}
|
|
|
|
|
2012-03-25 22:36:40 +00:00
|
|
|
/*============================================================
|
|
|
|
ON-SCREEN KEYBOARD UTILITY
|
|
|
|
============================================================ */
|
|
|
|
|
2012-06-19 03:10:42 +00:00
|
|
|
#ifdef HAVE_OSKUTIL
|
|
|
|
|
2012-04-10 19:23:42 +00:00
|
|
|
#define OSK_IN_USE 1
|
2012-03-25 22:36:40 +00:00
|
|
|
|
|
|
|
void oskutil_init(oskutil_params *params, unsigned int containersize)
|
|
|
|
{
|
|
|
|
params->flags = 0;
|
|
|
|
params->is_running = false;
|
|
|
|
if(containersize)
|
|
|
|
params->osk_memorycontainer = containersize;
|
|
|
|
else
|
|
|
|
params->osk_memorycontainer = 1024*1024*7;
|
|
|
|
}
|
|
|
|
|
2012-04-10 01:14:21 +00:00
|
|
|
static bool oskutil_enable_key_layout (void)
|
2012-03-25 22:36:40 +00:00
|
|
|
{
|
|
|
|
int ret = cellOskDialogSetKeyLayoutOption(CELL_OSKDIALOG_10KEY_PANEL | \
|
|
|
|
CELL_OSKDIALOG_FULLKEY_PANEL);
|
|
|
|
if (ret < 0)
|
|
|
|
return (false);
|
|
|
|
else
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void oskutil_create_activation_parameters(oskutil_params *params)
|
|
|
|
{
|
|
|
|
params->dialogParam.controlPoint.x = 0.0;
|
|
|
|
params->dialogParam.controlPoint.y = 0.0;
|
|
|
|
|
|
|
|
int32_t LayoutMode = CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER | CELL_OSKDIALOG_LAYOUTMODE_Y_ALIGN_TOP;
|
|
|
|
cellOskDialogSetLayoutMode(LayoutMode);
|
|
|
|
|
|
|
|
params->dialogParam.allowOskPanelFlg =
|
|
|
|
CELL_OSKDIALOG_PANELMODE_ALPHABET |
|
|
|
|
CELL_OSKDIALOG_PANELMODE_NUMERAL |
|
|
|
|
CELL_OSKDIALOG_PANELMODE_NUMERAL_FULL_WIDTH |
|
|
|
|
CELL_OSKDIALOG_PANELMODE_ENGLISH;
|
|
|
|
|
|
|
|
params->dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_ENGLISH;
|
|
|
|
params->dialogParam.prohibitFlgs = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void oskutil_write_message(oskutil_params *params, const wchar_t* msg)
|
|
|
|
{
|
|
|
|
params->inputFieldInfo.message = (uint16_t*)msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void oskutil_write_initial_message(oskutil_params *params, const wchar_t* msg)
|
|
|
|
{
|
|
|
|
params->inputFieldInfo.init_text = (uint16_t*)msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool oskutil_start(oskutil_params *params)
|
|
|
|
{
|
|
|
|
memset(params->osk_text_buffer, 0, sizeof(*params->osk_text_buffer));
|
|
|
|
memset(params->osk_text_buffer_char, 0, 256);
|
|
|
|
|
|
|
|
params->text_can_be_fetched = false;
|
|
|
|
|
|
|
|
if (params->flags & OSK_IN_USE)
|
|
|
|
return (true);
|
|
|
|
|
|
|
|
int ret = sys_memory_container_create(¶ms->containerid, params->osk_memorycontainer);
|
|
|
|
|
|
|
|
if(ret < 0)
|
|
|
|
return (false);
|
|
|
|
|
|
|
|
params->inputFieldInfo.limit_length = CELL_OSKDIALOG_STRING_SIZE;
|
|
|
|
|
|
|
|
oskutil_create_activation_parameters(params);
|
|
|
|
|
|
|
|
if(!oskutil_enable_key_layout())
|
|
|
|
return (false);
|
|
|
|
|
|
|
|
ret = cellOskDialogLoadAsync(params->containerid, ¶ms->dialogParam, ¶ms->inputFieldInfo);
|
|
|
|
if(ret < 0)
|
|
|
|
return (false);
|
|
|
|
|
|
|
|
params->flags |= OSK_IN_USE;
|
|
|
|
params->is_running = true;
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void oskutil_close(oskutil_params *params)
|
|
|
|
{
|
|
|
|
cellOskDialogAbort();
|
|
|
|
}
|
|
|
|
|
|
|
|
void oskutil_finished(oskutil_params *params)
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
|
|
|
|
params->outputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
|
|
|
|
params->outputInfo.numCharsResultString = 256;
|
|
|
|
params->outputInfo.pResultString = (uint16_t *)params->osk_text_buffer;
|
|
|
|
|
|
|
|
cellOskDialogUnloadAsync(¶ms->outputInfo);
|
|
|
|
|
|
|
|
switch (params->outputInfo.result)
|
|
|
|
{
|
|
|
|
case CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK:
|
|
|
|
num = wcstombs(params->osk_text_buffer_char, params->osk_text_buffer, 256);
|
|
|
|
params->osk_text_buffer_char[num]=0;
|
|
|
|
params->text_can_be_fetched = true;
|
|
|
|
break;
|
|
|
|
case CELL_OSKDIALOG_INPUT_FIELD_RESULT_CANCELED:
|
|
|
|
case CELL_OSKDIALOG_INPUT_FIELD_RESULT_ABORT:
|
|
|
|
case CELL_OSKDIALOG_INPUT_FIELD_RESULT_NO_INPUT_TEXT:
|
|
|
|
default:
|
|
|
|
params->osk_text_buffer_char[0]=0;
|
|
|
|
params->text_can_be_fetched = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
params->flags &= ~OSK_IN_USE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void oskutil_unload(oskutil_params *params)
|
|
|
|
{
|
|
|
|
sys_memory_container_destroy(params->containerid);
|
|
|
|
params->is_running = false;
|
|
|
|
}
|
|
|
|
|
2012-06-19 03:10:42 +00:00
|
|
|
#endif
|
|
|
|
|
2012-03-25 22:36:40 +00:00
|
|
|
/*============================================================
|
2012-04-21 21:13:50 +00:00
|
|
|
RetroArch PS3 INPUT DRIVER
|
2012-03-25 22:36:40 +00:00
|
|
|
============================================================ */
|
|
|
|
|
2011-11-30 16:24:18 +00:00
|
|
|
static void ps3_free_input(void *data)
|
|
|
|
{
|
2011-12-02 01:34:06 +00:00
|
|
|
(void)data;
|
2012-05-29 23:19:25 +00:00
|
|
|
//cellPadEnd();
|
2011-11-30 16:24:18 +00:00
|
|
|
}
|
|
|
|
|
2012-01-11 21:27:07 +00:00
|
|
|
static void* ps3_input_initialize(void)
|
|
|
|
{
|
2012-07-01 12:10:13 +00:00
|
|
|
pPadInit(MAX_PADS);
|
2012-06-19 03:10:42 +00:00
|
|
|
#ifdef HAVE_MOUSE
|
|
|
|
cellMouseInit(MAX_MICE);
|
|
|
|
#endif
|
2012-03-03 13:57:28 +00:00
|
|
|
for(unsigned i = 0; i < MAX_PADS; i++)
|
|
|
|
ps3_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
|
2012-05-28 03:06:25 +00:00
|
|
|
return (void*)-1;
|
2012-03-03 13:57:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ps3_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
|
|
|
|
{
|
2012-04-10 19:23:42 +00:00
|
|
|
switch(map_dpad_enum)
|
|
|
|
{
|
|
|
|
case DPAD_EMULATION_NONE:
|
2012-04-13 15:03:30 +00:00
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_UP].joykey = platform_keys[PS3_DEVICE_ID_JOYPAD_UP].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = platform_keys[PS3_DEVICE_ID_JOYPAD_DOWN].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = platform_keys[PS3_DEVICE_ID_JOYPAD_LEFT].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = platform_keys[PS3_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
2012-04-10 19:23:42 +00:00
|
|
|
break;
|
|
|
|
case DPAD_EMULATION_LSTICK:
|
2012-04-13 15:03:30 +00:00
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_UP].joykey = platform_keys[PS3_DEVICE_ID_LSTICK_UP_DPAD].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = platform_keys[PS3_DEVICE_ID_LSTICK_DOWN_DPAD].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = platform_keys[PS3_DEVICE_ID_LSTICK_LEFT_DPAD].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = platform_keys[PS3_DEVICE_ID_LSTICK_RIGHT_DPAD].joykey;
|
2012-04-10 19:23:42 +00:00
|
|
|
break;
|
|
|
|
case DPAD_EMULATION_RSTICK:
|
2012-04-13 15:03:30 +00:00
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_UP].joykey = platform_keys[PS3_DEVICE_ID_RSTICK_UP_DPAD].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = platform_keys[PS3_DEVICE_ID_RSTICK_DOWN_DPAD].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = platform_keys[PS3_DEVICE_ID_RSTICK_LEFT_DPAD].joykey;
|
|
|
|
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = platform_keys[PS3_DEVICE_ID_RSTICK_RIGHT_DPAD].joykey;
|
2012-04-10 19:23:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-01-11 21:27:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-02 01:34:06 +00:00
|
|
|
static bool ps3_key_pressed(void *data, int key)
|
|
|
|
{
|
|
|
|
(void)data;
|
2012-05-26 16:18:09 +00:00
|
|
|
gl_t *gl = driver.video_data;
|
|
|
|
|
2011-12-11 12:14:44 +00:00
|
|
|
switch (key)
|
2011-12-03 01:40:20 +00:00
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_FAST_FORWARD_HOLD_KEY:
|
2012-02-11 15:27:13 +00:00
|
|
|
return CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(~state[0]);
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_LOAD_STATE_KEY:
|
2011-12-04 03:11:02 +00:00
|
|
|
return (CTRL_RSTICK_UP(state[0]) && CTRL_R2(state[0]));
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_SAVE_STATE_KEY:
|
2011-12-04 03:11:02 +00:00
|
|
|
return (CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(state[0]));
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_STATE_SLOT_PLUS:
|
2011-12-04 03:00:17 +00:00
|
|
|
return (CTRL_RSTICK_RIGHT(state[0]) && CTRL_R2(state[0]));
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_STATE_SLOT_MINUS:
|
2011-12-04 03:00:17 +00:00
|
|
|
return (CTRL_RSTICK_LEFT(state[0]) && CTRL_R2(state[0]));
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_FRAMEADVANCE:
|
2012-02-11 18:22:51 +00:00
|
|
|
if(g_console.frame_advance_enable)
|
|
|
|
{
|
2012-02-13 20:37:32 +00:00
|
|
|
g_console.menu_enable = true;
|
2012-02-11 18:22:51 +00:00
|
|
|
g_console.ingame_menu_enable = true;
|
2012-02-13 20:37:32 +00:00
|
|
|
g_console.mode_switch = MODE_MENU;
|
2012-02-11 18:22:51 +00:00
|
|
|
}
|
2012-02-13 20:37:32 +00:00
|
|
|
return false;
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_REWIND:
|
2012-02-11 15:27:13 +00:00
|
|
|
return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]);
|
2012-04-21 21:25:32 +00:00
|
|
|
case RARCH_QUIT_KEY:
|
2012-05-28 01:46:44 +00:00
|
|
|
if(IS_TIMER_EXPIRED(gl))
|
2012-02-11 15:27:13 +00:00
|
|
|
{
|
2012-04-10 19:23:42 +00:00
|
|
|
uint32_t r3_pressed = CTRL_R3(state[0]);
|
|
|
|
uint32_t l3_pressed = CTRL_L3(state[0]);
|
|
|
|
bool retval = false;
|
2012-05-28 01:46:44 +00:00
|
|
|
g_console.menu_enable = (r3_pressed && l3_pressed && IS_TIMER_EXPIRED(gl));
|
2012-04-10 19:23:42 +00:00
|
|
|
g_console.ingame_menu_enable = r3_pressed && !l3_pressed;
|
|
|
|
|
|
|
|
if(g_console.menu_enable || (g_console.ingame_menu_enable && !g_console.menu_enable))
|
|
|
|
{
|
|
|
|
g_console.mode_switch = MODE_MENU;
|
2012-05-28 01:46:44 +00:00
|
|
|
SET_TIMER_EXPIRATION(gl, 30);
|
2012-04-10 19:23:42 +00:00
|
|
|
retval = g_console.menu_enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = g_console.ingame_menu_enable ? g_console.ingame_menu_enable : g_console.menu_enable;
|
|
|
|
return retval;
|
2012-02-11 15:27:13 +00:00
|
|
|
}
|
2011-12-04 03:00:17 +00:00
|
|
|
default:
|
2011-12-14 12:20:22 +00:00
|
|
|
return false;
|
2011-12-03 01:40:20 +00:00
|
|
|
}
|
2011-11-30 16:24:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const input_driver_t input_ps3 = {
|
2012-01-11 21:27:07 +00:00
|
|
|
.init = ps3_input_initialize,
|
2011-11-30 16:24:18 +00:00
|
|
|
.poll = ps3_input_poll,
|
|
|
|
.input_state = ps3_input_state,
|
2011-12-02 01:34:06 +00:00
|
|
|
.key_pressed = ps3_key_pressed,
|
2011-12-02 01:22:29 +00:00
|
|
|
.free = ps3_free_input,
|
|
|
|
.ident = "ps3",
|
2011-11-30 16:24:18 +00:00
|
|
|
};
|
2011-12-11 12:14:44 +00:00
|
|
|
|