mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-21 18:21:51 +00:00
(Menu) Simplifications
This commit is contained in:
parent
02a849d440
commit
099f33e0b3
@ -6359,12 +6359,12 @@ void input_keyboard_event(bool down, unsigned code,
|
||||
(code == RETROK_DELETE) || /* RETRO_DEVICE_ID_JOYPAD_Y */
|
||||
BIT512_GET(input_st->keyboard_mapping_bits, code))))
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
|
||||
menu_environ.data = NULL;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
menu_st->input_last_time_us = menu_st->current_time_us;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_DISABLE_SCREENSAVER,
|
||||
NULL, menu_st->userdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -227,32 +227,28 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
|
||||
static int action_left_scroll(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
size_t scroll_accel = 0;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
size_t selection = menu_st->selection_ptr;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
size_t selection = menu_st->selection_ptr;
|
||||
size_t scroll_accel = menu_st->scroll.acceleration;
|
||||
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||
unsigned fast_scroll_speed = 10 * scroll_speed;
|
||||
|
||||
if (menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
||||
if (selection > fast_scroll_speed)
|
||||
{
|
||||
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||
unsigned fast_scroll_speed = 10 * scroll_speed;
|
||||
|
||||
if (selection > fast_scroll_speed)
|
||||
{
|
||||
size_t idx = selection - fast_scroll_speed;
|
||||
menu_st->selection_ptr = idx;
|
||||
if (menu_st->driver_ctx->navigation_set)
|
||||
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool pending_push = false;
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||
}
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (selection != menu_st->selection_ptr) /* Changed? */
|
||||
audio_driver_mixer_play_scroll_sound(true);
|
||||
#endif
|
||||
size_t idx = selection - fast_scroll_speed;
|
||||
menu_st->selection_ptr = idx;
|
||||
if (menu_st->driver_ctx->navigation_set)
|
||||
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool pending_push = false;
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||
}
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (selection != menu_st->selection_ptr) /* Changed? */
|
||||
audio_driver_mixer_play_scroll_sound(true);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7802,22 +7802,19 @@ static int action_ok_core_delete(const char *path,
|
||||
static int action_ok_delete_playlist(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
menu_ctx_environment_t menu_environ;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
if (!playlist)
|
||||
return -1;
|
||||
|
||||
menu_environ.type = MENU_ENVIRON_NONE;
|
||||
menu_environ.data = NULL;
|
||||
|
||||
path = playlist_get_conf_path(playlist);
|
||||
|
||||
filestream_delete(path);
|
||||
|
||||
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
|
||||
NULL, menu_st->userdata);
|
||||
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
@ -234,34 +234,38 @@ static int action_right_input_desc(unsigned type, const char *label,
|
||||
static int action_right_scroll(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
size_t scroll_accel = 0;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
size_t scroll_accel = menu_st->scroll.acceleration;
|
||||
menu_list_t *menu_list = menu_st->entries.list;
|
||||
size_t selection = menu_st->selection_ptr;
|
||||
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||
unsigned fast_scroll_speed = 10 * scroll_speed;
|
||||
size_t entries_end = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
|
||||
|
||||
if (menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
||||
if (selection + fast_scroll_speed < entries_end)
|
||||
{
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_list_t *menu_list = menu_st->entries.list;
|
||||
size_t selection = menu_st->selection_ptr;
|
||||
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||
unsigned fast_scroll_speed = 10 * scroll_speed;
|
||||
size_t entries_end = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
|
||||
|
||||
if (selection + fast_scroll_speed < entries_end)
|
||||
{
|
||||
size_t idx = selection + fast_scroll_speed;
|
||||
menu_st->selection_ptr = idx;
|
||||
if (menu_st->driver_ctx->navigation_set)
|
||||
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entries_end > 0)
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
||||
}
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (selection != menu_st->selection_ptr)
|
||||
audio_driver_mixer_play_scroll_sound(false);
|
||||
#endif
|
||||
size_t idx = selection + fast_scroll_speed;
|
||||
menu_st->selection_ptr = idx;
|
||||
if (menu_st->driver_ctx->navigation_set)
|
||||
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entries_end > 0)
|
||||
{
|
||||
size_t menu_list_size = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||
size_t new_selection = menu_list_size - 1;
|
||||
|
||||
menu_st->selection_ptr = new_selection;
|
||||
|
||||
if (menu_st->driver_ctx->navigation_set_last)
|
||||
menu_st->driver_ctx->navigation_set_last(menu_st->userdata);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (selection != menu_st->selection_ptr)
|
||||
audio_driver_mixer_play_scroll_sound(false);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,11 +39,10 @@
|
||||
void handle_dbscan_finished(retro_task_t *task,
|
||||
void *task_data, void *user_data, const char *err)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
|
||||
menu_environ.data = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
|
||||
NULL, menu_st->userdata);
|
||||
}
|
||||
|
||||
int action_scan_file(const char *path,
|
||||
@ -101,14 +100,15 @@ int action_scan_directory(const char *path,
|
||||
int action_switch_thumbnail(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
const char *menu_ident = menu_driver_ident();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool switch_enabled = true;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
const char *menu_ident = menu_driver_ident();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool switch_enabled = true;
|
||||
#ifdef HAVE_RGUI
|
||||
switch_enabled = !string_is_equal(menu_ident, "rgui");
|
||||
switch_enabled = !string_is_equal(menu_ident, "rgui");
|
||||
#endif
|
||||
#ifdef HAVE_MATERIALUI
|
||||
switch_enabled = switch_enabled && !string_is_equal(menu_ident, "glui");
|
||||
switch_enabled = switch_enabled && !string_is_equal(menu_ident, "glui");
|
||||
#endif
|
||||
|
||||
if (!settings)
|
||||
@ -164,7 +164,8 @@ int action_switch_thumbnail(const char *path,
|
||||
}
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
||||
if (menu_st->driver_ctx && menu_st->driver_ctx->update_thumbnail_image)
|
||||
menu_st->driver_ctx->update_thumbnail_image(menu_st->userdata);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -9161,14 +9161,11 @@ static enum menu_action materialui_parse_menu_entry_action(
|
||||
(materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1))
|
||||
{
|
||||
retro_time_t current_time = menu_driver_get_current_time();
|
||||
size_t scroll_accel = 0;
|
||||
/* Determine whether in put repeat is
|
||||
* currently active
|
||||
* > This is always true when scroll
|
||||
* acceleration is greater than zero */
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL,
|
||||
&scroll_accel);
|
||||
|
||||
size_t scroll_accel = menu_st->scroll.acceleration;
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if ((current_time - mui->last_tab_switch_time) >= MUI_TAB_SWITCH_REPEAT_DELAY ||
|
||||
scroll_accel <= 0)
|
||||
|
@ -4544,31 +4544,26 @@ static enum menu_action xmb_parse_menu_entry_action(
|
||||
if (xmb->depth == 1)
|
||||
{
|
||||
retro_time_t current_time = menu_driver_get_current_time();
|
||||
size_t scroll_accel = 0;
|
||||
|
||||
/* Determine whether input repeat is
|
||||
* currently active
|
||||
* > This is always true when scroll
|
||||
* acceleration is greater than zero */
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL,
|
||||
&scroll_accel);
|
||||
|
||||
size_t scroll_accel = menu_st->scroll.acceleration;
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t category = xmb->categories_selection_ptr;
|
||||
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + xmb->system_tab_end;
|
||||
/* We only want the scrolling sound to play if any of the following are true:
|
||||
* 1. Wraparound is enabled (since the category is guaranteed to change)
|
||||
* 2. We're scrolling right, but we aren't on the last category
|
||||
* 3. We're scrolling left, but we aren't on the first category */
|
||||
bool fail_condition = ((action == MENU_ACTION_RIGHT) ? (category == list_size)
|
||||
: (category == 0)) && !(settings->bools.menu_navigation_wraparound_enable);
|
||||
|
||||
if (((current_time - xmb->last_tab_switch_time) >= XMB_TAB_SWITCH_REPEAT_DELAY ||
|
||||
scroll_accel <= 0) && !fail_condition)
|
||||
audio_driver_mixer_play_scroll_sound(action == MENU_ACTION_RIGHT);
|
||||
}
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t category = xmb->categories_selection_ptr;
|
||||
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + xmb->system_tab_end;
|
||||
/* We only want the scrolling sound to play if any of the following are true:
|
||||
* 1. Wraparound is enabled (since the category is guaranteed to change)
|
||||
* 2. We're scrolling right, but we aren't on the last category
|
||||
* 3. We're scrolling left, but we aren't on the first category */
|
||||
bool fail_condition = ((action == MENU_ACTION_RIGHT)
|
||||
? (category == list_size)
|
||||
: (category == 0)) && !(settings->bools.menu_navigation_wraparound_enable);
|
||||
|
||||
if (((current_time - xmb->last_tab_switch_time) >= XMB_TAB_SWITCH_REPEAT_DELAY ||
|
||||
scroll_accel <= 0) && !fail_condition)
|
||||
audio_driver_mixer_play_scroll_sound(action == MENU_ACTION_RIGHT);
|
||||
#endif
|
||||
if (scroll_accel > 0)
|
||||
{
|
||||
@ -8300,7 +8295,15 @@ static int xmb_pointer_up(void *userdata,
|
||||
xmb_navigation_set(xmb, true);
|
||||
}
|
||||
else
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
||||
{
|
||||
size_t menu_list_size = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||
size_t new_selection = menu_list_size - 1;
|
||||
|
||||
menu_st->selection_ptr = new_selection;
|
||||
|
||||
if (menu_st->driver_ctx->navigation_set_last)
|
||||
menu_st->driver_ctx->navigation_set_last(menu_st->userdata);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENU_INPUT_GESTURE_SWIPE_DOWN:
|
||||
|
@ -62,19 +62,15 @@ enum rarch_menu_ctl_state
|
||||
RARCH_MENU_CTL_SET_PREVENT_POPULATE,
|
||||
RARCH_MENU_CTL_UNSET_PREVENT_POPULATE,
|
||||
RARCH_MENU_CTL_IS_PREVENT_POPULATE,
|
||||
RARCH_MENU_CTL_ENVIRONMENT,
|
||||
RARCH_MENU_CTL_POINTER_DOWN,
|
||||
RARCH_MENU_CTL_POINTER_UP,
|
||||
RARCH_MENU_CTL_OSK_PTR_AT_POS,
|
||||
RARCH_MENU_CTL_BIND_INIT,
|
||||
RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH,
|
||||
RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE,
|
||||
RARCH_MENU_CTL_REFRESH_THUMBNAIL_IMAGE,
|
||||
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH,
|
||||
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE,
|
||||
MENU_NAVIGATION_CTL_CLEAR,
|
||||
MENU_NAVIGATION_CTL_SET_LAST,
|
||||
MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL
|
||||
MENU_NAVIGATION_CTL_CLEAR
|
||||
};
|
||||
|
||||
enum menu_timedate_style_type
|
||||
|
@ -3788,9 +3788,10 @@ static void menu_input_set_pointer_visibility(
|
||||
menu_input_t *menu_input,
|
||||
retro_time_t current_time)
|
||||
{
|
||||
static bool cursor_shown = false;
|
||||
static bool cursor_hidden = false;
|
||||
static retro_time_t end_time = 0;
|
||||
static bool cursor_shown = false;
|
||||
static bool cursor_hidden = false;
|
||||
static retro_time_t end_time = 0;
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
|
||||
/* Ensure that mouse cursor is hidden when not in use */
|
||||
if ((menu_input->pointer.type == MENU_POINTER_MOUSE)
|
||||
@ -3799,11 +3800,9 @@ static void menu_input_set_pointer_visibility(
|
||||
/* Show cursor */
|
||||
if ((current_time > end_time) && !cursor_shown)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_ENABLE_MOUSE_CURSOR;
|
||||
menu_environ.data = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_ENABLE_MOUSE_CURSOR,
|
||||
NULL, menu_st->userdata);
|
||||
cursor_shown = true;
|
||||
cursor_hidden = false;
|
||||
}
|
||||
@ -3815,11 +3814,9 @@ static void menu_input_set_pointer_visibility(
|
||||
/* Hide cursor */
|
||||
if ((current_time > end_time) && !cursor_hidden)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_DISABLE_MOUSE_CURSOR;
|
||||
menu_environ.data = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_DISABLE_MOUSE_CURSOR,
|
||||
NULL, menu_st->userdata);
|
||||
cursor_shown = false;
|
||||
cursor_hidden = true;
|
||||
}
|
||||
@ -4974,7 +4971,6 @@ static bool menu_driver_init_internal(
|
||||
settings_t *settings,
|
||||
bool video_is_threaded)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
struct menu_state *menu_st = &menu_driver_state;;
|
||||
|
||||
if (menu_st->driver_ctx)
|
||||
@ -5023,11 +5019,11 @@ static bool menu_driver_init_internal(
|
||||
generic_menu_init_list(menu_st, settings);
|
||||
|
||||
/* Initialise menu screensaver */
|
||||
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
|
||||
menu_environ.data = NULL;
|
||||
menu_st->input_last_time_us = cpu_features_get_time_usec();
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ))
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
if ( menu_st->driver_ctx->environ_cb
|
||||
&& (menu_st->driver_ctx->environ_cb(MENU_ENVIRON_DISABLE_SCREENSAVER,
|
||||
NULL, menu_st->userdata) == 0))
|
||||
menu_st->flags |= MENU_ST_FLAG_SCREENSAVER_SUPPORTED;
|
||||
else
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_SUPPORTED;
|
||||
@ -5655,12 +5651,11 @@ unsigned menu_event(
|
||||
/* Disable screensaver if required */
|
||||
if (input_active)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
|
||||
menu_environ.data = NULL;
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
menu_st->input_last_time_us = menu_st->current_time_us;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_DISABLE_SCREENSAVER,
|
||||
NULL, menu_st->userdata);
|
||||
}
|
||||
|
||||
/* Annul received input */
|
||||
@ -6726,11 +6721,10 @@ void retroarch_menu_running(void)
|
||||
* first switching to the menu */
|
||||
if (menu_st->flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
|
||||
menu_environ.data = NULL;
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_DISABLE_SCREENSAVER,
|
||||
NULL, menu_st->userdata);
|
||||
}
|
||||
menu_st->input_last_time_us = cpu_features_get_time_usec();
|
||||
|
||||
@ -6815,11 +6809,10 @@ void retroarch_menu_running_finished(bool quit)
|
||||
* switching off the menu */
|
||||
if (menu_st->flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
|
||||
menu_environ.data = NULL;
|
||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_DISABLE_SCREENSAVER,
|
||||
NULL, menu_st->userdata);
|
||||
}
|
||||
video_driver_set_texture_enable(false, false);
|
||||
#ifdef HAVE_OVERLAY
|
||||
@ -6944,19 +6937,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
}
|
||||
menu_st->driver_data = NULL;
|
||||
break;
|
||||
case RARCH_MENU_CTL_ENVIRONMENT:
|
||||
{
|
||||
menu_ctx_environment_t *menu_environ =
|
||||
(menu_ctx_environment_t*)data;
|
||||
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
{
|
||||
if (menu_st->driver_ctx->environ_cb(menu_environ->type,
|
||||
menu_environ->data, menu_st->userdata) == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case RARCH_MENU_CTL_POINTER_DOWN:
|
||||
{
|
||||
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
|
||||
@ -7015,13 +6995,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
menu_st->userdata, (unsigned)selection, 'R');
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE:
|
||||
{
|
||||
if (!menu_st->driver_ctx || !menu_st->driver_ctx->update_thumbnail_image)
|
||||
return false;
|
||||
menu_st->driver_ctx->update_thumbnail_image(menu_st->userdata);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_REFRESH_THUMBNAIL_IMAGE:
|
||||
{
|
||||
unsigned *i = (unsigned*)data;
|
||||
@ -7071,25 +7044,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENU_NAVIGATION_CTL_SET_LAST:
|
||||
{
|
||||
size_t menu_list_size = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||
size_t new_selection = menu_list_size - 1;
|
||||
|
||||
menu_st->selection_ptr = new_selection;
|
||||
|
||||
if (menu_st->driver_ctx->navigation_set_last)
|
||||
menu_st->driver_ctx->navigation_set_last(menu_st->userdata);
|
||||
}
|
||||
break;
|
||||
case MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL:
|
||||
{
|
||||
size_t *sel = (size_t*)data;
|
||||
if (!sel)
|
||||
return false;
|
||||
*sel = menu_st->scroll.acceleration;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case RARCH_MENU_CTL_NONE:
|
||||
break;
|
||||
@ -7125,19 +7079,17 @@ void menu_shader_manager_free(void)
|
||||
**/
|
||||
bool menu_shader_manager_init(void)
|
||||
{
|
||||
video_driver_state_t
|
||||
*video_st = video_state_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||
bool ret = true;
|
||||
bool is_preset = false;
|
||||
const char *path_shader = NULL;
|
||||
struct video_shader *menu_shader = NULL;
|
||||
|
||||
/* We get the shader preset directly from the video driver, so that
|
||||
* we are in sync with it (it could fail loading an auto-shader)
|
||||
* If we can't (e.g. get_current_shader is not implemented),
|
||||
* we'll load video_shader_get_current_shader_preset() like always */
|
||||
video_shader_ctx_t shader_info = {0};
|
||||
video_shader_ctx_t shader_info = {0};
|
||||
|
||||
video_shader_driver_get_current_shader(&shader_info);
|
||||
|
||||
@ -7222,8 +7174,8 @@ bool menu_shader_manager_set_preset(struct video_shader *menu_shader,
|
||||
* Used when a preset is directly loaded.
|
||||
* No point in updating when the Preset was
|
||||
* created from the menu itself. */
|
||||
if ( !menu_shader ||
|
||||
!(video_shader_load_preset_into_shader(preset_path, menu_shader)))
|
||||
if ( !menu_shader
|
||||
|| !(video_shader_load_preset_into_shader(preset_path, menu_shader)))
|
||||
goto end;
|
||||
|
||||
/* TODO/FIXME - localize */
|
||||
@ -7792,7 +7744,15 @@ int generic_menu_entry_action(
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||
}
|
||||
else
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
||||
{
|
||||
size_t menu_list_size = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||
size_t new_selection = menu_list_size - 1;
|
||||
|
||||
menu_st->selection_ptr = new_selection;
|
||||
|
||||
if (menu_st->driver_ctx->navigation_set_last)
|
||||
menu_st->driver_ctx->navigation_set_last(menu_st->userdata);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_driver_ctx->navigation_increment)
|
||||
@ -7880,7 +7840,15 @@ int generic_menu_entry_action(
|
||||
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
|
||||
}
|
||||
else
|
||||
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
||||
{
|
||||
size_t menu_list_size = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||
size_t new_selection = menu_list_size - 1;
|
||||
|
||||
menu_st->selection_ptr = new_selection;
|
||||
|
||||
if (menu_st->driver_ctx->navigation_set_last)
|
||||
menu_st->driver_ctx->navigation_set_last(menu_st->userdata);
|
||||
}
|
||||
|
||||
if (menu_driver_ctx->navigation_increment)
|
||||
menu_driver_ctx->navigation_increment(menu_userdata);
|
||||
|
@ -255,7 +255,8 @@ static int explore_qsort_func_entries(const void *a_, const void *b_)
|
||||
const char *a = ((const explore_entry_t*)a_)->playlist_entry->label;
|
||||
const char *b = ((const explore_entry_t*)b_)->playlist_entry->label;
|
||||
int a0 = TOLOWER(a[0]), b0 = TOLOWER(b[0]);
|
||||
if (a0 != b0) return a0 - b0;
|
||||
if (a0 != b0)
|
||||
return a0 - b0;
|
||||
return strcasecmp(a, b);
|
||||
}
|
||||
|
||||
@ -1020,11 +1021,10 @@ static const char* explore_get_view_path(void)
|
||||
|
||||
static void explore_on_edit_views(enum msg_hash_enums msg)
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_NONE;
|
||||
menu_environ.data = NULL;
|
||||
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
|
||||
NULL, menu_st->userdata);
|
||||
|
||||
runloop_msg_queue_push(msg_hash_to_str(msg),
|
||||
1, 180, true, NULL,
|
||||
@ -1056,7 +1056,8 @@ static void explore_action_saveview_complete(void *userdata, const char *name)
|
||||
explore_state_t *state = explore_state;
|
||||
|
||||
menu_input_dialog_end();
|
||||
if (!name || !*name) return;
|
||||
if (!name || !*name)
|
||||
return;
|
||||
|
||||
fill_pathname_join_special(lvwpath,
|
||||
config_get_ptr()->paths.directory_playlist, name, sizeof(lvwpath));
|
||||
@ -1098,14 +1099,16 @@ static void explore_action_saveview_complete(void *userdata, const char *name)
|
||||
unsigned i, n;
|
||||
for (i = n = 0; i != state->view_levels; i++)
|
||||
{
|
||||
uint8_t vop = state->view_op[i];
|
||||
unsigned vcat = state->view_cats[i];
|
||||
uint8_t vop = state->view_op[i];
|
||||
unsigned vcat = state->view_cats[i];
|
||||
explore_string_t **by = state->by[vcat];
|
||||
if (vop != op && (vop != EXPLORE_OP_RANGE || op == EXPLORE_OP_EQUAL))
|
||||
continue;
|
||||
|
||||
if (n++ == 0)
|
||||
{
|
||||
if (count++) rjsonwriter_add_comma(w);
|
||||
if (count++)
|
||||
rjsonwriter_add_comma(w);
|
||||
rjsonwriter_add_newline(w);
|
||||
rjsonwriter_add_tabs(w, 1);
|
||||
rjsonwriter_add_string(w,
|
||||
@ -1116,7 +1119,8 @@ static void explore_action_saveview_complete(void *userdata, const char *name)
|
||||
rjsonwriter_add_space(w);
|
||||
rjsonwriter_add_start_object(w);
|
||||
}
|
||||
if (n > 1) rjsonwriter_add_comma(w);
|
||||
if (n > 1)
|
||||
rjsonwriter_add_comma(w);
|
||||
rjsonwriter_add_newline(w);
|
||||
rjsonwriter_add_tabs(w, 2);
|
||||
rjsonwriter_add_string(w, explore_by_info[vcat].rdbkey);
|
||||
|
@ -787,41 +787,33 @@ int setting_bool_action_right_with_refresh(
|
||||
int setting_uint_action_right_with_refresh(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
int retval = setting_uint_action_right_default(setting, idx, wraparound);
|
||||
bool refresh = false;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
int retval = setting_uint_action_right_default(setting, idx, wraparound);
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int setting_bool_action_left_with_refresh(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
bool refresh = false;
|
||||
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
setting_set_with_string_representation(setting,
|
||||
*setting->value.target.boolean ? "false" : "true");
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setting_uint_action_left_with_refresh(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
int retval = setting_uint_action_left_default(
|
||||
setting, idx, wraparound);
|
||||
bool refresh = false;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
int retval = setting_uint_action_left_default(
|
||||
setting, idx, wraparound);
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
static int setting_size_action_left_default(
|
||||
@ -1157,14 +1149,12 @@ static void setting_reset_setting(rarch_setting_t* setting)
|
||||
|
||||
int setting_generic_action_start_default(rarch_setting_t *setting)
|
||||
{
|
||||
bool refresh = false;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
setting_reset_setting(setting);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5383,10 +5373,10 @@ unsigned libretro_device_get_size(unsigned *devices, size_t devices_size, unsign
|
||||
static int setting_action_left_libretro_device_type(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
bool refresh = false;
|
||||
retro_ctx_controller_info_t pad;
|
||||
unsigned current_device, current_idx, i, devices[128],
|
||||
types = 0, port = 0;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -5414,17 +5404,17 @@ static int setting_action_left_libretro_device_type(
|
||||
|
||||
core_set_controller_port_device(&pad);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setting_action_left_input_remap_port(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
bool refresh = false;
|
||||
unsigned port = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
unsigned port = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -5445,8 +5435,8 @@ static int setting_action_left_input_remap_port(
|
||||
* ports are set to 'RETRO_DEVICE_NONE' */
|
||||
command_event(CMD_EVENT_CONTROLLER_INIT, NULL);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7335,9 +7325,9 @@ static int setting_action_start_libretro_device_type(rarch_setting_t *setting)
|
||||
|
||||
static int setting_action_start_input_remap_port(rarch_setting_t *setting)
|
||||
{
|
||||
bool refresh = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned port;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -7354,16 +7344,14 @@ static int setting_action_start_input_remap_port(rarch_setting_t *setting)
|
||||
* ports are set to 'RETRO_DEVICE_NONE' */
|
||||
command_event(CMD_EVENT_CONTROLLER_INIT, NULL);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setting_action_start_video_refresh_rate_auto(
|
||||
rarch_setting_t *setting)
|
||||
{
|
||||
(void)setting;
|
||||
|
||||
video_driver_monitor_reset();
|
||||
return 0;
|
||||
}
|
||||
@ -7414,10 +7402,10 @@ static int setting_action_right_analog_dpad_mode(
|
||||
static int setting_action_right_libretro_device_type(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
bool refresh = false;
|
||||
retro_ctx_controller_info_t pad;
|
||||
unsigned current_device, current_idx, i, devices[128],
|
||||
types = 0, port = 0;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -7445,8 +7433,8 @@ static int setting_action_right_libretro_device_type(
|
||||
|
||||
core_set_controller_port_device(&pad);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
|
||||
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5706,13 +5706,12 @@ static enum runloop_state_enum runloop_check_state(
|
||||
&& (menu_st->flags & MENU_ST_FLAG_SCREENSAVER_SUPPORTED)
|
||||
&& (!(menu_st->flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE))
|
||||
&& ((menu_st->current_time_us - menu_st->input_last_time_us)
|
||||
> ((retro_time_t)screensaver_timeout * 1000000)))
|
||||
> ((retro_time_t)screensaver_timeout * 1000000)))
|
||||
{
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_ENABLE_SCREENSAVER;
|
||||
menu_environ.data = NULL;
|
||||
menu_st->flags |= MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_ENABLE_SCREENSAVER,
|
||||
NULL, menu_st->userdata);
|
||||
}
|
||||
|
||||
/* Iterate the menu driver for one frame. */
|
||||
|
@ -119,7 +119,7 @@ static void cb_task_manual_content_scan(
|
||||
manual_scan_handle_t *manual_scan = NULL;
|
||||
playlist_t *cached_playlist = playlist_get_cached();
|
||||
#if defined(RARCH_INTERNAL) && defined(HAVE_MENU)
|
||||
menu_ctx_environment_t menu_environ;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
if (!task)
|
||||
goto end;
|
||||
#else
|
||||
@ -127,9 +127,7 @@ static void cb_task_manual_content_scan(
|
||||
return;
|
||||
#endif
|
||||
|
||||
manual_scan = (manual_scan_handle_t*)task->state;
|
||||
|
||||
if (!manual_scan)
|
||||
if (!(manual_scan = (manual_scan_handle_t*)task->state))
|
||||
{
|
||||
#if defined(RARCH_INTERNAL) && defined(HAVE_MENU)
|
||||
goto end;
|
||||
@ -169,10 +167,9 @@ static void cb_task_manual_content_scan(
|
||||
end:
|
||||
/* When creating playlists, the playlist tabs of
|
||||
* any active menu driver must be refreshed */
|
||||
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
|
||||
menu_environ.data = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
|
||||
NULL, menu_st->userdata);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1000,14 +1000,13 @@ static const QPixmap getInvader(void)
|
||||
static void scan_finished_handler(retro_task_t *task,
|
||||
void *task_data, void *user_data, const char *err)
|
||||
{
|
||||
bool dont_ask = false;
|
||||
bool answer = false;
|
||||
bool dont_ask = false;
|
||||
bool answer = false;
|
||||
#ifdef HAVE_MENU
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
|
||||
menu_environ.data = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
if (menu_st->driver_ctx->environ_cb)
|
||||
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
|
||||
NULL, menu_st->userdata);
|
||||
#endif
|
||||
if (!ui_window.qtWindow->settings()->value(
|
||||
"scan_finish_confirm", true).toBool())
|
||||
@ -1023,14 +1022,14 @@ static void scan_finished_handler(retro_task_t *task,
|
||||
#endif
|
||||
|
||||
/* https://stackoverflow.com/questions/7246622/how-to-create-a-slider-with-a-non-linear-scale */
|
||||
static double exp_scale(double inputValue, double midValue, double maxValue)
|
||||
static double exp_scale(double input_val, double mid_val, double max_val)
|
||||
{
|
||||
double M = maxValue / midValue;
|
||||
double base = M - 1;
|
||||
double C = log(base * base);
|
||||
double B = maxValue / (exp(C) - 1);
|
||||
double A = -1 * B;
|
||||
double ret = A + B * exp(C * inputValue);
|
||||
double M = max_val / mid_val;
|
||||
double base = M - 1;
|
||||
double C = log(base * base);
|
||||
double B = max_val / (exp(C) - 1);
|
||||
double A = -1 * B;
|
||||
double ret = A + B * exp(C * input_val);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user