Support PC SC2.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2729 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+28
-7
@@ -41,7 +41,7 @@ struct options {
|
|||||||
enum {
|
enum {
|
||||||
Type_sc1, // PC version of SC1
|
Type_sc1, // PC version of SC1
|
||||||
Type_pc, // PC version of SC2
|
Type_pc, // PC version of SC2
|
||||||
Type_3do, // 3DO version of SC2
|
Type_3do, // 3DO version of SC2; also The Horde (PC version)
|
||||||
} type;
|
} type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ usage() {
|
|||||||
"\t-l list the resources\n"
|
"\t-l list the resources\n"
|
||||||
"\t-p print the index\n"
|
"\t-p print the index\n"
|
||||||
"\t-t package file type; one of \"sc1\", \"pc\", or \"3do\"\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");
|
"\t-v verbose mode\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,9 +171,6 @@ parse_arguments(int argc, char *argv[], struct options *opts) {
|
|||||||
} else if (strcmp(optarg, "3do") == 0 ||
|
} else if (strcmp(optarg, "3do") == 0 ||
|
||||||
strcmp(optarg, "3DO") == 0) {
|
strcmp(optarg, "3DO") == 0) {
|
||||||
opts->type = Type_3do;
|
opts->type = Type_3do;
|
||||||
fprintf(stderr, "3DO package files are not yet "
|
|
||||||
"supported.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid package file type.\n");
|
fprintf(stderr, "Invalid package file type.\n");
|
||||||
usage();
|
usage();
|
||||||
@@ -220,7 +218,16 @@ readIndex(const struct options *opts, const uint8 *buf) {
|
|||||||
h->header_len = 0;
|
h->header_len = 0;
|
||||||
break;
|
break;
|
||||||
case Type_pc:
|
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;
|
break;
|
||||||
case Type_3do:
|
case Type_3do:
|
||||||
h->packmem_list_offs =
|
h->packmem_list_offs =
|
||||||
@@ -320,7 +327,8 @@ readIndex(const struct options *opts, const uint8 *buf) {
|
|||||||
MAKE_WORD(bufptr[0], bufptr[1]);
|
MAKE_WORD(bufptr[0], bufptr[1]);
|
||||||
break;
|
break;
|
||||||
case Type_pc:
|
case Type_pc:
|
||||||
abort(); // Not yet supported.
|
instance->size =
|
||||||
|
2 * MAKE_WORD(bufptr[0], bufptr[1]);
|
||||||
break;
|
break;
|
||||||
case Type_3do:
|
case Type_3do:
|
||||||
instance->size =
|
instance->size =
|
||||||
@@ -374,7 +382,20 @@ printIndex(const struct options *opts, const index_header *h,
|
|||||||
MAKE_WORD(buf[0x13], buf[0x14]));
|
MAKE_WORD(buf[0x13], buf[0x14]));
|
||||||
break;
|
break;
|
||||||
case Type_pc:
|
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;
|
break;
|
||||||
case Type_3do:
|
case Type_3do:
|
||||||
fprintf(out, "0x00000002 packmem_list_offs: 0x%08x\n",
|
fprintf(out, "0x00000002 packmem_list_offs: 0x%08x\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user