do not return to game after canceling quit confirm if user toggled the menu manually

This commit is contained in:
Brad Parker 2016-09-05 11:35:27 -04:00
parent 4bc837fe77
commit ef29bc96b0
10 changed files with 168 additions and 120 deletions

View File

@ -200,11 +200,11 @@ static bool command_read_ram(const char *arg)
cheevos_parse_guest_addr(&var, strtoul(reply_at, (char**)&reply_at, 16));
data = cheevos_get_memory(&var);
if (data)
{
unsigned nbytes = strtol(reply_at, NULL, 10);
for (i=0;i<nbytes;i++)
{
sprintf(reply_at+3*i, " %.2X", data[i]);
@ -797,7 +797,7 @@ bool command_get(command_handle_t *handle)
{
if (!handle || !handle->handle)
return false;
return handle->id < RARCH_BIND_LIST_END
return handle->id < RARCH_BIND_LIST_END
&& handle->handle->state[handle->id];
}
@ -848,8 +848,8 @@ static void command_event_disk_control_set_eject(bool new_state, bool print_log)
if (control->set_eject_state(new_state))
snprintf(msg, sizeof(msg), "%s %s",
new_state ?
msg_hash_to_str(MSG_DISK_EJECTED) :
new_state ?
msg_hash_to_str(MSG_DISK_EJECTED) :
msg_hash_to_str(MSG_DISK_CLOSED),
msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY));
else
@ -1089,7 +1089,7 @@ static void command_event_init_controllers(void)
unsigned i;
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
for (i = 0; i < MAX_USERS; i++)
@ -1476,7 +1476,7 @@ static bool command_event_save_core_config(void)
}
/* Infer file name based on libretro core. */
if (!string_is_empty(config_get_active_core_path())
if (!string_is_empty(config_get_active_core_path())
&& path_file_exists(config_get_active_core_path()))
{
unsigned i;
@ -1527,8 +1527,8 @@ static bool command_event_save_core_config(void)
if (runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
{
/* Overrides block config file saving,
* make it appear as overrides weren't enabled
/* Overrides block config file saving,
* make it appear as overrides weren't enabled
* for a manual save. */
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
overrides_active = true;
@ -1664,9 +1664,9 @@ static void command_event_undo_save_state(char *s, size_t len)
{
if (content_undo_save_buf_is_empty())
{
strlcpy(s,
strlcpy(s,
msg_hash_to_str(MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET), len);
return;
return;
}
if (!content_undo_save_state())
@ -1710,13 +1710,13 @@ static void command_event_load_state(const char *path, char *s, size_t len)
static void command_event_undo_load_state(char *s, size_t len)
{
if (content_undo_load_buf_is_empty())
{
strlcpy(s,
strlcpy(s,
msg_hash_to_str(MSG_NO_STATE_HAS_BEEN_LOADED_YET),
len);
return;
return;
}
if (!content_undo_load_state())
@ -1727,7 +1727,7 @@ static void command_event_undo_load_state(char *s, size_t len)
return;
}
strlcpy(s,
strlcpy(s,
msg_hash_to_str(MSG_UNDID_LOAD_STATE), len);
}
@ -1995,8 +1995,8 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_QUIT_CONFIRM:
handle_quit_event();
break;
case CMD_EVENT_QUIT:
break;
case CMD_EVENT_QUIT:
#ifdef HAVE_MENU
if (settings && settings->confirm_on_exit &&
!menu_popup_is_active() && !runloop_is_quit_confirm())
@ -2441,7 +2441,7 @@ bool command_event(enum event_command cmd, void *data)
global_t *global = global_get_ptr();
global->sram.use = global->sram.use && !global->sram.save_disable;
#ifdef HAVE_NETPLAY
global->sram.use = global->sram.use &&
global->sram.use = global->sram.use &&
(!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL)
|| !global->netplay.is_client);
#endif

View File

@ -68,7 +68,7 @@ static enum action_iterate_type action_iterate_type(uint32_t hash)
*
* Runs RetroArch menu for one frame.
*
* Returns: 0 on success, -1 if we need to quit out of the loop.
* Returns: 0 on success, -1 if we need to quit out of the loop.
**/
int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
{
@ -94,7 +94,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
iterate_type = action_iterate_type(hash);
if ( action != MENU_ACTION_NOOP
|| menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
|| menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
|| menu_display_get_update_pending())
{
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
@ -128,7 +128,8 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
{
runloop_set_quit_confirm(false);
if (content_is_inited())
if (content_is_inited() &&
menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
}
}
@ -153,12 +154,12 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
case ITERATE_TYPE_INFO:
{
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_file_list_cbs_t *cbs =
menu_file_list_cbs_t *cbs =
menu_entries_get_actiondata_at_offset(selection_buf, selection);
if (cbs->enum_idx != MSG_UNKNOWN)
{
ret = menu_hash_get_help_enum(cbs->enum_idx,
ret = menu_hash_get_help_enum(cbs->enum_idx,
menu->menu_state.msg, sizeof(menu->menu_state.msg));
#if 0
RARCH_LOG("enum: %s\n", msg_hash_to_str(cbs->enum_idx));
@ -231,7 +232,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
}
if (enum_idx != MSG_UNKNOWN)
ret = menu_hash_get_help_enum(enum_idx,
ret = menu_hash_get_help_enum(enum_idx,
menu->menu_state.msg, sizeof(menu->menu_state.msg));
}
@ -243,10 +244,10 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
menu_popup_set_active(false);
break;
case ITERATE_TYPE_DEFAULT:
/* FIXME: Crappy hack, needed for mouse controls
/* FIXME: Crappy hack, needed for mouse controls
* to not be completely broken in case we press back.
*
* We need to fix this entire mess, mouse controls
* We need to fix this entire mess, mouse controls
* should not rely on a hack like this in order to work. */
selection = MAX(MIN(selection, (menu_entries_get_size() - 1)), 0);
@ -271,7 +272,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
menu_entries_pop_stack(&new_selection_ptr, 0, 0);
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
}
if (BIT64_GET(menu->state, MENU_STATE_POST_ITERATE))
menu_input_post_iterate(&ret, action);

View File

@ -42,6 +42,8 @@
uintptr_t menu_display_white_texture;
static enum menu_toggle_reason menu_display_toggle_reason = MENU_TOGGLE_REASON_NONE;
static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
#ifdef HAVE_D3D
&menu_display_ctx_d3d,
@ -59,6 +61,16 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
NULL,
};
enum menu_toggle_reason menu_display_toggle_get_reason(void)
{
return menu_display_toggle_reason;
}
void menu_display_toggle_set_reason(enum menu_toggle_reason reason)
{
menu_display_toggle_reason = reason;
}
static const char *menu_video_get_ident(void)
{
#ifdef HAVE_THREADS
@ -287,7 +299,7 @@ bool menu_display_libretro_running(void)
settings_t *settings = config_get_ptr();
if (!settings->menu.pause_libretro)
{
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
return true;
}
@ -430,7 +442,7 @@ float menu_display_get_dpi(void)
return true;
metrics.type = DISPLAY_METRIC_DPI;
metrics.value = &dpi;
metrics.value = &dpi;
if (settings->menu.dpi.override_enable)
return settings->menu.dpi.override_value;
@ -530,7 +542,7 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw)
if (!menu_display_libretro_running() && !menu_display_shader_pipeline_active())
add_opacity_to_wallpaper = true;
if (string_is_equal(menu_driver_ident(), "xmb")
if (string_is_equal(menu_driver_ident(), "xmb")
&& settings->menu.xmb.menu_color_theme == XMB_THEME_WALLPAPER)
add_opacity_to_wallpaper = true;
@ -757,7 +769,7 @@ void menu_display_snow(int width, int height)
p->x += menu_display_scalef(mouse_x, 0, width, -0.3, 0.3);
p->x += p->xspeed;
p->alive = p->y >= 0 && p->y < height
p->alive = p->y >= 0 && p->y < height
&& p->x >= 0 && p->x < width;
}
else if (max_gen > 0 && timeout <= 0)
@ -803,7 +815,7 @@ void menu_display_snow(int width, int height)
}
}
void menu_display_draw_text(const char *msg,
void menu_display_draw_text(const char *msg,
int width, int height, struct font_params *params)
{
void *fb_buf = menu_display_get_font_buffer();

View File

@ -167,6 +167,16 @@ typedef struct menu_display_ctx_font
typedef uintptr_t menu_texture_item;
enum menu_toggle_reason
{
MENU_TOGGLE_REASON_NONE = 0,
MENU_TOGGLE_REASON_USER,
MENU_TOGGLE_REASON_MESSAGE
};
enum menu_toggle_reason menu_display_toggle_get_reason(void);
void menu_display_toggle_set_reason(enum menu_toggle_reason reason);
void menu_display_blend_begin(void);
void menu_display_blend_end(void);
@ -230,7 +240,7 @@ void menu_display_handle_wallpaper_upload(void *task_data,
void menu_display_handle_thumbnail_upload(void *task_data,
void *user_data, const char *err);
void menu_display_push_quad(
void menu_display_push_quad(
unsigned width, unsigned height,
const float *colors, int x1, int y1,
int x2, int y2);
@ -243,7 +253,7 @@ void menu_display_draw_cursor(
float *color, float cursor_size, uintptr_t texture,
float x, float y, unsigned width, unsigned height);
void menu_display_draw_text(const char *msg, int width, int height,
void menu_display_draw_text(const char *msg, int width, int height,
struct font_params *params);
bool menu_display_shader_pipeline_active(void);

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - 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.
@ -70,6 +70,7 @@ static bool menu_driver_pending_quick_menu = false;
static bool menu_driver_prevent_populate = false;
static bool menu_driver_load_no_content = false;
static bool menu_driver_alive = false;
static bool menu_driver_toggled = false;
static bool menu_driver_data_own = false;
static bool menu_driver_pending_quit = false;
static bool menu_driver_pending_shutdown = false;
@ -98,7 +99,7 @@ const void *menu_driver_find_handle(int idx)
* menu_driver_find_ident:
* @idx : index of driver to get handle to.
*
* Returns: Human-readable identifier of menu driver at index.
* Returns: Human-readable identifier of menu driver at index.
* Can be NULL if nothing found.
**/
const char *menu_driver_find_ident(int idx)
@ -143,7 +144,7 @@ static void bundle_decompressed(void *task_data,
free(dec);
}
settings->bundle_assets_extract_last_version =
settings->bundle_assets_extract_last_version =
settings->bundle_assets_extract_version_current;
settings->bundle_finished = true;
}
@ -178,19 +179,19 @@ static bool menu_init(menu_handle_t *menu_data)
}
if ( settings->bundle_assets_extract_enable
&& !string_is_empty(settings->path.bundle_assets_src)
&& !string_is_empty(settings->path.bundle_assets_src)
&& !string_is_empty(settings->path.bundle_assets_dst)
#ifdef IOS
&& menu_popup_is_push_pending()
#else
&& (settings->bundle_assets_extract_version_current
&& (settings->bundle_assets_extract_version_current
!= settings->bundle_assets_extract_last_version)
#endif
)
{
menu_popup_push_pending(true, MENU_POPUP_HELP_EXTRACT);
#ifdef HAVE_ZLIB
task_push_decompress(settings->path.bundle_assets_src,
task_push_decompress(settings->path.bundle_assets_src,
settings->path.bundle_assets_dst,
NULL, settings->path.bundle_assets_dst_subdir,
NULL, bundle_decompressed, NULL);
@ -221,7 +222,12 @@ static void menu_driver_toggle(bool latch)
retro_keyboard_event_t *key_event = NULL;
retro_keyboard_event_t *frontend_key_event = NULL;
settings_t *settings = config_get_ptr();
menu_driver_toggled = latch;
if (!latch)
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);
if (latch)
@ -290,10 +296,10 @@ const char *menu_driver_ident(void)
static void menu_update_libretro_info(void)
{
struct retro_system_info *info = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&info);
if (!info)
return;
@ -409,7 +415,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
break;
case RARCH_MENU_CTL_SYSTEM_INFO_GET:
{
struct retro_system_info **system =
struct retro_system_info **system =
(struct retro_system_info**)data;
if (!system)
return false;
@ -438,14 +444,14 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
if (!menu_driver_data)
return false;
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER)
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER)
!= BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX))
BIT64_SET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER);
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER))
menu_display_set_framebuffer_dirty_flag();
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)
&& !string_is_empty(menu_driver_data->menu_state.msg))
{
menu_driver_ctl(RARCH_MENU_CTL_RENDER_MESSAGEBOX, NULL);
@ -464,7 +470,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_ctl(RARCH_MENU_CTL_BLIT_RENDER, NULL);
}
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
menu_display_libretro();
@ -509,6 +515,9 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
break;
case RARCH_MENU_CTL_IS_PREVENT_POPULATE:
return menu_driver_prevent_populate;
case RARCH_MENU_CTL_IS_TOGGLE:
return menu_driver_toggled;
break;
case RARCH_MENU_CTL_SET_TOGGLE:
menu_driver_toggle(true);
break;
@ -824,7 +833,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
break;
case RARCH_MENU_CTL_LOAD_IMAGE:
{
menu_ctx_load_image_t *load_image_info =
menu_ctx_load_image_t *load_image_info =
(menu_ctx_load_image_t*)data;
if (!menu_driver_ctx || !menu_driver_ctx->load_image)
return false;
@ -867,7 +876,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
}
if (!menu_driver_ctx || !menu_driver_ctx->iterate)
return false;
if (menu_driver_ctx->iterate(menu_driver_data,
menu_userdata, iterate->action) == -1)
return false;
@ -875,7 +884,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
break;
case RARCH_MENU_CTL_ENVIRONMENT:
{
menu_ctx_environment_t *menu_environ =
menu_ctx_environment_t *menu_environ =
(menu_ctx_environment_t*)data;
if (menu_driver_ctx->environ_cb)

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - 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.
@ -71,7 +71,7 @@ enum menu_state_changes
MENU_STATE_BLIT,
MENU_STATE_POP_STACK,
MENU_STATE_POST_ITERATE
};
};
enum rarch_menu_ctl_state
{
@ -106,6 +106,7 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_UNSET_PREVENT_POPULATE,
RARCH_MENU_CTL_IS_PREVENT_POPULATE,
RARCH_MENU_CTL_SET_TEXTURE,
RARCH_MENU_CTL_IS_TOGGLE,
RARCH_MENU_CTL_SET_TOGGLE,
RARCH_MENU_CTL_UNSET_TOGGLE,
RARCH_MENU_CTL_SET_ALIVE,

View File

@ -215,7 +215,7 @@ void menu_input_st_cheat_cb(void *userdata, const char *str)
if (str && *str)
{
unsigned cheat_index =
unsigned cheat_index =
menu_input->keyboard.type - MENU_SETTINGS_CHEAT_BEGIN;
cheat_manager_set_code(cheat_index, str);
}
@ -317,9 +317,9 @@ static void menu_input_key_bind_poll_bind_get_rested_axes(
struct menu_bind_state *state, unsigned port)
{
unsigned a;
const input_device_driver_t *joypad =
const input_device_driver_t *joypad =
input_driver_get_joypad_driver();
const input_device_driver_t *sec_joypad =
const input_device_driver_t *sec_joypad =
input_driver_get_sec_joypad_driver();
if (!state || !joypad)
@ -327,14 +327,14 @@ static void menu_input_key_bind_poll_bind_get_rested_axes(
/* poll only the relevant port */
for (a = 0; a < MENU_MAX_AXES; a++)
state->axis_state[port].rested_axes[a] =
state->axis_state[port].rested_axes[a] =
input_joypad_axis_raw(joypad, port, a);
if (sec_joypad)
{
/* poll only the relevant port */
for (a = 0; a < MENU_MAX_AXES; a++)
state->axis_state[port].rested_axes[a] =
state->axis_state[port].rested_axes[a] =
input_joypad_axis_raw(sec_joypad, port, a);
}
}
@ -348,20 +348,20 @@ static void menu_input_key_bind_poll_bind_state_internal(
unsigned b, a, h;
if (!joypad)
return;
if (joypad->poll)
joypad->poll();
/* poll only the relevant port */
/* for (i = 0; i < settings->input.max_users; i++) */
for (b = 0; b < MENU_MAX_BUTTONS; b++)
state->state[port].buttons[b] =
state->state[port].buttons[b] =
input_joypad_button_raw(joypad, port, b);
for (a = 0; a < MENU_MAX_AXES; a++)
state->state[port].axes[a] =
state->state[port].axes[a] =
input_joypad_axis_raw(joypad, port, a);
for (h = 0; h < MENU_MAX_HATS; h++)
{
if (input_joypad_hat_raw(joypad, port, HAT_UP_MASK, h))
@ -380,9 +380,9 @@ static void menu_input_key_bind_poll_bind_state(
unsigned port,
bool timed_out)
{
const input_device_driver_t *joypad =
const input_device_driver_t *joypad =
input_driver_get_joypad_driver();
const input_device_driver_t *sec_joypad =
const input_device_driver_t *sec_joypad =
input_driver_get_sec_joypad_driver();
if (!state)
@ -391,10 +391,10 @@ static void menu_input_key_bind_poll_bind_state(
memset(state->state, 0, sizeof(state->state));
state->skip = timed_out || input_driver_state(NULL, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
menu_input_key_bind_poll_bind_state_internal(
joypad, state, port, timed_out);
if (sec_joypad)
menu_input_key_bind_poll_bind_state_internal(
sec_joypad, state, port, timed_out);
@ -472,13 +472,13 @@ static bool menu_input_key_bind_poll_find_trigger_pad(
{
/* Take care of case where axis rests on +/- 0x7fff
* (e.g. 360 controller on Linux) */
state->target->joyaxis = n->axes[a] > 0
state->target->joyaxis = n->axes[a] > 0
? AXIS_POS(a) : AXIS_NEG(a);
state->target->joykey = NO_BTN;
/* Lock the current axis */
new_state->axis_state[p].locked_axes[a] =
n->axes[a] > 0 ?
new_state->axis_state[p].locked_axes[a] =
n->axes[a] > 0 ?
0x7fff : -0x7fff;
return true;
}
@ -546,7 +546,7 @@ static bool menu_input_key_bind_iterate(char *s, size_t len)
menu_input_t *menu_input = menu_input_get_ptr();
settings_t *settings = config_get_ptr();
int64_t current = cpu_features_get_time_usec();
int timeout =
int timeout =
(menu_input->binds.timeout_end - current) / 1000000;
if (timeout <= 0)
@ -614,10 +614,10 @@ bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox
{
int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
bool inside_hitbox =
(mouse_x >= hitbox->x1)
&& (mouse_x <= hitbox->x2)
&& (mouse_y >= hitbox->y1)
bool inside_hitbox =
(mouse_x >= hitbox->x1)
&& (mouse_x <= hitbox->x2)
&& (mouse_y >= hitbox->y1)
&& (mouse_y <= hitbox->y2)
;
@ -639,7 +639,7 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
{
case MENU_INPUT_CTL_BIND_SET_MIN_MAX:
{
menu_input_ctx_bind_limits_t *lim =
menu_input_ctx_bind_limits_t *lim =
(menu_input_ctx_bind_limits_t*)data;
if (!lim || !menu_input)
return false;
@ -776,7 +776,7 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
menu_input->keyboard.type = line->type;
menu_input->keyboard.idx = line->idx;
menu_input_keyboard_buffer =
menu_input_keyboard_buffer =
input_keyboard_start_line(menu, line->cb);
}
break;
@ -794,13 +794,13 @@ static int menu_input_pointer(unsigned *action)
menu_input_t *menu_input = menu_input_get_ptr();
unsigned fb_width = menu_display_get_width();
unsigned fb_height = menu_display_get_height();
int pointer_device =
int pointer_device =
menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ?
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
int pointer_x =
int pointer_x =
input_driver_state(binds, 0, pointer_device,
0, RETRO_DEVICE_ID_POINTER_X);
int pointer_y =
int pointer_y =
input_driver_state(binds, 0, pointer_device,
0, RETRO_DEVICE_ID_POINTER_Y);
@ -885,7 +885,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse,
if (
!settings->menu.mouse.enable
!settings->menu.mouse.enable
#ifdef HAVE_OVERLAY
|| (settings->input.overlay_enable && input_overlay_is_alive(NULL))
#endif
@ -1042,7 +1042,7 @@ static int menu_input_pointer_post_iterate(
return -1;
#ifdef HAVE_OVERLAY
check_overlay = check_overlay ||
check_overlay = check_overlay ||
(settings->input.overlay_enable && input_overlay_is_alive(NULL));
#endif
@ -1059,7 +1059,7 @@ static int menu_input_pointer_post_iterate(
int16_t pointer_y = menu_input_pointer_state(MENU_POINTER_Y_AXIS);
metrics.type = DISPLAY_METRIC_DPI;
metrics.value = &dpi;
metrics.value = &dpi;
video_context_driver_get_metrics(&metrics);
@ -1176,10 +1176,10 @@ static unsigned menu_input_frame_pointer(unsigned *data)
bool mouse_enabled = settings->menu.mouse.enable;
#ifdef HAVE_OVERLAY
if (!mouse_enabled)
mouse_enabled = !(settings->input.overlay_enable
mouse_enabled = !(settings->input.overlay_enable
&& input_overlay_is_alive(NULL));
#endif
if (!mouse_enabled)
menu_input->mouse.ptr = 0;

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - 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.

View File

@ -16,6 +16,7 @@
#include <compat/strl.h>
#include <features/features_cpu.h>
#include "menu_display.h"
#include "menu_driver.h"
#include "menu_popup.h"
@ -94,10 +95,10 @@ int menu_popup_iterate(char *s, size_t len, const char *label)
for (i = 0; i < ARRAY_SIZE(binds); i++)
{
const struct retro_keybind *keybind =
const struct retro_keybind *keybind =
(const struct retro_keybind*)
&settings->input.binds[0][binds[i]];
const struct retro_keybind *auto_bind =
const struct retro_keybind *auto_bind =
(const struct retro_keybind*)
input_get_auto_bind(0, binds[i]);
@ -170,7 +171,7 @@ int menu_popup_iterate(char *s, size_t len, const char *label)
);
}
break;
#ifdef HAVE_CHEEVOS
case MENU_POPUP_HELP_CHEEVOS_DESCRIPTION:
desc_info.idx = menu_popup_current_id;
@ -273,6 +274,8 @@ void menu_popup_reset(void)
menu_popup_current_id = 0;
menu_popup_current_type = MENU_POPUP_NONE;
menu_popup_current_msg = MSG_UNKNOWN;
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
}
void menu_popup_show_message(
@ -280,6 +283,9 @@ void menu_popup_show_message(
{
menu_popup_current_msg = msg;
if (!menu_driver_ctl(RARCH_MENU_CTL_IS_TOGGLE, NULL))
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_MESSAGE);
menu_popup_push_pending(true, type);
menu_popup_push();
}

View File

@ -61,6 +61,7 @@
#include "tasks/tasks_internal.h"
#ifdef HAVE_MENU
#include "menu/menu_display.h"
#include "menu/menu_driver.h"
#include "menu/menu_popup.h"
#endif
@ -81,7 +82,7 @@
#define DEFAULT_EXT ""
#endif
#define runloop_cmd_triggered(cmd, id) BIT64_GET(cmd->state[2].state, id)
#define runloop_cmd_triggered(cmd, id) BIT64_GET(cmd->state[2].state, id)
#define runloop_cmd_press(cmd, id) BIT64_GET(cmd->state[0].state, id)
#define runloop_cmd_pressed(cmd, id) BIT64_GET(cmd->state[1].state, id)
@ -583,7 +584,7 @@ static void runloop_check_shader_dir(
/**
* rarch_game_specific_options:
*
* Returns: true (1) if a game specific core
* Returns: true (1) if a game specific core
* options path has been found,
* otherwise false (0).
**/
@ -591,7 +592,7 @@ static bool rarch_game_specific_options(char **output)
{
char game_path[PATH_MAX_LENGTH] = {0};
config_file_t *option_file = NULL;
if (!retroarch_validate_game_options(game_path,
sizeof(game_path), false))
return false;
@ -601,7 +602,7 @@ static bool rarch_game_specific_options(char **output)
return false;
config_file_free(option_file);
RARCH_LOG("%s %s\n",
msg_hash_to_str(MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT),
game_path);
@ -625,7 +626,7 @@ static bool runloop_check_pause_state(event_cmd_state_t *cmd)
return false;
check_is_oneshot = runloop_cmd_triggered(cmd,
RARCH_FRAMEADVANCE)
RARCH_FRAMEADVANCE)
|| runloop_cmd_press(cmd, RARCH_REWIND);
if (!runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
@ -722,8 +723,8 @@ static bool runloop_check_state(event_cmd_state_t *cmd,
if (runloop_cmd_triggered(cmd, RARCH_MOVIE_RECORD_TOGGLE))
runloop_check_movie();
if (runloop_cmd_triggered(cmd, RARCH_SHADER_NEXT) ||
if (runloop_cmd_triggered(cmd, RARCH_SHADER_NEXT) ||
runloop_cmd_triggered(cmd, RARCH_SHADER_PREV))
{
runloop_check_shader_dir(shader_dir,
@ -814,17 +815,17 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
free(runloop_system.subsystem.data);
runloop_system.subsystem.data = NULL;
runloop_system.subsystem.size = 0;
if (runloop_system.ports.data)
free(runloop_system.ports.data);
runloop_system.ports.data = NULL;
runloop_system.ports.size = 0;
if (runloop_system.mmaps.descriptors)
free((void *)runloop_system.mmaps.descriptors);
runloop_system.mmaps.descriptors = NULL;
runloop_system.mmaps.num_descriptors = 0;
runloop_key_event = NULL;
runloop_frontend_key_event = NULL;
@ -844,7 +845,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
runloop_overrides_active = true;
break;
case RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE:
runloop_overrides_active = false;
runloop_overrides_active = false;
break;
case RUNLOOP_CTL_IS_OVERRIDES_ACTIVE:
return runloop_overrides_active;
@ -1160,7 +1161,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
RARCH_LOG("Environ GET_VARIABLE %s:\n", var->key);
core_option_manager_get(runloop_core_options, var);
RARCH_LOG("\t%s\n", var->value ? var->value :
RARCH_LOG("\t%s\n", var->value ? var->value :
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
}
break;
@ -1172,10 +1173,10 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
const char *options_path = settings->path.core_options;
const struct retro_variable *vars =
const struct retro_variable *vars =
(const struct retro_variable*)data;
if (string_is_empty(options_path)
if (string_is_empty(options_path)
&& !string_is_empty(global->path.config))
{
fill_pathname_resolve_relative(buf, global->path.config,
@ -1190,14 +1191,14 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if(ret)
{
runloop_ctl(RUNLOOP_CTL_SET_GAME_OPTIONS_ACTIVE, NULL);
runloop_core_options =
runloop_core_options =
core_option_manager_new(game_options_path, vars);
free(game_options_path);
}
else
{
runloop_ctl(RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE, NULL);
runloop_core_options =
runloop_core_options =
core_option_manager_new(options_path, vars);
}
@ -1233,7 +1234,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
break;
case RUNLOOP_CTL_KEY_EVENT_GET:
{
retro_keyboard_event_t **key_event =
retro_keyboard_event_t **key_event =
(retro_keyboard_event_t**)data;
if (!key_event)
return false;
@ -1242,7 +1243,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
break;
case RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET:
{
retro_keyboard_event_t **key_event =
retro_keyboard_event_t **key_event =
(retro_keyboard_event_t**)data;
if (!key_event)
return false;
@ -1361,7 +1362,11 @@ static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed)
!runloop_quit_confirm)
{
if (content_is_inited())
{
if(menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_MESSAGE);
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
}
menu_popup_show_message(MENU_POPUP_QUIT_CONFIRM, MENU_ENUM_LABEL_CONFIRM_ON_EXIT);
return 1;
@ -1413,8 +1418,8 @@ static int runloop_iterate_menu(enum menu_action action, unsigned *sleep_ms)
*
* Run Libretro core in RetroArch for one frame.
*
* Returns: 0 on success, 1 if we have to wait until
* button input in order to wake up the loop,
* Returns: 0 on success, 1 if we have to wait until
* button input in order to wake up the loop,
* -1 if we forcibly quit out of the RetroArch iteration loop.
**/
int runloop_iterate(unsigned *sleep_ms)
@ -1436,14 +1441,14 @@ int runloop_iterate(unsigned *sleep_ms)
if (runloop_ctl(RUNLOOP_CTL_SHOULD_SET_FRAME_LIMIT, NULL))
{
struct retro_system_av_info *av_info =
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
float fastforward_ratio =
(settings->fastforward_ratio == 0.0f)
float fastforward_ratio =
(settings->fastforward_ratio == 0.0f)
? 1.0f : settings->fastforward_ratio;
frame_limit_last_time = cpu_features_get_time_usec();
frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f
frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f
/ (av_info->timing.fps * fastforward_ratio));
runloop_ctl(RUNLOOP_CTL_UNSET_FRAME_LIMIT, NULL);
@ -1463,7 +1468,7 @@ int runloop_iterate(unsigned *sleep_ms)
input_driver_set_flushing_input();
}
}
if (runloop_frame_time.callback)
{
/* Updates frame timing if frame timing callback is in use by the core.
@ -1499,7 +1504,7 @@ int runloop_iterate(unsigned *sleep_ms)
{
bool fullscreen_toggled = !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);
#ifdef HAVE_MENU
fullscreen_toggled = fullscreen_toggled ||
fullscreen_toggled = fullscreen_toggled ||
menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL);
#endif
@ -1511,17 +1516,20 @@ int runloop_iterate(unsigned *sleep_ms)
command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL);
#ifdef HAVE_MENU
if (runloop_cmd_menu_press(cmd_ptr) ||
if (runloop_cmd_menu_press(cmd_ptr) ||
rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
{
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) &&
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) &&
!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
}
else
{
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_USER);
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
}
}
#endif
@ -1546,6 +1554,7 @@ int runloop_iterate(unsigned *sleep_ms)
if (ret == -1)
goto end;
return ret;
}
#endif
@ -1583,7 +1592,7 @@ int runloop_iterate(unsigned *sleep_ms)
settings->input.analog_dpad_mode[i]);
}
if ((settings->video.frame_delay > 0) &&
if ((settings->video.frame_delay > 0) &&
!input_driver_is_nonblock_state())
retro_sleep(settings->video.frame_delay);
@ -1620,7 +1629,7 @@ end:
#endif
current = cpu_features_get_time_usec();
target = frame_limit_last_time +
target = frame_limit_last_time +
frame_limit_minimum_time;
to_sleep_ms = (target - current) / 1000;