Merge input_sensor.c with input_driver.c

This commit is contained in:
twinaphex 2015-11-25 03:29:18 +01:00
parent c9db73e944
commit 08ae9df639
8 changed files with 48 additions and 91 deletions

View File

@ -165,7 +165,6 @@ OBJ += frontend/frontend.o \
input/input_common.o \
input/input_keymaps.o \
input/input_remapping.o \
input/input_sensor.o \
tasks/task_overlay.o \
input/input_overlay.o \
patch.o \

View File

@ -30,6 +30,8 @@
#include "performance.h"
#include "audio/audio_driver.h"
#include "input/input_driver.h"
#include "libretro_private.h"
#include "cores/internal_cores.h"
#include "retroarch.h"
@ -38,7 +40,6 @@
#include "msg_hash.h"
#include "verbosity.h"
#include "input/input_sensor.h"
#ifdef HAVE_DYNAMIC
#define SYMBOL(x) do { \

View File

@ -311,7 +311,6 @@ INPUT
#include "../input/input_common.c"
#include "../input/input_keymaps.c"
#include "../input/input_remapping.c"
#include "../input/input_sensor.c"
#include "../input/keyboard_line.c"
#ifdef HAVE_OVERLAY

View File

@ -289,3 +289,35 @@ void input_driver_keyboard_mapping_set_block(bool value)
if (input->keyboard_mapping_set_block)
driver->input->keyboard_mapping_set_block(driver->input_data, value);
}
/**
* input_sensor_set_state:
* @port : User number.
* @effect : Sensor action.
* @rate : Sensor rate update.
*
* Sets the sensor state.
* Used by RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE.
**/
bool input_sensor_set_state(unsigned port,
enum retro_sensor_action action, unsigned rate)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input_data &&
driver->input->set_sensor_state)
return driver->input->set_sensor_state(driver->input_data,
port, action, rate);
return false;
}
float input_sensor_get_input(unsigned port, unsigned id)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input_data &&
driver->input->get_sensor_input)
return driver->input->get_sensor_input(driver->input_data,
port, id);
return 0.0f;
}

View File

@ -179,6 +179,20 @@ const input_driver_t *input_get_ptr(void *data);
void input_driver_set(const input_driver_t **input, void **input_data);
/**
* input_sensor_set_state:
* @port : User number.
* @effect : Sensor action.
* @rate : Sensor rate update.
*
* Sets the sensor state.
* Used by RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE.
**/
bool input_sensor_set_state(unsigned port,
enum retro_sensor_action action, unsigned rate);
float input_sensor_get_input(unsigned port, unsigned id);
#ifdef __cplusplus
}
#endif

View File

@ -1,51 +0,0 @@
/* 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/>.
*/
#include "input_sensor.h"
#include "../driver.h"
/**
* input_sensor_set_state:
* @port : User number.
* @effect : Sensor action.
* @rate : Sensor rate update.
*
* Sets the sensor state.
* Used by RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE.
**/
bool input_sensor_set_state(unsigned port,
enum retro_sensor_action action, unsigned rate)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input_data &&
driver->input->set_sensor_state)
return driver->input->set_sensor_state(driver->input_data,
port, action, rate);
return false;
}
float input_sensor_get_input(unsigned port, unsigned id)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input_data &&
driver->input->get_sensor_input)
return driver->input->get_sensor_input(driver->input_data,
port, id);
return 0.0f;
}

View File

@ -1,36 +0,0 @@
/* 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_SENSOR_H
#define __INPUT_SENSOR_H
#include "../libretro.h"
/**
* input_sensor_set_state:
* @port : User number.
* @effect : Sensor action.
* @rate : Sensor rate update.
*
* Sets the sensor state.
* Used by RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE.
**/
bool input_sensor_set_state(unsigned port,
enum retro_sensor_action action, unsigned rate);
float input_sensor_get_input(unsigned port, unsigned id);
#endif

View File

@ -638,7 +638,6 @@ task_finished:
if (task->cancelled)
{
struct overlay *o;
unsigned i;
if (task->error)