#ifdef HAVE_EEZE
typedef void (*Joystick_Mapper)(struct js_event *event, Ecore_Event_Joystick *e);
-static void _joystick_xiinput_mapper(struct js_event *event, Ecore_Event_Joystick *e);
+static void _joystick_xbox360_mapper(struct js_event *event, Ecore_Event_Joystick *e);
+static void _joystick_xboxone_mapper(struct js_event *event, Ecore_Event_Joystick *e);
static void _joystick_ps4_mapper(struct js_event *event, Ecore_Event_Joystick *e);
struct _Joystick_Info
const char *product;
Joystick_Mapper mapper;
} Joystick_Mapping_Info[] = {
- {"045e", "028e", _joystick_xiinput_mapper}, /* Microsoft X-Box 360 pad */
+ {"045e", "028e", _joystick_xbox360_mapper}, /* Microsoft X-Box 360 pad */
+ {"045e", "02dd", _joystick_xboxone_mapper}, /* Microsoft X-Box One pad (Covert Forces) */
{"054c", "05c4", _joystick_ps4_mapper} /* Sony Computer Entertainment Wireless Controller */
};
}
static void
-_joystick_xiinput_mapper(struct js_event *event, Ecore_Event_Joystick *e)
+_joystick_xbox360_mapper(struct js_event *event, Ecore_Event_Joystick *e)
{
if (event->type == JS_EVENT_BUTTON)
{
}
static void
+_joystick_xboxone_mapper(struct js_event *event, Ecore_Event_Joystick *e)
+{
+ if (event->type == JS_EVENT_BUTTON)
+ {
+ e->type = ECORE_EVENT_JOYSTICK_EVENT_TYPE_BUTTON;
+ e->button.value = event->value;
+ switch (event->number)
+ {
+ case 0:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_FACE_0;
+ break;
+
+ case 1:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_FACE_1;
+ break;
+
+ case 2:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_FACE_2;
+ break;
+
+ case 3:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_FACE_3;
+ break;
+
+ case 4:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_LEFT_SHOULDER;
+ break;
+
+ case 5:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_RIGHT_SHOULDER;
+ break;
+
+ case 6:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_META;
+ break;
+
+ case 7:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_SELECT;
+ break;
+
+ case 8:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_START;
+ break;
+
+ case 9:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_LEFT_ANALOG_STICK;
+ break;
+
+ case 10:
+ e->button.index = ECORE_EVENT_JOYSTICK_BUTTON_RIGHT_ANALOG_STICK;
+ break;
+
+ default:
+ ERR("Unsupported joystick event: %d", event->number);
+ break;
+ }
+ }
+ else
+ {
+ e->type = ECORE_EVENT_JOYSTICK_EVENT_TYPE_AXIS;
+ e->axis.value = event->value / 32767.0f;;
+ switch (event->number)
+ {
+ case 0:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_LEFT_ANALOG_HOR;
+ break;
+
+ case 1:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_LEFT_ANALOG_VER;
+ break;
+
+ case 2:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_LEFT_SHOULDER;
+ break;
+
+ case 3:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_RIGHT_ANALOG_HOR;
+ break;
+
+ case 4:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_RIGHT_ANALOG_VER;
+ break;
+
+ case 5:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_RIGHT_SHOULDER;
+ break;
+
+ case 6:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_HAT_X;
+ break;
+
+ case 7:
+ e->axis.index = ECORE_EVENT_JOYSTICK_AXIS_HAT_Y;
+ break;
+
+ default:
+ ERR("Unsupported joystick event: %d", event->number);
+ break;
+ }
+ }
+}
+
+static void
_joystick_event_add(struct js_event *event, Joystick_Info *ji)
{
Ecore_Event_Joystick *e;