Revert "Cleanups"

This reverts commit 3eeae957f6.
This commit is contained in:
twinaphex 2017-09-09 00:17:14 +02:00
parent 3eeae957f6
commit ad579e5cc4
7 changed files with 68 additions and 78 deletions

View File

@ -63,36 +63,36 @@ struct config_bool_setting
struct config_int_setting
{
const char *ident;
bool def_enable;
bool handle;
int *ptr;
bool def_enable;
int def;
bool handle;
};
struct config_uint_setting
{
const char *ident;
bool def_enable;
bool handle;
unsigned *ptr;
bool def_enable;
unsigned def;
bool handle;
};
struct config_float_setting
{
const char *ident;
bool def_enable;
bool handle;
float *ptr;
bool def_enable;
float def;
bool handle;
};
struct config_array_setting
{
const char *ident;
char *ptr;
const char *def;
bool def_enable;
const char *def;
bool handle;
};
@ -100,8 +100,8 @@ struct config_path_setting
{
const char *ident;
char *ptr;
char *def;
bool def_enable;
char *def;
bool handle;
};

View File

@ -172,42 +172,44 @@ typedef struct menu_displaylist_info
bool need_refresh;
bool need_entries_refresh;
bool need_push;
/* should we clear the displaylist before we push
* entries onto it? */
bool need_clear;
bool push_builtin_cores;
/* Should a 'download core' entry be pushed onto the list?
* This will be set to true in case there are no currently
* installed cores. */
bool download_core;
/* does the navigation index need to be cleared to 0 (first entry) ? */
bool need_navigation_clear;
enum msg_hash_enums enum_idx;
file_list_t *list;
file_list_t *menu_list;
char path[PATH_MAX_LENGTH];
char path_b[PATH_MAX_LENGTH];
char path_c[PATH_MAX_LENGTH];
char exts[PATH_MAX_LENGTH];
char label[255];
size_t directory_ptr;
uint32_t label_hash;
char exts[PATH_MAX_LENGTH];
unsigned type;
unsigned type_default;
size_t directory_ptr;
unsigned flags;
enum msg_hash_enums enum_idx;
rarch_setting_t *setting;
file_list_t *list;
file_list_t *menu_list;
} menu_displaylist_info_t;
typedef struct menu_displaylist_ctx_parse_entry
{
void *data;
menu_displaylist_info_t *info;
const char *info_label;
enum msg_hash_enums enum_idx;
enum menu_displaylist_parse_type parse_type;
bool add_empty_entry;
menu_displaylist_info_t *info;
const char *info_label;
void *data;
} menu_displaylist_ctx_parse_entry_t;
typedef struct menu_displaylist_ctx_entry

View File

@ -992,8 +992,7 @@ static int setting_action_start_bind_device(void *data)
return -1;
configuration_set_uint(settings,
settings->uints.input_joypad_map[setting->index_offset],
setting->index_offset);
settings->uints.input_joypad_map[index_offset], setting->index_offset);
return 0;
}

View File

@ -45,13 +45,13 @@ enum menu_entry_type
typedef struct menu_entry
{
enum msg_hash_enums enum_idx;
char path[255];
char label[255];
char sublabel[255];
char rich_label[255];
char value[255];
size_t entry_idx;
enum msg_hash_enums enum_idx;
unsigned idx;
unsigned type;
unsigned spacing;

View File

@ -119,7 +119,7 @@ void filebrowser_parse(void *data, unsigned type_data)
{
for (i = 0; i < list_size; i++)
{
char label[32];
char label[PATH_MAX_LENGTH];
bool is_dir = false;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
enum msg_file_type file_type = FILE_TYPE_NONE;

View File

@ -49,14 +49,16 @@ struct menu_bind_axis_state
struct menu_bind_state
{
bool skip;
struct retro_keybind *target;
/* For keyboard binding. */
rarch_timer_t timer;
unsigned begin;
unsigned last;
unsigned user;
rarch_timer_t timer;
struct retro_keybind *target;
struct menu_bind_state_port state[MAX_USERS];
struct menu_bind_axis_state axis_state[MAX_USERS];
bool skip;
};
static unsigned menu_bind_port = 0;
@ -71,8 +73,7 @@ static bool menu_input_key_bind_custom_bind_keyboard_cb(
menu_input_binds.begin++;
menu_input_binds.target++;
rarch_timer_begin_new_time(&menu_input_binds.timer,
settings->uints.input_bind_timeout);
rarch_timer_begin_new_time(&menu_input_binds.timer, settings->uints.input_bind_timeout);
return (menu_input_binds.begin <= menu_input_binds.last);
}
@ -169,33 +170,33 @@ static void menu_input_key_bind_poll_bind_state_internal(
unsigned port,
bool timed_out)
{
uint8_t b, a, h;
if (!joypad)
return;
unsigned b, a, h;
if (!joypad)
return;
if (joypad->poll)
joypad->poll();
if (joypad->poll)
joypad->poll();
/* poll only the relevant port */
for (b = 0; b < MENU_MAX_BUTTONS; b++)
state->state[port].buttons[b] =
input_joypad_button_raw(joypad, port, b);
/* poll only the relevant port */
for (b = 0; b < MENU_MAX_BUTTONS; b++)
state->state[port].buttons[b] =
input_joypad_button_raw(joypad, port, b);
for (a = 0; a < MENU_MAX_AXES; a++)
state->state[port].axes[a] =
input_joypad_axis_raw(joypad, port, a);
for (a = 0; a < MENU_MAX_AXES; a++)
state->state[port].axes[a] =
input_joypad_axis_raw(joypad, port, a);
for (h = 0; h < MENU_MAX_HATS; h++)
{
if (input_joypad_hat_raw(joypad, port, HAT_UP_MASK, h))
state->state[port].hats[h] |= HAT_UP_MASK;
if (input_joypad_hat_raw(joypad, port, HAT_DOWN_MASK, h))
state->state[port].hats[h] |= HAT_DOWN_MASK;
if (input_joypad_hat_raw(joypad, port, HAT_LEFT_MASK, h))
state->state[port].hats[h] |= HAT_LEFT_MASK;
if (input_joypad_hat_raw(joypad, port, HAT_RIGHT_MASK, h))
state->state[port].hats[h] |= HAT_RIGHT_MASK;
}
for (h = 0; h < MENU_MAX_HATS; h++)
{
if (input_joypad_hat_raw(joypad, port, HAT_UP_MASK, h))
state->state[port].hats[h] |= HAT_UP_MASK;
if (input_joypad_hat_raw(joypad, port, HAT_DOWN_MASK, h))
state->state[port].hats[h] |= HAT_DOWN_MASK;
if (input_joypad_hat_raw(joypad, port, HAT_LEFT_MASK, h))
state->state[port].hats[h] |= HAT_LEFT_MASK;
if (input_joypad_hat_raw(joypad, port, HAT_RIGHT_MASK, h))
state->state[port].hats[h] |= HAT_RIGHT_MASK;
}
}
static void menu_input_key_bind_poll_bind_state(
@ -268,12 +269,10 @@ static bool menu_input_key_bind_poll_find_trigger_pad(
struct menu_bind_state *new_state,
unsigned p)
{
uint8_t a, b, h;
const struct menu_bind_state_port *n =
(const struct menu_bind_state_port*)
unsigned a, b, h;
const struct menu_bind_state_port *n = (const struct menu_bind_state_port*)
&new_state->state[p];
const struct menu_bind_state_port *o =
(const struct menu_bind_state_port*)
const struct menu_bind_state_port *o = (const struct menu_bind_state_port*)
&state->state[p];
for (b = 0; b < MENU_MAX_BUTTONS; b++)
@ -346,9 +345,8 @@ static bool menu_input_key_bind_poll_find_trigger(
struct menu_bind_state *state,
struct menu_bind_state *new_state)
{
uint8_t i;
unsigned max_users = *(input_driver_get_uint(
INPUT_ACTION_MAX_USERS));
unsigned i;
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
if (!state || !new_state)
return false;
@ -393,8 +391,7 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind)
menu_input_binds.begin++;
menu_input_binds.target++;
rarch_timer_begin_new_time(&menu_input_binds.timer,
settings->uints.input_bind_timeout);
rarch_timer_begin_new_time(&menu_input_binds.timer, settings->uints.input_bind_timeout);
timed_out = true;
}
@ -413,8 +410,7 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind)
/* We won't be getting any key events, so just cancel early. */
if (timed_out)
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_CANCEL_WAIT_KEYS, NULL);
input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_CANCEL_WAIT_KEYS, NULL);
return true;
}
@ -436,14 +432,12 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind)
if (binds.begin > binds.last)
{
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_CANCEL_WAIT_KEYS, NULL);
input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_CANCEL_WAIT_KEYS, NULL);
return true;
}
binds.target++;
rarch_timer_begin_new_time(&binds.timer,
settings->uints.input_bind_timeout);
rarch_timer_begin_new_time(&binds.timer, settings->uints.input_bind_timeout);
}
menu_input_binds = binds;

View File

@ -23,10 +23,10 @@
struct menu_list
{
size_t menu_stack_size;
size_t selection_buf_size;
file_list_t **menu_stack;
size_t menu_stack_size;
file_list_t **selection_buf;
size_t selection_buf_size;
};
void menu_list_free_list(file_list_t *list)
@ -79,20 +79,17 @@ void menu_list_free(menu_list_t *menu_list)
menu_list_t *menu_list_new(void)
{
unsigned i;
menu_list_t *list = (menu_list_t*)calloc(1,
sizeof(*list));
menu_list_t *list = (menu_list_t*)calloc(1, sizeof(*list));
if (!list)
return NULL;
list->menu_stack = (file_list_t**)calloc(1,
sizeof(*list->menu_stack));
list->menu_stack = (file_list_t**)calloc(1, sizeof(*list->menu_stack));
if (!list->menu_stack)
goto error;
list->selection_buf = (file_list_t**)calloc(1,
sizeof(*list->selection_buf));
list->selection_buf = (file_list_t**)calloc(1, sizeof(*list->selection_buf));
if (!list->selection_buf)
goto error;
@ -101,12 +98,10 @@ menu_list_t *menu_list_new(void)
list->selection_buf_size = 1;
for (i = 0; i < list->menu_stack_size; i++)
list->menu_stack[i] = (file_list_t*)calloc(1,
sizeof(*list->menu_stack[i]));
list->menu_stack[i] = (file_list_t*)calloc(1, sizeof(*list->menu_stack[i]));
for (i = 0; i < list->selection_buf_size; i++)
list->selection_buf[i] = (file_list_t*)calloc(1,
sizeof(*list->selection_buf[i]));
list->selection_buf[i] = (file_list_t*)calloc(1, sizeof(*list->selection_buf[i]));
return list;