コード例 #1
0
ファイル: unif.cpp プロジェクト: glennimoss/marionet
int LoadUNIFChunks(FCEUFILE *fp)
{
	int x;
	int t;
	for(;;)
	{
		t=FCEU_fread(&uchead,1,4,fp);
		if(t<4)
		{
			if(t>0)
				return 0;
			return 1;
		}
		if(!(FCEU_read32le(&uchead.info,fp)))
			return 0;
		t=0;
		x=0;
		//printf("Funky: %s\n",((uint8 *)&uchead));
		while(bfunc[x].name)
		{
			if(!memcmp(&uchead,bfunc[x].name,strlen(bfunc[x].name)))
			{
				if(!bfunc[x].init(fp))
					return 0;
				t=1;
				break;
			}
			x++;
		}
		if(!t)
			if(FCEU_fseek(fp,uchead.info,SEEK_CUR)<0)
				return(0);
	}
}
コード例 #2
0
ファイル: unif.cpp プロジェクト: buliaoyin/fce360
int UNIFLoad(const char *name, FCEUFILE *fp)
{
	FCEU_fseek(fp,0,SEEK_SET);
	FCEU_fread(&unhead,1,4,fp);
	if(memcmp(&unhead,"UNIF",4))
		return 0;

	ResetCartMapping();

	ResetExState(0,0);
	ResetUNIF();
	if(!FCEU_read32le(&unhead.info,fp))
		goto aborto;
	if(FCEU_fseek(fp,0x20,SEEK_SET)<0)
		goto aborto;
	if(!LoadUNIFChunks(fp))
		goto aborto;
	{
		int x;
		struct md5_context md5;

		md5_starts(&md5);

		for(x=0;x<32;x++)
			if(malloced[x])
			{
				md5_update(&md5,malloced[x],mallocedsizes[x]);
			}
			md5_finish(&md5,UNIFCart.MD5);
			FCEU_printf(" ROM MD5:  0x");
			for(x=0;x<16;x++)
				FCEU_printf("%02x",UNIFCart.MD5[x]);
			FCEU_printf("\n");
			memcpy(&GameInfo->MD5,&UNIFCart.MD5,sizeof(UNIFCart.MD5));
	}

	if(!InitializeBoard())
		goto aborto;

	#if !defined(GEKKO)|| !defined(_XBOX)
	FCEU_LoadGameSave(&UNIFCart);
	#endif

	strcpy(LoadedRomFName,name); //For the debugger list
	GameInterface=UNIFGI;
	return 1;

aborto:

	FreeUNIF();
	ResetUNIF();


	return 0;
}
コード例 #3
0
ファイル: unif.c プロジェクト: CatalystG/fceu-next
int UNIFLoad(const char *name, FCEUFILE *fp) {
	FCEU_fseek(fp, 0, SEEK_SET);
	FCEU_fread(&unhead, 1, 4, fp);
	if (memcmp(&unhead, "UNIF", 4))
		return 0;

	ResetCartMapping();

	ResetExState(0, 0);
	ResetUNIF();
	if (!FCEU_read32le(&unhead.info, fp))
		goto aborto;
	if (FCEU_fseek(fp, 0x20, SEEK_SET) < 0)
		goto aborto;
	if (!LoadUNIFChunks(fp))
		goto aborto;
	{
		int x;
		struct md5_context md5;

		md5_starts(&md5);

		for (x = 0; x < 32; x++)
			if (malloced[x]) {
				md5_update(&md5, malloced[x], mallocedsizes[x]);
			}
		md5_finish(&md5, UNIFCart.MD5);
		FCEU_printf(" ROM MD5:  0x%s\n", md5_asciistr(UNIFCart.MD5));
		memcpy(FCEUGameInfo->MD5, UNIFCart.MD5, sizeof(UNIFCart.MD5));
	}

	if (!InitializeBoard())
		goto aborto;

	FCEU_LoadGameSave(&UNIFCart);
	GameInterface = UNIFGI;
	return 1;

 aborto:

	FreeUNIF();
	ResetUNIF();
	return 0;
}