changeset 73:e4a12dd9a51b

Remove useless duplicated main of scn2kdump.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 02 Apr 2011 02:29:42 +0200
parents f9eb96a4cce0
children f8751d74918b
files scn2k/scn2k_cmd.cc scn2k/scn2kdump.cc
diffstat 2 files changed, 0 insertions(+), 115 deletions(-) [+]
line wrap: on
line diff
--- a/scn2k/scn2k_cmd.cc
+++ b/scn2k/scn2k_cmd.cc
@@ -38,11 +38,8 @@
 using namespace std;
 
 
-// #define SCN_DUMP
 /* 注意点: @@@ で表記 */
 
-
-
 //bool debug_flag = true;
 bool debug_flag = false;
 void dprintf(const char* fmt, ...) {
@@ -1633,113 +1630,3 @@ void CmdSimplified::Load(const char* sav
 	*args_buffer++ = TYPE_END;
 }
 
-#ifdef SCN_DUMP
-void usage(void) {
-	fprintf(stderr,"usage : scn2kdump [inputfile] [outputfile]\n");
-	fprintf(stderr,"  inputfile:  seen.txt(default)\n");
-	fprintf(stderr,"  outputfile: seen.txt_out(default)\n");
-	exit(-1);
-}
-int main(int argc, char** argv) {
-	/* determine file names */
-	bool verbose = false;
-	char* inname = "seen.txt";
-	char* outname = NULL;
-	if (argc > 2 && strcmp(argv[1],"-v") == 0) {
-		int i; for (i=1; i<argc; i++) argv[i] = argv[i+1];
-		argc--;
-		verbose = true;
-	}
-	switch(argc) {
-		case 1: break;
-		case 2:
-			inname = argv[1];
-			break;
-		case 3:
-			inname = argv[1];
-			outname = argv[2];
-			break;
-		default: usage();
-	}
-	/* open output file */
-	FILE* outstream = stdout;
-	/* create archive instance */
-	SCN2kFILE archive(inname);
-	archive.Init();
-	if (archive.Deal() == 0) {
-		fprintf(stderr,"Cannot open / Invalid archive file %s\n",inname);
-		usage();
-	}
-	/* dump files */
-	archive.InitList();
-	char* fname;
-	fprintf(stderr,"Dump start\n");
-	int system_version = 0;
-	while( (fname = archive.ListItem()) != 0) {
-		ARCINFO* info = archive.Find(fname,"");
-		if (info == NULL) continue;
-		char* data = info->CopyRead();
-		char* d = data;
-		char* dend = d + info->Size();
-		/* version 確認 */
-		if (read_little_endian_int(d) == 0x1cc) {
-			system_version = 0;
-		} else if (read_little_endian_int(d) == 0x1d0) {
-			system_version = 1;
-		} else {
-			continue;
-		}
-		if (read_little_endian_int(d+4) == 0x1adb2) ; // little busters!
-		else if (read_little_endian_int(d+4) != 0x2712) continue;
-		int header_size;
-		if (system_version == 0) {
-			header_size = 0x1cc + read_little_endian_int(d+0x20) * 4;
-		} else {
-			header_size = read_little_endian_int(d+0x20);
-		}
-		d += header_size;
-
-		const char* dcur = d;
-		const char* dstart = d;
-		fprintf(stderr,"Dumping %s\n",fname);
-		Flags flags;
-		/* 最初から最後までコマンド取得 -> 出力を繰り返す */
-		while(dcur<dend) {
-			const char* dprev = dcur;
-			Cmd cmd(flags, system_version); cmd.ClearError();
-
-			/* end? */
-			if (*dcur == -1) {
-				/* 0xff x 32byte + 0x00 : end sign */
-				int i; for (i=0; i<0x20; i++)
-					if (dcur[i] != -1) break;
-				if (i == 0x20 && dcur[i] == 0) break;
-			}
-			dprintf("%d : ",dcur-dstart);
-			cmd.GetCmd(flags, dcur);
-			if (cmd.IsError()) {
-				fprintf(outstream, "Error at %6d\n",dprev-dstart);
-				while(dcur < dend) {
-					if (*dcur == 0x29 && dcur[1] == 0x0a) {dcur++;break;}
-					dcur++;
-				}
-				dprev -= 2*16;
-				int ilen = (dcur-dprev+15)/16;
-				int i; for (i=0; i<ilen; i++) {
-					fprintf(outstream, "%6d: ",dprev-dstart);
-					int j; for (j=0; j<16; j++) {
-						if (dprev >= dend) break;
-						if (dprev < data) continue;
-						fprintf(outstream, "%02x ",*(unsigned char*)(dprev));
-						dprev++;
-					}
-					fprintf(outstream, "\n");
-				}
-			}
-		}
-		delete info;
-	}
-	return 0;
-}
-#endif
-
--- a/scn2k/scn2kdump.cc
+++ b/scn2k/scn2kdump.cc
@@ -34,8 +34,6 @@ using namespace std;
 #include "scn2k.h"
 
 
-#define SCN_DUMP
-
 class CmdD : public Cmd
 {
   public: