[Scummvm-cvs-logs] SF.net SVN: scummvm:[34540] scummvm/trunk/engines/scumm
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Sep 14 23:13:40 CEST 2008
Revision: 34540
http://scummvm.svn.sourceforge.net/scummvm/?rev=34540&view=rev
Author: lordhoto
Date: 2008-09-14 21:13:40 +0000 (Sun, 14 Sep 2008)
Log Message:
-----------
Added thumbnail support for launcher to SCUMM engine.
Modified Paths:
--------------
scummvm/trunk/engines/scumm/detection.cpp
scummvm/trunk/engines/scumm/saveload.cpp
scummvm/trunk/engines/scumm/scumm.h
Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp 2008-09-14 21:00:24 UTC (rev 34539)
+++ scummvm/trunk/engines/scumm/detection.cpp 2008-09-14 21:13:40 UTC (rev 34540)
@@ -683,6 +683,7 @@
virtual SaveStateList listSaves(const char *target) const;
virtual void removeSaveState(const char *target, int slot) const;
+ virtual Graphics::Surface *loadThumbnailFromSlot(const char *target, int slot) const;
};
bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -690,7 +691,8 @@
(f == kSupportsRTL) ||
(f == kSupportsListSaves) ||
(f == kSupportsDirectLoad) ||
- (f == kSupportsDeleteSave);
+ (f == kSupportsDeleteSave) ||
+ (f == kSupportsThumbnails);
}
GameList ScummMetaEngine::getSupportedGames() const {
@@ -986,6 +988,10 @@
g_system->getSavefileManager()->removeSavefile(filename.c_str());
}
+Graphics::Surface *ScummMetaEngine::loadThumbnailFromSlot(const char *target, int slot) const {
+ return ScummEngine::loadThumbnailFromSlot(target, slot);
+}
+
#if PLUGIN_ENABLED_DYNAMIC(SCUMM)
REGISTER_PLUGIN_DYNAMIC(SCUMM, PLUGIN_TYPE_ENGINE, ScummMetaEngine);
#else
Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp 2008-09-14 21:00:24 UTC (rev 34539)
+++ scummvm/trunk/engines/scumm/saveload.cpp 2008-09-14 21:13:40 UTC (rev 34540)
@@ -73,20 +73,6 @@
#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) {
@@ -494,7 +480,7 @@
return true;
}
-Graphics::Surface *ScummEngine::loadThumbnailFromSlot(int slot) {
+Graphics::Surface *ScummEngine::loadThumbnailFromSlot(const char *target, int slot) {
char filename[256];
Common::SeekableReadStream *in;
SaveGameHeader hdr;
@@ -502,8 +488,9 @@
if (slot < 0)
return 0;
- makeSavegameName(filename, slot, false);
- if (!(in = _saveFileMan->openForLoading(filename))) {
+ // TODO: Remove code duplication (check: makeSavegameName)
+ snprintf(filename, sizeof(filename), "%s.s%02d", target, slot);
+ if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
return 0;
}
@@ -519,7 +506,15 @@
return 0;
}
- Graphics::Surface *thumb = loadThumbnail(in);
+ Graphics::Surface *thumb = 0;
+ if (Graphics::checkThumbnailHeader(*in)) {
+ thumb = new Graphics::Surface();
+ assert(thumb);
+ if (!Graphics::loadThumbnail(*in, *thumb)) {
+ delete thumb;
+ thumb = 0;
+ }
+ }
delete in;
return thumb;
Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h 2008-09-14 21:00:24 UTC (rev 34539)
+++ scummvm/trunk/engines/scumm/scumm.h 2008-09-14 21:13:40 UTC (rev 34540)
@@ -627,12 +627,14 @@
// thumbnail + info stuff
public:
- Graphics::Surface *loadThumbnailFromSlot(int slot);
+ Graphics::Surface *loadThumbnailFromSlot(int slot) {
+ return loadThumbnailFromSlot(_targetName.c_str(), slot);
+ }
+ static Graphics::Surface *loadThumbnailFromSlot(const char *target, int slot);
+
bool loadInfosFromSlot(int slot, InfoStuff *stuff);
protected:
- Graphics::Surface *loadThumbnail(Common::SeekableReadStream *file);
-
void saveInfos(Common::WriteStream* file);
bool loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff);
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