[Scummvm-cvs-logs] SF.net SVN: scummvm:[41687] tools/trunk
strangerke at users.sourceforge.net
strangerke at users.sourceforge.net
Fri Jun 19 23:08:08 CEST 2009
Revision: 41687
http://scummvm.svn.sourceforge.net/scummvm/?rev=41687&view=rev
Author: strangerke
Date: 2009-06-19 21:08:07 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
Add a '-f' flag to force compression for all files
Modified Paths:
--------------
tools/trunk/compress_gob.cpp
tools/trunk/dist/msvc8/compress_gob.vcproj
tools/trunk/dist/msvc9/compress_gob.vcproj
Added Paths:
-----------
tools/trunk/compress_gob.h
Modified: tools/trunk/compress_gob.cpp
===================================================================
--- tools/trunk/compress_gob.cpp 2009-06-19 20:41:32 UTC (rev 41686)
+++ tools/trunk/compress_gob.cpp 2009-06-19 21:08:07 UTC (rev 41687)
@@ -21,8 +21,7 @@
*/
#include "util.h"
-#define confSTK21 "STK21"
-#define confSTK10 "STK10"
+#include "compress_gob.h"
struct Chunk {
char name[64];
@@ -44,23 +43,43 @@
bool filcmp(FILE *src1, Chunk *compChunk);
bool checkDico(byte *unpacked, uint32 unpackedIndex, int32 counter, byte *dico, uint16 currIndex, uint16 &pos, uint8 &length);
-byte *packData(byte *src, uint32 &size);
+uint8 execMode;
int main(int argc, char **argv) {
Chunk *chunks;
FILE *stk;
FILE *gobConf;
uint16 chunkCount;
+ char gobConfName[256];
char stkName[256];
- if ((argc < 2) || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
- printf("Usage: %s <Conf file>\n\n", argv[0]);
- printf("The archive will be created into the current directory.\n");
+ execMode = MODE_NORMAL;
+ if ((argc < 2) || (argc > 4))
+ execMode = MODE_HELP;
+ else
+ for (uint8 i = 1; i < argc; ++i) {
+ printf("%d %s\n", i, argv[i]);
+ if ((!strcmp(argv[i], "-h")) || (!strcmp(argv[i], "--help")))
+ execMode |= MODE_HELP;
+ else if (!strcmp(argv[i], "-f"))
+ execMode |= MODE_FORCE;
+ else if ((strlen(argv[i]) < 255) && !(execMode & MODE_SET)) {
+ strcpy (gobConfName, argv[i]);
+ execMode &= MODE_SET;
+ } else
+ execMode &= MODE_HELP;
+ }
+
+ if (execMode & MODE_HELP) {
+ printf("Usage: %s <Conf file> <-f>\n\n", argv[0]);
+ printf("<Conf file> is a .gob file generated extract_gob_stk\n");
+ printf("<-f> ignores the compression flag in the .gob file and force compression for all files\n\n");
+ printf("The STK/ITK archive will be created in the current directory.\n");
return -1;
}
- if (!(gobConf = fopen(argv[1], "r")))
- error("Couldn't open conf file \"%s\"", argv[1]);
+ if (!(gobConf = fopen(gobConfName, "r")))
+ error("Couldn't open conf file \"%s\"", gobConfName);
chunks = readChunkConf(gobConf, stkName, chunkCount);
fclose(gobConf);
@@ -123,7 +142,7 @@
while (!feof(gobConf)) {
strcpy(curChunk->name, buffer);
fscanf(gobConf, "%s", buffer);
- if (strcmp(buffer, "1") == 0)
+ if ((strcmp(buffer, "1") == 0) || (execMode & MODE_FORCE))
curChunk->packed = true;
else
curChunk->packed = false;
Added: tools/trunk/compress_gob.h
===================================================================
--- tools/trunk/compress_gob.h (rev 0)
+++ tools/trunk/compress_gob.h 2009-06-19 21:08:07 UTC (rev 41687)
@@ -0,0 +1,29 @@
+/* Scumm Tools
+ * Copyright (C) 2007 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#define confSTK21 "STK21"
+#define confSTK10 "STK10"
+
+#define MODE_NORMAL 0
+#define MODE_HELP 1
+#define MODE_FORCE 2
+#define MODE_SET 4
\ No newline at end of file
Property changes on: tools/trunk/compress_gob.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Modified: tools/trunk/dist/msvc8/compress_gob.vcproj
===================================================================
--- tools/trunk/dist/msvc8/compress_gob.vcproj 2009-06-19 20:41:32 UTC (rev 41686)
+++ tools/trunk/dist/msvc8/compress_gob.vcproj 2009-06-19 21:08:07 UTC (rev 41687)
@@ -170,6 +170,10 @@
</References>
<Files>
<File
+ RelativePath="..\..\compress_gob.h"
+ >
+ </File>
+ <File
RelativePath="..\..\compress_gob.cpp"
>
</File>
Modified: tools/trunk/dist/msvc9/compress_gob.vcproj
===================================================================
--- tools/trunk/dist/msvc9/compress_gob.vcproj 2009-06-19 20:41:32 UTC (rev 41686)
+++ tools/trunk/dist/msvc9/compress_gob.vcproj 2009-06-19 21:08:07 UTC (rev 41687)
@@ -171,6 +171,10 @@
</References>
<Files>
<File
+ RelativePath="..\..\compress_gob.h"
+ >
+ </File>
+ <File
RelativePath="..\..\compress_gob.cpp"
>
</File>
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