Remember to load default config for keys and joypad so no need

to mess ourself setting them if we don't find the group in the
config file.
This commit is contained in:
riccardom 2009-05-12 19:39:23 +00:00
parent 10ebeb093f
commit 5c5be96f52
1 changed files with 5 additions and 9 deletions

View File

@ -59,6 +59,7 @@ GKeyFile *desmume_config_read_file()
g_free(config_file);
load_default_config(gtk_kb_cfg);
desmume_config_read_keys(keyfile);
desmume_config_read_joykeys(keyfile);
@ -113,13 +114,8 @@ gboolean desmume_config_read_keys(GKeyFile *keyfile)
{
GError *error = NULL;
if (!g_key_file_has_group(keyfile, "KEYS")) {
for (int i = 0; i < NB_KEYS; i++) {
keyboard_cfg[i] = gtk_kb_cfg[i];
}
desmume_config_update_keys(keyfile);
return TRUE;
}
if (!g_key_file_has_group(keyfile, "KEYS"))
return TRUE;
for (int i = 0; i < NB_KEYS; i++) {
keyboard_cfg[i] = g_key_file_get_integer(keyfile, "KEYS", key_names[i], &error);
@ -136,8 +132,8 @@ gboolean desmume_config_read_joykeys(GKeyFile *keyfile)
{
GError *error = NULL;
if (!g_key_file_has_group(keyfile, "KEYS"))
return FALSE;
if (!g_key_file_has_group(keyfile, "JOYKEYS"))
return TRUE;
for (int i = 0; i < NB_KEYS; i++) {
joypad_cfg[i] = g_key_file_get_integer(keyfile, "JOYKEYS", key_names[i], &error);