From b54a1227d9bb53135e434ba9e00ce6cba592f6b1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 3 Aug 2008 17:05:01 +0000 Subject: OSYSTEM: Pushed some SDL/Symbian specific code to the respective backends; made openConfigFileForReading/openConfigFileForWriting return 0 if they failed to open a file svn-id: r33585 --- backends/platform/symbian/src/SymbianOS.cpp | 33 +++++++++++++++++++++++++++++ backends/platform/symbian/src/SymbianOS.h | 3 +++ 2 files changed, 36 insertions(+) (limited to 'backends/platform/symbian') diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index e3a4027d79..0ce44d1704 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -30,6 +30,7 @@ #include "backends/platform/symbian/src/SymbianActions.h" #include "common/config-manager.h" #include "common/events.h" +#include "common/file.h" #include "gui/Actions.h" #include "gui/Key.h" #include "gui/message.h" @@ -42,6 +43,10 @@ #define SAMPLES_PER_SEC 16000 #endif + +#define DEFAULT_CONFIG_FILE "scummvm.ini" + + #define KInputBufferLength 128 // Symbian libc file functionality in order to provide shared file handles struct TSymbianFileEntry { @@ -122,6 +127,34 @@ FilesystemFactory *OSystem_SDL_Symbian::getFilesystemFactory() { return &SymbianFilesystemFactory::instance(); } +static Common::String getDefaultConfigFileName() { + char configFile[MAXPATHLEN]; + strcpy(configFile, Symbian::GetExecutablePath()); + strcat(configFile, DEFAULT_CONFIG_FILE); + return configFile; +} + +Common::SeekableReadStream *OSystem_SDL_Symbian::openConfigFileForReading() { + Common::File *confFile = new Common::File(); + assert(confFile); + if (!confFile->open(getDefaultConfigFileName())) { + delete confFile; + confFile = 0; + } + return confFile; +} + +Common::WriteStream *OSystem_SDL_Symbian::openConfigFileForWriting() { + Common::DumpFile *confFile = new Common::DumpFile(); + assert(confFile); + if (!confFile->open(getDefaultConfigFileName())) { + delete confFile; + confFile = 0; + } + return confFile; +} + + OSystem_SDL_Symbian::zoneDesc OSystem_SDL_Symbian::_zones[TOTAL_ZONES] = { { 0, 0, 320, 145 }, { 0, 145, 150, 55 }, diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h index 71d24f6286..68a6fb492f 100644 --- a/backends/platform/symbian/src/SymbianOS.h +++ b/backends/platform/symbian/src/SymbianOS.h @@ -71,6 +71,9 @@ protected: static void symbianMixCallback(void *s, byte *samples, int len); virtual FilesystemFactory *getFilesystemFactory(); + + virtual Common::SeekableReadStream *openConfigFileForReading(); + virtual Common::WriteStream *openConfigFileForWriting(); public: // vibration support #ifdef USE_VIBRA_SE_PXXX -- cgit v1.2.3