2016-09-16 14:39:30 +00:00
|
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2016-10-27 16:17:43 +00:00
|
|
|
|
* Copyright (C) 2014-2016 - Jean-André Santoni
|
2016-09-16 14:39:30 +00:00
|
|
|
|
*
|
|
|
|
|
* 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 <stdint.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "../config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "widgets/menu_entry.h"
|
|
|
|
|
#include "widgets/menu_input_dialog.h"
|
|
|
|
|
|
|
|
|
|
#include "menu_event.h"
|
|
|
|
|
|
|
|
|
|
#include "menu_driver.h"
|
|
|
|
|
#include "menu_input.h"
|
|
|
|
|
#include "menu_animation.h"
|
|
|
|
|
#include "menu_display.h"
|
|
|
|
|
#include "menu_navigation.h"
|
|
|
|
|
|
2016-10-27 04:13:39 +00:00
|
|
|
|
#include "widgets/menu_dialog.h"
|
|
|
|
|
|
2016-09-16 14:39:30 +00:00
|
|
|
|
#include "../configuration.h"
|
2016-10-29 02:59:56 +00:00
|
|
|
|
#include "../content.h"
|
2016-10-27 04:13:39 +00:00
|
|
|
|
#include "../retroarch.h"
|
|
|
|
|
#include "../runloop.h"
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
2016-10-28 03:48:49 +00:00
|
|
|
|
static unsigned char menu_keyboard_key_state[RETROK_LAST];
|
2016-10-26 22:14:01 +00:00
|
|
|
|
|
2016-10-29 23:51:02 +00:00
|
|
|
|
enum osk_type
|
|
|
|
|
{
|
|
|
|
|
OSK_TYPE_UNKNOWN = 0U,
|
|
|
|
|
OSK_UPPERCASE_LATIN,
|
|
|
|
|
OSK_LOWERCASE_LATIN,
|
|
|
|
|
OSK_HIRAGANA_PAGE1,
|
|
|
|
|
OSK_HIRAGANA_PAGE2,
|
|
|
|
|
OSK_KATAKANA_PAGE1,
|
|
|
|
|
OSK_KATAKANA_PAGE2,
|
|
|
|
|
OSK_TYPE_LAST
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static enum osk_type osk_idx = OSK_UPPERCASE_LATIN;
|
|
|
|
|
static unsigned osk_ptr;
|
|
|
|
|
static const char *osk_grid[41];
|
|
|
|
|
|
|
|
|
|
static const char *uppercase_grid[] = {
|
|
|
|
|
"!","@","#","$","%","^","&","*","(",")",
|
|
|
|
|
"Q","W","E","R","T","Y","U","I","O","P",
|
|
|
|
|
"A","S","D","F","G","H","J","K","L",":",
|
|
|
|
|
"Z","X","C","V","B","N","M"," ","<",">"};
|
|
|
|
|
|
|
|
|
|
static const char *lowercase_grid[] = {
|
|
|
|
|
"1","2","3","4","5","6","7","8","9","0",
|
|
|
|
|
"q","w","e","r","t","y","u","i","o","p",
|
|
|
|
|
"a","s","d","f","g","h","j","k","l",";",
|
|
|
|
|
"z","x","c","v","b","n","m"," ",",","."};
|
|
|
|
|
|
|
|
|
|
static const char *hiragana_page1_grid[] = {
|
|
|
|
|
"あ","い","う","え","お","ら","り","る","れ","ろ",
|
|
|
|
|
"か","き","く","け","こ","が","ぎ","ぐ","げ","ご",
|
|
|
|
|
"さ","し","す","せ","そ","ざ","じ","ず","ぜ","ぞ",
|
|
|
|
|
"た","ち","つ","て","と","だ","ぢ","づ","で","ど"};
|
|
|
|
|
|
|
|
|
|
static const char *hiragana_page2_grid[] = {
|
|
|
|
|
"な","に","ぬ","ね","の","ば","び","ぶ","べ","ぼ",
|
|
|
|
|
"は","ひ","ふ","へ","ほ","ぱ","ぴ","ぷ","ぺ","ぽ",
|
|
|
|
|
"ま","み","む","め","も","ん","っ","ゃ","ゅ","ょ",
|
|
|
|
|
"や","ゆ","よ","わ","を","ぁ","ぃ","ぅ","ぇ","ぉ"};
|
|
|
|
|
|
|
|
|
|
static const char *katakana_page1_grid[] = {
|
|
|
|
|
"ア","イ","ウ","エ","オ","ラ","リ","ル","レ","ロ",
|
|
|
|
|
"カ","キ","ク","ケ","コ","ガ","ギ","グ","ゲ","ゴ",
|
|
|
|
|
"サ","シ","ス","セ","ソ","ザ","ジ","ズ","ゼ","ゾ",
|
|
|
|
|
"タ","チ","ツ","テ","ト","ダ","ヂ","ヅ","デ","ド"};
|
|
|
|
|
|
|
|
|
|
static const char *katakana_page2_grid[] = {
|
|
|
|
|
"ナ","ニ","ヌ","ネ","ノ","バ","ビ","ブ","ベ","ボ",
|
|
|
|
|
"ハ","ヒ","フ","ヘ","ホ","パ","ピ","プ","ペ","ポ",
|
|
|
|
|
"マ","ミ","ム","メ","モ","ン","ッ","ャ","ュ","ョ",
|
|
|
|
|
"ヤ","ユ","ヨ","ワ","ヲ","ァ","ィ","ゥ","ェ","ォ"};
|
|
|
|
|
|
|
|
|
|
unsigned menu_event_get_osk_ptr()
|
|
|
|
|
{
|
|
|
|
|
return osk_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char** menu_event_get_osk_grid()
|
|
|
|
|
{
|
|
|
|
|
return osk_grid;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 14:39:30 +00:00
|
|
|
|
static int menu_event_pointer(unsigned *action)
|
|
|
|
|
{
|
|
|
|
|
const struct retro_keybind *binds[MAX_USERS] = {NULL};
|
|
|
|
|
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 =
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ?
|
|
|
|
|
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
|
|
|
|
|
int pointer_x =
|
2016-10-23 02:38:08 +00:00
|
|
|
|
current_input->input_state(current_input_data, binds,
|
|
|
|
|
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X);
|
2016-09-16 14:39:30 +00:00
|
|
|
|
int pointer_y =
|
2016-10-23 02:38:08 +00:00
|
|
|
|
current_input->input_state(current_input_data, binds,
|
|
|
|
|
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y);
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
2016-10-23 02:38:08 +00:00
|
|
|
|
menu_input->pointer.pressed[0] = current_input->input_state(current_input_data, binds,
|
|
|
|
|
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
|
|
|
|
|
menu_input->pointer.pressed[1] = current_input->input_state(current_input_data, binds,
|
|
|
|
|
0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_PRESSED);
|
|
|
|
|
menu_input->pointer.back = current_input->input_state(current_input_data, binds,
|
|
|
|
|
0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK);
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
|
|
|
|
menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF;
|
|
|
|
|
menu_input->pointer.y = ((pointer_y + 0x7fff) * (int)fb_height) / 0xFFFF;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-28 03:48:49 +00:00
|
|
|
|
unsigned char menu_event_keyboard_is_set(enum retro_key key)
|
2016-10-26 22:14:01 +00:00
|
|
|
|
{
|
|
|
|
|
return menu_keyboard_key_state[key];
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-28 03:43:07 +00:00
|
|
|
|
void menu_event_keyboard_set(bool down, enum retro_key key)
|
2016-10-26 22:14:01 +00:00
|
|
|
|
{
|
2016-10-28 03:43:07 +00:00
|
|
|
|
if (key == RETROK_UNKNOWN)
|
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < RETROK_LAST; i++)
|
2016-10-28 03:48:49 +00:00
|
|
|
|
menu_keyboard_key_state[i] = (menu_keyboard_key_state[i] & 1) << 1;
|
2016-10-28 03:43:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
menu_keyboard_key_state[key] = ((menu_keyboard_key_state[key] & 1) << 1) | down;
|
2016-10-26 22:14:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
|
|
|
|
menu_animation_ctx_delta_t delta;
|
|
|
|
|
float delta_time;
|
2016-09-16 14:54:04 +00:00
|
|
|
|
/* Used for key repeat */
|
|
|
|
|
static float delay_timer = 0.0f;
|
|
|
|
|
static float delay_count = 0.0f;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
unsigned ret = MENU_ACTION_NOOP;
|
|
|
|
|
static bool initial_held = true;
|
|
|
|
|
static bool first_held = false;
|
|
|
|
|
bool set_scroll = false;
|
|
|
|
|
bool mouse_enabled = false;
|
|
|
|
|
size_t new_scroll_accel = 0;
|
2016-09-16 14:54:04 +00:00
|
|
|
|
menu_input_t *menu_input = NULL;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (input)
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
|
|
|
|
if (!first_held)
|
|
|
|
|
{
|
|
|
|
|
/* don't run anything first frame, only capture held inputs
|
|
|
|
|
* for old_input_state. */
|
|
|
|
|
|
2016-09-16 14:54:04 +00:00
|
|
|
|
first_held = true;
|
|
|
|
|
delay_timer = initial_held ? 12 : 6;
|
|
|
|
|
delay_count = 0;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 14:54:04 +00:00
|
|
|
|
if (delay_count >= delay_timer)
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
2016-10-22 15:03:20 +00:00
|
|
|
|
uint64_t input_repeat = 0;
|
|
|
|
|
BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_UP);
|
|
|
|
|
BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_DOWN);
|
|
|
|
|
BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_LEFT);
|
|
|
|
|
BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_RIGHT);
|
|
|
|
|
BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_L);
|
|
|
|
|
BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_R);
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
|
|
|
|
set_scroll = true;
|
|
|
|
|
first_held = false;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
trigger_input |= input & input_repeat;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL,
|
|
|
|
|
&new_scroll_accel);
|
|
|
|
|
|
|
|
|
|
new_scroll_accel = MIN(new_scroll_accel + 1, 64);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initial_held = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
set_scroll = true;
|
|
|
|
|
first_held = false;
|
|
|
|
|
initial_held = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (set_scroll)
|
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
|
|
|
|
&new_scroll_accel);
|
|
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
|
|
|
|
|
|
|
|
|
delta.current = delta_time;
|
|
|
|
|
|
|
|
|
|
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
|
2016-09-16 14:54:04 +00:00
|
|
|
|
delay_count += delta.ideal;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
|
|
|
|
if (menu_input_dialog_get_display_kb())
|
|
|
|
|
{
|
2016-10-29 21:54:06 +00:00
|
|
|
|
switch (osk_idx)
|
2016-10-29 20:43:34 +00:00
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
case OSK_HIRAGANA_PAGE1:
|
|
|
|
|
{
|
|
|
|
|
memcpy(osk_grid, hiragana_page1_grid, sizeof(hiragana_page1_grid));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case OSK_HIRAGANA_PAGE2:
|
|
|
|
|
{
|
|
|
|
|
memcpy(osk_grid, hiragana_page2_grid, sizeof(hiragana_page2_grid));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case OSK_KATAKANA_PAGE1:
|
2016-10-29 21:54:06 +00:00
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
memcpy(osk_grid, katakana_page1_grid, sizeof(katakana_page1_grid));
|
2016-10-29 21:54:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-10-29 23:51:02 +00:00
|
|
|
|
case OSK_KATAKANA_PAGE2:
|
2016-10-29 21:54:06 +00:00
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
memcpy(osk_grid, katakana_page2_grid, sizeof(katakana_page2_grid));
|
2016-10-29 21:54:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-10-29 23:51:02 +00:00
|
|
|
|
case OSK_LOWERCASE_LATIN:
|
2016-10-29 21:54:06 +00:00
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
memcpy(osk_grid, lowercase_grid, sizeof(lowercase_grid));
|
2016-10-29 21:54:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-10-29 23:51:02 +00:00
|
|
|
|
case OSK_UPPERCASE_LATIN:
|
|
|
|
|
default:
|
2016-10-29 21:54:06 +00:00
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
memcpy(osk_grid, uppercase_grid, sizeof(uppercase_grid));
|
2016-10-29 21:54:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-10-29 20:43:34 +00:00
|
|
|
|
}
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
2016-10-29 21:28:53 +00:00
|
|
|
|
if (osk_ptr < 30)
|
|
|
|
|
osk_ptr = osk_ptr + 10;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
2016-10-29 21:28:53 +00:00
|
|
|
|
if (osk_ptr >= 10)
|
|
|
|
|
osk_ptr = osk_ptr - 10;
|
2016-10-24 18:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
|
|
|
|
{
|
2016-10-29 21:28:53 +00:00
|
|
|
|
if (osk_ptr < 39)
|
|
|
|
|
osk_ptr = osk_ptr + 1;
|
2016-10-24 18:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
|
|
|
|
{
|
2016-10-29 21:28:53 +00:00
|
|
|
|
if (osk_ptr >= 1)
|
|
|
|
|
osk_ptr = osk_ptr - 1;
|
2016-10-24 18:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-29 21:54:06 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L))
|
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
if (osk_idx > OSK_TYPE_UNKNOWN + 1)
|
2016-10-30 01:40:05 +00:00
|
|
|
|
osk_idx = (enum osk_type)(osk_idx - 1);
|
2016-10-29 21:54:06 +00:00
|
|
|
|
else
|
2016-10-30 01:40:05 +00:00
|
|
|
|
osk_idx = (enum osk_type)(OSK_TYPE_LAST - 1);
|
2016-10-29 21:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R))
|
2016-10-24 18:26:22 +00:00
|
|
|
|
{
|
2016-10-29 23:51:02 +00:00
|
|
|
|
if (osk_idx < OSK_TYPE_LAST - 1)
|
2016-10-30 01:40:05 +00:00
|
|
|
|
osk_idx = (enum osk_type)(osk_idx + 1);
|
2016-10-29 21:54:06 +00:00
|
|
|
|
else
|
2016-10-30 01:40:05 +00:00
|
|
|
|
osk_idx = (enum osk_type)(OSK_TYPE_UNKNOWN + 1);
|
2016-09-16 14:39:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
2016-10-29 21:28:53 +00:00
|
|
|
|
input_keyboard_line_append(osk_grid[osk_ptr]);
|
2016-09-16 14:39:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
{
|
|
|
|
|
input_keyboard_event(true, '\x7f', '\x7f', 0, RETRO_DEVICE_KEYBOARD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* send return key to close keyboard input window */
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_START))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
trigger_input = 0;
|
2016-09-16 14:39:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-22 15:03:20 +00:00
|
|
|
|
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_UP;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_DOWN;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_LEFT;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_RIGHT;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_scroll_up_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_SCROLL_UP;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_scroll_down_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_SCROLL_DOWN;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_cancel_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_CANCEL;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_ok_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_OK;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_search_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_SEARCH;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_SCAN;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_default_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_START;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << settings->menu_info_btn))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_INFO;
|
2016-10-22 15:03:20 +00:00
|
|
|
|
else if (trigger_input & (UINT64_C(1) << RARCH_MENU_TOGGLE))
|
2016-09-16 14:39:30 +00:00
|
|
|
|
ret = MENU_ACTION_TOGGLE;
|
|
|
|
|
|
2016-10-28 04:41:53 +00:00
|
|
|
|
if (menu_keyboard_key_state[RETROK_F11])
|
|
|
|
|
{
|
2016-10-27 04:13:39 +00:00
|
|
|
|
command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL);
|
2016-10-28 04:41:53 +00:00
|
|
|
|
menu_keyboard_key_state[RETROK_F11] = false;
|
|
|
|
|
}
|
2016-10-27 04:13:39 +00:00
|
|
|
|
|
|
|
|
|
if (runloop_cmd_press(trigger_input, RARCH_QUIT_KEY))
|
|
|
|
|
{
|
|
|
|
|
int should_we_quit = true;
|
|
|
|
|
|
|
|
|
|
if (!runloop_is_quit_confirm())
|
|
|
|
|
{
|
|
|
|
|
if (settings && settings->confirm_on_exit)
|
|
|
|
|
{
|
2016-10-29 02:11:54 +00:00
|
|
|
|
if (!menu_dialog_is_active() && content_is_inited())
|
2016-10-27 04:13:39 +00:00
|
|
|
|
{
|
|
|
|
|
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_dialog_show_message(MENU_DIALOG_QUIT_CONFIRM, MENU_ENUM_LABEL_CONFIRM_ON_EXIT);
|
|
|
|
|
|
|
|
|
|
should_we_quit = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((settings && !settings->confirm_on_exit) ||
|
|
|
|
|
should_we_quit)
|
|
|
|
|
return MENU_ACTION_QUIT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 14:39:30 +00:00
|
|
|
|
mouse_enabled = settings->menu.mouse.enable;
|
|
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
|
if (!mouse_enabled)
|
|
|
|
|
mouse_enabled = !(settings->input.overlay_enable
|
|
|
|
|
&& input_overlay_is_alive(NULL));
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-09-16 14:54:04 +00:00
|
|
|
|
if (!(menu_input = menu_input_get_ptr()))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2016-09-16 14:39:30 +00:00
|
|
|
|
if (!mouse_enabled)
|
|
|
|
|
menu_input->mouse.ptr = 0;
|
|
|
|
|
|
|
|
|
|
if (settings->menu.pointer.enable)
|
|
|
|
|
menu_event_pointer(&ret);
|
|
|
|
|
else
|
2016-10-21 17:36:46 +00:00
|
|
|
|
{
|
|
|
|
|
menu_input->pointer.x = 0;
|
|
|
|
|
menu_input->pointer.y = 0;
|
|
|
|
|
menu_input->pointer.dx = 0;
|
|
|
|
|
menu_input->pointer.dy = 0;
|
|
|
|
|
menu_input->pointer.accel = 0;
|
|
|
|
|
menu_input->pointer.pressed[0] = false;
|
|
|
|
|
menu_input->pointer.pressed[1] = false;
|
|
|
|
|
menu_input->pointer.back = false;
|
|
|
|
|
menu_input->pointer.ptr = 0;
|
|
|
|
|
}
|
2016-09-16 14:39:30 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|