summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorToad King2012-06-14 03:21:06 -0400
committerToad King2012-06-14 03:21:06 -0400
commit6fb0c7a7a53e1eba7a0f5dc5b1ade312a0d76119 (patch)
tree885cf7f507139b795ba7b2a6fb829dc044da39dd /src/config.c
downloadsnes9x2002-6fb0c7a7a53e1eba7a0f5dc5b1ade312a0d76119.tar.gz
snes9x2002-6fb0c7a7a53e1eba7a0f5dc5b1ade312a0d76119.tar.bz2
snes9x2002-6fb0c7a7a53e1eba7a0f5dc5b1ade312a0d76119.zip
initial pocketsnes commit
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c39
1 files changed, 39 insertions, 0 deletions
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 <stdio.h>
+#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;
+ }
+}
+