[Scummvm-cvs-logs] SF.net SVN: scummvm:[34060] scummvm/trunk/engines/scumm
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Wed Aug 20 17:08:01 CEST 2008
Revision: 34060
http://scummvm.svn.sourceforge.net/scummvm/?rev=34060&view=rev
Author: lordhoto
Date: 2008-08-20 15:08:00 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Cleanup of thumbnail saving/loading code.
Modified Paths:
--------------
scummvm/trunk/engines/scumm/module.mk
scummvm/trunk/engines/scumm/saveload.cpp
scummvm/trunk/engines/scumm/scumm.h
Removed Paths:
-------------
scummvm/trunk/engines/scumm/thumbnail.cpp
Modified: scummvm/trunk/engines/scumm/module.mk
===================================================================
--- scummvm/trunk/engines/scumm/module.mk 2008-08-20 15:06:26 UTC (rev 34059)
+++ scummvm/trunk/engines/scumm/module.mk 2008-08-20 15:08:00 UTC (rev 34060)
@@ -53,7 +53,6 @@
scumm.o \
sound.o \
string.o \
- thumbnail.o \
usage_bits.o \
util.o \
vars.o \
Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp 2008-08-20 15:06:26 UTC (rev 34059)
+++ scummvm/trunk/engines/scumm/saveload.cpp 2008-08-20 15:08:00 UTC (rev 34060)
@@ -46,6 +46,8 @@
#include "sound/audiocd.h"
#include "sound/mixer.h"
+#include "graphics/thumbnail.h"
+
namespace Scumm {
struct SaveGameHeader {
@@ -71,6 +73,22 @@
#define INFOSECTION_VERSION 2
+Graphics::Surface *ScummEngine::loadThumbnail(Common::SeekableReadStream *file) {
+ if (!Graphics::checkThumbnailHeader(*file))
+ return 0;
+
+ Graphics::Surface *thumb = new Graphics::Surface();
+ assert(thumb);
+ if (!Graphics::loadThumbnail(*file, *thumb)) {
+ delete thumb;
+ return 0;
+ }
+
+ return thumb;
+}
+
+#pragma mark -
+
void ScummEngine::requestSave(int slot, const char *name, bool temporary) {
_saveLoadSlot = slot;
_saveTemporaryState = temporary;
@@ -114,7 +132,9 @@
memcpy(hdr.name, _saveLoadName, sizeof(hdr.name));
saveSaveGameHeader(out, hdr);
- saveThumbnail(out);
+#if !defined(__DS__)
+ Graphics::saveThumbnail(*out);
+#endif
saveInfos(out);
Serializer ser(0, out, CURRENT_VER);
@@ -184,8 +204,18 @@
}
// Since version 52 a thumbnail is saved directly after the header.
- if (hdr.ver >= VER(52))
- skipThumbnailHeader(in);
+ if (hdr.ver >= VER(52)) {
+ // Prior to version 75 we always required an thumbnail to be present
+ if (hdr.ver <= VER(74)) {
+ if (!Graphics::checkThumbnailHeader(*in)) {
+ warning("Can not load thumbnail");
+ delete in;
+ return false;
+ }
+ } else {
+ Graphics::skipThumbnailHeader(*in);
+ }
+ }
// Since version 56 we save additional information about the creation of
// the save game and the save time.
Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h 2008-08-20 15:06:26 UTC (rev 34059)
+++ scummvm/trunk/engines/scumm/scumm.h 2008-08-20 15:08:00 UTC (rev 34060)
@@ -636,8 +636,6 @@
protected:
Graphics::Surface *loadThumbnail(Common::SeekableReadStream *file);
- void saveThumbnail(Common::WriteStream *file);
- void skipThumbnailHeader(Common::SeekableReadStream *file);
void saveInfos(Common::WriteStream* file);
bool loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff);
Deleted: scummvm/trunk/engines/scumm/thumbnail.cpp
===================================================================
--- scummvm/trunk/engines/scumm/thumbnail.cpp 2008-08-20 15:06:26 UTC (rev 34059)
+++ scummvm/trunk/engines/scumm/thumbnail.cpp 2008-08-20 15:08:00 UTC (rev 34060)
@@ -1,59 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 file 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-
-#include "common/system.h"
-#include "common/savefile.h"
-#include "graphics/scaler.h"
-#include "graphics/thumbnail.h"
-#include "scumm/scumm.h"
-
-namespace Scumm {
-
-Graphics::Surface *ScummEngine::loadThumbnail(Common::SeekableReadStream *file) {
- if (!Graphics::checkThumbnailHeader(*file))
- return 0;
-
- Graphics::Surface *thumb = new Graphics::Surface();
- assert(thumb);
- if (!Graphics::loadThumbnail(*file, *thumb)) {
- delete thumb;
- return 0;
- }
-
- return thumb;
-}
-
-void ScummEngine::saveThumbnail(Common::OutSaveFile *file) {
-#if !defined(__DS__)
- Graphics::saveThumbnail(*file);
-#endif
-}
-
-void ScummEngine::skipThumbnailHeader(Common::SeekableReadStream *file) {
- Graphics::skipThumbnailHeader(*file);
-}
-
-} // end of namespace Scumm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list