From 8e86b3377608d37895887e1258a5ddaf2a647cd7 Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sun, 8 Apr 2007 20:31:19 +0000 Subject: [PATCH] Support PC SC2. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2729 8092fc87-c524-0410-9efc-e669fe64eaf9 --- tools/pkg/unpkg.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/tools/pkg/unpkg.c b/tools/pkg/unpkg.c index 588cf6185..76b93d1fb 100644 --- a/tools/pkg/unpkg.c +++ b/tools/pkg/unpkg.c @@ -41,7 +41,7 @@ struct options { enum { Type_sc1, // PC version of SC1 Type_pc, // PC version of SC2 - Type_3do, // 3DO version of SC2 + Type_3do, // 3DO version of SC2; also The Horde (PC version) } type; }; @@ -137,6 +137,7 @@ usage() { "\t-l list the resources\n" "\t-p print the index\n" "\t-t package file type; one of \"sc1\", \"pc\", or \"3do\"\n" + "\t \"3do\" also works for the PC version of The Horde\n" "\t-v verbose mode\n"); } @@ -170,9 +171,6 @@ parse_arguments(int argc, char *argv[], struct options *opts) { } else if (strcmp(optarg, "3do") == 0 || strcmp(optarg, "3DO") == 0) { opts->type = Type_3do; - fprintf(stderr, "3DO package files are not yet " - "supported.\n"); - exit(EXIT_FAILURE); } else { fprintf(stderr, "Invalid package file type.\n"); usage(); @@ -220,7 +218,16 @@ readIndex(const struct options *opts, const uint8 *buf) { h->header_len = 0; break; case Type_pc: - abort(); // Not supported + h->packmem_list_offs = + MAKE_DWORD(buf[0x02], buf[0x03], buf[0x04], buf[0x05]); + h->path_list_offs = + MAKE_DWORD(buf[0x06], buf[0x07], buf[0x08], buf[0x09]); + h->file_list_offs = + MAKE_DWORD(buf[0x0a], buf[0x0b], buf[0x0c], buf[0x0d]); + h->num_packages = MAKE_WORD(buf[0x0e], buf[0x0f]); + h->num_types = buf[0x10]; + h->header_len = MAKE_DWORD( + buf[0x12], buf[0x13], buf[0x14], buf[0x15]); break; case Type_3do: h->packmem_list_offs = @@ -320,7 +327,8 @@ readIndex(const struct options *opts, const uint8 *buf) { MAKE_WORD(bufptr[0], bufptr[1]); break; case Type_pc: - abort(); // Not yet supported. + instance->size = + 2 * MAKE_WORD(bufptr[0], bufptr[1]); break; case Type_3do: instance->size = @@ -374,7 +382,20 @@ printIndex(const struct options *opts, const index_header *h, MAKE_WORD(buf[0x13], buf[0x14])); break; case Type_pc: - abort(); // Not supported + fprintf(out, "0x00000002 packmem_list_offs: 0x%08x\n", + h->packmem_list_offs); + fprintf(out, "0x00000006 path_list_offs: 0x%08x\n", + h->path_list_offs); + fprintf(out, "0x0000000a file_list_offs: 0x%08x\n", + h->file_list_offs); + fprintf(out, "0x0000000e Number of packages: %d\n", + h->num_packages); + fprintf(out, "0x00000010 Number of package types: %d\n", + h->num_types); + fprintf(out, "0x00000011 Unknown: 0x%02x\n", + buf[0x11]); + fprintf(out, "0x00000012 Header length: 0x%08x\n", + h->header_len); break; case Type_3do: fprintf(out, "0x00000002 packmem_list_offs: 0x%08x\n",