mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Merge menu_input_dialog.c into retroarch.c
This commit is contained in:
parent
20b1bf9b12
commit
d30b2ecaca
@ -805,7 +805,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
menu/menu_setting.o \
|
||||
menu/widgets/menu_filebrowser.o \
|
||||
menu/widgets/menu_dialog.o \
|
||||
menu/widgets/menu_input_dialog.o \
|
||||
menu/widgets/menu_input_bind_dialog.o \
|
||||
menu/widgets/menu_osk.o \
|
||||
menu/menu_cbs.o \
|
||||
|
@ -44,7 +44,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../../menu/widgets/menu_input_dialog.h"
|
||||
#include "../../menu/menu_cbs.h"
|
||||
#endif
|
||||
|
||||
|
@ -1241,7 +1241,6 @@ MENU
|
||||
|
||||
#include "../menu/widgets/menu_filebrowser.c"
|
||||
#include "../menu/widgets/menu_dialog.c"
|
||||
#include "../menu/widgets/menu_input_dialog.c"
|
||||
#include "../menu/widgets/menu_input_bind_dialog.c"
|
||||
#ifdef HAVE_MENU_WIDGETS
|
||||
#include "../menu/widgets/menu_widgets.c"
|
||||
|
@ -701,6 +701,35 @@ extern hid_driver_t wiiusb_hid;
|
||||
extern hid_driver_t null_hid;
|
||||
#endif
|
||||
|
||||
typedef struct menu_input_ctx_line
|
||||
{
|
||||
const char *label;
|
||||
const char *label_setting;
|
||||
unsigned type;
|
||||
unsigned idx;
|
||||
input_keyboard_line_complete_t cb;
|
||||
} menu_input_ctx_line_t;
|
||||
|
||||
const char *menu_input_dialog_get_label_setting_buffer(void);
|
||||
|
||||
const char *menu_input_dialog_get_label_buffer(void);
|
||||
|
||||
const char *menu_input_dialog_get_buffer(void);
|
||||
|
||||
unsigned menu_input_dialog_get_kb_type(void);
|
||||
|
||||
unsigned menu_input_dialog_get_kb_idx(void);
|
||||
|
||||
bool menu_input_dialog_start_search(void);
|
||||
|
||||
void menu_input_dialog_set_kb(bool val);
|
||||
|
||||
bool menu_input_dialog_get_display_kb(void);
|
||||
|
||||
bool menu_input_dialog_start(menu_input_ctx_line_t *line);
|
||||
|
||||
void menu_input_dialog_end(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../menu/menu_driver.h"
|
||||
#include "../menu/widgets/menu_input_dialog.h"
|
||||
#include "../menu/widgets/menu_input_bind_dialog.h"
|
||||
#endif
|
||||
|
||||
|
@ -49,7 +49,6 @@
|
||||
#endif
|
||||
#include "../widgets/menu_dialog.h"
|
||||
#include "../widgets/menu_filebrowser.h"
|
||||
#include "../widgets/menu_input_dialog.h"
|
||||
#include "../widgets/menu_input_bind_dialog.h"
|
||||
#include "../menu_input.h"
|
||||
#include "../menu_networking.h"
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "../menu_animation.h"
|
||||
#include "../menu_input.h"
|
||||
|
||||
#include "../widgets/menu_input_dialog.h"
|
||||
#include "../widgets/menu_osk.h"
|
||||
|
||||
#include "../../core_info.h"
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "../../playlist.h"
|
||||
#include "../../runtime_file.h"
|
||||
|
||||
#include "../../widgets/menu_input_dialog.h"
|
||||
#include "../../widgets/menu_osk.h"
|
||||
#include "../../widgets/menu_filebrowser.h"
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "../../menu_input.h"
|
||||
#include "../../menu_animation.h"
|
||||
|
||||
#include "../../widgets/menu_input_dialog.h"
|
||||
#include "../../widgets/menu_osk.h"
|
||||
|
||||
static void ozone_cursor_animation_cb(void *userdata);
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_animation.h"
|
||||
|
||||
#include "../widgets/menu_input_dialog.h"
|
||||
#include "../widgets/menu_osk.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "../../core_info.h"
|
||||
#include "../../core.h"
|
||||
|
||||
#include "../widgets/menu_input_dialog.h"
|
||||
#include "../widgets/menu_osk.h"
|
||||
#include "../widgets/menu_filebrowser.h"
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "menu_driver.h"
|
||||
#include "menu_cbs.h"
|
||||
|
||||
#include "widgets/menu_input_dialog.h"
|
||||
|
||||
#include "../core.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../version.h"
|
||||
|
@ -68,7 +68,6 @@
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
||||
#include "menu_shader.h"
|
||||
#endif
|
||||
#include "widgets/menu_input_dialog.h"
|
||||
#include "widgets/menu_input_bind_dialog.h"
|
||||
|
||||
#include "../core.h"
|
||||
|
@ -1,135 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - 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.
|
||||
*
|
||||
* 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 <compat/strl.h>
|
||||
|
||||
#include "menu_input_dialog.h"
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../../input/input_driver.h"
|
||||
|
||||
static const char **menu_input_dialog_keyboard_buffer = {NULL};
|
||||
static unsigned menu_input_dialog_keyboard_type = 0;
|
||||
static unsigned menu_input_dialog_keyboard_idx = 0;
|
||||
static char menu_input_dialog_keyboard_label_setting[256] = {0};
|
||||
static char menu_input_dialog_keyboard_label[256] = {0};
|
||||
|
||||
static void menu_input_search_cb(void *userdata, const char *str)
|
||||
{
|
||||
size_t idx = 0;
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
|
||||
if (!selection_buf)
|
||||
return;
|
||||
|
||||
if (str && *str && file_list_search(selection_buf, str, &idx))
|
||||
{
|
||||
menu_navigation_set_selection(idx);
|
||||
menu_driver_navigation_set(true);
|
||||
}
|
||||
|
||||
menu_input_dialog_end();
|
||||
}
|
||||
|
||||
const char *menu_input_dialog_get_label_buffer(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_label;
|
||||
}
|
||||
|
||||
const char *menu_input_dialog_get_label_setting_buffer(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_label_setting;
|
||||
}
|
||||
|
||||
void menu_input_dialog_end(void)
|
||||
{
|
||||
menu_input_dialog_keyboard_type = 0;
|
||||
menu_input_dialog_keyboard_idx = 0;
|
||||
menu_input_dialog_set_kb(false);
|
||||
menu_input_dialog_keyboard_label[0] = '\0';
|
||||
menu_input_dialog_keyboard_label_setting[0] = '\0';
|
||||
|
||||
/* Avoid triggering tates on pressing return. */
|
||||
input_driver_set_flushing_input();
|
||||
}
|
||||
|
||||
const char *menu_input_dialog_get_buffer(void)
|
||||
{
|
||||
if (!(*menu_input_dialog_keyboard_buffer))
|
||||
return "";
|
||||
return *menu_input_dialog_keyboard_buffer;
|
||||
}
|
||||
|
||||
unsigned menu_input_dialog_get_kb_type(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_type;
|
||||
}
|
||||
|
||||
unsigned menu_input_dialog_get_kb_idx(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_idx;
|
||||
}
|
||||
|
||||
bool menu_input_dialog_start_search(void)
|
||||
{
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(
|
||||
RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input_dialog_set_kb(true);
|
||||
strlcpy(menu_input_dialog_keyboard_label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SEARCH),
|
||||
sizeof(menu_input_dialog_keyboard_label));
|
||||
|
||||
input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_LINE_FREE, NULL);
|
||||
|
||||
menu_input_dialog_keyboard_buffer =
|
||||
input_keyboard_start_line(menu, menu_input_search_cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menu_input_dialog_start(menu_input_ctx_line_t *line)
|
||||
{
|
||||
menu_handle_t *menu = NULL;
|
||||
if (!line)
|
||||
return false;
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input_dialog_set_kb(true);
|
||||
|
||||
/* Only copy over the menu label and setting if they exist. */
|
||||
if (line->label)
|
||||
strlcpy(menu_input_dialog_keyboard_label, line->label,
|
||||
sizeof(menu_input_dialog_keyboard_label));
|
||||
if (line->label_setting)
|
||||
strlcpy(menu_input_dialog_keyboard_label_setting,
|
||||
line->label_setting,
|
||||
sizeof(menu_input_dialog_keyboard_label_setting));
|
||||
|
||||
menu_input_dialog_keyboard_type = line->type;
|
||||
menu_input_dialog_keyboard_idx = line->idx;
|
||||
|
||||
input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_LINE_FREE, NULL);
|
||||
|
||||
menu_input_dialog_keyboard_buffer =
|
||||
input_keyboard_start_line(menu, line->cb);
|
||||
|
||||
return true;
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - 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.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef _MENU_INPUT_DIALOG_H
|
||||
#define _MENU_INPUT_DIALOG_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include "../../input/input_driver.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct menu_input_ctx_line
|
||||
{
|
||||
const char *label;
|
||||
const char *label_setting;
|
||||
unsigned type;
|
||||
unsigned idx;
|
||||
input_keyboard_line_complete_t cb;
|
||||
} menu_input_ctx_line_t;
|
||||
|
||||
const char *menu_input_dialog_get_label_setting_buffer(void);
|
||||
|
||||
const char *menu_input_dialog_get_label_buffer(void);
|
||||
|
||||
const char *menu_input_dialog_get_buffer(void);
|
||||
|
||||
unsigned menu_input_dialog_get_kb_type(void);
|
||||
|
||||
unsigned menu_input_dialog_get_kb_idx(void);
|
||||
|
||||
bool menu_input_dialog_start_search(void);
|
||||
|
||||
void menu_input_dialog_set_kb(bool val);
|
||||
|
||||
bool menu_input_dialog_get_display_kb(void);
|
||||
|
||||
bool menu_input_dialog_start(menu_input_ctx_line_t *line);
|
||||
|
||||
void menu_input_dialog_end(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
@ -37,10 +37,6 @@
|
||||
#include "../../retroarch.h"
|
||||
#include "../../version.h"
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../../menu/widgets/menu_input_dialog.h"
|
||||
#endif
|
||||
|
||||
const uint32_t netplay_magic = 0x52414E50; /* RANP */
|
||||
|
||||
/* TODO/FIXME - replace netplay_log_connection with calls
|
||||
|
124
retroarch.c
124
retroarch.c
@ -122,7 +122,6 @@
|
||||
#include "menu/menu_animation.h"
|
||||
#include "menu/menu_input.h"
|
||||
#include "menu/widgets/menu_dialog.h"
|
||||
#include "menu/widgets/menu_input_dialog.h"
|
||||
#include "menu/widgets/menu_input_bind_dialog.h"
|
||||
#ifdef HAVE_MENU_WIDGETS
|
||||
#include "menu/widgets/menu_widgets.h"
|
||||
@ -927,6 +926,11 @@ enum menu_mouse_action
|
||||
MENU_MOUSE_ACTION_HORIZ_WHEEL_DOWN
|
||||
};
|
||||
|
||||
static const char **menu_input_dialog_keyboard_buffer = {NULL};
|
||||
static unsigned menu_input_dialog_keyboard_type = 0;
|
||||
static unsigned menu_input_dialog_keyboard_idx = 0;
|
||||
static char menu_input_dialog_keyboard_label_setting[256] = {0};
|
||||
static char menu_input_dialog_keyboard_label[256] = {0};
|
||||
static bool menu_input_dialog_keyboard_display = false;
|
||||
static unsigned char menu_keyboard_key_state[RETROK_LAST] = {0};
|
||||
|
||||
@ -946,6 +950,119 @@ extern u32 __nx_applet_type;
|
||||
extern void libnx_apply_overclock(void);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
#define menu_input_dialog_get_display_kb_internal() menu_input_dialog_get_display_kb()
|
||||
#else
|
||||
#define menu_input_dialog_get_display_kb_internal() menu_input_dialog_keyboard_display
|
||||
#endif
|
||||
|
||||
static void menu_input_search_cb(void *userdata, const char *str)
|
||||
{
|
||||
size_t idx = 0;
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
|
||||
if (!selection_buf)
|
||||
return;
|
||||
|
||||
if (str && *str && file_list_search(selection_buf, str, &idx))
|
||||
{
|
||||
menu_navigation_set_selection(idx);
|
||||
menu_driver_navigation_set(true);
|
||||
}
|
||||
|
||||
menu_input_dialog_end();
|
||||
}
|
||||
|
||||
const char *menu_input_dialog_get_label_buffer(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_label;
|
||||
}
|
||||
|
||||
const char *menu_input_dialog_get_label_setting_buffer(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_label_setting;
|
||||
}
|
||||
|
||||
void menu_input_dialog_end(void)
|
||||
{
|
||||
menu_input_dialog_keyboard_type = 0;
|
||||
menu_input_dialog_keyboard_idx = 0;
|
||||
menu_input_dialog_set_kb(false);
|
||||
menu_input_dialog_keyboard_label[0] = '\0';
|
||||
menu_input_dialog_keyboard_label_setting[0] = '\0';
|
||||
|
||||
/* Avoid triggering tates on pressing return. */
|
||||
input_driver_set_flushing_input();
|
||||
}
|
||||
|
||||
const char *menu_input_dialog_get_buffer(void)
|
||||
{
|
||||
if (!(*menu_input_dialog_keyboard_buffer))
|
||||
return "";
|
||||
return *menu_input_dialog_keyboard_buffer;
|
||||
}
|
||||
|
||||
unsigned menu_input_dialog_get_kb_type(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_type;
|
||||
}
|
||||
|
||||
unsigned menu_input_dialog_get_kb_idx(void)
|
||||
{
|
||||
return menu_input_dialog_keyboard_idx;
|
||||
}
|
||||
|
||||
bool menu_input_dialog_start_search(void)
|
||||
{
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(
|
||||
RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input_dialog_set_kb(true);
|
||||
strlcpy(menu_input_dialog_keyboard_label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SEARCH),
|
||||
sizeof(menu_input_dialog_keyboard_label));
|
||||
|
||||
input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_LINE_FREE, NULL);
|
||||
|
||||
menu_input_dialog_keyboard_buffer =
|
||||
input_keyboard_start_line(menu, menu_input_search_cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menu_input_dialog_start(menu_input_ctx_line_t *line)
|
||||
{
|
||||
menu_handle_t *menu = NULL;
|
||||
if (!line)
|
||||
return false;
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input_dialog_set_kb(true);
|
||||
|
||||
/* Only copy over the menu label and setting if they exist. */
|
||||
if (line->label)
|
||||
strlcpy(menu_input_dialog_keyboard_label, line->label,
|
||||
sizeof(menu_input_dialog_keyboard_label));
|
||||
if (line->label_setting)
|
||||
strlcpy(menu_input_dialog_keyboard_label_setting,
|
||||
line->label_setting,
|
||||
sizeof(menu_input_dialog_keyboard_label_setting));
|
||||
|
||||
menu_input_dialog_keyboard_type = line->type;
|
||||
menu_input_dialog_keyboard_idx = line->idx;
|
||||
|
||||
input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_LINE_FREE, NULL);
|
||||
|
||||
menu_input_dialog_keyboard_buffer =
|
||||
input_keyboard_start_line(menu, line->cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menu_input_dialog_get_display_kb(void)
|
||||
{
|
||||
#ifdef HAVE_LIBNX
|
||||
@ -1008,11 +1125,6 @@ bool menu_input_dialog_get_display_kb(void)
|
||||
return menu_input_dialog_keyboard_display;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
#define menu_input_dialog_get_display_kb_internal() menu_input_dialog_get_display_kb()
|
||||
#else
|
||||
#define menu_input_dialog_get_display_kb_internal() menu_input_dialog_keyboard_display
|
||||
#endif
|
||||
|
||||
void menu_input_dialog_set_kb(bool val)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user