aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/package
diff options
context:
space:
mode:
authorPaul Gilbert2010-09-20 09:38:53 +0000
committerEugene Sandulenko2010-10-12 23:59:49 +0000
commit3e84d4fe73ac36bcfb36bbe8a26ce99ab71e92db (patch)
tree2c7fe72f16be514e9e7cad0bce288c6a22148dbf /engines/sword25/package
parent80521ed5dd279316d0534fc3cc4b61c27d19ef4e (diff)
downloadscummvm-rg350-3e84d4fe73ac36bcfb36bbe8a26ce99ab71e92db.tar.gz
scummvm-rg350-3e84d4fe73ac36bcfb36bbe8a26ce99ab71e92db.tar.bz2
scummvm-rg350-3e84d4fe73ac36bcfb36bbe8a26ce99ab71e92db.zip
SWORD25: Implemented thumbnail loading for savegame list
svn-id: r53374
Diffstat (limited to 'engines/sword25/package')
-rw-r--r--engines/sword25/package/packagemanager.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/engines/sword25/package/packagemanager.cpp b/engines/sword25/package/packagemanager.cpp
index 1b49eda5a4..4cea4f578d 100644
--- a/engines/sword25/package/packagemanager.cpp
+++ b/engines/sword25/package/packagemanager.cpp
@@ -36,8 +36,11 @@
#include "common/archive.h"
#include "common/config-manager.h"
+#include "common/savefile.h"
#include "common/str-array.h"
+#include "common/system.h"
#include "common/unzip.h"
+#include "sword25/kernel/filesystemutil.h"
#include "sword25/package/packagemanager.h"
namespace Sword25 {
@@ -142,7 +145,29 @@ bool PackageManager::LoadDirectoryAsPackage(const Common::String &directoryName,
}
byte *PackageManager::GetFile(const Common::String &fileName, uint *fileSizePtr) {
+ const Common::String B25S_EXTENSION(".b25s");
Common::SeekableReadStream *in;
+
+ if (fileName.hasSuffix(B25S_EXTENSION)) {
+ // Savegame loading logic
+ Common::SaveFileManager *sfm = g_system->getSavefileManager();
+ Common::InSaveFile *file = sfm->openForLoading(
+ FileSystemUtil::GetInstance().GetPathFilename(fileName));
+ if (!file) {
+ BS_LOG_ERRORLN("Could not load savegame \"%s\".", fileName.c_str());
+ return 0;
+ }
+
+ if (*fileSizePtr)
+ *fileSizePtr = file->size();
+
+ byte *buffer = new byte[file->size()];
+ file->read(buffer, file->size());
+
+ delete file;
+ return buffer;
+ }
+
Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory));
if (!fileNode)
return 0;