diff options
Diffstat (limited to 'backends/platform/symbian/src/SymbianOS.cpp')
-rw-r--r-- | backends/platform/symbian/src/SymbianOS.cpp | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 660b0c69ed..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 }, @@ -617,9 +650,13 @@ bool symbian_feof(FILE* handle) { long int symbian_ftell(FILE* handle) { TInt pos = 0; + TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle)); - ((TSymbianFileEntry*)(handle))->iFileHandle.Seek(ESeekCurrent, pos); - + entry->iFileHandle.Seek(ESeekCurrent, pos); + if(entry->iInputPos != KErrNotFound) + { + pos+=(entry->iInputPos - entry->iInputBufferLen); + } return pos; } @@ -627,6 +664,7 @@ int symbian_fseek(FILE* handle, long int offset, int whence) { TSeek seekMode = ESeekStart; TInt pos = offset; + TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle)); switch(whence) { case SEEK_SET: @@ -634,6 +672,9 @@ int symbian_fseek(FILE* handle, long int offset, int whence) { break; case SEEK_CUR: seekMode = ESeekCurrent; + if(entry->iInputPos != KErrNotFound) { + pos+=(entry->iInputPos - entry->iInputBufferLen); + } break; case SEEK_END: seekMode = ESeekEnd; @@ -641,9 +682,9 @@ int symbian_fseek(FILE* handle, long int offset, int whence) { } - ((TSymbianFileEntry*)(handle))->iInputPos = KErrNotFound; + entry->iInputPos = KErrNotFound; - return ((TSymbianFileEntry*)(handle))->iFileHandle.Seek(seekMode, pos); + return entry->iFileHandle.Seek(seekMode, pos); } void symbian_clearerr(FILE* /*handle*/) { |