[Scummvm-cvs-logs] SF.net SVN: scummvm:[34664] scummvm/trunk/engines/scumm/detection.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Sep 28 01:27:01 CEST 2008
Revision: 34664
http://scummvm.svn.sourceforge.net/scummvm/?rev=34664&view=rev
Author: fingolfin
Date: 2008-09-27 23:27:01 +0000 (Sat, 27 Sep 2008)
Log Message:
-----------
SCUMM: Use FilesystemNode::openForReading instead of Common::File::open(FilesystemNode) in the detector
Modified Paths:
--------------
scummvm/trunk/engines/scumm/detection.cpp
Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp 2008-09-27 23:00:46 UTC (rev 34663)
+++ scummvm/trunk/engines/scumm/detection.cpp 2008-09-27 23:27:01 UTC (rev 34664)
@@ -25,6 +25,7 @@
#include "base/plugins.h"
+#include "common/archive.h"
#include "common/config-manager.h"
#include "common/fs.h"
#include "common/list.h"
@@ -211,9 +212,11 @@
// ever determine that this is insufficient, we can still
// switch to MD5 based detection).
const char *filename = (id == GID_CMI) ? "LANGUAGE.TAB" : "LANGUAGE.BND";
- Common::File tmp;
+ Common::FilePtr tmp;
Common::FilesystemNode langFile;
- if (!searchFSNode(fslist, filename, langFile) || !tmp.open(langFile)) {
+ if (searchFSNode(fslist, filename, langFile))
+ tmp = Common::FilePtr(langFile.openForReading());
+ if (!tmp) {
// try loading in RESOURCE sub dir...
Common::FilesystemNode resDir;
Common::FSList tmpList;
@@ -221,11 +224,11 @@
&& resDir.isDirectory()
&& resDir.getChildren(tmpList, Common::FilesystemNode::kListFilesOnly)
&& searchFSNode(tmpList, filename, langFile)) {
- tmp.open(langFile);
+ tmp = Common::FilePtr(langFile.openForReading());
}
}
- if (tmp.isOpen()) {
- uint size = tmp.size();
+ if (tmp) {
+ uint size = tmp->size();
if (id == GID_CMI) {
switch (size) {
case 439080: // 2daf3db71d23d99d19fc9a544fcf6431
@@ -450,8 +453,8 @@
// To do this, we take a close look at the detection file and
// try to filter out some cases.
- Common::File tmp;
- if (!tmp.open(d.node)) {
+ Common::FilePtr tmp(d.node.openForReading());
+ if (!tmp) {
warning("SCUMM testGame: failed to open '%s' for read access", d.node.getPath().c_str());
return false;
}
@@ -465,7 +468,7 @@
// Read a few bytes to narrow down the game.
byte buf[6];
- tmp.read(buf, 6);
+ tmp->read(buf, 6);
if (buf[0] == 0xbc && buf[1] == 0xb9) {
// The NES version of MM
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