From 6fb0c7a7a53e1eba7a0f5dc5b1ade312a0d76119 Mon Sep 17 00:00:00 2001 From: Toad King Date: Thu, 14 Jun 2012 03:21:06 -0400 Subject: initial pocketsnes commit --- src/config.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/config.c (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000..174ef58 --- /dev/null +++ b/src/config.c @@ -0,0 +1,39 @@ +#include +#include "minIni.h" +#include "menu.h" +#include "port.h" +#include "config.h" + +static char *cfgEntry_lastLoaded = "last_loaded"; +static char *cfgEntry_theme = "theme"; +static char *cfgFile = "config.ini"; +static char *cfgSection_general = "general"; + +void getConfigValue(unsigned int value, char *buffer, int bfsz) { + char fp_cfgFile[_MAX_PATH]; + sprintf(fp_cfgFile, "%s/%s", snesOptionsDir, cfgFile); + + switch(value) { + case CONFIG_LASTLOADED: + ini_gets(cfgSection_general, cfgEntry_lastLoaded, "\0", buffer, bfsz, fp_cfgFile); + break; + case CONFIG_THEME: + ini_gets(cfgSection_general, cfgEntry_theme, "default", buffer, bfsz, fp_cfgFile); + break; + } +} + +void setConfigValue(unsigned int value, char *ll) { + char fp_cfgFile[_MAX_PATH]; + sprintf(fp_cfgFile, "%s/%s", snesOptionsDir, cfgFile); + + switch(value) { + case CONFIG_LASTLOADED: + ini_puts(cfgSection_general, cfgEntry_lastLoaded, ll, fp_cfgFile); + break; + case CONFIG_THEME: + ini_puts(cfgSection_general, cfgEntry_theme, ll, fp_cfgFile); + break; + } +} + -- cgit v1.2.3