Пример #1
0
static void LoadPRG(Stream *fp)
{
 uint32 t;
 unsigned z;

 z = uchead.ID[3] - '0';	// FIXME hex

 if(z > 15)
  throw MDFN_Error(0, "Invalid PRG ROM index '%c'.\n", uchead.ID[3]);

 MDFN_printf(_("PRG ROM %u size: %u\n"), z, uchead.info);

 if(malloced[z])
  free(malloced[z]);

 t = FixRomSize(uchead.info, 2048);

 malloced[z] = (uint8 *)MDFN_malloc_T(t, _("PRG ROM"));
 mallocedsizes[z] = t;
 memset(malloced[z] + uchead.info, 0xFF, t - uchead.info);

 fp->read(malloced[z], uchead.info);

 SetupCartPRGMapping(z,malloced[z],t,0); 
}
Пример #2
0
static int LoadCHR(FCEUFILE *fp)
{
	int z,t;
	z=uchead.ID[3]-'0';
	if(z<0 || z>15)
		return(0);
	FCEU_printf(" CHR ROM %d size: %d",z,(int) uchead.info);
	if(malloced[16+z])
		free(malloced[16+z]);
	t=FixRomSize(uchead.info,8192);
	if(!(malloced[16+z]=(uint8 *)FCEU_malloc(t)))
		return(0);
	mallocedsizes[16+z]=t;
	memset(malloced[16+z]+uchead.info,0xFF,t-uchead.info);
	if(FCEU_fread(malloced[16+z],1,uchead.info,fp)!=uchead.info)
	{
		FCEU_printf("Read Error!\n");
		return(0);
	}
	else
		FCEU_printf("\n");

	SetupCartCHRMapping(z,malloced[16+z],t,0);
	return(1);
}
Пример #3
0
static void LoadCHR(Stream *fp)
{
 uint32 t;
 unsigned z;

 z = uchead.ID[3] - '0';

 if(z > 15)
  throw MDFN_Error(0, "Invalid CHR ROM index '%c'.\n", uchead.ID[3]);

 MDFN_printf(_("CHR ROM %u size: %u\n"), z, uchead.info);

 if(malloced[16 + z])
  delete[] malloced[16 + z];

 t = FixRomSize(uchead.info, 8192);
 malloced[16 + z] = new uint8[t];
 mallocedsizes[16 + z]=t;
 memset(malloced[16 + z] + uchead.info, 0xFF, t - uchead.info);

 fp->read(malloced[16 + z], uchead.info);

 SetupCartCHRMapping(z, malloced[16 + z], t, 0);
}