mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(PS3) Start turning PS3 input drivers more the same
This commit is contained in:
parent
22c760af41
commit
35fa25bed6
@ -57,21 +57,26 @@ typedef struct ps3_input
|
|||||||
#endif
|
#endif
|
||||||
} ps3_input_t;
|
} ps3_input_t;
|
||||||
|
|
||||||
#ifdef HAVE_MOUSE
|
|
||||||
static void ps3_input_poll(void *data)
|
static void ps3_input_poll(void *data)
|
||||||
{
|
{
|
||||||
CellMouseInfo mouse_info;
|
|
||||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||||
|
#ifdef HAVE_MOUSE
|
||||||
cellMouseGetInfo(&mouse_info);
|
mouseInfo mouse_info;
|
||||||
|
ioMouseGetInfo(&mouse_info);
|
||||||
|
#ifdef __PSL1GHT__
|
||||||
|
ps3->mice_connected = mouse_info.connected;
|
||||||
|
#else
|
||||||
ps3->mice_connected = mouse_info.now_connect;
|
ps3->mice_connected = mouse_info.now_connect;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_MOUSE
|
||||||
static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
||||||
unsigned user, unsigned id)
|
unsigned user, unsigned id)
|
||||||
{
|
{
|
||||||
CellMouseData mouse_state;
|
mouseData mouse_state;
|
||||||
cellMouseGetData(id, &mouse_state);
|
ioMouseGetData(id, &mouse_state);
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
@ -147,7 +152,7 @@ static void ps3_input_free_input(void *data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_MOUSE
|
#ifdef HAVE_MOUSE
|
||||||
cellMouseEnd();
|
ioMouseEnd();
|
||||||
#endif
|
#endif
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
@ -159,7 +164,7 @@ static void* ps3_input_init(const char *joypad_driver)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef HAVE_MOUSE
|
#ifdef HAVE_MOUSE
|
||||||
cellMouseInit(MAX_MICE);
|
ioMouseInit(MAX_MICE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ps3;
|
return ps3;
|
||||||
@ -178,22 +183,22 @@ static uint64_t ps3_input_get_capabilities(void *data)
|
|||||||
static bool ps3_input_set_sensor_state(void *data, unsigned port,
|
static bool ps3_input_set_sensor_state(void *data, unsigned port,
|
||||||
enum retro_sensor_action action, unsigned event_rate)
|
enum retro_sensor_action action, unsigned event_rate)
|
||||||
{
|
{
|
||||||
CellPadInfo2 pad_info;
|
padInfo2 pad_info;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case RETRO_SENSOR_ACCELEROMETER_ENABLE:
|
case RETRO_SENSOR_ACCELEROMETER_ENABLE:
|
||||||
cellPadGetInfo2(&pad_info);
|
ioPadGetInfo2(&pad_info);
|
||||||
if ((pad_info.device_capability[port]
|
if ((pad_info.device_capability[port]
|
||||||
& CELL_PAD_CAPABILITY_SENSOR_MODE)
|
& CELL_PAD_CAPABILITY_SENSOR_MODE)
|
||||||
== CELL_PAD_CAPABILITY_SENSOR_MODE)
|
== CELL_PAD_CAPABILITY_SENSOR_MODE)
|
||||||
{
|
{
|
||||||
cellPadSetPortSetting(port, CELL_PAD_SETTING_SENSOR_ON);
|
ioPadSetPortSetting(port, CELL_PAD_SETTING_SENSOR_ON);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_SENSOR_ACCELEROMETER_DISABLE:
|
case RETRO_SENSOR_ACCELEROMETER_DISABLE:
|
||||||
cellPadSetPortSetting(port, 0);
|
ioPadSetPortSetting(port, 0);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -204,11 +209,7 @@ static bool ps3_input_set_sensor_state(void *data, unsigned port,
|
|||||||
|
|
||||||
input_driver_t input_ps3 = {
|
input_driver_t input_ps3 = {
|
||||||
ps3_input_init,
|
ps3_input_init,
|
||||||
#ifdef HAVE_MOUSE
|
|
||||||
ps3_input_poll,
|
ps3_input_poll,
|
||||||
#else
|
|
||||||
NULL, /* poll */
|
|
||||||
#endif
|
|
||||||
ps3_input_state,
|
ps3_input_state,
|
||||||
ps3_input_free_input,
|
ps3_input_free_input,
|
||||||
ps3_input_set_sensor_state,
|
ps3_input_set_sensor_state,
|
||||||
|
@ -551,7 +551,11 @@ static void ps3_input_poll(void *data)
|
|||||||
#ifdef HAVE_MOUSE
|
#ifdef HAVE_MOUSE
|
||||||
mouseInfo mouse_info;
|
mouseInfo mouse_info;
|
||||||
ioMouseGetInfo(&mouse_info);
|
ioMouseGetInfo(&mouse_info);
|
||||||
|
#ifdef __PSL1GHT__
|
||||||
ps3->mice_connected = mouse_info.connected;
|
ps3->mice_connected = mouse_info.connected;
|
||||||
|
#else
|
||||||
|
ps3->mice_connected = mouse_info.now_connect;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIGHTGUN
|
#ifdef HAVE_LIGHTGUN
|
||||||
gemInfo gem_info;
|
gemInfo gem_info;
|
||||||
@ -606,23 +610,20 @@ static bool psl1ght_keyboard_port_input_pressed(
|
|||||||
static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
||||||
unsigned user, unsigned id)
|
unsigned user, unsigned id)
|
||||||
{
|
{
|
||||||
if (ps3->mice_connected)
|
mouseData mouse_state;
|
||||||
{
|
ioMouseGetData(id, &mouse_state);
|
||||||
mouseData mouse_state;
|
|
||||||
ioMouseGetData(id, &mouse_state);
|
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
/* TODO: mouse wheel up/down */
|
/* TODO: mouse wheel up/down */
|
||||||
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
||||||
return (mouse_state.buttons & CELL_MOUSE_BUTTON_1);
|
return (mouse_state.buttons & CELL_MOUSE_BUTTON_1);
|
||||||
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
||||||
return (mouse_state.buttons & CELL_MOUSE_BUTTON_2);
|
return (mouse_state.buttons & CELL_MOUSE_BUTTON_2);
|
||||||
case RETRO_DEVICE_ID_MOUSE_X:
|
case RETRO_DEVICE_ID_MOUSE_X:
|
||||||
return (mouse_state.x_axis);
|
return (mouse_state.x_axis);
|
||||||
case RETRO_DEVICE_ID_MOUSE_Y:
|
case RETRO_DEVICE_ID_MOUSE_Y:
|
||||||
return (mouse_state.y_axis);
|
return (mouse_state.y_axis);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -817,7 +818,9 @@ static int16_t ps3_input_state(
|
|||||||
return psl1ght_keyboard_port_input_pressed(ps3, id);
|
return psl1ght_keyboard_port_input_pressed(ps3, id);
|
||||||
#ifdef HAVE_MOUSE
|
#ifdef HAVE_MOUSE
|
||||||
case RETRO_DEVICE_MOUSE:
|
case RETRO_DEVICE_MOUSE:
|
||||||
return ps3_mouse_device_state(ps3, port, id);
|
if (ps3->mice_connected)
|
||||||
|
return ps3_mouse_device_state(ps3, port, id);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIGHTGUN
|
#ifdef HAVE_LIGHTGUN
|
||||||
case RETRO_DEVICE_LIGHTGUN:
|
case RETRO_DEVICE_LIGHTGUN:
|
||||||
|
@ -165,6 +165,7 @@ extern int audioAddData(uint32_t portNum, float *data,
|
|||||||
#define ioPadGetData cellPadGetData
|
#define ioPadGetData cellPadGetData
|
||||||
#define ioPadInit cellPadInit
|
#define ioPadInit cellPadInit
|
||||||
#define ioPadEnd cellPadEnd
|
#define ioPadEnd cellPadEnd
|
||||||
|
#define ioPadSetPortSetting cellPadSetPortSetting
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*============================================================
|
/*============================================================
|
||||||
@ -198,6 +199,13 @@ extern int audioAddData(uint32_t portNum, float *data,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
#include <cell/mouse.h>
|
#include <cell/mouse.h>
|
||||||
|
#define mouseInfo CellMouseInfo
|
||||||
|
#define mouseData CellMouseData
|
||||||
|
|
||||||
|
#define ioMouseInit cellMouseInit
|
||||||
|
#define ioMouseGetData cellMouseGetData
|
||||||
|
#define ioMouseEnd cellMouseEnd
|
||||||
|
#define ioMouseGetInfo cellMouseGetInfo
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user