Move input_frame to menu_input_line_cb.c and rename it menu_input_frame

This commit is contained in:
twinaphex 2015-01-10 06:33:05 +01:00
parent c1e6a955dd
commit d32e9ed4c5
4 changed files with 36 additions and 35 deletions

View File

@ -343,35 +343,6 @@ void menu_ticker_line(char *buf, size_t len, unsigned idx,
}
}
static unsigned input_frame(uint64_t trigger_state)
{
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
return MENU_ACTION_UP;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
return MENU_ACTION_DOWN;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
return MENU_ACTION_LEFT;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
return MENU_ACTION_RIGHT;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
return MENU_ACTION_SCROLL_UP;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
return MENU_ACTION_SCROLL_DOWN;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
return MENU_ACTION_CANCEL;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
return MENU_ACTION_OK;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
return MENU_ACTION_Y;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
return MENU_ACTION_START;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT))
return MENU_ACTION_SELECT;
if (trigger_state & (1ULL << RARCH_MENU_TOGGLE))
return MENU_ACTION_TOGGLE;
return MENU_ACTION_NOOP;
}
void apply_deferred_settings(void)
{
rarch_setting_t *setting = NULL;
@ -505,7 +476,7 @@ int menu_iterate(retro_input_t input,
/* don't run anything first frame, only capture held inputs
* for old_input_state.
*/
action = input_frame(trigger_input);
action = menu_input_frame(trigger_input);
if (driver.menu_ctx && driver.menu_ctx->backend
&& driver.menu_ctx->backend->iterate)

View File

@ -27,8 +27,7 @@
#include "menu_navigation.h"
#include "../../core_info.h"
#include "../../playlist.h"
#include "../../input/input_common.h"
#include "../../input/keyboard_line.h"
#include "menu_input_line_cb.h"
#include "../../gfx/shader/shader_context.h"
#ifdef HAVE_RGUI

View File

@ -24,11 +24,10 @@
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include "menu_input_line_cb.h"
#include "menu.h"
#include "menu_action.h"
#include "menu_shader.h"
#include "../input/keyboard_line.h"
#include "menu_input_line_cb.h"
#include "../performance.h"
#include "../settings_data.h"
@ -66,8 +65,8 @@ static void menu_key_end_line(void *data)
static void menu_search_callback(void *userdata, const char *str)
{
menu_handle_t *menu = (menu_handle_t*)userdata;
size_t idx;
menu_handle_t *menu = (menu_handle_t*)userdata;
if (str && *str && file_list_search(menu->menu_list->selection_buf, str, &idx))
menu_navigation_set(menu, idx, true);
@ -410,3 +409,32 @@ int menu_input_bind_iterate_keyboard(void *data)
return 0;
}
unsigned menu_input_frame(retro_input_t trigger_state)
{
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
return MENU_ACTION_UP;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
return MENU_ACTION_DOWN;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
return MENU_ACTION_LEFT;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
return MENU_ACTION_RIGHT;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
return MENU_ACTION_SCROLL_UP;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
return MENU_ACTION_SCROLL_DOWN;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
return MENU_ACTION_CANCEL;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
return MENU_ACTION_OK;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
return MENU_ACTION_Y;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
return MENU_ACTION_START;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT))
return MENU_ACTION_SELECT;
if (trigger_state & (1ULL << RARCH_MENU_TOGGLE))
return MENU_ACTION_TOGGLE;
return MENU_ACTION_NOOP;
}

View File

@ -17,6 +17,7 @@
#ifndef _MENU_INPUT_LINE_CB_H
#define _MENU_INPUT_LINE_CB_H
#include "../input/input_common.h"
#include "../input/keyboard_line.h"
#ifdef __cplusplus
@ -49,6 +50,8 @@ int menu_input_bind_iterate(void *data);
int menu_input_bind_iterate_keyboard(void *data);
unsigned menu_input_frame(retro_input_t trigger_state);
#ifdef __cplusplus
}
#endif