mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Add 'Y button' callback function for input binds
This commit is contained in:
parent
7ec6dc0bde
commit
e75633064a
@ -119,7 +119,9 @@ static video_pixel_scaler_t *video_driver_scaler_ptr = NULL;
|
|||||||
* TODO: Refactor this better. */
|
* TODO: Refactor this better. */
|
||||||
static struct retro_hw_render_callback hw_render;
|
static struct retro_hw_render_callback hw_render;
|
||||||
|
|
||||||
static const struct retro_hw_render_context_negotiation_interface *hw_render_context_negotiation = NULL;
|
static const struct
|
||||||
|
retro_hw_render_context_negotiation_interface *
|
||||||
|
hw_render_context_negotiation = NULL;
|
||||||
|
|
||||||
static bool video_driver_use_rgba = false;
|
static bool video_driver_use_rgba = false;
|
||||||
static bool video_driver_data_own = false;
|
static bool video_driver_data_own = false;
|
||||||
|
@ -488,3 +488,79 @@ const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned i
|
|||||||
return &settings->input.autoconf_binds[joy_idx][id];
|
return &settings->input.autoconf_binds[joy_idx][id];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned input_config_label_to_key(const char *label)
|
||||||
|
{
|
||||||
|
unsigned key = 0;
|
||||||
|
|
||||||
|
if (string_is_equal(label, "toggle_fast_forward"))
|
||||||
|
key = RARCH_FAST_FORWARD_KEY;
|
||||||
|
else if (string_is_equal(label, "hold_fast_forward"))
|
||||||
|
key = RARCH_FAST_FORWARD_HOLD_KEY;
|
||||||
|
else if (string_is_equal(label, "load_state"))
|
||||||
|
key = RARCH_LOAD_STATE_KEY;
|
||||||
|
else if (string_is_equal(label, "save_state"))
|
||||||
|
key = RARCH_SAVE_STATE_KEY;
|
||||||
|
else if (string_is_equal(label, "toggle_fullscreen"))
|
||||||
|
key = RARCH_FULLSCREEN_TOGGLE_KEY;
|
||||||
|
else if (string_is_equal(label, "exit_emulator"))
|
||||||
|
key = RARCH_QUIT_KEY;
|
||||||
|
else if (string_is_equal(label, "state_slot_increase"))
|
||||||
|
key = RARCH_STATE_SLOT_PLUS;
|
||||||
|
else if (string_is_equal(label, "state_slot_decrease"))
|
||||||
|
key = RARCH_STATE_SLOT_MINUS;
|
||||||
|
else if (string_is_equal(label, "rewind"))
|
||||||
|
key = RARCH_REWIND;
|
||||||
|
else if (string_is_equal(label, "movie_record_toggle"))
|
||||||
|
key = RARCH_MOVIE_RECORD_TOGGLE;
|
||||||
|
else if (string_is_equal(label, "pause_toggle"))
|
||||||
|
key = RARCH_PAUSE_TOGGLE;
|
||||||
|
else if (string_is_equal(label, "frame_advance"))
|
||||||
|
key = RARCH_FRAMEADVANCE;
|
||||||
|
else if (string_is_equal(label, "reset"))
|
||||||
|
key = RARCH_RESET;
|
||||||
|
else if (string_is_equal(label, "shader_next"))
|
||||||
|
key = RARCH_SHADER_NEXT;
|
||||||
|
else if (string_is_equal(label, "shader_prev"))
|
||||||
|
key = RARCH_SHADER_PREV;
|
||||||
|
else if (string_is_equal(label, "cheat_index_plus"))
|
||||||
|
key = RARCH_CHEAT_INDEX_PLUS;
|
||||||
|
else if (string_is_equal(label, "cheat_index_minus"))
|
||||||
|
key = RARCH_CHEAT_INDEX_MINUS;
|
||||||
|
else if (string_is_equal(label, "cheat_toggle"))
|
||||||
|
key = RARCH_CHEAT_TOGGLE;
|
||||||
|
else if (string_is_equal(label, "screenshot"))
|
||||||
|
key = RARCH_SCREENSHOT;
|
||||||
|
else if (string_is_equal(label, "audio_mute"))
|
||||||
|
key = RARCH_MUTE;
|
||||||
|
else if (string_is_equal(label, "osk_toggle"))
|
||||||
|
key = RARCH_OSK;
|
||||||
|
else if (string_is_equal(label, "netplay_flip_players_1_2"))
|
||||||
|
key = RARCH_NETPLAY_FLIP;
|
||||||
|
else if (string_is_equal(label, "netplay_game_watch"))
|
||||||
|
key = RARCH_NETPLAY_GAME_WATCH;
|
||||||
|
else if (string_is_equal(label, "slowmotion"))
|
||||||
|
key = RARCH_SLOWMOTION;
|
||||||
|
else if (string_is_equal(label, "enable_hotkey"))
|
||||||
|
key = RARCH_ENABLE_HOTKEY;
|
||||||
|
else if (string_is_equal(label, "volume_up"))
|
||||||
|
key = RARCH_VOLUME_UP;
|
||||||
|
else if (string_is_equal(label, "volume_down"))
|
||||||
|
key = RARCH_VOLUME_DOWN;
|
||||||
|
else if (string_is_equal(label, "overlay_next"))
|
||||||
|
key = RARCH_OVERLAY_NEXT;
|
||||||
|
else if (string_is_equal(label, "disk_eject_toggle"))
|
||||||
|
key = RARCH_DISK_EJECT_TOGGLE;
|
||||||
|
else if (string_is_equal(label, "disk_next"))
|
||||||
|
key = RARCH_DISK_NEXT;
|
||||||
|
else if (string_is_equal(label, "disk_prev"))
|
||||||
|
key = RARCH_DISK_PREV;
|
||||||
|
else if (string_is_equal(label, "grab_mouse_toggle"))
|
||||||
|
key = RARCH_GRAB_MOUSE_TOGGLE;
|
||||||
|
else if (string_is_equal(label, "game_focus_toggle"))
|
||||||
|
key = RARCH_GAME_FOCUS_TOGGLE;
|
||||||
|
else if (string_is_equal(label, "menu_toggle"))
|
||||||
|
key = RARCH_MENU_TOGGLE;
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
@ -67,6 +67,8 @@ void input_config_parse_joy_button(void *data, const char *prefix,
|
|||||||
void input_config_parse_joy_axis(void *data, const char *prefix,
|
void input_config_parse_joy_axis(void *data, const char *prefix,
|
||||||
const char *axis, struct retro_keybind *bind);
|
const char *axis, struct retro_keybind *bind);
|
||||||
|
|
||||||
|
unsigned input_config_label_to_key(const char *label);
|
||||||
|
|
||||||
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
|
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
#include <compat/strl.h>
|
#include <compat/strl.h>
|
||||||
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
@ -24,6 +25,8 @@
|
|||||||
#include "../menu_cbs.h"
|
#include "../menu_cbs.h"
|
||||||
#include "../menu_setting.h"
|
#include "../menu_setting.h"
|
||||||
|
|
||||||
|
#include "../input/input_config.h"
|
||||||
|
|
||||||
#include "../../configuration.h"
|
#include "../../configuration.h"
|
||||||
#include "../../tasks/tasks_internal.h"
|
#include "../../tasks/tasks_internal.h"
|
||||||
|
|
||||||
@ -114,9 +117,43 @@ int action_switch_thumbnail(const char *path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int action_scan_input_desc(const char *path,
|
||||||
|
const char *label, unsigned type, size_t idx)
|
||||||
|
{
|
||||||
|
const char *menu_label = NULL;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
unsigned key = 0;
|
||||||
|
unsigned inp_desc_user = 0;
|
||||||
|
struct retro_keybind *target = NULL;
|
||||||
|
|
||||||
|
menu_entries_get_last_stack(NULL, &menu_label, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
if (string_is_equal(menu_label, "deferred_user_binds_list"))
|
||||||
|
{
|
||||||
|
unsigned char player_no_str = atoi(&label[1]);
|
||||||
|
|
||||||
|
inp_desc_user = (unsigned)player_no_str - 1;
|
||||||
|
key = idx - 6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
key = input_config_label_to_key(label);
|
||||||
|
|
||||||
|
target = (struct retro_keybind*)&settings->input.binds[inp_desc_user][key];
|
||||||
|
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
target->key = RETROK_UNKNOWN;
|
||||||
|
target->joykey = NO_BTN;
|
||||||
|
target->joyaxis = AXIS_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
|
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
|
||||||
unsigned type)
|
unsigned type)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBRETRODB
|
#ifdef HAVE_LIBRETRODB
|
||||||
@ -148,6 +185,15 @@ int menu_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
|
|||||||
|
|
||||||
BIND_ACTION_SCAN(cbs, NULL);
|
BIND_ACTION_SCAN(cbs, NULL);
|
||||||
|
|
||||||
|
if (cbs->setting)
|
||||||
|
{
|
||||||
|
if (setting_get_type(cbs->setting) == ST_BIND)
|
||||||
|
{
|
||||||
|
BIND_ACTION_SCAN(cbs, action_scan_input_desc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
menu_cbs_init_bind_scan_compare_type(cbs, type);
|
menu_cbs_init_bind_scan_compare_type(cbs, type);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "menu_cbs.h"
|
#include "menu_cbs.h"
|
||||||
#include "../verbosity.h"
|
#include "../verbosity.h"
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
#define DEBUG_LOG
|
#define DEBUG_LOG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ struct nbio_image_handle
|
|||||||
size_t size;
|
size_t size;
|
||||||
unsigned processing_pos_increment;
|
unsigned processing_pos_increment;
|
||||||
unsigned pos_increment;
|
unsigned pos_increment;
|
||||||
int processing_final_state;
|
enum image_process_code processing_final_state;
|
||||||
enum image_status_enum status;
|
enum image_status_enum status;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,9 +65,14 @@ static int cb_image_menu_upload_generic(void *data, size_t len)
|
|||||||
if (!image)
|
if (!image)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (image->processing_final_state == IMAGE_PROCESS_ERROR ||
|
switch (image->processing_final_state)
|
||||||
image->processing_final_state == IMAGE_PROCESS_ERROR_END)
|
{
|
||||||
return -1;
|
case IMAGE_PROCESS_ERROR:
|
||||||
|
case IMAGE_PROCESS_ERROR_END:
|
||||||
|
return -1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
image_texture_set_color_shifts(&r_shift, &g_shift, &b_shift,
|
image_texture_set_color_shifts(&r_shift, &g_shift, &b_shift,
|
||||||
&a_shift, &image->ti);
|
&a_shift, &image->ti);
|
||||||
@ -119,7 +124,7 @@ static int task_image_process(
|
|||||||
|
|
||||||
static int cb_image_menu_generic(nbio_handle_t *nbio)
|
static int cb_image_menu_generic(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
int retval;
|
enum image_process_code retval;
|
||||||
unsigned width = 0, height = 0;
|
unsigned width = 0, height = 0;
|
||||||
struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data;
|
struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data;
|
||||||
|
|
||||||
@ -127,8 +132,15 @@ static int cb_image_menu_generic(nbio_handle_t *nbio)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
retval = task_image_process(nbio, &width, &height);
|
retval = task_image_process(nbio, &width, &height);
|
||||||
if ((retval == IMAGE_PROCESS_ERROR) || (retval == IMAGE_PROCESS_ERROR_END))
|
|
||||||
return -1;
|
switch (retval)
|
||||||
|
{
|
||||||
|
case IMAGE_PROCESS_ERROR:
|
||||||
|
case IMAGE_PROCESS_ERROR_END:
|
||||||
|
return -1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
image->is_blocking_on_processing = (retval != IMAGE_PROCESS_END);
|
image->is_blocking_on_processing = (retval != IMAGE_PROCESS_END);
|
||||||
image->is_finished = (retval == IMAGE_PROCESS_END);
|
image->is_finished = (retval == IMAGE_PROCESS_END);
|
||||||
@ -151,7 +163,7 @@ static int cb_image_menu_thumbnail(void *data, size_t len)
|
|||||||
|
|
||||||
static int task_image_iterate_process_transfer(nbio_handle_t *nbio)
|
static int task_image_iterate_process_transfer(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
enum image_process_code retval;
|
||||||
unsigned i, width = 0, height = 0;
|
unsigned i, width = 0, height = 0;
|
||||||
struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data;
|
struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user