aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/gp2x
diff options
context:
space:
mode:
authorJohn Willis2006-10-09 20:48:30 +0000
committerJohn Willis2006-10-09 20:48:30 +0000
commit043fe970c55ec9063b268593f44973f4f45d6d07 (patch)
treef568f9f6c8ab230611d7f664374029375f12e0d3 /backends/platform/gp2x
parent9aa0984702d4b91bd4839acfc1ae68cfabf5b84f (diff)
downloadscummvm-rg350-043fe970c55ec9063b268593f44973f4f45d6d07.tar.gz
scummvm-rg350-043fe970c55ec9063b268593f44973f4f45d6d07.tar.bz2
scummvm-rg350-043fe970c55ec9063b268593f44973f4f45d6d07.zip
Update GP2X backend with overloads for default config file stuff (including save location).
svn-id: r24258
Diffstat (limited to 'backends/platform/gp2x')
-rw-r--r--backends/platform/gp2x/gp2x.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 7da510ad29..4ecbb928ca 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -34,6 +34,13 @@
#include "common/util.h"
#include "base/main.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <errno.h>
+#include <sys/stat.h>
+
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
@@ -78,6 +85,38 @@ void OSystem_GP2X::initBackend() {
// TODO: Clean way of flushing the file on every write without resorting to this or hacking the POSIX FS code.
//system("/bin/mount -t vfat -o remount,sync,iocharset=utf8 /dev/mmcsd/disc0/part1 /mnt/sd");
+ // Setup default save path to be workingdir/saves
+ #ifndef PATH_MAX
+ #define PATH_MAX 255
+ #endif
+
+ char savePath[PATH_MAX+1];
+ char workDirName[PATH_MAX+1]; /* To be passed to getcwd system call. */
+ if (getcwd(workDirName, PATH_MAX) == NULL) {
+ error("Could not obtain current working directory.");
+ } else {
+ printf("Current working directory: %s\n", workDirName);
+ }
+
+ strcpy(savePath, workDirName);
+ strcat(savePath, "/saves");
+ printf("Current save directory: %s\n", savePath);
+ struct stat sb;
+ if (stat(savePath, &sb) == -1)
+ if (errno == ENOENT) // Create the dir if it does not exist
+ if (mkdir(savePath, 0755) != 0)
+ warning("mkdir for '%s' failed!", savePath);
+
+ ConfMan.registerDefault("savepath", savePath);
+
+ // Setup other defaults.
+
+ ConfMan.registerDefault("aspect_ratio", true);
+ ConfMan.registerDefault("music_volume", 250); // Up default volume as we use a seperate volume system anyway.
+ ConfMan.registerDefault("sfx_volume", 250);
+ ConfMan.registerDefault("speech_volume", 250);
+ ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time.
+
_graphicsMutex = createMutex();
_cksumValid = false;