parent
be49eb93e1
commit
35527c24c3
|
@ -448,23 +448,6 @@ static bool parse_line(config_file_t *conf,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
string_is_equal(list->value, "true")
|
||||
|| string_is_equal(list->value, "1")
|
||||
)
|
||||
{
|
||||
list->type = CONFIG_FILE_ENTRY_TYPE_BOOL;
|
||||
list->value_bool = true;
|
||||
}
|
||||
else if (
|
||||
string_is_equal(list->value, "false")
|
||||
|| string_is_equal(list->value, "0")
|
||||
)
|
||||
{
|
||||
list->type = CONFIG_FILE_ENTRY_TYPE_BOOL;
|
||||
list->value_bool = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -928,13 +911,21 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in)
|
|||
{
|
||||
const struct config_entry_list *entry = config_get_entry(conf, key, NULL);
|
||||
|
||||
if (entry && entry->type == CONFIG_FILE_ENTRY_TYPE_BOOL)
|
||||
if (entry)
|
||||
{
|
||||
*in = entry->value_bool;
|
||||
return true;
|
||||
if (string_is_equal(entry->value, "true"))
|
||||
*in = true;
|
||||
else if (string_is_equal(entry->value, "1"))
|
||||
*in = true;
|
||||
else if (string_is_equal(entry->value, "false"))
|
||||
*in = false;
|
||||
else if (string_is_equal(entry->value, "0"))
|
||||
*in = false;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return entry != NULL;
|
||||
}
|
||||
|
||||
void config_set_string(config_file_t *conf, const char *key, const char *val)
|
||||
|
|
|
@ -51,13 +51,6 @@ RETRO_BEGIN_DECLS
|
|||
base->var = tmp; \
|
||||
} while(0)
|
||||
|
||||
enum config_file_entry_type
|
||||
{
|
||||
CONFIG_FILE_ENTRY_TYPE_DONTCARE = 0,
|
||||
CONFIG_FILE_ENTRY_TYPE_BOOL
|
||||
};
|
||||
|
||||
|
||||
struct config_file
|
||||
{
|
||||
char *path;
|
||||
|
@ -127,11 +120,10 @@ struct config_entry_list
|
|||
|
||||
char *key;
|
||||
char *value;
|
||||
enum config_file_entry_type type;
|
||||
bool value_bool;
|
||||
struct config_entry_list *next;
|
||||
};
|
||||
|
||||
|
||||
struct config_file_entry
|
||||
{
|
||||
const char *key;
|
||||
|
|
Loading…
Reference in New Issue