ErikPshat, у меня вообще сейчас даже другое хобби...
а то что вы просите элементарно же
		// "~PSP" header check
	if(memcmp(elf, "~PSP", 4) == 0)
	{
		printf("~PSP header detected, please decompress it.\n");
		return -1;
	}
	// ELF check
	else if(memcmp(elf, "\x7f\x45\x4c\x46", 4) != 0)
	{
		printf("Incorrect file\n");
		return -1;
	}
	else
	{
		printf("ELF detected\n");
	}