Megaman4Pass.c

aus RHWiki, der freien Romhacking-Enzyklopädie

#include <stdio.h>
#include <string.h>
void IdToPos(int id)
{
	int posx,posy;
	id/=4;
	posx=id%6;
	posy=id/6;
	posx++;
	posy+=10;
	printf("%d%X ",posx,posy);
}
main(int argc, char *argv[])
{
	int i,j,chk,a,b;
	unsigned char Select[] = { 3,3,3,3,3 };
	const unsigned char Forbidden[]={0x58,0x5c,0x84,0x70,0x8c};
	const unsigned char CSUM[]={0x88,0x14,0x1c,0x20,0x30,0x3c,0x44,0x4c,0x6c,0x74,0x78};
	const unsigned char One[][5] = {{0x34,0x18,0x00,0x04},{0x38,0x24,0x0C,0x08},
		{0x2C,0x40,0x28,0x10},{0x60,0x7C,0x64,0x48},{0x54,0x50,0x80,0x68}};
	const char *Names[] = {"Bright","Toad","Drill","Pharaoh","Ring","Dust","Dive","Skull","Wire","Ballon"};

	printf("MegaMan4 PassGenerator by loadingNOW\r\nYou have beaten: ");
	if(argc==1)
		printf("\r\nOptions: Bright Toad Drill Pharaoh Ring Dust Dive Skull Wire Ballon");

	for(i=1; i<argc; i++)
	{
	for(j=0; j<10;j++)
		if(!(strcmp(Names[j],argv[i])))
		{
			printf("%s ",Names[j]);
			a=j%2;
			b=j/2;
			a^=3;
			Select[b]^=a;
		}
	}
	printf("\r\nPasscode: ");

	chk=0;
	for(i=0; i<5; i++)
	{
		if(Select[i]==2)
			chk+=2;
		if(Select[i]<2)
			chk+=1;
	}
	IdToPos(CSUM[chk]);
	for(i=0; i<5; i++)
		IdToPos(One[i][Select[i]]);
	printf("\r\nEnjoy your PW!\r\n");
}

Siehe auch

'Persönliche Werkzeuge