aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2009-06-22 10:15:14 +0000
committerSven Hesse2009-06-22 10:15:14 +0000
commit82568c66b1a5408050dbc2e2b659a0a92aa35ef2 (patch)
tree90cb8454f8715a7d6df1307d2e3d14c4effb0de6
parent28041433a5749c36352f687581f52449efd03123 (diff)
downloadscummvm-rg350-82568c66b1a5408050dbc2e2b659a0a92aa35ef2.tar.gz
scummvm-rg350-82568c66b1a5408050dbc2e2b659a0a92aa35ef2.tar.bz2
scummvm-rg350-82568c66b1a5408050dbc2e2b659a0a92aa35ef2.zip
Implemented loading TOTs from video file again
svn-id: r41756
-rw-r--r--engines/gob/script.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp
index e068ae5ff3..f4dca835b2 100644
--- a/engines/gob/script.cpp
+++ b/engines/gob/script.cpp
@@ -30,6 +30,7 @@
#include "gob/script.h"
#include "gob/dataio.h"
#include "gob/parse.h"
+#include "gob/videoplayer.h"
namespace Gob {
@@ -276,27 +277,39 @@ bool Script::load(const char *fileName) {
delete fileBase;
- if (_vm->_dataIO->existData(_totFile.c_str())) {
- if (lom) {
- if (!loadLOM(_totFile)) {
- unload();
- return false;
- }
- } else {
- if (!loadTOT(_totFile)) {
- unload();
- return false;
- }
+ if (lom) {
+ if (!loadLOM(_totFile)) {
+ unload();
+ return false;
}
- } else
- return false;
+ } else {
+ if (!loadTOT(_totFile)) {
+ unload();
+ return false;
+ }
+ }
return true;
}
bool Script::loadTOT(const Common::String &fileName) {
- _totSize = _vm->_dataIO->getDataSize(_totFile.c_str());
- _totData = _vm->_dataIO->getData(_totFile.c_str());
+ if (_vm->_dataIO->existData(fileName.c_str())) {
+ _totSize = _vm->_dataIO->getDataSize(_totFile.c_str());
+ _totData = _vm->_dataIO->getData(_totFile.c_str());
+ } else {
+ Common::MemoryReadStream *videoExtraData = _vm->_vidPlayer->getExtraData(fileName.c_str());
+
+ if (videoExtraData) {
+ warning("Loading TOT \"%s\" from video file", fileName.c_str());
+
+ _totSize = videoExtraData->size();
+ _totData = new byte[_totSize];
+
+ videoExtraData->read(_totData, _totSize);
+
+ delete videoExtraData;
+ }
+ }
return (_totData != 0);
}
@@ -305,6 +318,8 @@ bool Script::loadLOM(const Common::String &fileName) {
warning("Urban Stub: loadLOM %s", _totFile.c_str());
_lomHandle = _vm->_dataIO->openData(_totFile.c_str());
+ if (_lomHandle < 0)
+ return false;
DataStream *stream = _vm->_dataIO->openAsStream(_lomHandle);