diff options
author | Chris Apers | 2003-05-01 11:30:36 +0000 |
---|---|---|
committer | Chris Apers | 2003-05-01 11:30:36 +0000 |
commit | ee9ff114ab8e56abbe787e258d26ce8fa3feb172 (patch) | |
tree | 8c7edc4f28afe49477aa337864cd12798fe38731 /backends/PalmOS/Src | |
parent | c77cbc5cb47c1abdac4a4a4b906e21a0861f158b (diff) | |
download | scummvm-rg350-ee9ff114ab8e56abbe787e258d26ce8fa3feb172.tar.gz scummvm-rg350-ee9ff114ab8e56abbe787e258d26ce8fa3feb172.tar.bz2 scummvm-rg350-ee9ff114ab8e56abbe787e258d26ce8fa3feb172.zip |
No more needed
svn-id: r7241
Diffstat (limited to 'backends/PalmOS/Src')
-rw-r--r-- | backends/PalmOS/Src/saveslot.cpp | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/backends/PalmOS/Src/saveslot.cpp b/backends/PalmOS/Src/saveslot.cpp deleted file mode 100644 index 4cad8f2023..0000000000 --- a/backends/PalmOS/Src/saveslot.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* ScummVM - Scumm Interpreter - * Copyright (C) 2001 Ludvig Strigeus - * Copyright (C) 2001-2003 The ScummVM project - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - * - */ - -//#include "extras.h" -#include <string.h> -#include "scummsys.h" -#include "saveload.h" - -#define MAX_BLOCK 64000 - -enum SaveLoadState { - STATE_LOAD, - STATE_SAVE, - STATE_NONE -}; - -class SaveLoadData { - public: - SaveLoadData(); - - SaveLoadState _currentState; - byte * _readWriteData; - uint32 _readWritePos; - bool _needDump; -}; - -SaveLoadData current; - -SaveLoadData::SaveLoadData() -{ - _currentState = STATE_NONE; - _readWritePos = 0; - _needDump = false; -} - -bool SerializerStream::fopen(const char *filename, const char *mode) -{ - if (current._currentState != STATE_NONE) - fclose(); - - context = ::fopen(filename, mode); - if (context != NULL) { - current._currentState = ((strcmp(mode,"rb")==0) ? STATE_LOAD : STATE_SAVE); - return true; - } - - return false; -} - -int SerializerStream::fread(void *buf, int size, int cnt) -{ - return ::fread(buf, size, cnt, (FILE *)context); -} - -int SerializerStream::fwrite(void *buf, int size, int cnt) { - - int fullsize = size*cnt; - - if (current._currentState == STATE_SAVE && fullsize<=MAX_BLOCK) - { - if (!current._readWriteData) - current._readWriteData = (byte *)malloc(MAX_BLOCK); - - if ((current._readWritePos+fullsize)>MAX_BLOCK) { - ::fwrite(current._readWriteData, current._readWritePos, 1, (FILE *)context); - current._readWritePos = 0; - current._needDump = false; - } - - memcpy(current._readWriteData + current._readWritePos, buf, fullsize); - current._readWritePos += fullsize; - current._needDump = true; - - return cnt; - } - - return ::fwrite(buf, size, cnt, (FILE *)context); -} - - -void SerializerStream::fclose() -{ - if (current._needDump && current._readWriteData != NULL) { - if (current._currentState == STATE_SAVE) - ::fwrite(current._readWriteData, current._readWritePos, 1, (FILE *)context); - - free(current._readWriteData); - current._readWriteData = NULL; - } - - current._readWritePos = 0; - current._needDump = false; - current._currentState = STATE_NONE; - ::fclose((FILE *)context); -}
\ No newline at end of file |