Start splitting up accounts options

This commit is contained in:
twinaphex 2015-10-18 22:08:17 +02:00
parent 47f63ad6f4
commit 7f843fe21e
5 changed files with 76 additions and 8 deletions

View File

@ -1317,7 +1317,7 @@ static int cheevos_login( void )
snprintf(
request, sizeof( request ),
"http://retroachievements.org/dorequest.php?r=login&u=%s&p=%s",
config_get_ptr()->cheevos.user_name, config_get_ptr()->cheevos.password
config_get_ptr()->cheevos.username, config_get_ptr()->cheevos.password
);
request[ sizeof( request ) - 1 ] = 0;
@ -1356,7 +1356,7 @@ int cheevos_get_by_game_id( const char** json, unsigned game_id )
snprintf(
request, sizeof( request ),
"http://retroachievements.org/dorequest.php?r=patch&u=%s&g=%u&f=3&l=1&t=%s",
config_get_ptr()->cheevos.user_name, game_id, token
config_get_ptr()->cheevos.username, game_id, token
);
request[ sizeof( request ) - 1 ] = 0;
@ -1384,7 +1384,7 @@ static unsigned cheevos_get_game_id( unsigned char* hash )
snprintf(
request, sizeof( request ),
"http://retroachievements.org/dorequest.php?r=gameid&u=%s&m=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
config_get_ptr()->cheevos.user_name,
config_get_ptr()->cheevos.username,
hash[ 0 ], hash[ 1 ], hash[ 2 ], hash[ 3 ],
hash[ 4 ], hash[ 5 ], hash[ 6 ], hash[ 7 ],
hash[ 8 ], hash[ 9 ], hash[ 10 ], hash[ 11 ],

View File

@ -597,7 +597,7 @@ static void config_set_defaults(void)
#ifdef HAVE_CHEEVOS
settings->cheevos.enable = false;
settings->cheevos.test_unofficial = false;
*settings->cheevos.user_name = '\0';
*settings->cheevos.username = '\0';
*settings->cheevos.password = '\0';
#endif
@ -1467,7 +1467,7 @@ static bool config_load_file(const char *path, bool set_defaults)
#ifdef HAVE_CHEEVOS
CONFIG_GET_BOOL_BASE(conf, settings, cheevos.enable, "cheevos_enable");
CONFIG_GET_BOOL_BASE(conf, settings, cheevos.test_unofficial, "cheevos_test_unofficial");
CONFIG_GET_STRING_BASE(conf, settings, cheevos.user_name, "cheevos_user_name");
CONFIG_GET_STRING_BASE(conf, settings, cheevos.username, "cheevos_user_name");
CONFIG_GET_STRING_BASE(conf, settings, cheevos.password, "cheevos_password");
#endif
@ -2556,7 +2556,7 @@ bool config_save_file(const char *path)
#ifdef HAVE_CHEEVOS
config_set_bool(conf, "cheevos_enable", settings->cheevos.enable);
config_set_bool(conf, "cheevos_test_unofficial", settings->cheevos.test_unofficial);
config_set_string(conf, "cheevos_user_name", settings->cheevos.user_name);
config_set_string(conf, "cheevos_username", settings->cheevos.username);
config_set_string(conf, "cheevos_password", settings->cheevos.password);
#endif

View File

@ -286,7 +286,7 @@ typedef struct settings
{
bool enable;
bool test_unofficial;
char user_name[32];
char username[32];
char password[32];
} cheevos;
#endif

View File

@ -5915,6 +5915,67 @@ static bool setting_append_list_playlist_options(
return true;
}
static bool setting_append_list_accounts_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
const char *parent_group)
{
rarch_setting_group_info_t group_info = {0};
rarch_setting_group_info_t subgroup_info = {0};
settings_t *settings = config_get_ptr();
START_GROUP(group_info,
#if 0
menu_hash_to_str(MENU_LABEL_VALUE_USER_SETTINGS),
#else
"Accounts",
#endif
parent_group);
parent_group = menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info, parent_group);
CONFIG_STRING(
settings->cheevos.username,
#if 0
menu_hash_to_str(MENU_LABEL_CHEEVOS_USERNAME),
menu_hash_to_str(MENU_LABEL_VALUE_CHEEVOS_USERNAME),
#else
"cheevos_username",
"Username",
#endif
"",
group_info.name,
subgroup_info.name,
parent_group,
general_write_handler,
general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
CONFIG_STRING(
settings->cheevos.username,
#if 0
menu_hash_to_str(MENU_LABEL_CHEEVOS_USERNAME),
menu_hash_to_str(MENU_LABEL_VALUE_CHEEVOS_USERNAME),
#else
"cheevos_password",
"Password",
#endif
"",
group_info.name,
subgroup_info.name,
parent_group,
general_write_handler,
general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
return true;
}
static bool setting_append_list_user_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
@ -6809,6 +6870,12 @@ rarch_setting_t *menu_setting_new(unsigned mask)
goto error;
}
if (mask & SL_FLAG_SETTINGS_SUB_ACCOUNTS_OPTIONS)
{
if (!setting_append_list_accounts_options(&list, list_info, root))
goto error;
}
if (mask & SL_FLAG_SETTINGS_DIRECTORY_OPTIONS)
{
if (!setting_append_list_directory_options(&list, list_info, root))

View File

@ -91,7 +91,8 @@ enum setting_list_flags
SL_FLAG_SETTINGS_LOGGING_OPTIONS = (1 << 27),
SL_FLAG_SETTINGS_SAVING_OPTIONS = (1 << 28),
SL_FLAG_SETTINGS_ALL = (1 << 29),
SL_FLAG_ALLOW_EMPTY_LIST = (1 << 30)
SL_FLAG_SETTINGS_SUB_ACCOUNTS_OPTIONS = (1 << 30),
SL_FLAG_ALLOW_EMPTY_LIST = (1 << 31)
};
typedef struct rarch_setting rarch_setting_t;