Example #1
0
void main(int argc, char *argv[])
{
	switch (argc) {
	case 2:
		encrypt_init();
		scramble_file(argv[1]);
		break;
	case 3:
		encrypt_init();
		if ( !stricmp("-u", argv[1]) ) {
			unscramble_file(argv[2]);
		} else if ( !stricmp("-st", argv[1]) ) {
			scramble_file(argv[2], argv[2], PREPROCESS_SHIPS_TBL);
		} else if ( !stricmp("-wt", argv[1]) ) {
			scramble_file(argv[2], argv[2], PREPROCESS_WEAPONS_TBL);
		} else {
			scramble_file(argv[1], argv[2]);
		}
		break;
	case 4:
		encrypt_init();
		if ( !stricmp("-u", argv[1]) ) {
			unscramble_file(argv[2], argv[3]);
		} else if ( !stricmp("-st", argv[1]) ) {
			scramble_file(argv[2], argv[3], PREPROCESS_SHIPS_TBL);
		} else if ( !stricmp("-wt", argv[1]) ) {
			scramble_file(argv[2], argv[3], PREPROCESS_WEAPONS_TBL);
		} else {
			print_instructions();
		}
		break;
	default:
		print_instructions();
		return;
	}
}
Example #2
0
int main(int argc, char *argv[])
{
	switch (argc) {
	case 2:
		encrypt_init();
		if ( !stricmp("-u", argv[1]) || !stricmp("-i", argv[1]) || !stricmp("-st", argv[1]) ||
				!stricmp("-wt", argv[1]) || !stricmp("-fs1", argv[1]) || !stricmp("-8bit", argv[1]) ) {
			print_instructions();
		} else {
			scramble_file(argv[1]);
		}
		break;

	case 3:
		encrypt_init();
		if ( !stricmp("-u", argv[1]) ) {
			unscramble_file(argv[2]);
		} else if ( !stricmp("-i", argv[1]) ) {
			scramble_identify(argv[2]);
		} else if ( !stricmp("-st", argv[1]) ) {
			Use_8bit = 0;
			fs2 = false;
			scramble_file(argv[2], argv[2], PREPROCESS_SHIPS_TBL);
		} else if ( !stricmp("-wt", argv[1]) ) {
			Use_8bit = 0;
			fs2 =false;
			scramble_file(argv[2], argv[2], PREPROCESS_WEAPONS_TBL);
		} else if ( !stricmp("-fs1", argv[1]) ) {
			Use_8bit = 0;
			fs2 = false;
			scramble_file(argv[2], argv[2]);
		} else if ( !stricmp("-8bit", argv[1]) ) {
			Use_8bit = 1;
			fs2 = false;
			scramble_file(argv[2], argv[2]);
		} else {
			scramble_file(argv[1], argv[2]);
		}
		break;

	case 4:
		encrypt_init();
		if ( !stricmp("-u", argv[1]) ) {
			unscramble_file(argv[2], argv[3]);
		} else if ( !stricmp("-st", argv[1]) ) {
			Use_8bit = 0;
			fs2 = false;
			scramble_file(argv[2], argv[3], PREPROCESS_SHIPS_TBL);
		} else if ( !stricmp("-wt", argv[1]) ) {
			Use_8bit = 0;
			fs2 = false;
			scramble_file(argv[2], argv[3], PREPROCESS_WEAPONS_TBL);
		} else if ( !stricmp("-fs1", argv[1]) ) {
			Use_8bit = 0;
			fs2 = false;
			scramble_file(argv[2], argv[3]);
		} else if ( !stricmp("-8bit", argv[1]) ) {
			Use_8bit = 1;
			fs2 = false;
			scramble_file(argv[2], argv[3]);
		} else {
			print_instructions();
		}
		break;

	default:
		print_instructions();
		return 1;
	}
}