Ejemplo n.º 1
0
void HuCClose(void)
{
 if(IsPopulous)
 {
  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 6, ROMSpace + 0x40 * 8192, 32768);
 }
 else if(IsBRAMUsed())
 {
  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 0, SaveRAM, 2048);
 }

 if(arcade_card)
 {
  delete arcade_card;
  arcade_card = NULL;
 }

 if(PCE_IsCD)
 {
  PCECD_Close();
 }

 if(HuCROM)
 {
  MDFN_free(HuCROM);
  HuCROM = NULL;
 }
}
Ejemplo n.º 2
0
void HuC_SaveNV(void)
{
 if(IsPopulous)
 {
  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), ROMSpace + 0x40 * 8192, 32768);
 }
 else if(IsBRAMUsed())
 {
  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), SaveRAM, 2048);
 }
}
Ejemplo n.º 3
0
void HuC_DumpSave(void)
{
	if(IsPopulous)
	{
	 MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 6, ROMSpace + 0x40 * 8192, 32768);
	}
	/*else if(IsTsushin && TsushinRAM)
	{
	 MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 6, TsushinRAM, 32768);
	}*/
	else if(IsBRAMUsed())
	{
	 MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 0, SaveRAM, 2048);
	 //MDFN_printf("saving BRAM to %s\n", MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str());
	}
}
Ejemplo n.º 4
0
bool MDFN_DumpToFile(const std::string& path, const void *data, uint64 length, bool throw_on_error)
{
    std::vector<PtrLengthPair> tmp_pairs;

    tmp_pairs.push_back(PtrLengthPair(data, length));

    return MDFN_DumpToFile(path, tmp_pairs, throw_on_error);
}
Ejemplo n.º 5
0
void HuC_Close(void)
{
 if(mcg)
 {
  for(unsigned i = 0; i < mcg->GetNVPDC(); i++)
  {
   uint32 nvs = mcg->GetNVSize(i);

   if(nvs)
   {
    char buf[32];
    std::vector<uint8> tmp_buf;

    tmp_buf.resize(nvs);

    mcg->ReadNV(i, &tmp_buf[0], 0, tmp_buf.size());

    trio_snprintf(buf, sizeof(buf), "mg%d", i);
    MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, buf).c_str(), 6, &tmp_buf[0], tmp_buf.size());
   }
  }
 }

 if(IsPopulous)
 {
  if(PopRAM)
  {
   MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 6, PopRAM, 32768);
  }
 }
 else if(IsTsushin)
 {
  if(TsushinRAM)
  {
   MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 6, TsushinRAM, 32768);
   MDFN_free(TsushinRAM);
   TsushinRAM = NULL;
  }
 }
 else if(!BRAM_Disabled && IsBRAMUsed())
 {
  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 0, SaveRAM, 2048);
 }

 Cleanup();
}
Ejemplo n.º 6
0
bool GBA_EEPROM_SaveFile(const char *filename)
{
 if(eepromInUse)
 {
  if(!MDFN_DumpToFile(filename, 0, eepromData, eepromSize))
   return(0);
 }

 return(1);
}
Ejemplo n.º 7
0
void MDCart_SaveNV(void)
{
 if(cart_hardware->GetNVMemorySize())
 {
  uint8 buf[cart_hardware->GetNVMemorySize()];

  cart_hardware->ReadNVMemory(buf);

  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), buf, sizeof(buf), true);
 }
}
Ejemplo n.º 8
0
void HuC_SaveNV(void)
{
 if(mcg)
 {
  for(unsigned i = 0; i < mcg->GetNVPDC(); i++)
  {
   uint32 nvs = mcg->GetNVSize(i);

   if(nvs)
   {
    char buf[32];

    trio_snprintf(buf, sizeof(buf), "mg%d", i);
    MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, buf), mcg->ReadNV(i), nvs);
   }
  }
 }

 if(IsPopulous)
 {
  if(PopRAM)
  {
   MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), PopRAM, 32768);
  }
 }
 else if(IsTsushin)
 {
  if(TsushinRAM)
  {
   MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), TsushinRAM, 32768);
  }
 }
 else if(!BRAM_Disabled && IsBRAMUsed())
 {
  MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), SaveRAM, 2048);
 }
}
Ejemplo n.º 9
0
int MDFNSS_Save(const char *fname, const char *suffix, const MDFN_Surface *surface, const MDFN_Rect *DisplayRect, const MDFN_Rect *LineWidths)
{
	StateMem st;

	memset(&st, 0, sizeof(StateMem));


	if(!MDFNGameInfo->StateAction)
	{
		MDFN_DispMessage("Module \"%s\" doesn't support save states.", MDFNGameInfo->shortname);
		return(0);
	}

	if(!MDFNSS_SaveSM(&st, 1, 0, surface, DisplayRect, LineWidths))
	{
		if(st.data)
			free(st.data);
		if(!fname && !suffix)
			MDFN_DispMessage("State %d save error.", CurrentState);
		return(0);
	}

	if(!MDFN_DumpToFile(fname ? fname : MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str(), 6, st.data, st.len))
	{
		SaveStateStatus[CurrentState] = 0;
		free(st.data);

		if(!fname && !suffix)
			MDFN_DispMessage("State %d save error.",CurrentState);

		return(0);
	}

	std::string bleh = MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix);
	SaveStateMovie(bleh);

	free(st.data);

	SaveStateStatus[CurrentState] = 1;
	RecentlySavedState = CurrentState;

	if(!fname && !suffix)
		MDFN_DispMessage("State %d saved.",CurrentState);

	return(1);
}
Ejemplo n.º 10
0
int MDFNSS_Save(const char *fname, const char *suffix, uint32 *fb, MDFN_Rect *LineWidths)
{
	StateMem st;

	memset(&st, 0, sizeof(StateMem));

	if(!MDFNSS_SaveSM(&st, 1, 0, fb, LineWidths))
	{
		if(st.data)
			free(st.data);
		if(!fname && !suffix)
			MDFN_DispMessage(_("State %d save error."), CurrentState);
		return(0);
	}

	if(!MDFN_DumpToFile(fname ? fname : MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str(), 6, st.data, st.len))
	{
		SaveStateStatus[CurrentState] = 0;
		free(st.data);

		if(!fname && !suffix)
			MDFN_DispMessage(_("State %d save error."),CurrentState);

		return(0);
	}

	SaveStateMovie((const char*)MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str());

	free(st.data);

	SaveStateStatus[CurrentState] = 1;
	RecentlySavedState = CurrentState;

	if(!fname && !suffix)
		MDFN_DispMessage(_("State %d saved."),CurrentState);

	return(1);
}