Esempio n. 1
0
static MDFN_COLD void Load(MDFNFILE *fp)
{
 try
 {
  uint8 hes_header[4];

  const bool IsHES = false;
  IsSGX = false;

  fp->read(hes_header, 4);
  fp->seek(0, SEEK_SET);

  /*if(!memcmp(hes_header, "HESM", 4))
   IsHES = true;*/

  LoadCommonPre();

  for(int x = 0; x < 0x100; x++)
  {
   HuCPU.PCERead[x] = PCEBusRead;
   HuCPU.PCEWrite[x] = PCENullWrite;
  }

  if(IsHES)
   HES_Load(fp);
  else
  {
   uint32 crc;

   crc = HuC_Load(fp);

   if(fp->ext == "sgx")
    IsSGX = true;
   else
   {
    for(auto const& e : sgx_table)
    {
     if(e.crc == crc)
     {
      IsSGX = true;
      MDFN_printf(_("SuperGrafx: %s\n"), e.name);
      break;
     }
    }
   }
  }

  LoadCommon();
 }
 catch(...)
 {
  Cleanup();
  throw;
 }
}
Esempio n. 2
0
void V4SceneManager::LoadNew() 
{
	LoadCommon();
	
	/* Create a BIFS stream with one AU with one ReplaceScene */
	GF_StreamContext *sc = gf_sm_stream_new(m_pSm, 1, GF_STREAM_SCENE, 0);
	GF_AUContext *au = gf_sm_stream_au_new(sc, 0, 0, 1);
	GF_Command *command = gf_sg_command_new(m_pIs->graph, GF_SG_SCENE_REPLACE);
	gf_list_add(au->commands, command);

	SetLength(50);
	SetFrameRate(25);

	// reinitializes the node pool
	pools.Clear();
}
Esempio n. 3
0
void V4SceneManager::LoadFile(const char *path) 
{	
	LoadCommon();
	GF_Terminal *term = m_gpac_panel->GetMPEG4Terminal();

	/* Loading of a file (BT, MP4 ...) and modification of the SceneManager */
	GF_SceneLoader load;
	memset(&load, 0, sizeof(GF_SceneLoader));
	load.fileName = path;
	load.ctx = m_pSm;
	if (strstr(path, ".mp4") || strstr(path, ".MP4") ) load.isom = gf_isom_open(path, GF_ISOM_OPEN_READ, NULL);
	gf_sm_load_init(&load);
	gf_sm_load_run(&load);
	gf_sm_load_done(&load);
	if (load.isom) gf_isom_delete(load.isom);

	/* SceneManager should be initialized  and filled correctly */

	gf_sg_set_scene_size_info(m_pIs->graph, m_pSm->scene_width, m_pSm->scene_height, m_pSm->is_pixel_metrics);

	// TODO : replace with GetBifsStream
	GF_StreamContext *sc = (GF_StreamContext *) gf_list_get(m_pSm->streams,0);

	if (sc->streamType == 3) {
		GF_AUContext *au = (GF_AUContext *) gf_list_get(sc->AUs,0);
		GF_Command *c = (GF_Command *) gf_list_get(au->commands,0);
		//gf_sg_command_apply(m_pIs->graph, c, 0);
		/* This is a patch to solve the save pb:
		    When ApplyCommand is made on a Scene Replace Command
		    The command node is set to NULL
		    When we save a BIFS stream whose first command is of this kind,
		    the file saver thinks the bifs commands should come from an NHNT file 
		   This is a temporary patch */
		if (c->tag == GF_SG_SCENE_REPLACE) { c->node = m_pIs->graph->RootNode; }
	}

	gf_sc_set_scene(term->compositor, m_pIs->graph);
	m_pIs->graph_attached = 1;

	// TODO : read actual values from file
	SetLength(50);
	SetFrameRate(25);

	// retrieves all the node from the tree and adds them to the node pool
	GF_Node * root = gf_sg_get_root_node(m_pIs->graph);
//	CreateDictionnary();
}
Esempio n. 4
0
static int LoadCD(std::vector<CDIF *> *CDInterfaces)
{
 std::string bios_path = MDFN_MakeFName(MDFNMKF_FIRMWARE, 0, MDFN_GetSettingS("pce_fast.cdbios").c_str() );

 //IsHES = 0;
 IsSGX = 0;

 LoadCommonPre();

 if(!HuCLoadCD(bios_path.c_str()))
  return(0);

 SCSICD_SetDisc(true, NULL, true);
 SCSICD_SetDisc(false, (*CDInterfaces)[0], true);

 return(LoadCommon());
}
Esempio n. 5
0
static MDFN_COLD void LoadCD(std::vector<CDIF *> *CDInterfaces)
{
 try
 {
	 std::string bios_path = MDFN_MakeFName(MDFNMKF_FIRMWARE, 0, MDFN_GetSettingS("pce_fast.cdbios"));

	 //IsHES = 0;
	 IsSGX = 0;

	 LoadCommonPre();

	 HuC_LoadCD(bios_path.c_str());

	 cdifs = CDInterfaces;
	 PCECD_Drive_SetDisc(true, NULL, true);

	 LoadCommon();
 }
 catch(...)
 {
	 Cleanup();
	 throw;
 }
}
Esempio n. 6
0
bool CPDF_TrueTypeFont::Load() {
  return LoadCommon();
}
Esempio n. 7
0
static void LoadGG(MDFNFILE *fp)
{
 sms.console = CONSOLE_GG;

 LoadCommon(fp);
}
Esempio n. 8
0
static void LoadSMS(MDFNFILE *fp)
{
 sms.console = CONSOLE_SMS;

 LoadCommon(fp);
}
Esempio n. 9
0
static int Load(const char *name, MDFNFILE *fp)
{
 uint32 headerlen = 0;
 uint32 r_size;

 //IsHES = 0;
 IsSGX = 0;

 /*if(!memcmp(fp->data, "HESM", 4))
  IsHES = 1;*/

 LoadCommonPre();

 if(!IsHES)
 {
  if(fp->size & 0x200) // 512 byte header!
   headerlen = 512;
 }

 r_size = fp->size - headerlen;
 if(r_size > 4096 * 1024) r_size = 4096 * 1024;

 for(int x = 0; x < 0x100; x++)
 {
  PCERead[x] = PCEBusRead;
  PCEWrite[x] = PCENullWrite;
 }

 uint32 crc = crc32(0, fp->data + headerlen, fp->size - headerlen);


 if(IsHES)
 {
  if(!PCE_HESLoad(fp->data, fp->size))
   return(0);
 }
 else
  HuCLoad(fp->data + headerlen, fp->size - headerlen, crc);

 if(!strcasecmp(fp->ext, "sgx"))
  IsSGX = TRUE;

 if(fp->size >= 8192 && !memcmp(fp->data + headerlen, "DARIUS Version 1.11b", strlen("DARIUS VERSION 1.11b")))
 {
  MDFN_printf("SuperGfx:  Darius Plus\n");
  IsSGX = 1;
 }

 if(crc == 0x4c2126b0)
 {
  MDFN_printf("SuperGfx:  Aldynes\n");
  IsSGX = 1;
 }

 if(crc == 0x8c4588e2)
 {
  MDFN_printf("SuperGfx:  1941 - Counter Attack\n");
  IsSGX = 1;
 }
 if(crc == 0x1f041166)
 {
  MDFN_printf("SuperGfx:  Madouou Granzort\n");
  IsSGX = 1;
 }
 if(crc == 0xb486a8ed)
 {
  MDFN_printf("SuperGfx:  Daimakaimura\n");
  IsSGX = 1;
 }
 if(crc == 0x3b13af61)
 {
  MDFN_printf("SuperGfx:  Battle Ace\n");
  IsSGX = 1;
 }

 return(LoadCommon());
}
Esempio n. 10
0
static int LoadGG(MDFNFILE *fp)
{
 sms.console = CONSOLE_GG;

 return(LoadCommon(fp));
}
Esempio n. 11
0
static int LoadSMS(MDFNFILE *fp)
{
 sms.console = CONSOLE_SMS;

 return(LoadCommon(fp));
}