diff options
author | Einar Johan Trøan Sømåen | 2012-07-23 04:40:31 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-23 04:40:31 +0200 |
commit | 88fe4e3106e4eb7f3c179dfdb3b5a2f4fd3c7e2c (patch) | |
tree | 36043aa08b1ee10d46e59c2f9468947ba178a3fa /engines | |
parent | 5bcc47646451c8c1cfe358ff69f5e7f77336fc91 (diff) | |
download | scummvm-rg350-88fe4e3106e4eb7f3c179dfdb3b5a2f4fd3c7e2c.tar.gz scummvm-rg350-88fe4e3106e4eb7f3c179dfdb3b5a2f4fd3c7e2c.tar.bz2 scummvm-rg350-88fe4e3106e4eb7f3c179dfdb3b5a2f4fd3c7e2c.zip |
WINTERMUTE: Handle the "language/" subdirectory separately for choice of language.
Since we don't have the same launcher the games have, we'll have to avoid including ALL
the datafiles, as the localization-dcps are usually intended to work alone. For now, it's hardcoded
to only load english.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/base/base_file_manager.cpp | 28 | ||||
-rw-r--r-- | engines/wintermute/base/base_file_manager.h | 4 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_package.cpp | 7 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_package.h | 2 |
4 files changed, 29 insertions, 12 deletions
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index 5d399c33a1..1ff82d5e18 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -246,7 +246,10 @@ bool BaseFileManager::initPaths() { if (dataSubFolder.exists()) {
addPath(PATH_PACKAGE, dataSubFolder);
}
-
+ Common::FSNode languageSubFolder = gameData.getChild("language");
+ if (languageSubFolder.exists()) {
+ addPath(PATH_PACKAGE, languageSubFolder);
+ }
return STATUS_OK;
}
@@ -254,7 +257,7 @@ bool BaseFileManager::registerPackages(const Common::FSList &fslist) { for (Common::FSList::const_iterator it = fslist.begin(); it != fslist.end(); it++) {
debugC(kWinterMuteDebugFileAccess, "Adding %s", (*it).getName().c_str());
if ((*it).getName().contains(".dcp")) {
- if (registerPackage((*it).createReadStream())) {
+ if (registerPackage((*it))) {
addPath(PATH_PACKAGE, (*it));
}
}
@@ -276,8 +279,16 @@ bool BaseFileManager::registerPackages() { for (Common::FSList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
if (!fileIt->getName().contains(".dcp"))
continue;
+ // Avoid registering all the language files
+ // TODO: Select based on the gameDesc.
+ if (fileIt->getParent().getName() == "language") {
+ Common::String parentName = fileIt->getParent().getName();
+ Common::String dcpName = fileIt->getName();
+ if (fileIt->getName() != "english.dcp")
+ continue;
+ }
warning("Registering %s %s", (*fileIt).getPath().c_str(), (*fileIt).getName().c_str());
- registerPackage((*fileIt).createReadStream());
+ registerPackage((*fileIt));
}
}
@@ -287,7 +298,7 @@ bool BaseFileManager::registerPackages() { }
//////////////////////////////////////////////////////////////////////////
-bool BaseFileManager::registerPackage(const Common::String &filename , bool searchSignature) {
+/*bool BaseFileManager::registerPackage(const Common::String &filename , bool searchSignature) {
Common::File *package = new Common::File();
package->open(filename);
if (!package->isOpen()) {
@@ -295,12 +306,14 @@ bool BaseFileManager::registerPackage(const Common::String &filename , bool sear return STATUS_OK;
}
return registerPackage(package, filename);
-}
+}*/
-bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const Common::String &filename, bool searchSignature) {
+bool BaseFileManager::registerPackage(Common::FSNode file, const Common::String &filename, bool searchSignature) {
uint32 absoluteOffset = 0;
bool boundToExe = false;
-
+ Common::SeekableReadStream * package = file.createReadStream();
+ if (!package)
+ return STATUS_FAILED;
if (searchSignature) {
uint32 offset;
if (!findPackageSignature(package, &offset)) {
@@ -335,6 +348,7 @@ bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const for (uint32 i = 0; i < hdr._numDirs; i++) {
BasePackage *pkg = new BasePackage(this);
+ pkg->_fsnode = file;
if (!pkg) return STATUS_FAILED;
pkg->_boundToExe = boundToExe;
diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 8dfde06f74..f859e39b00 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -75,8 +75,8 @@ private: Common::FSList _packagePaths;
// Common::FSList _singlePaths;
bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset);
- bool registerPackage(Common::SeekableReadStream *stream, const Common::String &filename = "", bool searchSignature = false);
- bool registerPackage(const Common::String &filename, bool searchSignature = false);
+ bool registerPackage(Common::FSNode package, const Common::String &filename = "", bool searchSignature = false);
+// bool registerPackage(const Common::String &filename, bool searchSignature = false);
Common::Array<BasePackage *> _packages;
Common::Array<Common::SeekableReadStream *> _openFiles;
Common::HashMap<Common::String, BaseFileEntry *> _files;
diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index a0f56ddf83..427f2f46f8 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -86,12 +86,13 @@ bool BasePackage::read(Common::SeekableReadStream *file, uint32 offset, byte *bu //////////////////////////////////////////////////////////////////////////
Common::SeekableReadStream *BasePackage::getFilePointer() {
- Common::File *file = _fileManager->openPackage(_name);
+ Common::SeekableReadStream *stream = _fsnode.createReadStream();
+/* Common::File *file = _fileManager->openPackage(_name);
if (!file) {
_fileManager->requestCD(_cd, _name, "");
file = _fileManager->openPackage(_name);
- }
- return file;
+ }*/
+ return stream;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h index af180ac7bf..673655a710 100644 --- a/engines/wintermute/base/file/base_package.h +++ b/engines/wintermute/base/file/base_package.h @@ -30,6 +30,7 @@ #define WINTERMUTE_BPACKAGE_H
#include "common/stream.h"
+#include "common/fs.h"
namespace Common {
class SeekableReadStream;
@@ -43,6 +44,7 @@ public: Common::SeekableReadStream *getFilePointer();
void closeFilePointer(Common::SeekableReadStream *&file);
+ Common::FSNode _fsnode;
bool _boundToExe;
byte _priority;
bool read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size);
|