extractor-gtk-cvslog Mailing List for Obscure-Extractor-GTK
Extract files from unusual archive formats
Brought to you by:
someone-guy
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
(19) |
Oct
(1) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
(19) |
Mar
(6) |
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(31) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <som...@us...> - 2012-08-19 20:35:58
|
Revision: 124 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=124&view=rev Author: someone-guy Date: 2012-08-19 20:35:51 +0000 (Sun, 19 Aug 2012) Log Message: ----------- Add support for "installkit" files. They are used by installers created with InstallJammer. Modified Paths: -------------- trunk/extractor/Makefile trunk/extractor/extractor.c trunk/extractor/formats.h Added Paths: ----------- trunk/extractor/installkit.c Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2011-08-21 10:08:02 UTC (rev 123) +++ trunk/extractor/Makefile 2012-08-19 20:35:51 UTC (rev 124) @@ -18,6 +18,7 @@ dsnpk.c \ generic.c \ homeworld2.c \ + installkit.c \ nwn.c \ pak.c \ solid.c \ Modified: trunk/extractor/extractor.c =================================================================== --- trunk/extractor/extractor.c 2011-08-21 10:08:02 UTC (rev 123) +++ trunk/extractor/extractor.c 2012-08-19 20:35:51 UTC (rev 124) @@ -22,6 +22,7 @@ &dsnpk_fmt, &generic_fmt, &homeworld2_fmt, + &installkit_fmt, &nwn_fmt, &pak_fmt, &solid_fmt, Modified: trunk/extractor/formats.h =================================================================== --- trunk/extractor/formats.h 2011-08-21 10:08:02 UTC (rev 123) +++ trunk/extractor/formats.h 2012-08-19 20:35:51 UTC (rev 124) @@ -30,6 +30,7 @@ extern const fmt_desc_t dsnpk_fmt; extern const fmt_desc_t generic_fmt; extern const fmt_desc_t homeworld2_fmt; +extern const fmt_desc_t installkit_fmt; extern const fmt_desc_t nwn_fmt; extern const fmt_desc_t pak_fmt; extern const fmt_desc_t solid_fmt; Added: trunk/extractor/installkit.c =================================================================== --- trunk/extractor/installkit.c (rev 0) +++ trunk/extractor/installkit.c 2012-08-19 20:35:51 UTC (rev 124) @@ -0,0 +1,113 @@ +/** + * \file installkit.c + * \brief routines for handling the installkit CRAP archive files + * + * Copyright (C) 2012 Reimar Döffinger + * License: GPL v2 (see LICENSE file) + */ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <inttypes.h> +#include "formats.h" +#include "helpers.h" + +//! check if this is a installkit archive file +static int check_file(FILE *in) { + char sig[7] = {0}; + fseek(in, -256, SEEK_END); + fread(sig, 6, 1, in); + return strcmp(sig, "CRAP02") == 0; +} + +static file_t *get_list(FILE *in) { + char header[257] = {0}; + char *end; + file_t *list = NULL; + uint32_t count = 0, tblpos; + fseek(in, -256, SEEK_END); + if (fread(header, 256, 1, in) != 1) + return NULL; + tblpos = strtoull(header + 6, &end, 0); + if (*end) + return NULL; + + fseek(in, tblpos, SEEK_SET); + while (fread(header, 256, 1, in) == 1) { + char *pos = header; + if (count >= MAX_FILES) break; + if (memcmp(header, "FILE", 4)) break; + add_entry_empty(&list, count); + pos += 6; + list[count].name = calloc(strlen(pos) + 11, 1); + strcpy(list[count].name, pos); + pos += 128; + list[count].len = strtoull(pos, &end, 0); + if (*end) continue; + pos += 12; + list[count].clen = strtoull(pos, &end, 0); + if (*end) continue; + pos += 12 + 12 + 2; // mtime, corefile and encryption (RC4) marker + list[count].start = strtoull(pos, &end, 0); + if (*end) continue; + pos += 12; + list[count].compressed = 1; + switch (TAG(0, 0, header[4], header[5])) { + case TAG(0, 0, 'L', 'Z'): + strcat(list[count].name, ".lzma"); + list[count].priv = (void *)(intptr_t)1; + break; + case TAG(0, 0, 'Z', 'L'): + strcat(list[count].name, ".gz"); + list[count].priv = (void *)(intptr_t)2; + break; + case TAG(0, 0, '0', '0'): + list[count].compressed = 0; + break; + default: + // HACK: until we can actually decompress + list[count].len = list[count].clen; + strcat(list[count].name, ".compr"); + break; + } + count++; + } + return list; +} + +static int extract_file(FILE *in, const file_t *file, FILE *out) { + uint64_t l = file->len; + uint8_t sizeb[8] = {l, l >>8, l >> 16, l >> 24, l >> 32, l >> 40, l >> 48, l >> 56}; + int len, len2; + if (!file->priv) return default_extract_file(in, file, out); + fseek(in, file->start, SEEK_SET); + if ((intptr_t)file->priv == 2) { + static const uint8_t gzhdr[] = {0x1f, 0x8b, 8, 0, 0, 0, 0, 0, 2, 0xff}; + static const uint8_t dummy_crc[4]; + if (fwrite(gzhdr, sizeof(gzhdr), 1, out) != 1) return -1; + len = fcopy(in, out, file->clen); + if (len <= 0) return len; + if (fwrite(dummy_crc, sizeof(dummy_crc), 1, out) != 1) return -1; + if (fwrite(sizeb, 4, 1, out) != 1) return -1; + return sizeof(gzhdr) + len + 8; + } + if (file->clen < 5) return -1; + len = fcopy(in, out, 5); + if (len <= 0) return len; + if (fwrite(sizeb, sizeof(sizeb), 1, out) != 1) return -1; + len2 = fcopy(in, out, file->clen - 5); + if (len2 <= 0) return len2; + return len + sizeof(sizeb) + len2; +} + +const fmt_desc_t installkit_fmt = { + "installkit", + "installkit (CRAP)", + "installkit (*.crap;*.bin)", + "*.crap;*.bin", + check_file, + get_list, + default_free_list, + extract_file, + default_extract_mem, +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2011-08-21 10:08:08
|
Revision: 123 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=123&view=rev Author: someone-guy Date: 2011-08-21 10:08:02 +0000 (Sun, 21 Aug 2011) Log Message: ----------- Switch to mingw64 for commented-out alternative compiler. Modified Paths: -------------- trunk/extractor/Makefile Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2011-08-21 10:07:20 UTC (rev 122) +++ trunk/extractor/Makefile 2011-08-21 10:08:02 UTC (rev 123) @@ -8,7 +8,7 @@ #MINGW_GTK_HACK=yes CC=gcc -#CC=i586-mingw32msvc-gcc +#CC=i686-w64-mingw32-gcc # should not need to change anything beyond here CFLAGS=-Wall -Wdeclaration-after-statement -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -g -O2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2011-08-21 10:07:26
|
Revision: 122 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=122&view=rev Author: someone-guy Date: 2011-08-21 10:07:20 +0000 (Sun, 21 Aug 2011) Log Message: ----------- Use int type to avoid compiler warnings. Modified Paths: -------------- trunk/extractor/homeworld2.c Modified: trunk/extractor/homeworld2.c =================================================================== --- trunk/extractor/homeworld2.c 2010-02-18 19:50:36 UTC (rev 121) +++ trunk/extractor/homeworld2.c 2011-08-21 10:07:20 UTC (rev 122) @@ -25,7 +25,7 @@ file_t *list; char **paths; char **pathmap; - uint16_t count, pathcount; + int count, pathcount; uint32_t pathmappos, namepos, tblpos; uint32_t datastart; int i; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2010-02-18 19:50:48
|
Revision: 121 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=121&view=rev Author: someone-guy Date: 2010-02-18 19:50:36 +0000 (Thu, 18 Feb 2010) Log Message: ----------- Add support for detecting and extracting PE executable files. Modified Paths: -------------- trunk/extractor/generic.c Modified: trunk/extractor/generic.c =================================================================== --- trunk/extractor/generic.c 2009-09-03 14:15:13 UTC (rev 120) +++ trunk/extractor/generic.c 2010-02-18 19:50:36 UTC (rev 121) @@ -220,6 +220,43 @@ break; } switch ((uint16_t)t) { + case TAG(0, 0, 'M', 'Z'): { + // PE exe files + int pe_size = 0; + uint8_t *start = p; + int optsize; + uint32_t pe_offset; + p += 0x3c - 2; + pe_offset = get_le32(&p); + if (pe_offset < 0x40 || pe_offset > RAMBUF_SZ / 2) + break; + p += pe_offset - 0x40; + if (get_be32(&p) != TAG('P', 'E', 0, 0)) + break; + p += 0x10; + optsize = get_le16(&p); + p += 2; + if (p - start + optsize >= RAMBUF_SZ / 2) + break; + p += optsize; + while (*p) { + // find end of last section + int sect_end; + if (p - start + 40 >= RAMBUF_SZ / 2) + break; + p += 16; + sect_end = get_le32(&p); // size + sect_end += get_le32(&p); // offset + if (sect_end > pe_size) + pe_size = sect_end; + p += 16; + } while (*p && p - start + 40 < RAMBUF_SZ / 2); + add_entry(&list, cnt, "exe"); + list[cnt].start = fpos - 2; + list[cnt].len = pe_size; + cnt++; + break; + } case TAG(0, 0, 'B', 'M'): { uint32_t len = get_le32(&p); uint16_t res1 = get_le16(&p); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-09-03 14:15:19
|
Revision: 120 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=120&view=rev Author: someone-guy Date: 2009-09-03 14:15:13 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Fix copy-and-paste error in documentation Modified Paths: -------------- trunk/extractor/solid.c Modified: trunk/extractor/solid.c =================================================================== --- trunk/extractor/solid.c 2009-09-03 14:11:18 UTC (rev 119) +++ trunk/extractor/solid.c 2009-09-03 14:15:13 UTC (rev 120) @@ -59,7 +59,7 @@ /** * \brief get string matching the type id - * \param lang type id + * \param type type id * \return pointer to corresponding string constant */ static const char *typestr(int type) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-09-03 14:11:27
|
Revision: 119 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=119&view=rev Author: someone-guy Date: 2009-09-03 14:11:18 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Add or improve code documentation Modified Paths: -------------- trunk/extractor/dsnpk.c trunk/extractor/generic.c trunk/extractor/helpers.c trunk/extractor/solid.c trunk/extractor/solidsub.c Modified: trunk/extractor/dsnpk.c =================================================================== --- trunk/extractor/dsnpk.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/dsnpk.c 2009-09-03 14:11:18 UTC (rev 119) @@ -18,6 +18,12 @@ return read_le32(in) == TAG('N', 'P', 'K', '0'); } +/** + * \brief reads a tag header into tag and end file offset + * \param in file to read tag header from at current position + * \param tag returns the tag read + * \param end file offset where this tag's data ends + */ static inline void get_tag(FILE *in, uint32_t *tag, uint64_t *end) { *tag = read_le32(in); *end = read_le32(in); Modified: trunk/extractor/generic.c =================================================================== --- trunk/extractor/generic.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/generic.c 2009-09-03 14:11:18 UTC (rev 119) @@ -14,9 +14,15 @@ #include "helpers.h" static int check_file(FILE *in) { + // no autodetection return 0; } +/** + * \brief checks if the given value would be a valid FOURCC as used in AVI files + * \param id value to check + * \return 1 if it would be a valid FOURCC, 0 otherwise + */ static int is_valid_fourcc(uint32_t id) { static const char valid_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz" @@ -31,38 +37,46 @@ typedef uint64_t buffer_t; + +//! size of data buffered at least in RAM (twice as much memory is used) #define RAMBUF_SZ (256 * 1024) +//! read an unsigned 16-bit little-endian value and advance pointer static inline uint16_t get_le16(uint8_t **p) { uint16_t res = *(*p)++; res += *(*p)++ << 8; return res; } +//! read an unsigned 16-bit big-endian value and advance pointer static inline uint16_t get_be16(uint8_t **p) { uint16_t res = *(*p)++ << 8; res += *(*p)++; return res; } +//! read an unsigned 32-bit little-endian value and advance pointer static inline uint32_t get_le32(uint8_t **p) { uint32_t res = get_le16(p); res += get_le16(p) << 16; return res; } +//! read an unsigned 32-bit big-endian value and advance pointer static inline uint32_t get_be32(uint8_t **p) { uint32_t res = get_be16(p) << 16; res += get_be16(p); return res; } +//! read an unsigned 64-bit little-endian value and advance pointer static inline uint64_t get_le64(uint8_t **p) { uint64_t res = get_le32(p); res += (uint64_t)get_le32(p) << 32; return res; } +//! read an unsigned 64-bit big-endian value and advance pointer static inline uint64_t get_be64(uint8_t **p) { uint64_t res = (uint64_t)get_be32(p) << 32; res += get_be32(p); Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/helpers.c 2009-09-03 14:11:18 UTC (rev 119) @@ -33,6 +33,11 @@ return name; } +/** + * \brief append an empty, zero-initialized entry + * \param list file list to append to + * \param cnt current number of entries in list + */ void add_entry_empty(struct file_s **list, int cnt) { file_t *l = *list; l = realloc(l, (cnt + 2) * sizeof(file_t)); @@ -41,7 +46,7 @@ } /** - * \brief append a new entry to a file list + * \brief append a new numbered entry to a file list * \param list file list to append to * \param cnt current number of entries in list * \param namenr number to base file name on Modified: trunk/extractor/solid.c =================================================================== --- trunk/extractor/solid.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/solid.c 2009-09-03 14:11:18 UTC (rev 119) @@ -28,6 +28,12 @@ LANG_JA = 7, }; + +/** + * \brief get string matching the language id + * \param lang language id + * \return pointer to corresponding string constant + */ static const char *langstr(int lang) { switch (lang) { case LANG_ANY: return ""; @@ -51,6 +57,11 @@ TYPE_PADDING = 0xf0, }; +/** + * \brief get string matching the type id + * \param lang type id + * \return pointer to corresponding string constant + */ static const char *typestr(int type) { switch (type) { case TYPE_AUDIO : return "ogg"; @@ -64,6 +75,14 @@ return "bin"; } +/** + * \brief reads a block header + * \param in file to read block header from at current position + * \param lang language id of block + * \param type type id of block + * \param len length of block + * \return 0 if reading failed, 1 otherwise + */ static inline int read_block_header(FILE *in, int *lang, int *type, uint32_t *len) { *lang = read_be16(in); *type = read_be16(in); Modified: trunk/extractor/solidsub.c =================================================================== --- trunk/extractor/solidsub.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/solidsub.c 2009-09-03 14:11:18 UTC (rev 119) @@ -38,6 +38,7 @@ return list; } +//! header for writing a PBM file static const char pbm_string[] = "P4\n" "# PBM header added by extractor, original data follows the third newline\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-07-31 13:42:29
|
Revision: 118 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=118&view=rev Author: someone-guy Date: 2009-07-31 13:42:18 +0000 (Fri, 31 Jul 2009) Log Message: ----------- Try to make MinGW builds feasible. Modified Paths: -------------- trunk/extractor/Makefile Added Paths: ----------- trunk/extractor/README.MinGW trunk/extractor/mingw-build.sh Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2009-07-31 11:47:22 UTC (rev 117) +++ trunk/extractor/Makefile 2009-07-31 13:42:18 UTC (rev 118) @@ -8,6 +8,7 @@ #MINGW_GTK_HACK=yes CC=gcc +#CC=i586-mingw32msvc-gcc # should not need to change anything beyond here CFLAGS=-Wall -Wdeclaration-after-statement -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -g -O2 @@ -34,7 +35,10 @@ MAIN+= gtkstuff.c ifeq ($(MINGW_GTK_HACK), yes) CFLAGS+=-mms-bitfields -Iinclude -LDFLAGS=libglib-2.0-0.dll libgobject-2.0-0.dll libgdk-win32-2.0-0.dll libgdk_pixbuf-2.0-0.dll libgtk-win32-2.0-0.dll intl.dll +CFLAGS+=-Iinclude/gtk-2.0 -Iinclude/glib-2.0 +CFLAGS+=-Ilib/gtk-2.0/include -Ilib/glib-2.0/include +CFLAGS+=-Iinclude/cairo -Iinclude/pango-1.0 -Iinclude/atk-1.0 +LDFLAGS=bin/libglib-2.0-0.dll bin/libgobject-2.0-0.dll bin/libgdk-win32-2.0-0.dll bin/libgdk_pixbuf-2.0-0.dll bin/libgtk-win32-2.0-0.dll bin/intl.dll LDFLAGS+=-mwindows else CFLAGS+=$(shell pkg-config --cflags gtk+-2.0) Added: trunk/extractor/README.MinGW =================================================================== --- trunk/extractor/README.MinGW (rev 0) +++ trunk/extractor/README.MinGW 2009-07-31 13:42:18 UTC (rev 118) @@ -0,0 +1,23 @@ +In addition to the comments in the README, here are some build +instructions for MinGW if you want the GTK Gui (commandline builds +should be a non-issue). + +1) Go to www.gtk.org and get the "Binaries" and "dev" packages of + GLib + GTK+ + Pango + ATK + Cairo + gettext-runtime + + And the "Binaries" for + zlib + libpng + +2) unzip those files directly into the extractor source directory + (or install it properly into MinGW if you prefer, but I did not test that). + +3) compile using + sh mingw-build.sh + +The binary is now in bin/extractor.exe Added: trunk/extractor/mingw-build.sh =================================================================== --- trunk/extractor/mingw-build.sh (rev 0) +++ trunk/extractor/mingw-build.sh 2009-07-31 13:42:18 UTC (rev 118) @@ -0,0 +1,3 @@ +make MINGW_GTK_HACK=yes +cp extractor bin/extractor.exe +cp zlib1.dll bin/ Property changes on: trunk/extractor/mingw-build.sh ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-07-31 11:47:35
|
Revision: 117 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=117&view=rev Author: someone-guy Date: 2009-07-31 11:47:22 +0000 (Fri, 31 Jul 2009) Log Message: ----------- Typo fixes Modified Paths: -------------- trunk/extractor/Makefile trunk/extractor/README Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2009-07-29 14:22:38 UTC (rev 116) +++ trunk/extractor/Makefile 2009-07-31 11:47:22 UTC (rev 117) @@ -32,7 +32,7 @@ CFLAGS+=-DWITHOUT_GTK else MAIN+= gtkstuff.c -ifeq ($(MiNGW_GTK_HACK), yes) +ifeq ($(MINGW_GTK_HACK), yes) CFLAGS+=-mms-bitfields -Iinclude LDFLAGS=libglib-2.0-0.dll libgobject-2.0-0.dll libgdk-win32-2.0-0.dll libgdk_pixbuf-2.0-0.dll libgtk-win32-2.0-0.dll intl.dll LDFLAGS+=-mwindows Modified: trunk/extractor/README =================================================================== --- trunk/extractor/README 2009-07-29 14:22:38 UTC (rev 116) +++ trunk/extractor/README 2009-07-31 11:47:22 UTC (rev 117) @@ -1,4 +1,4 @@ -Not much of a docuentation yet, sorry. +Not much of a documentation yet, sorry. You can change some compilation options by editing the first few lines of the Makefile. To compile, just type This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-07-29 14:22:53
|
Revision: 116 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=116&view=rev Author: someone-guy Date: 2009-07-29 14:22:38 +0000 (Wed, 29 Jul 2009) Log Message: ----------- Add some compilation help/README in the hope it helps someone... Modified Paths: -------------- trunk/extractor/Makefile Added Paths: ----------- trunk/extractor/README Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2009-02-08 15:43:32 UTC (rev 115) +++ trunk/extractor/Makefile 2009-07-29 14:22:38 UTC (rev 116) @@ -1,4 +1,15 @@ +# configuration options, change as necessary + +# uncomment to compile a commandline version +#WITHOUT_GTK=yes + +# uncomment to hardcode GTK linking appropriate for my MinGW install +# instead of trying to use pkg-config +#MINGW_GTK_HACK=yes + CC=gcc + +# should not need to change anything beyond here CFLAGS=-Wall -Wdeclaration-after-statement -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -g -O2 CFLAGS+=-std=c99 -D_XOPEN_SOURCE=500 MODULES= \ @@ -21,12 +32,15 @@ CFLAGS+=-DWITHOUT_GTK else MAIN+= gtkstuff.c +ifeq ($(MiNGW_GTK_HACK), yes) +CFLAGS+=-mms-bitfields -Iinclude +LDFLAGS=libglib-2.0-0.dll libgobject-2.0-0.dll libgdk-win32-2.0-0.dll libgdk_pixbuf-2.0-0.dll libgtk-win32-2.0-0.dll intl.dll +LDFLAGS+=-mwindows +else CFLAGS+=$(shell pkg-config --cflags gtk+-2.0) LDFLAGS=$(shell pkg-config --libs gtk+-2.0) -#CFLAGS+=-mms-bitfields -Iinclude -#LDFLAGS=libglib-2.0-0.dll libgobject-2.0-0.dll libgdk-win32-2.0-0.dll libgdk_pixbuf-2.0-0.dll libgtk-win32-2.0-0.dll intl.dll -#LDFLAGS+=-mwindows endif +endif SRCS=$(MAIN) $(MODULES) OBJS=${SRCS:.c=.o} Added: trunk/extractor/README =================================================================== --- trunk/extractor/README (rev 0) +++ trunk/extractor/README 2009-07-29 14:22:38 UTC (rev 116) @@ -0,0 +1,15 @@ +Not much of a docuentation yet, sorry. +You can change some compilation options by editing the first few lines +of the Makefile. +To compile, just type +make +use +make clean +to remove generated files +Edit the Makefile or use +make WITHOUT_GTK=yes +to compile the commandline version. +Edit the Makefile or try +make MINGW_GTK_HACK=yes +to compile for MinGW without installing pkg-config for it. +This may or may not work for you. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-02-08 15:43:39
|
Revision: 115 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=115&view=rev Author: someone-guy Date: 2009-02-08 15:43:32 +0000 (Sun, 08 Feb 2009) Log Message: ----------- Check fread return value in some cases to avoid warnings. Modified Paths: -------------- trunk/extractor/helpers.h Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2009-02-08 12:42:05 UTC (rev 114) +++ trunk/extractor/helpers.h 2009-02-08 15:43:32 UTC (rev 115) @@ -5,7 +5,8 @@ //! read a 32 bit little-endian value from file static inline uint32_t read_le32(FILE *f) { unsigned char t[4]; - fread(t, 4, 1, f); + if (!fread(t, 4, 1, f)) + return 0; return (t[3] << 8 | t[2]) << 16 | (t[1] << 8 | t[0]); } @@ -19,21 +20,24 @@ //! read a 32 bit big-endian value from file static inline uint32_t read_be32(FILE *f) { unsigned char t[4]; - fread(t, 4, 1, f); + if (!fread(t, 4, 1, f)) + return 0; return (t[0] << 8 | t[1]) << 16 | (t[2] << 8 | t[3]); } //! read a 16 bit little-endian value from file static inline uint16_t read_le16(FILE *f) { unsigned char t[2]; - fread(t, 2, 1, f); + if (!fread(t, 2, 1, f)) + return 0; return t[1] << 8 | t[0]; } //! read a 16 bit big-endian value from file static inline uint16_t read_be16(FILE *f) { unsigned char t[2]; - fread(t, 2, 1, f); + if (!fread(t, 2, 1, f)) + return 0; return t[0] << 8 | t[1]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2009-02-08 12:42:11
|
Revision: 114 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=114&view=rev Author: someone-guy Date: 2009-02-08 12:42:05 +0000 (Sun, 08 Feb 2009) Log Message: ----------- Add detection for DV headers. Modified Paths: -------------- trunk/extractor/generic.c Modified: trunk/extractor/generic.c =================================================================== --- trunk/extractor/generic.c 2008-09-17 19:00:18 UTC (rev 113) +++ trunk/extractor/generic.c 2009-02-08 12:42:05 UTC (rev 114) @@ -57,6 +57,18 @@ return res; } +static inline uint64_t get_le64(uint8_t **p) { + uint64_t res = get_le32(p); + res += (uint64_t)get_le32(p) << 32; + return res; +} + +static inline uint64_t get_be64(uint8_t **p) { + uint64_t res = (uint64_t)get_be32(p) << 32; + res += get_be32(p); + return res; +} + static file_t *get_list(FILE *in) { register buffer_t t = 0; uint8_t *rambuf = malloc(2 * RAMBUF_SZ); @@ -85,6 +97,7 @@ t = t << 8 | rambuf[rambuf_pos++]; p = rambuf + rambuf_pos; fpos++; + // NOTE: at least RAMBUF_SZ bytes after p are valid (unless EOF was reached) switch (t) { case HUGETAG(0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1): add_entry(&list, cnt, "msi"); @@ -105,6 +118,18 @@ break; } switch ((uint32_t)t) { + case 0x1f07003f: + case 0x1f0700bf: { + uint32_t dvhdr = get_be32(&p); + uint64_t padding = get_be64(&p); + p -= 12; + if (padding != 0xffffffffffffffff) break; + add_entry(&list, cnt, "dv"); + list[cnt].start = fpos - 4; + list[cnt].len = 0; + cnt++; + break; + } case TAG('M', 'S', 'C', 'F'): { uint32_t unk = get_le32(&p); uint32_t size = get_le32(&p); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-09-17 12:00:21
|
Revision: 113 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=113&view=rev Author: someone-guy Date: 2008-09-17 19:00:18 +0000 (Wed, 17 Sep 2008) Log Message: ----------- Extract "chunk" headers as well for solid video files to allow to easily find frame boundaries. Modified Paths: -------------- trunk/extractor/solid.c Modified: trunk/extractor/solid.c =================================================================== --- trunk/extractor/solid.c 2008-09-17 19:00:00 UTC (rev 112) +++ trunk/extractor/solid.c 2008-09-17 19:00:18 UTC (rev 113) @@ -144,6 +144,10 @@ skip = len - data_len; len = data_len; + } else if (type == TYPE_VIDEO) { + // extract the chunk headers, too, they allow splitting by frames + fseek(in, -8, SEEK_CUR); + len += 16; } else fseek(in, 8, SEEK_CUR); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-09-17 12:00:02
|
Revision: 112 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=112&view=rev Author: someone-guy Date: 2008-09-17 19:00:00 +0000 (Wed, 17 Sep 2008) Log Message: ----------- Recognize video type files Modified Paths: -------------- trunk/extractor/solid.c Modified: trunk/extractor/solid.c =================================================================== --- trunk/extractor/solid.c 2008-08-24 10:27:20 UTC (rev 111) +++ trunk/extractor/solid.c 2008-09-17 19:00:00 UTC (rev 112) @@ -46,6 +46,7 @@ TYPE_SUB = 0x04, TYPE_T6 = 0x06, // subtitle references? (unsure) TYPE_T7 = 0x07, + TYPE_VIDEO = 0x0e, TYPE_INDEX = 0x10, TYPE_PADDING = 0xf0, }; @@ -56,6 +57,7 @@ case TYPE_SUB : return "sub"; case TYPE_T6 : return "t6"; case TYPE_T7 : return "t7"; + case TYPE_VIDEO : return "vid"; case TYPE_INDEX : return "idx"; // should never be used case TYPE_PADDING: return "pad"; // should not be used either } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-24 10:27:22
|
Revision: 111 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=111&view=rev Author: someone-guy Date: 2008-08-24 10:27:20 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Partial support for V1.1 HAKs Modified Paths: -------------- trunk/extractor/nwn.c Modified: trunk/extractor/nwn.c =================================================================== --- trunk/extractor/nwn.c 2008-08-24 10:26:53 UTC (rev 110) +++ trunk/extractor/nwn.c 2008-08-24 10:27:20 UTC (rev 111) @@ -18,7 +18,8 @@ char sig[9] = {0}; rewind(in); fread(sig, 8, 1, in); - return strcmp(sig, "MOD V1.0") == 0 || strcmp(sig, "MOD V1.1") == 0; + return strcmp(sig, "MOD V1.0") == 0 || strcmp(sig, "MOD V1.1") == 0 || + strcmp(sig, "HAK V1.0") == 0; } static file_t *get_list(FILE *in) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-24 10:26:55
|
Revision: 110 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=110&view=rev Author: someone-guy Date: 2008-08-24 10:26:53 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Distinguish between NWN1 V1.1 and NWN2 files Modified Paths: -------------- trunk/extractor/nwn.c Modified: trunk/extractor/nwn.c =================================================================== --- trunk/extractor/nwn.c 2008-08-23 11:21:39 UTC (rev 109) +++ trunk/extractor/nwn.c 2008-08-24 10:26:53 UTC (rev 110) @@ -31,7 +31,9 @@ rewind(in); fread(sig, 8, 1, in); if (strcmp(sig, "MOD V1.1") == 0) version = 1; - if (version) namelen = 32; + // for some idiocy, both NWN1 premium modules and + // NWN2 modules use MOD V1.1. Try to distinguish them. + if (version && read_le32(in) == 0 && read_le32(in) == 0) namelen = 32; fseek(in, 0x10, SEEK_SET); count = read_le32(in); if (count > MAX_FILES) count = MAX_FILES; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-23 11:21:41
|
Revision: 109 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=109&view=rev Author: someone-guy Date: 2008-08-23 11:21:39 +0000 (Sat, 23 Aug 2008) Log Message: ----------- Incomplete support for Drakensang export.npg file Modified Paths: -------------- trunk/extractor/Makefile trunk/extractor/extractor.c trunk/extractor/formats.h Added Paths: ----------- trunk/extractor/dsnpk.c Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2008-08-23 11:21:10 UTC (rev 108) +++ trunk/extractor/Makefile 2008-08-23 11:21:39 UTC (rev 109) @@ -3,6 +3,7 @@ CFLAGS+=-std=c99 -D_XOPEN_SOURCE=500 MODULES= \ bloodrayne.c \ + dsnpk.c \ generic.c \ homeworld2.c \ nwn.c \ Added: trunk/extractor/dsnpk.c =================================================================== --- trunk/extractor/dsnpk.c (rev 0) +++ trunk/extractor/dsnpk.c 2008-08-23 11:21:39 UTC (rev 109) @@ -0,0 +1,73 @@ +/** + * \file dsnpk.c + * \brief routines for handling the Drakensang npk archive file + * + * Copyright (C) 2008 Reimar Döffinger + * License: GPL v2 (see LICENSE file) + */ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <inttypes.h> +#include "formats.h" +#include "helpers.h" + +//! check if this is a npk archive file (starts with 0KPN) +static int check_file(FILE *in) { + rewind(in); + return read_le32(in) == TAG('N', 'P', 'K', '0'); +} + +static inline void get_tag(FILE *in, uint32_t *tag, uint64_t *end) { + *tag = read_le32(in); + *end = read_le32(in); + *end += ftell(in); +} + +static file_t *get_list(FILE *in) { + file_t *list = calloc(1, sizeof(file_t)); + int cnt = 0; + uint64_t next_pos = 0; + uint64_t data_offset = 0; + do { + uint32_t tag; + uint16_t nlen; + fseek(in, next_pos, SEEK_SET); + get_tag(in, &tag, &next_pos); + switch (tag) { + case TAG('N', 'P', 'K', '0'): + data_offset = read_le32(in); // offset of data tag + data_offset += 8; // data starts after tag header + break; + case TAG('F', 'I', 'L', 'E'): + add_entry_empty(&list, cnt); + list[cnt].start = data_offset + read_le32(in); + list[cnt].len = read_le32(in); + nlen = read_le16(in); + list[cnt].name = calloc(1, nlen + 1); + fread(list[cnt].name, 1, nlen, in); + cnt++; + break; + case TAG('D', 'I', 'R', '_'): // TODO: descend given directory + break; + case TAG('D', 'E', 'N', 'D'): // TODO: ascend path + break; + default: + // unknown tag + break; + } + } while(!feof(in)); + return list; +} + +const fmt_desc_t dsnpk_fmt = { + "dsnpk", + "NPK (Drakensang)", + "NPK (*.npk)", + "*.npk", + check_file, + get_list, + default_free_list, + default_extract_file, + default_extract_mem, +}; Modified: trunk/extractor/extractor.c =================================================================== --- trunk/extractor/extractor.c 2008-08-23 11:21:10 UTC (rev 108) +++ trunk/extractor/extractor.c 2008-08-23 11:21:39 UTC (rev 109) @@ -19,6 +19,7 @@ //! brief NULL-terminated array of supported formats const fmt_desc_t * const fmts[] = { &bloodrayne_fmt, + &dsnpk_fmt, &generic_fmt, &homeworld2_fmt, &nwn_fmt, Modified: trunk/extractor/formats.h =================================================================== --- trunk/extractor/formats.h 2008-08-23 11:21:10 UTC (rev 108) +++ trunk/extractor/formats.h 2008-08-23 11:21:39 UTC (rev 109) @@ -27,6 +27,7 @@ } fmt_desc_t; extern const fmt_desc_t bloodrayne_fmt; +extern const fmt_desc_t dsnpk_fmt; extern const fmt_desc_t generic_fmt; extern const fmt_desc_t homeworld2_fmt; extern const fmt_desc_t nwn_fmt; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-23 11:21:12
|
Revision: 108 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=108&view=rev Author: someone-guy Date: 2008-08-23 11:21:10 +0000 (Sat, 23 Aug 2008) Log Message: ----------- add_entry_empty helper function Modified Paths: -------------- trunk/extractor/helpers.c trunk/extractor/helpers.h Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2008-08-22 16:12:15 UTC (rev 107) +++ trunk/extractor/helpers.c 2008-08-23 11:21:10 UTC (rev 108) @@ -33,6 +33,13 @@ return name; } +void add_entry_empty(struct file_s **list, int cnt) { + file_t *l = *list; + l = realloc(l, (cnt + 2) * sizeof(file_t)); + memset(&l[cnt + 1], 0, sizeof(file_t)); + *list = l; +} + /** * \brief append a new entry to a file list * \param list file list to append to @@ -41,12 +48,11 @@ * \param ext extension of entry to add */ void add_entry_nr(struct file_s **list, int cnt, int namenr, const char *ext) { - file_t *l = *list; - l = realloc(l, (cnt + 2) * sizeof(file_t)); - memset(&l[cnt + 1], 0, sizeof(file_t)); + file_t *l; + add_entry_empty(list, cnt); + l = *list; l[cnt].name = malloc(50); snprintf(l[cnt].name, 50, "%i.%s", namenr, ext); - *list = l; } /** Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2008-08-22 16:12:15 UTC (rev 107) +++ trunk/extractor/helpers.h 2008-08-23 11:21:10 UTC (rev 108) @@ -42,6 +42,7 @@ #define HUGETAG(a, b, c, d, e, f, g, h) (((uint64_t)(TAG(a, b, c, d)) << 32) | TAG(e, f, g, h)) struct file_s; +void add_entry_empty(struct file_s **list, int cnt); void add_entry_nr(struct file_s **list, int cnt, int namenr, const char *ext); void add_entry(struct file_s **list, int cnt, const char *ext); void default_free_list(struct file_s *list); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:12:18
|
Revision: 107 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=107&view=rev Author: someone-guy Date: 2008-08-22 16:12:15 +0000 (Fri, 22 Aug 2008) Log Message: ----------- NWN2 act images are in Targa (.tga) format. Modified Paths: -------------- trunk/extractor/nwn.c Modified: trunk/extractor/nwn.c =================================================================== --- trunk/extractor/nwn.c 2008-08-22 16:12:00 UTC (rev 106) +++ trunk/extractor/nwn.c 2008-08-22 16:12:15 UTC (rev 107) @@ -66,7 +66,7 @@ strcat(list[i].name, ".xml"); break; case 0x0003: // act start image - strcat(list[i].name, ".img"); + strcat(list[i].name, ".tga"); break; default: { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:12:06
|
Revision: 106 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=106&view=rev Author: someone-guy Date: 2008-08-22 16:12:00 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Correctly identify Japanese language subtitles. Modified Paths: -------------- trunk/extractor/solid.c Modified: trunk/extractor/solid.c =================================================================== --- trunk/extractor/solid.c 2008-08-22 16:11:41 UTC (rev 105) +++ trunk/extractor/solid.c 2008-08-22 16:12:00 UTC (rev 106) @@ -25,6 +25,7 @@ LANG_DE, LANG_IT, LANG_ES, + LANG_JA = 7, }; static const char *langstr(int lang) { @@ -35,6 +36,7 @@ case LANG_DE : return "de"; case LANG_IT : return "it"; case LANG_ES : return "es"; + case LANG_JA : return "ja"; } return "nn"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:11:43
|
Revision: 105 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=105&view=rev Author: someone-guy Date: 2008-08-22 16:11:41 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Add pbm header Modified Paths: -------------- trunk/extractor/solidsub.c Modified: trunk/extractor/solidsub.c =================================================================== --- trunk/extractor/solidsub.c 2008-08-22 16:11:25 UTC (rev 104) +++ trunk/extractor/solidsub.c 2008-08-22 16:11:41 UTC (rev 105) @@ -26,9 +26,10 @@ while (!feof(in) && cnt < MAX_FILES) { uint32_t size = read_le32(in); if (!size) continue; - add_entry_nr(&list, cnt, namenr, img ? "img" : "txt"); + add_entry_nr(&list, cnt, namenr, img ? "pbm" : "txt"); list[cnt].start = ftell(in); list[cnt].len = size; + list[cnt].priv = (void *)(intptr_t)img; cnt++; fseek(in, size, SEEK_CUR); if (img) namenr++; @@ -37,6 +38,38 @@ return list; } +static const char pbm_string[] = + "P4\n" + "# PBM header added by extractor, original data follows the third newline\n" + "48 %i\n"; + +static int extract_file(FILE *in, const file_t *file, FILE *out) { + int len, len2; + // not an image file + if (!file->priv) return default_extract_file(in, file, out); + len = fprintf(out, pbm_string, (int)file->len / 6); + if (len <= 0) return len; + fseek(in, file->start, SEEK_SET); + len2 = fcopy(in, out, file->len); + if (len2 <= 0) return len2; + return len + len2; +} + +static int extract_mem(FILE *in, const file_t *file, uint8_t *out, int size) { + int len, len2; + // not an image file + if (!file->priv) return default_extract_mem(in, file, out, size); + len = snprintf(out, size, pbm_string, (int)file->len / 6); + if (len >= size) return size; + out += len; + size -= len; + if (size > file->len) size = file->len; + fseek(in, file->start, SEEK_SET); + len2 = fread(out, 1, size, in); + if (len2 <= 0) return len2; + return len + len2; +} + const fmt_desc_t solidsub_fmt = { "solidsub", "MetalGear Solid: TS subtitles", @@ -45,6 +78,6 @@ check_file, get_list, default_free_list, - default_extract_file, - default_extract_mem, + extract_file, + extract_mem, }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:11:28
|
Revision: 104 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=104&view=rev Author: someone-guy Date: 2008-08-22 16:11:25 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Module to extract character images from MetalGear Solid: TS subtitles Modified Paths: -------------- trunk/extractor/Makefile trunk/extractor/extractor.c trunk/extractor/formats.h trunk/extractor/helpers.c trunk/extractor/helpers.h Added Paths: ----------- trunk/extractor/solidsub.c Modified: trunk/extractor/Makefile =================================================================== --- trunk/extractor/Makefile 2008-08-22 16:10:43 UTC (rev 103) +++ trunk/extractor/Makefile 2008-08-22 16:11:25 UTC (rev 104) @@ -8,6 +8,7 @@ nwn.c \ pak.c \ solid.c \ + solidsub.c \ wad.c \ xtre.c \ Modified: trunk/extractor/extractor.c =================================================================== --- trunk/extractor/extractor.c 2008-08-22 16:10:43 UTC (rev 103) +++ trunk/extractor/extractor.c 2008-08-22 16:11:25 UTC (rev 104) @@ -24,6 +24,7 @@ &nwn_fmt, &pak_fmt, &solid_fmt, + &solidsub_fmt, &wad_fmt, &xtre_fmt, NULL Modified: trunk/extractor/formats.h =================================================================== --- trunk/extractor/formats.h 2008-08-22 16:10:43 UTC (rev 103) +++ trunk/extractor/formats.h 2008-08-22 16:11:25 UTC (rev 104) @@ -32,6 +32,7 @@ extern const fmt_desc_t nwn_fmt; extern const fmt_desc_t pak_fmt; extern const fmt_desc_t solid_fmt; +extern const fmt_desc_t solidsub_fmt; extern const fmt_desc_t wad_fmt; extern const fmt_desc_t xtre_fmt; Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2008-08-22 16:10:43 UTC (rev 103) +++ trunk/extractor/helpers.c 2008-08-22 16:11:25 UTC (rev 104) @@ -37,17 +37,28 @@ * \brief append a new entry to a file list * \param list file list to append to * \param cnt current number of entries in list + * \param namenr number to base file name on * \param ext extension of entry to add */ -void add_entry(struct file_s **list, int cnt, const char *ext) { +void add_entry_nr(struct file_s **list, int cnt, int namenr, const char *ext) { file_t *l = *list; l = realloc(l, (cnt + 2) * sizeof(file_t)); memset(&l[cnt + 1], 0, sizeof(file_t)); l[cnt].name = malloc(50); - snprintf(l[cnt].name, 50, "%i.%s", cnt, ext); + snprintf(l[cnt].name, 50, "%i.%s", namenr, ext); *list = l; } +/** + * \brief append a new entry to a file list + * \param list file list to append to + * \param cnt current number of entries in list + * \param ext extension of entry to add + */ +void add_entry(struct file_s **list, int cnt, const char *ext) { + add_entry_nr(list, cnt, cnt, ext); +} + #define BLOCK_SIZE 4096 /** * \brief copy data from one file into another Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2008-08-22 16:10:43 UTC (rev 103) +++ trunk/extractor/helpers.h 2008-08-22 16:11:25 UTC (rev 104) @@ -42,6 +42,7 @@ #define HUGETAG(a, b, c, d, e, f, g, h) (((uint64_t)(TAG(a, b, c, d)) << 32) | TAG(e, f, g, h)) struct file_s; +void add_entry_nr(struct file_s **list, int cnt, int namenr, const char *ext); void add_entry(struct file_s **list, int cnt, const char *ext); void default_free_list(struct file_s *list); void default_free_ignorepriv(struct file_s *list); Added: trunk/extractor/solidsub.c =================================================================== --- trunk/extractor/solidsub.c (rev 0) +++ trunk/extractor/solidsub.c 2008-08-22 16:11:25 UTC (rev 104) @@ -0,0 +1,50 @@ +/** + * \file solidsub.c + * \brief routines for handling the solid subtitle files extracted from vox.dat + * + * Copyright (C) 2008 Reimar Döffinger + * License: GPL v2 (see LICENSE file) + */ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <inttypes.h> +#include "formats.h" +#include "helpers.h" + +static int check_file(FILE *in) { + // no safe autodetection available + return 0; +} + +static file_t *get_list(FILE *in) { + int namenr = 0; + int cnt = 0; + int img = 0; + file_t *list = calloc(1, sizeof(file_t)); + rewind(in); + while (!feof(in) && cnt < MAX_FILES) { + uint32_t size = read_le32(in); + if (!size) continue; + add_entry_nr(&list, cnt, namenr, img ? "img" : "txt"); + list[cnt].start = ftell(in); + list[cnt].len = size; + cnt++; + fseek(in, size, SEEK_CUR); + if (img) namenr++; + img = !img; + } + return list; +} + +const fmt_desc_t solidsub_fmt = { + "solidsub", + "MetalGear Solid: TS subtitles", + "MetalGear Solid: TS subtitles (*.sub)", + "*.sub", + check_file, + get_list, + default_free_list, + default_extract_file, + default_extract_mem, +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:10:46
|
Revision: 103 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=103&view=rev Author: someone-guy Date: 2008-08-22 16:10:43 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Put text preview in a scrolled window. Modified Paths: -------------- trunk/extractor/gtkstuff.c Modified: trunk/extractor/gtkstuff.c =================================================================== --- trunk/extractor/gtkstuff.c 2008-08-22 16:10:18 UTC (rev 102) +++ trunk/extractor/gtkstuff.c 2008-08-22 16:10:43 UTC (rev 103) @@ -184,20 +184,23 @@ else { const gchar *bad; gchar *txt = (gchar *)tmpdata; + GtkWidget *tv; GtkTextBuffer *tb = gtk_text_buffer_new(NULL); if (size > MAX_TXT_SZ) size = MAX_TXT_SZ; while (!g_utf8_validate(txt, size, &bad)) txt[bad - txt] = '?'; gtk_text_buffer_set_text(tb, txt, size); - img = gtk_text_view_new_with_buffer(tb); - gtk_text_view_set_editable(GTK_TEXT_VIEW(img), FALSE); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(img), TRUE); + tv = gtk_text_view_new_with_buffer(tb); + gtk_text_view_set_editable(GTK_TEXT_VIEW(tv), FALSE); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tv), FALSE); + img = gtk_scrolled_window_new(NULL, NULL); gtk_widget_set_size_request(img, 600, 400); + gtk_container_add(GTK_CONTAINER(img), tv); } g_object_unref(pbl); free(tmpdata); gtk_container_add(GTK_CONTAINER(preview_win), img); - gtk_widget_show(img); + gtk_widget_show_all(img); gtk_window_present(GTK_WINDOW(preview_win)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:10:21
|
Revision: 102 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=102&view=rev Author: someone-guy Date: 2008-08-22 16:10:18 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Add a text preview Modified Paths: -------------- trunk/extractor/gtkstuff.c Modified: trunk/extractor/gtkstuff.c =================================================================== --- trunk/extractor/gtkstuff.c 2008-08-22 16:10:00 UTC (rev 101) +++ trunk/extractor/gtkstuff.c 2008-08-22 16:10:18 UTC (rev 102) @@ -150,6 +150,7 @@ } #define MAX_IMG_SZ (100*1024*1024) +#define MAX_TXT_SZ (100*1024) /** * Called when user double-clicks on a archive content @@ -176,11 +177,25 @@ if (size > MAX_IMG_SZ || size < 0) size = MAX_IMG_SZ; pbl = gdk_pixbuf_loader_new(); gdk_pixbuf_loader_write(pbl, tmpdata, size, NULL); - free(tmpdata); gdk_pixbuf_loader_close(pbl, NULL); pb = gdk_pixbuf_loader_get_pixbuf(pbl); - img = gtk_image_new_from_pixbuf(pb); + if (pb) + img = gtk_image_new_from_pixbuf(pb); + else { + const gchar *bad; + gchar *txt = (gchar *)tmpdata; + GtkTextBuffer *tb = gtk_text_buffer_new(NULL); + if (size > MAX_TXT_SZ) size = MAX_TXT_SZ; + while (!g_utf8_validate(txt, size, &bad)) + txt[bad - txt] = '?'; + gtk_text_buffer_set_text(tb, txt, size); + img = gtk_text_view_new_with_buffer(tb); + gtk_text_view_set_editable(GTK_TEXT_VIEW(img), FALSE); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(img), TRUE); + gtk_widget_set_size_request(img, 600, 400); + } g_object_unref(pbl); + free(tmpdata); gtk_container_add(GTK_CONTAINER(preview_win), img); gtk_widget_show(img); gtk_window_present(GTK_WINDOW(preview_win)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:10:03
|
Revision: 101 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=101&view=rev Author: someone-guy Date: 2008-08-22 16:10:00 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Add short format name to -l file info text Modified Paths: -------------- trunk/extractor/extractor.c Modified: trunk/extractor/extractor.c =================================================================== --- trunk/extractor/extractor.c 2008-08-22 16:09:42 UTC (rev 100) +++ trunk/extractor/extractor.c 2008-08-22 16:10:00 UTC (rev 101) @@ -129,7 +129,7 @@ } if (list_files) { file_t *f = flist; - printf("Detected file format: %s\n\n", cur_fmt->name); + printf("Detected file format: %s (%s)\n\n", cur_fmt->name, cur_fmt->shortname); printf("Files found:\n"); printf(" size | position | c | name\n"); while(f->name) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <som...@us...> - 2008-08-22 16:09:45
|
Revision: 100 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=100&view=rev Author: someone-guy Date: 2008-08-22 16:09:42 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Print some more info in -l mode Modified Paths: -------------- trunk/extractor/extractor.c Modified: trunk/extractor/extractor.c =================================================================== --- trunk/extractor/extractor.c 2008-08-22 16:09:24 UTC (rev 99) +++ trunk/extractor/extractor.c 2008-08-22 16:09:42 UTC (rev 100) @@ -129,8 +129,11 @@ } if (list_files) { file_t *f = flist; + printf("Detected file format: %s\n\n", cur_fmt->name); + printf("Files found:\n"); + printf(" size | position | c | name\n"); while(f->name) { - printf("%12"PRId64" 0x%012"PRIx64" %c %s\n", f->len, f->start, f->compressed ? 'c' : ' ', f->name); + printf("%12"PRId64" 0x%012"PRIx64" %c %s\n", f->len, f->start, f->compressed ? 'c' : ' ', f->name); f++; }; return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |