[Scummvm-cvs-logs] SF.net SVN: scummvm:[52434] tools/trunk/engines/gob/extract_fascination_cd. cpp
strangerke at users.sourceforge.net
strangerke at users.sourceforge.net
Sun Aug 29 09:29:34 CEST 2010
Revision: 52434
http://scummvm.svn.sourceforge.net/scummvm/?rev=52434&view=rev
Author: strangerke
Date: 2010-08-29 07:29:33 +0000 (Sun, 29 Aug 2010)
Log Message:
-----------
TOOLS: Add sanity checks to Fascination extraction tool
Add 2 sanity checks in the CD extraction tool, so that users know
immediately when something went wrong: ISO too small or one STK not
found. A more detailed feedback could be given if ISO is too small
Modified Paths:
--------------
tools/trunk/engines/gob/extract_fascination_cd.cpp
Modified: tools/trunk/engines/gob/extract_fascination_cd.cpp
===================================================================
--- tools/trunk/engines/gob/extract_fascination_cd.cpp 2010-08-29 02:31:18 UTC (rev 52433)
+++ tools/trunk/engines/gob/extract_fascination_cd.cpp 2010-08-29 07:29:33 UTC (rev 52434)
@@ -33,12 +33,13 @@
struct STKFile {
const char *stkFilename;
- const char *firstEntryName;
-} static const stkFile[] = {
- { "intro.stk", "INTRO1.TOT" },
- { "disk1.stk", "DOUCHE.TOT" },
- { "disk2.stk", "PLANQUE.TOT" },
- { "disk3.stk", "MELANGE.TOT" },
+ const char *firstEntryName;
+ bool extracted;
+} static stkFile[] = {
+ { "intro.stk", "INTRO1.TOT", false },
+ { "disk1.stk", "DOUCHE.TOT", false },
+ { "disk2.stk", "PLANQUE.TOT", false },
+ { "disk3.stk", "MELANGE.TOT", false },
};
@@ -65,6 +66,10 @@
error("'%s' is too large to be a Fascination mode1/2048 ISO", _inputPaths[0].path.c_str());
}
+ if (fileSize < (8 * 1024 * 1024)) {
+ error("'%s' is too small to be a Fascination mode1/2048 ISO", _inputPaths[0].path.c_str());
+ }
+
if (fileSize % 2048) {
error("'%s' doesn't appear to be a mode1/2048 ISO", _inputPaths[0].path.c_str());
}
@@ -101,6 +106,7 @@
assert(output.isOpen());
output.write(stkFileStart, stkEntrySize);
output.close();
+ stkFile[i].extracted = true;
curPos += stkEntrySize;
}
@@ -109,6 +115,11 @@
}
}
+ for (int i = 0; i < ARRAYSIZE(stkFile); i++) {
+ if (!stkFile[i].extracted)
+ error("A problem occurred: '%s' has NOT been extracted", stkFile[i].stkFilename);
+ }
+
delete[] data;
}
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