(ozone) ozone_draw_osk - use strtok_r instead of string_list
This commit is contained in:
parent
5a863652b6
commit
36e9d4a79d
|
@ -6675,7 +6675,6 @@ static void ozone_draw_osk(
|
||||||
unsigned video_height,
|
unsigned video_height,
|
||||||
const char *label, const char *str)
|
const char *label, const char *str)
|
||||||
{
|
{
|
||||||
unsigned i;
|
|
||||||
char message[2048];
|
char message[2048];
|
||||||
gfx_display_t *p_disp = (gfx_display_t*)disp_userdata;
|
gfx_display_t *p_disp = (gfx_display_t*)disp_userdata;
|
||||||
const char *text = str;
|
const char *text = str;
|
||||||
|
@ -6686,8 +6685,10 @@ static void ozone_draw_osk(
|
||||||
0.00, 0.00, 0.00, 0.15,
|
0.00, 0.00, 0.00, 0.15,
|
||||||
0.00, 0.00, 0.00, 0.15,
|
0.00, 0.00, 0.00, 0.15,
|
||||||
};
|
};
|
||||||
|
char *tok, *save;
|
||||||
|
unsigned i = 0;
|
||||||
static retro_time_t last_time = 0;
|
static retro_time_t last_time = 0;
|
||||||
struct string_list list = {0};
|
unsigned list_size = 0;
|
||||||
float scale_factor = ozone->last_scale_factor;
|
float scale_factor = ozone->last_scale_factor;
|
||||||
unsigned margin = 75 * scale_factor;
|
unsigned margin = 75 * scale_factor;
|
||||||
unsigned padding = 10 * scale_factor;
|
unsigned padding = 10 * scale_factor;
|
||||||
|
@ -6797,12 +6798,12 @@ static void ozone_draw_osk(
|
||||||
ozone->fonts.entries_label.wideglyph_width,
|
ozone->fonts.entries_label.wideglyph_width,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
string_list_initialize(&list);
|
tok = strtok_r(message, "\n", &save);
|
||||||
string_split_noalloc(&list, message, "\n");
|
list_size = string_count_occurrences_single_character(message, '\n');
|
||||||
|
|
||||||
for (i = 0; i < list.size; i++)
|
while (tok)
|
||||||
{
|
{
|
||||||
const char *msg = list.elems[i].data;
|
const char *msg = tok;
|
||||||
|
|
||||||
gfx_display_draw_text(
|
gfx_display_draw_text(
|
||||||
ozone->fonts.entries_label.font,
|
ozone->fonts.entries_label.font,
|
||||||
|
@ -6819,7 +6820,7 @@ static void ozone_draw_osk(
|
||||||
false);
|
false);
|
||||||
|
|
||||||
/* Cursor */
|
/* Cursor */
|
||||||
if (i == list.size - 1)
|
if (i == list_size - 1)
|
||||||
{
|
{
|
||||||
if (ozone->flags & OZONE_FLAG_OSK_CURSOR)
|
if (ozone->flags & OZONE_FLAG_OSK_CURSOR)
|
||||||
{
|
{
|
||||||
|
@ -6850,6 +6851,9 @@ static void ozone_draw_osk(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
y_offset += 25 * scale_factor;
|
y_offset += 25 * scale_factor;
|
||||||
|
|
||||||
|
tok = strtok_r(NULL, "\n", &save);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keyboard */
|
/* Keyboard */
|
||||||
|
@ -6868,8 +6872,6 @@ static void ozone_draw_osk(
|
||||||
input_st->osk_ptr,
|
input_st->osk_ptr,
|
||||||
ozone->theme->text_rgba);
|
ozone->theme->text_rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
string_list_deinitialize(&list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ozone_draw_messagebox(
|
static void ozone_draw_messagebox(
|
||||||
|
|
Loading…
Reference in New Issue