(Menu) Cleanups

This commit is contained in:
twinaphex 2015-06-13 00:09:09 +02:00
parent daf4f5719b
commit b31723236d
6 changed files with 44 additions and 34 deletions

View File

@ -423,8 +423,9 @@ static void glui_frame(void)
if (menu->keyboard.display)
{
char msg[PATH_MAX_LENGTH];
const char *str = *menu->keyboard.buffer;
char msg[PATH_MAX_LENGTH] = {0};
const char *str = *menu->keyboard.buffer;
if (!str)
str = "";
glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75);

View File

@ -327,17 +327,19 @@ static void rgui_blit_cursor(menu_handle_t *menu)
static void rgui_render(void)
{
size_t i, end;
int bottom;
char title[256], title_buf[256], title_msg[64];
char timedate[PATH_MAX_LENGTH];
unsigned x, y;
uint16_t hover_color, normal_color;
menu_handle_t *menu = menu_driver_get_ptr();
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
uint64_t frame_count = video_driver_get_frame_count();
size_t i, end;
int bottom;
char title[256] = {0};
char title_buf[256] = {0};
char title_msg[64] = {0};
char timedate[PATH_MAX_LENGTH] = {0};
menu_handle_t *menu = menu_driver_get_ptr();
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
uint64_t frame_count = video_driver_get_frame_count();
(void)driver;
@ -489,8 +491,9 @@ static void rgui_render(void)
if (menu->keyboard.display)
{
char msg[PATH_MAX_LENGTH];
const char *str = *menu->keyboard.buffer;
char msg[PATH_MAX_LENGTH] = {0};
const char *str = *menu->keyboard.buffer;
if (!str)
str = "";
snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);

View File

@ -158,7 +158,8 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
if (XuiHandleIsValid(m_menutitlebottom))
{
char str[PATH_MAX_LENGTH];
char str[PATH_MAX_LENGTH] = {0};
snprintf(str, sizeof(str), "%s - %s", PACKAGE_VERSION, global->title_buf);
mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
@ -379,9 +380,9 @@ static void xui_render_message(const char *msg)
for (i = 0; i < list->size; i++, j++)
{
char *msg = (char*)list->elems[i].data;
unsigned msglen = strlen(msg);
float msg_width = d3d->resolution_hd_enable ? 160 : 100;
char *msg = (char*)list->elems[i].data;
unsigned msglen = strlen(msg);
float msg_width = d3d->resolution_hd_enable ? 160 : 100;
float msg_height = 120;
float msg_offset = 32;
@ -531,7 +532,7 @@ static void rmenu_xui_set_list_text(int index, const wchar_t* leftText,
static void rmenu_xui_render(void)
{
size_t end, i;
char title[PATH_MAX_LENGTH];
char title[PATH_MAX_LENGTH] = {0};
const char *dir = NULL, *label = NULL;
unsigned menu_type = 0;
menu_handle_t *menu = menu_driver_get_ptr();
@ -568,8 +569,10 @@ static void rmenu_xui_render(void)
end = menu_entries_get_end();
for (i = 0; i < end; i++)
{
char entry_path[PATH_MAX_LENGTH], entry_value[PATH_MAX_LENGTH];
wchar_t msg_left[PATH_MAX_LENGTH], msg_right[PATH_MAX_LENGTH];
char entry_path[PATH_MAX_LENGTH] = {0};
char entry_value[PATH_MAX_LENGTH] = {0};
char msg_right[PATH_MAX_LENGTH] = {0};
wchar_t msg_left[PATH_MAX_LENGTH] = {0};
menu_entry_get_value(i, entry_value, sizeof(entry_value));
menu_entry_get_path(i, entry_path, sizeof(entry_path));
@ -582,8 +585,9 @@ static void rmenu_xui_render(void)
if (menu->keyboard.display)
{
char msg[1024];
char msg[1024] = {0};
const char *str = *menu->keyboard.buffer;
if (!str)
str = "";
snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
@ -629,7 +633,7 @@ static void rmenu_xui_navigation_alphabet(size_t *ptr_out)
static void rmenu_xui_list_insert(file_list_t *list,
const char *path, const char *, size_t list_size)
{
wchar_t buf[PATH_MAX_LENGTH];
wchar_t buf[PATH_MAX_LENGTH] = {0};
XuiListInsertItems(m_menulist, list_size, 1);
mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t));

View File

@ -60,8 +60,8 @@ static void menu_push_to_history_playlist(void)
if (*global->fullpath)
{
char tmp[PATH_MAX_LENGTH];
char str[PATH_MAX_LENGTH];
char tmp[PATH_MAX_LENGTH] = {0};
char str[PATH_MAX_LENGTH] = {0};
fill_pathname_base(tmp, global->fullpath, sizeof(tmp));
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
@ -102,7 +102,8 @@ bool menu_load_content(void)
if (!(main_load_content(0, NULL, NULL, menu_environment_get,
driver->frontend_ctx->process_args)))
{
char name[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
char name[PATH_MAX_LENGTH] = {0};
char msg[PATH_MAX_LENGTH] = {0};
fill_pathname_base(name, global->fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);

View File

@ -54,8 +54,9 @@ int menu_entry_go_back(void)
static rarch_setting_t *menu_entry_get_setting(uint32_t i)
{
const char *path = NULL, *entry_label = NULL;
unsigned type = 0;
unsigned type = 0;
const char *path = NULL;
const char *entry_label = NULL;
const char *dir = NULL;
const char *label = NULL;
menu_list_t *menu_list = menu_list_get_ptr();
@ -73,7 +74,7 @@ static rarch_setting_t *menu_entry_get_setting(uint32_t i)
enum menu_entry_type menu_entry_get_type(uint32_t i)
{
rarch_setting_t *setting;
rarch_setting_t *setting = NULL;
const char *path = NULL, *entry_label = NULL;
unsigned type = 0;
const char *dir = NULL;

View File

@ -509,13 +509,13 @@ static int menu_input_bind_iterate_keyboard(int64_t current, int timeout)
int menu_input_bind_iterate(void)
{
int64_t current;
char msg[PATH_MAX_LENGTH];
struct menu_bind_state binds;
int timeout = 0;
menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
bool bind_mode_kb = global ? global->menu.bind_mode_keyboard : false;
char msg[PATH_MAX_LENGTH] = {0};
int timeout = 0;
menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
bool bind_mode_kb = global ? global->menu.bind_mode_keyboard : false;
if (!menu)
return 1;