|
@@ -41,8 +41,8 @@
|
|
|
|
|
|
#include "../msg_hash.h"
|
|
|
#include "include/hid_types.h"
|
|
|
-#include "include/hid_driver.h"
|
|
|
-#include "include/gamepad.h"
|
|
|
+// #include "include/hid_driver.h"
|
|
|
+// #include "include/gamepad.h"
|
|
|
#include "../configuration.h"
|
|
|
#include "../performance_counters.h"
|
|
|
|
|
@@ -271,50 +271,45 @@ typedef struct input_list_element_t
|
|
|
struct input_driver
|
|
|
{
|
|
|
/**
|
|
|
- * Initializes input driver.
|
|
|
+ * 初始化输入驱动。
|
|
|
*
|
|
|
- * @param joypad_driver Name of the joypad driver associated with the
|
|
|
- * input driver
|
|
|
+ * @param joypad_driver 与输入驱动程序相关联的手柄驱动程序的名称。
|
|
|
*/
|
|
|
void *(*init)(const char *joypad_driver);
|
|
|
|
|
|
- /**
|
|
|
- * Called once every frame to poll input. This function pointer can be set
|
|
|
- * to NULL if not supported by the input driver, for example if a joypad
|
|
|
- * driver is responsible for polling on a particular driver/platform.
|
|
|
+ /**
|
|
|
+ * 在每帧调用以轮询输入。如果输入驱动程序不支持此功能,例如某个特定
|
|
|
+ * 程序/平台上负责轮询的手柄驱动程序,可以将此函数指针设置为NULL。
|
|
|
*
|
|
|
- * @param data the input state struct
|
|
|
+ * @param data 输入状态结构体
|
|
|
*/
|
|
|
void (*poll)(void *data);
|
|
|
|
|
|
/**
|
|
|
- * Queries state for a specified control on a specified input port. This
|
|
|
- * function pointer can be set to NULL if not supported by the input driver,
|
|
|
- * for example if a joypad driver is responsible for quering state for a
|
|
|
- * particular driver/platform.
|
|
|
+ * 查询特定输入端口上指定控件的状态。如果输入驱动程序不支持此功能,例如
|
|
|
+ * 如果手柄驱动程序负责查询特定驱动程序/平台上的状态,则可以将此函数
|
|
|
+ * 指针设置为NULL。
|
|
|
*
|
|
|
- * @param joypad_data Input state struct, defined by the input driver
|
|
|
- * @param sec_joypad_data Input state struct for secondary input devices (eg
|
|
|
- * MFi controllers), defined by a secondary driver.
|
|
|
- * Queried state to be returned is the logical OR of
|
|
|
- * joypad_data and sec_joypad_data. May be NULL.
|
|
|
- * @param joypad_info Info struct for the controller to be queried,
|
|
|
- * with hardware device ID and autoconfig mapping.
|
|
|
- * @param retro_keybinds Structure for control mappings for all libretro
|
|
|
- * input device abstractions
|
|
|
+ * @param joypad_data 输入驱动程序定义的输入状态结构体。
|
|
|
+ * @param sec_joypad_data 由辅助驱动程序定义的用于辅助输入设备(例如 MFi
|
|
|
+ * 控制器)的输入状态结构体。要返回的查询状态是
|
|
|
+ * joypad_data 和 sec_joypad_data 的逻辑 OR。
|
|
|
+ * 可以为NULL。
|
|
|
+ * @param joypad_info 用于查询控制器的信息结构体,包含hardware device
|
|
|
+ * ID和autoconfig mapping。
|
|
|
+ * @param retro_keybinds 用于所有libretro输入设备抽象的控制映射结构体。
|
|
|
* @param keyboard_mapping_blocked
|
|
|
- * If true, disregard custom keyboard mapping
|
|
|
- * @param port Which RetroArch port is being polled
|
|
|
- * @param device Which libretro abstraction is being polled
|
|
|
+ * 如果为真,则忽略自定义键盘映射。
|
|
|
+ * @param port 正在轮询的 RetroArch 端口是哪个。
|
|
|
+ * @param device 正在轮询的 libretro abstraction 是哪个
|
|
|
* (RETRO_DEVICE_ID_RETROPAD, RETRO_DEVICE_ID_MOUSE)
|
|
|
- * @param index For controls with more than one axis or multiple
|
|
|
- * simultaneous inputs, such as an analog joystick
|
|
|
- * or touchpad.
|
|
|
- * @param id Which control is being polled
|
|
|
- * (eg RETRO_DEVICE_ID_JOYPAD_START)
|
|
|
+ * @param index 对于具有多个轴或多个同时输入的控件,例如模拟摇杆
|
|
|
+ * 或触摸板。
|
|
|
+ * @param id 正在轮询的控件是哪个
|
|
|
+ * (例如 RETRO_DEVICE_ID_JOYPAD_START)
|
|
|
*
|
|
|
- * @return 1 for pressed digital control, 0 for non-pressed digital control.
|
|
|
- * Values in the range of a signed 16-bit integer,[-0x8000, 0x7fff]
|
|
|
+ * @return 对于按下的数字控件,值为1;对于未按下的数字控件,
|
|
|
+ * 值为0。取值范围为带符号的16位整数[-0x8000, 0x7fff]。
|
|
|
*/
|
|
|
int16_t (*input_state)(void *data,
|
|
|
const input_device_driver_t *joypad_data,
|
|
@@ -325,27 +320,22 @@ struct input_driver
|
|
|
unsigned port, unsigned device, unsigned index, unsigned id);
|
|
|
|
|
|
/**
|
|
|
- * Frees the input struct.
|
|
|
+ * 释放输入结构体。
|
|
|
*
|
|
|
- * @param data The input state struct.
|
|
|
+ * @param data 输入结构体
|
|
|
*/
|
|
|
void (*free)(void *data);
|
|
|
|
|
|
/**
|
|
|
- * Sets the state related for sensors, such as polling rate or to deactivate
|
|
|
- * the sensor entirely, etc. This function pointer may be set to NULL if
|
|
|
- * setting sensor values is not supported.
|
|
|
+ * 设置与传感器相关的状态,例如轮询速率或完全禁用传感器等。
|
|
|
+ * 如果不支持设置传感器值,则可以将此函数指针设置为NULL。
|
|
|
*
|
|
|
- * @param data
|
|
|
- * The input state struct
|
|
|
- * @param port
|
|
|
- * The port of the device
|
|
|
- * @param effect
|
|
|
- * Sensor action
|
|
|
- * @param rate
|
|
|
- * Sensor rate update
|
|
|
+ * @param data 输入结构体
|
|
|
+ * @param port 设备的端口。
|
|
|
+ * @param effect 传感器动作
|
|
|
+ * @param rate 传感器更新速率
|
|
|
*
|
|
|
- * @return true if the operation is successful.
|
|
|
+ * @return 如果操作成功,则返回true。
|
|
|
**/
|
|
|
bool (*set_sensor_state)(void *data, unsigned port,
|
|
|
enum retro_sensor_action action, unsigned rate);
|
|
@@ -988,6 +978,10 @@ const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned i
|
|
|
|
|
|
void input_config_reset_autoconfig_binds(unsigned port);
|
|
|
|
|
|
+/**
|
|
|
+ * 重置输入配置,设备信息,相关变量:input_config_binds, input_autoconf_binds, input_st->libretro_input_binds
|
|
|
+ * input_st->input_device_info
|
|
|
+ */
|
|
|
void input_config_reset(void);
|
|
|
|
|
|
const char *joypad_driver_name(unsigned i);
|