[Scummvm-cvs-logs] SF.net SVN: scummvm:[47586] tools/trunk/engines/mohawk
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Wed Jan 27 03:22:45 CET 2010
Revision: 47586
http://scummvm.svn.sourceforge.net/scummvm/?rev=47586&view=rev
Author: tdhs
Date: 2010-01-27 02:22:45 +0000 (Wed, 27 Jan 2010)
Log Message:
-----------
Modified extract_mohawk tool to allow preservation of file table flags during raw dump.
Also, allowed selection of file name output format by option, so that file table indexes can be omitted.
Modified Paths:
--------------
tools/trunk/engines/mohawk/archive.cpp
tools/trunk/engines/mohawk/archive.h
tools/trunk/engines/mohawk/extract_mohawk.cpp
Modified: tools/trunk/engines/mohawk/archive.cpp
===================================================================
--- tools/trunk/engines/mohawk/archive.cpp 2010-01-27 01:47:41 UTC (rev 47585)
+++ tools/trunk/engines/mohawk/archive.cpp 2010-01-27 02:22:45 UTC (rev 47586)
@@ -194,7 +194,7 @@
}
MohawkOutputStream MohawkArchive::getRawData(uint32 tag, uint16 id) {
- MohawkOutputStream output = { 0, 0, 0, 0, "" };
+ MohawkOutputStream output = { 0, 0, 0, 0, 0, "" };
if (!_mhk)
return output;
@@ -226,6 +226,7 @@
output.tag = tag;
output.id = id;
output.index = fileTableIndex;
+ output.flags = _fileTable[fileTableIndex].flags;
if (idIndex < _types[typeIndex].nameTable.num)
output.name = _types[typeIndex].nameTable.entries[idIndex].name;
@@ -233,7 +234,7 @@
}
MohawkOutputStream MohawkArchive::getNextFile() {
- MohawkOutputStream output = { 0, 0, 0, 0, "" };
+ MohawkOutputStream output = { 0, 0, 0, 0, 0, "" };
if (_curExType >= _typeTable.resource_types) // No more!
return output;
@@ -259,6 +260,7 @@
output.tag = _types[_curExType].tag;
output.id = _types[_curExType].resTable.entries[_curExTypeIndex].id;
output.index = fileTableIndex;
+ output.flags = _fileTable[fileTableIndex].flags;
if (_curExTypeIndex < _types[_curExType].nameTable.num)
output.name = _types[_curExType].nameTable.entries[_curExTypeIndex].name;
@@ -354,7 +356,7 @@
}
MohawkOutputStream LivingBooksArchive_v1::getRawData(uint32 tag, uint16 id) {
- MohawkOutputStream output = { 0, 0, 0, 0, "" };
+ MohawkOutputStream output = { 0, 0, 0, 0, 0, "" };
if (!_mhk)
return output;
@@ -378,7 +380,7 @@
}
MohawkOutputStream LivingBooksArchive_v1::getNextFile() {
- MohawkOutputStream output = { 0, 0, 0, 0, "" };
+ MohawkOutputStream output = { 0, 0, 0, 0, 0, "" };
if (_curExType >= _typeTable.resource_types) // No more!
return output;
Modified: tools/trunk/engines/mohawk/archive.h
===================================================================
--- tools/trunk/engines/mohawk/archive.h 2010-01-27 01:47:41 UTC (rev 47585)
+++ tools/trunk/engines/mohawk/archive.h 2010-01-27 02:22:45 UTC (rev 47586)
@@ -126,6 +126,7 @@
uint32 tag;
uint32 id;
uint32 index;
+ byte flags;
Common::String name;
};
Modified: tools/trunk/engines/mohawk/extract_mohawk.cpp
===================================================================
--- tools/trunk/engines/mohawk/extract_mohawk.cpp 2010-01-27 01:47:41 UTC (rev 47585)
+++ tools/trunk/engines/mohawk/extract_mohawk.cpp 2010-01-27 02:22:45 UTC (rev 47586)
@@ -123,10 +123,15 @@
fclose(outputFile);
}
-void outputMohawkStream(MohawkOutputStream output, bool doConversion) {
+void outputMohawkStream(MohawkOutputStream output, bool doConversion, bool fileTableIndex, bool fileTableFlags) {
// File output naming format preserves all archive information...
char *strBuf = (char *)malloc(256);
- sprintf(strBuf, "%04d_%s_%d", output.index, tag2str(output.tag), output.id);
+ strBuf[0] = '\0';
+ if (fileTableIndex)
+ sprintf(strBuf + strlen(strBuf), "%04d_", output.index);
+ if (fileTableFlags)
+ sprintf(strBuf + strlen(strBuf), "%02x_", output.flags);
+ sprintf(strBuf + strlen(strBuf), "%s_%d", tag2str(output.tag), output.id);
if (!output.name.empty())
sprintf(strBuf + strlen(strBuf), "_%s", output.name.c_str());
output.name = strBuf;
@@ -159,12 +164,22 @@
void printUsage(const char *appName) {
printf("Usage: %s [options] <mohawk archive> [tag id]\n", appName);
- printf("Options : --raw Dump Resources as raw binary dump (default)\n");
- printf(" --convert Dump Resources as converted files\n");
+ printf("\n");
+ printf("Options : --raw Dump Resources as raw binary dump (default)\n");
+ printf(" --convert Dump Resources as converted files\n");
+ printf("\n");
+ printf(" --ftindex Prepend File Table Index to dumped resource names (default)\n");
+ printf(" --no-ftindex Omit File Table Index from dumped resource names\n");
+ printf(" --ftflags Prepend File Table Flags to dumped resource names (default)\n");
+ printf(" --no-ftflags Omit File Table Flags from dumped resource names\n");
}
int main(int argc, char *argv[]) {
+ // Defaults for options
bool doConversion = false;
+ bool fileTableIndex = true;
+ bool fileTableFlags = true;
+
int archiveArg;
// Parse parameters
@@ -179,6 +194,14 @@
doConversion = false;
else if (current.equals("--convert"))
doConversion = true;
+ else if (current.equals("--no-ftindex"))
+ fileTableIndex = false;
+ else if (current.equals("--ftindex"))
+ fileTableIndex = true;
+ else if (current.equals("--no-ftflags"))
+ fileTableFlags = false;
+ else if (current.equals("--no-ftflags"))
+ fileTableFlags = true;
else {
printf("Unknown argument : \"%s\"\n", argv[archiveArg]);
printUsage(argv[0]);
@@ -216,7 +239,7 @@
MohawkOutputStream output = mohawkArchive->getRawData(tag, id);
if (output.stream) {
- outputMohawkStream(output, doConversion);
+ outputMohawkStream(output, doConversion, fileTableIndex, fileTableFlags);
delete output.stream;
} else {
printf ("Could not find specified data!\n");
@@ -224,7 +247,7 @@
} else {
MohawkOutputStream output = mohawkArchive->getNextFile();
while (output.stream) {
- outputMohawkStream(output, doConversion);
+ outputMohawkStream(output, doConversion, fileTableIndex, fileTableFlags);
delete output.stream;
output = mohawkArchive->getNextFile();
}
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