mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(OSK) move some global state to rarch_state
This commit is contained in:
parent
5fc12c7761
commit
38f9a1b1f0
@ -34,7 +34,6 @@
|
||||
/* TODO/FIXME - static public global variables */
|
||||
static char *osk_grid[45] = {NULL};
|
||||
static int osk_ptr = 0;
|
||||
static enum osk_type osk_idx = OSK_LOWERCASE_LATIN;
|
||||
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
/* This file has a UTF8 BOM, we assume HAVE_LANGEXTRA is only enabled for compilers that can support this. */
|
||||
@ -60,16 +59,6 @@ static const char *lowercase_grid[] = {
|
||||
"z","x","c","v","b","n","m"," ","-",".","Next"};
|
||||
#endif
|
||||
|
||||
void input_event_set_osk_idx(enum osk_type idx)
|
||||
{
|
||||
osk_idx = idx;
|
||||
}
|
||||
|
||||
enum osk_type input_event_get_osk_idx(void)
|
||||
{
|
||||
return osk_idx;
|
||||
}
|
||||
|
||||
int input_event_get_osk_ptr(void)
|
||||
{
|
||||
return osk_ptr;
|
||||
@ -80,7 +69,7 @@ void input_event_set_osk_ptr(int i)
|
||||
osk_ptr = i;
|
||||
}
|
||||
|
||||
void input_event_osk_append(int ptr, bool is_rgui)
|
||||
void input_event_osk_append(enum osk_type *osk_idx, int ptr, bool is_rgui)
|
||||
{
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
if (string_is_equal(osk_grid[ptr],"\xe2\x87\xa6")) /* backspace character */
|
||||
@ -89,9 +78,9 @@ void input_event_osk_append(int ptr, bool is_rgui)
|
||||
input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);
|
||||
else
|
||||
if (string_is_equal(osk_grid[ptr],"\xe2\x87\xa7")) /* up arrow */
|
||||
osk_idx = OSK_UPPERCASE_LATIN;
|
||||
*osk_idx = OSK_UPPERCASE_LATIN;
|
||||
else if (string_is_equal(osk_grid[ptr],"\xe2\x87\xa9")) /* down arrow */
|
||||
osk_idx = OSK_LOWERCASE_LATIN;
|
||||
*osk_idx = OSK_LOWERCASE_LATIN;
|
||||
else if (string_is_equal(osk_grid[ptr],"\xe2\x8a\x95")) /* plus sign (next button) */
|
||||
#else
|
||||
if (string_is_equal(osk_grid[ptr], "Bksp"))
|
||||
@ -100,20 +89,20 @@ void input_event_osk_append(int ptr, bool is_rgui)
|
||||
input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);
|
||||
else
|
||||
if (string_is_equal(osk_grid[ptr], "Upper"))
|
||||
osk_idx = OSK_UPPERCASE_LATIN;
|
||||
*osk_idx = OSK_UPPERCASE_LATIN;
|
||||
else if (string_is_equal(osk_grid[ptr], "Lower"))
|
||||
osk_idx = OSK_LOWERCASE_LATIN;
|
||||
*osk_idx = OSK_LOWERCASE_LATIN;
|
||||
else if (string_is_equal(osk_grid[ptr], "Next"))
|
||||
#endif
|
||||
if (osk_idx < (is_rgui ? OSK_SYMBOLS_PAGE1 : OSK_TYPE_LAST - 1))
|
||||
osk_idx = (enum osk_type)(osk_idx + 1);
|
||||
if (*osk_idx < (is_rgui ? OSK_SYMBOLS_PAGE1 : OSK_TYPE_LAST - 1))
|
||||
*osk_idx = (enum osk_type)(*osk_idx + 1);
|
||||
else
|
||||
osk_idx = ((enum osk_type)(OSK_TYPE_UNKNOWN + 1));
|
||||
*osk_idx = ((enum osk_type)(OSK_TYPE_UNKNOWN + 1));
|
||||
else
|
||||
input_keyboard_line_append(osk_grid[ptr]);
|
||||
}
|
||||
|
||||
void input_event_osk_iterate(void)
|
||||
void input_event_osk_iterate(enum osk_type osk_idx)
|
||||
{
|
||||
switch (osk_idx)
|
||||
{
|
||||
|
@ -47,17 +47,13 @@ enum osk_type
|
||||
OSK_TYPE_LAST
|
||||
};
|
||||
|
||||
enum osk_type input_event_get_osk_idx(void);
|
||||
|
||||
void input_event_set_osk_idx(enum osk_type idx);
|
||||
|
||||
int input_event_get_osk_ptr(void);
|
||||
|
||||
void input_event_set_osk_ptr(int a);
|
||||
|
||||
void input_event_osk_append(int a, bool is_rgui);
|
||||
void input_event_osk_append(enum osk_type *osk_idx, int ptr, bool is_rgui);
|
||||
|
||||
void input_event_osk_iterate(void);
|
||||
void input_event_osk_iterate(enum osk_type osk_idx);
|
||||
|
||||
char **input_event_get_osk_grid(void);
|
||||
|
||||
|
28
retroarch.c
28
retroarch.c
@ -1808,6 +1808,7 @@ typedef struct discord_state discord_state_t;
|
||||
|
||||
struct rarch_state
|
||||
{
|
||||
enum osk_type osk_idx;
|
||||
enum rarch_core_type current_core_type;
|
||||
enum rarch_core_type explicit_current_core_type;
|
||||
enum rotation initial_screen_orientation;
|
||||
@ -22959,7 +22960,7 @@ static unsigned menu_event(
|
||||
|
||||
if (display_kb)
|
||||
{
|
||||
input_event_osk_iterate();
|
||||
input_event_osk_iterate(p_rarch->osk_idx);
|
||||
|
||||
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
{
|
||||
@ -22992,33 +22993,32 @@ static unsigned menu_event(
|
||||
|
||||
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L))
|
||||
{
|
||||
enum osk_type osk_type_idx = input_event_get_osk_idx();
|
||||
if (osk_type_idx > OSK_TYPE_UNKNOWN + 1)
|
||||
input_event_set_osk_idx((enum osk_type)(
|
||||
osk_type_idx - 1));
|
||||
if (p_rarch->osk_idx > OSK_TYPE_UNKNOWN + 1)
|
||||
p_rarch->osk_idx = ((enum osk_type)
|
||||
(p_rarch->osk_idx - 1));
|
||||
else
|
||||
input_event_set_osk_idx((enum osk_type)(menu_has_fb
|
||||
p_rarch->osk_idx = ((enum osk_type)(menu_has_fb
|
||||
? OSK_SYMBOLS_PAGE1
|
||||
: OSK_TYPE_LAST - 1));
|
||||
}
|
||||
|
||||
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R))
|
||||
{
|
||||
enum osk_type osk_type_idx = input_event_get_osk_idx();
|
||||
if (osk_type_idx < (menu_has_fb
|
||||
if (p_rarch->osk_idx < (menu_has_fb
|
||||
? OSK_SYMBOLS_PAGE1
|
||||
: OSK_TYPE_LAST - 1))
|
||||
input_event_set_osk_idx((enum osk_type)(
|
||||
osk_type_idx + 1));
|
||||
p_rarch->osk_idx = ((enum osk_type)(
|
||||
p_rarch->osk_idx + 1));
|
||||
else
|
||||
input_event_set_osk_idx((enum osk_type)(OSK_TYPE_UNKNOWN + 1));
|
||||
p_rarch->osk_idx = ((enum osk_type)(OSK_TYPE_UNKNOWN + 1));
|
||||
}
|
||||
|
||||
if (BIT256_GET_PTR(p_trigger_input, menu_ok_btn))
|
||||
{
|
||||
int ptr = input_event_get_osk_ptr();
|
||||
if (ptr >= 0)
|
||||
input_event_osk_append(ptr, menu_has_fb);
|
||||
input_event_osk_append(&p_rarch->osk_idx,
|
||||
ptr, menu_has_fb);
|
||||
}
|
||||
|
||||
if (BIT256_GET_PTR(p_trigger_input, menu_cancel_btn))
|
||||
@ -23680,7 +23680,8 @@ static int menu_input_pointer_post_iterate(
|
||||
menu->driver_ctx->set_texture);
|
||||
|
||||
input_event_set_osk_ptr(point.retcode);
|
||||
input_event_osk_append(point.retcode,
|
||||
input_event_osk_append(&p_rarch->osk_idx,
|
||||
point.retcode,
|
||||
menu_has_fb);
|
||||
}
|
||||
}
|
||||
@ -34442,6 +34443,7 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
global_t *global = &p_rarch->g_extern;
|
||||
|
||||
p_rarch->osk_idx = OSK_LOWERCASE_LATIN;
|
||||
p_rarch->video_driver_active = true;
|
||||
p_rarch->audio_driver_active = true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user