summaryrefslogtreecommitdiff
path: root/VP/decomp-slz.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-07-14 17:00:53 +0000
committerPixel <Pixel>2002-07-14 17:00:53 +0000
commit50dbdbd466572928a619554e5c756bd52c415597 (patch)
tree121b0f0af6be3ec5288c1e8e7f01a2b839e611e7 /VP/decomp-slz.cpp
parentfeeefcebf8053dc21a396c26c17a9f5fdbf90aff (diff)
Plop
Diffstat (limited to 'VP/decomp-slz.cpp')
-rw-r--r--VP/decomp-slz.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/VP/decomp-slz.cpp b/VP/decomp-slz.cpp
new file mode 100644
index 0000000..fa09411
--- /dev/null
+++ b/VP/decomp-slz.cpp
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "lzss.h"
+#include "fileutils.h"
+#include "generic.h"
+
+int main(int argc, char ** argv) {
+ int sig, l, d, v;
+ FILE * fin = stdin, * fout = stdout;
+
+ switch (argc) {
+ case 3:
+ if (!(fout = fopen(argv[2], "w"))) {
+ printm(M_ERROR, "Error opening file %s.\n", argv[3]);
+ exit(-1);
+ }
+ case 2:
+ if (!(fin = fopen(argv[1], "r"))) {
+ printm(M_ERROR, "Error opening file %s.\n", argv[2]);
+ exit(-1);
+ }
+ break;
+ case 1:
+ break;
+ default:
+ printm(M_BARE, "Usage: %s [filein] [fileout]\n", argv[0]);
+ exit(-1);
+ }
+
+ verbosity = M_STATUS;
+
+ fread(&sig, 1, 4, fin);
+ fread(&d, 1, 4, fin);
+ fread(&l, 1, 4, fin);
+ switch (sig) {
+ case 0x05a4c53:
+ printm(M_STATUS, "Detected a SLZ-type 0 file.\n");
+ fread(&v, 1, 4, fin);
+ copy(fin, fout, d);
+ exit(0);
+ case 0x15a4c53:
+ scheme = schemes[VP_1];
+ printm(M_STATUS, "Detected a SLZ-type 1 file.\n");
+ break;
+ case 0x25a4c53:
+ scheme = schemes[VP_2];
+ printm(M_STATUS, "Detected a SLZ-type 2 file.\n");
+ break;
+ default:
+ printm(M_ERROR, "Not a SLZ file.\n");
+ exit(-1);
+ }
+
+ lzss_decomp(fin, fout, l);
+ exit(0);
+}