X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fconfig.c;h=e2a23955e65b71869e0415d1f09a8f84a1d9b689;hb=558d8e1fdd54558c58fe5f661369f76458e1addc;hp=c117fb901fec26991009479ef476bf8a4a6895b7;hpb=8e708f920ffd20b026aed616e58c8c8e94c8fb8d;p=libpicofe.git diff --git a/common/config.c b/common/config.c index c117fb9..e2a2395 100644 --- a/common/config.c +++ b/common/config.c @@ -21,7 +21,7 @@ extern const int cdopt_entry_count; static menu_entry *cfg_opts[] = { opt_entries, opt2_entries, cdopt_entries }; static const int *cfg_opt_counts[] = { &opt_entry_count, &opt2_entry_count, &cdopt_entry_count }; -#define NL "\n" +#define NL "\r\n" static char *mystrip(char *str) @@ -322,6 +322,9 @@ write: keys_write(fn, "bind_joy2", currentConfig.JoyBinds[2], defaultConfig.JoyBinds[2], joyKeyNames, 1); keys_write(fn, "bind_joy3", currentConfig.JoyBinds[3], defaultConfig.JoyBinds[3], joyKeyNames, 1); + if (section == NULL) + fprintf(fn, "Sound Volume = %i" NL, currentConfig.volume); + fprintf(fn, NL); if (fo != NULL) @@ -350,7 +353,7 @@ int config_writelrom(const char *fname) int size; FILE *f; - if (strlen(lastRomFile) == 0) return 0; + if (strlen(lastRomFile) == 0) return -1; f = fopen(fname, "r"); if (f != NULL) @@ -626,6 +629,11 @@ static void parse(const char *var, const char *val) if (strcasecmp(var, "LastUsedROM") == 0) return; /* handled elsewhere */ + if (strcasecmp(var, "Sound Volume") == 0) { + currentConfig.volume = atoi(val); + return; + } + // key binds if (strncasecmp(var, "bind ", 5) == 0) { keys_parse(var + 5, val, currentConfig.KeyBinds, keyNames); @@ -686,7 +694,7 @@ int config_readsect(const char *fname, const char *section) FILE *f; f = fopen(fname, "r"); - if (f == NULL) return 0; + if (f == NULL) return -1; if (section != NULL) {