mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 10:20:21 +00:00
b4b81bd740
input_common.c
84 lines
2.8 KiB
C
84 lines
2.8 KiB
C
/* RetroArch - A frontend for libretro.
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
|
*
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
* 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.
|
|
*
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef INPUT_JOYPAD_H__
|
|
#define INPUT_JOYPAD_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "input_context.h"
|
|
#include <file/config_file.h>
|
|
#include <stdint.h>
|
|
#include "../driver.h"
|
|
|
|
static inline void input_conv_analog_id_to_bind_id(unsigned idx, unsigned ident,
|
|
unsigned *ident_minus, unsigned *ident_plus)
|
|
{
|
|
switch ((idx << 1) | ident)
|
|
{
|
|
case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_X:
|
|
*ident_minus = RARCH_ANALOG_LEFT_X_MINUS;
|
|
*ident_plus = RARCH_ANALOG_LEFT_X_PLUS;
|
|
break;
|
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_Y:
|
|
*ident_minus = RARCH_ANALOG_LEFT_Y_MINUS;
|
|
*ident_plus = RARCH_ANALOG_LEFT_Y_PLUS;
|
|
break;
|
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_X:
|
|
*ident_minus = RARCH_ANALOG_RIGHT_X_MINUS;
|
|
*ident_plus = RARCH_ANALOG_RIGHT_X_PLUS;
|
|
break;
|
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_Y:
|
|
*ident_minus = RARCH_ANALOG_RIGHT_Y_MINUS;
|
|
*ident_plus = RARCH_ANALOG_RIGHT_Y_PLUS;
|
|
break;
|
|
}
|
|
}
|
|
|
|
bool input_joypad_pressed(const rarch_joypad_driver_t *driver,
|
|
unsigned port, const struct retro_keybind *binds, unsigned key);
|
|
|
|
int16_t input_joypad_analog(const rarch_joypad_driver_t *driver,
|
|
unsigned port, unsigned idx, unsigned ident,
|
|
const struct retro_keybind *binds);
|
|
|
|
bool input_joypad_set_rumble(const rarch_joypad_driver_t *driver,
|
|
unsigned port, enum retro_rumble_effect effect, uint16_t strength);
|
|
|
|
int16_t input_joypad_axis_raw(const rarch_joypad_driver_t *driver,
|
|
unsigned joypad, unsigned axis);
|
|
|
|
bool input_joypad_button_raw(const rarch_joypad_driver_t *driver,
|
|
unsigned joypad, unsigned button);
|
|
|
|
bool input_joypad_hat_raw(const rarch_joypad_driver_t *driver,
|
|
unsigned joypad, unsigned hat_dir, unsigned hat);
|
|
|
|
const char *input_joypad_name(const rarch_joypad_driver_t *driver,
|
|
unsigned joypad);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|