示例#1
0
int main()
{
	irqInit();
	fifoInit();

	readUserSettings();
	initClockIRQ();

	SetYtrigger(80);

	installSystemFIFO();

	irqSet(IRQ_VCOUNT, VCountHandler);
	irqSet(IRQ_VBLANK, 0);
	irqEnable(IRQ_VBLANK|IRQ_VCOUNT|IRQ_NETWORK);

	powerOn(POWER_SOUND);
	REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(127);

	static Player oPlayer;
	Player_Init(& oPlayer);

	while ( 1 )
	{
		swiWaitForVBlank();

		Player_Execute(& oPlayer);
	}

	return 0;
}
示例#2
0
// *************************** Capture image dimensions out of BMP**********
int main(void){
  TExaS_Init(SSI0_Real_Nokia5110_Scope);  // set system clock to 80 MHz
  Random_Init(69);
  Output_Init();
	ADC0_Init();
	ST7735_InvertDisplay(0);
	ST7735_SetRotation(0);
	AI_Init(0x07);
	Player_Init();
	player.potato=1;
	
	Timer0_Init(Master_Funk,  30);

  ST7735_DrawBitmap(53, 151, Bunker0, 18,5);
//	Delay100ms(1);              // delay 5 sec at 80 MHz

 /* ST7735_FillScreen(0x0000);            // set screen to black
  ST7735_SetCursor(1, 1);
  ST7735_OutString("GAME OVER");
  ST7735_SetCursor(1, 2);
  ST7735_OutString("Nice try,");
  ST7735_SetCursor(1, 3);
  ST7735_OutString("Earthling!");
  ST7735_SetCursor(2, 4);
  LCD_OutDec(1234);	 */
  while(1){							
  } 
}
示例#3
0
static void Load(MDFNFILE* fp)
{
 try
 {
  std::vector<std::string> SongNames;

  ssf_loader = new SSFLoader(fp->stream());

  SongNames.push_back(ssf_loader->tags.GetTag("title"));
  Player_Init(1, ssf_loader->tags.GetTag("game"), ssf_loader->tags.GetTag("artist"), ssf_loader->tags.GetTag("copyright"), SongNames, false);

  SOUND_Init();

  EmulatedSSFPlay.fps = 75 * 65536 * 256;
  EmulatedSSFPlay.MasterClock = MDFN_MASTERCLOCK_FIXED(44100 * 256);

  Reset();
 }
 catch(...)
 {
  Cleanup();
  throw;
 }
}
示例#4
0
/* Loads a module given an reader */
MODULE* Player_LoadGeneric_internal(MREADER *reader,int maxchan,BOOL curious)
{
	int t;
	MLOADER *l;
	BOOL ok;
	MODULE *mf;

	modreader = reader;
	_mm_errno = 0;
	_mm_critical = 0;
	_mm_iobase_setcur(modreader);

	/* Try to find a loader that recognizes the module */
	for(l=firstloader;l;l=l->next) {
		_mm_rewind(modreader);
		if(l->Test()) break;
	}

	if(!l) {
		_mm_errno = MMERR_NOT_A_MODULE;
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	/* init unitrk routines */
	if(!UniInit()) {
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	/* init the module structure with vanilla settings */
	memset(&of,0,sizeof(MODULE));
	of.bpmlimit = 33;
	of.initvolume = 128;
	for (t = 0; t < UF_MAXCHAN; t++) of.chanvol[t] = 64;
	for (t = 0; t < UF_MAXCHAN; t++)
		of.panning[t] = ((t + 1) & 2) ? PAN_RIGHT : PAN_LEFT;

	/* init module loader and load the header / patterns */
	if (!l->Init || l->Init()) {
		_mm_rewind(modreader);
		ok = l->Load(curious);
		/* propagate inflags=flags for in-module samples */
		for (t = 0; t < of.numsmp; t++)
			if (of.samples[t].inflags == 0)
				of.samples[t].inflags = of.samples[t].flags;
	} else
		ok = 0;

	/* free loader and unitrk allocations */
	if (l->Cleanup) l->Cleanup();
	UniCleanup();

	if(!ok) {
		ML_FreeEx(&of);
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	if(!ML_LoadSamples()) {
		ML_FreeEx(&of);
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	if(!(mf=ML_AllocUniMod())) {
		ML_FreeEx(&of);
		_mm_rewind(modreader);_mm_iobase_revert();
		if(_mm_errorhandler) _mm_errorhandler();
		return NULL;
	}
	
	/* If the module doesn't have any specific panning, create a
	   MOD-like panning, with the channels half-separated. */
	if (!(of.flags & UF_PANNING))
		for (t = 0; t < of.numchn; t++)
			of.panning[t] = ((t + 1) & 2) ? PAN_HALFRIGHT : PAN_HALFLEFT;

	/* Copy the static MODULE contents into the dynamic MODULE struct. */
	memcpy(mf,&of,sizeof(MODULE));

	if(maxchan>0) {
		if(!(mf->flags&UF_NNA)&&(mf->numchn<maxchan))
			maxchan = mf->numchn;
		else
		  if((mf->numvoices)&&(mf->numvoices<maxchan))
			maxchan = mf->numvoices;

		if(maxchan<mf->numchn) mf->flags |= UF_NNA;

		if(MikMod_SetNumVoices_internal(maxchan,-1)) {
			_mm_iobase_revert();
			Player_Free(mf);
			return NULL;
		}
	}
	if(SL_LoadSamples()) {
		_mm_iobase_revert();
		Player_Free_internal(mf);
		return NULL;
	}
	if(Player_Init(mf)) {
		_mm_iobase_revert();
		Player_Free_internal(mf);
		mf=NULL;
	}
	_mm_iobase_revert();
	return mf;
}
示例#5
0
/* Loads a module given an reader */
MODULE* Player_LoadGeneric_internal(MREADER *reader,int maxchan,BOOL curious)
{
	int t;
	MLOADER *l;
	BOOL ok;
	MODULE *mf;

	modreader = reader;
	_mm_errno = 0;
	_mm_critical = 0;
	_mm_iobase_setcur(modreader);

	/* Try to find a loader that recognizes the module */
	for(l=firstloader;l;l=l->next) {
		_mm_rewind(modreader);
		if(l->Test()) break;
	}

	if(!l) {
		_mm_errno = MMERR_NOT_A_MODULE;
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	/* init unitrk routines */
	if(!UniInit()) {
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	/* load the song using the song's loader variable */
	memset(&of,0,sizeof(MODULE));
	of.initvolume = 128;

	/* init panning array */
	for(t=0; t<64; t++) of.panning[t] = ((t+1)&2) ? 255 : 0;
	for(t=0; t<64; t++) of.chanvol[t] = 64;

	/* init module loader and load the header / patterns */
	if(l->Init()) {
		_mm_rewind(modreader);
		ok = l->Load(curious);
	} else
		ok = 0;

	/* free loader and unitrk allocations */
	l->Cleanup();
	UniCleanup();

	if(!ok) {
		ML_FreeEx(&of);
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	if(!ML_LoadSamples()) {
		ML_FreeEx(&of);
		if(_mm_errorhandler) _mm_errorhandler();
		_mm_rewind(modreader);_mm_iobase_revert();
		return NULL;
	}

	if(!(mf=ML_AllocUniMod())) {
		ML_FreeEx(&of);
		_mm_rewind(modreader);_mm_iobase_revert();
		if(_mm_errorhandler) _mm_errorhandler();
		return NULL;
	}

	/* Copy the static MODULE contents into the dynamic MODULE struct. */
	memcpy(mf,&of,sizeof(MODULE));
	_mm_iobase_revert();

	if(maxchan>0) {
		if(!(mf->flags&UF_NNA)&&(mf->numchn<maxchan))
			maxchan = mf->numchn;
		else
		  if((mf->numvoices)&&(mf->numvoices<maxchan))
			maxchan = mf->numvoices;

		if(maxchan<mf->numchn) mf->flags |= UF_NNA;

		if(MikMod_SetNumVoices_internal(maxchan,-1)) {
			Player_Free(mf);
			return NULL;
		}
	}
	if(SL_LoadSamples()) {
		Player_Free_internal(mf);
		return NULL;
	}
	if(Player_Init(mf)) {
		Player_Free_internal(mf);
		mf=NULL;
	}
	return mf;
}
示例#6
0
文件: hes.cpp 项目: gammy/wiimednafen
int PCE_HESLoad(const uint8 *buf, uint32 size)
{
 uint32 LoadAddr, LoadSize;
 uint32 CurPos;
 uint16 InitAddr;
 uint8 StartingSong;
 int TotalSongs;

 InitAddr = MDFN_de16lsb(&buf[0x6]);

 CurPos = 0x10;
 
 if(!(rom = (uint8 *)MDFN_malloc(0x88 * 8192, _("HES ROM"))))
 {
  return(0);
 }

 if(!(rom_backup = (uint8 *)MDFN_malloc(0x88 * 8192, _("HES ROM"))))
 {
  return(0);
 }

 memset(rom, 0, 0x88 * 8192);
 memset(rom_backup, 0, 0x88 * 8192);

 while(CurPos < (size - 0x10))
 {
  LoadSize = MDFN_de32lsb(&buf[CurPos + 0x4]);
  LoadAddr = MDFN_de32lsb(&buf[CurPos + 0x8]);

  //printf("Size: %08x(%d), Addr: %08x, La: %02x\n", LoadSize, LoadSize, LoadAddr, LoadAddr / 8192);

  CurPos += 0x10;

  if(((uint64)LoadSize + CurPos) > size)
  {
   uint32 NewLoadSize = size - CurPos;

   MDFN_printf(_("Warning:  HES is trying to load more data than is present in the file(%u attempted, %u left)!\n"), LoadSize, NewLoadSize);

   LoadSize = NewLoadSize;
  }

  // 0x88 * 8192 = 0x110000
  if(((uint64)LoadAddr + LoadSize) > 0x110000)
  {
   MDFN_printf(_("Warning:  HES is trying to load data past boundary.\n"));

   if(LoadAddr >= 0x110000)
    break;

   LoadSize = 0x110000 - LoadAddr;
  }

  memcpy(rom + LoadAddr, &buf[CurPos], LoadSize);
  CurPos += LoadSize;
 }

 for(int x = 0; x < 8; x++)
  mpr_start[x] = buf[0x8 + x];

 memcpy(rom_backup, rom, 0x88 * 8192);

 CurrentSong = StartingSong = buf[5];
 TotalSongs = 256;

 memset(IBP_Bank, 0, 0x2000);

 uint8 *IBP_WR = IBP_Bank + 0x1C00;

 for(int i = 0; i < 8; i++)
 {
  *IBP_WR++ = 0xA9;             // LDA (immediate)
  *IBP_WR++ = mpr_start[i];
  *IBP_WR++ = 0x53;             // TAM
  *IBP_WR++ = 1 << i;
 }

 *IBP_WR++ = 0xAD;              // LDA(absolute)
 *IBP_WR++ = 0x00;              //
 *IBP_WR++ = 0x1D;              //
 *IBP_WR++ = 0x20;               // JSR
 *IBP_WR++ = InitAddr;           //  JSR target LSB
 *IBP_WR++ = InitAddr >> 8;      //  JSR target MSB
 *IBP_WR++ = 0x58;               // CLI
 *IBP_WR++ = 0xFC;               // (Mednafen Special)
 *IBP_WR++ = 0x80;               // BRA
 *IBP_WR++ = 0xFD;               //  -3

 Player_Init(TotalSongs, NULL, NULL, NULL, NULL); //UTF8 **snames);

 for(int x = 0; x < 0x80; x++)
 {
  HuCPUFastMap[x] = rom;
  PCERead[x] = HESROMRead;
  PCEWrite[x] = HESROMWrite;
 }

 HuCPUFastMap[0xFF] = IBP_Bank - (0xFF * 8192);

 // FIXME:  If a HES rip tries to execute a SCSI command, the CD emulation code will probably crash.  Obviously, a HES rip shouldn't do this,
 // but Mednafen shouldn't crash either. ;)
 PCE_IsCD = 1;
 PCE_InitCD();

 ROMWriteWarningGiven = FALSE;

 return(1);
}
/**************************************************************
 *  Name                 : periodic_tasks_init_SysDrvs
 *  Description          : Initialize needed system drivers (system elements) before start application
 *  Parameters           : none
 *  Return               : none
 *  Critical/explanation : no
 **************************************************************/
void periodic_tasks_init_SysDrvs(void)
{
	init_leds();
	//InitButtons();
	Player_Init();
}
示例#8
0
void NSFLoad(Stream *fp, NESGameType *gt)
{
 try
 {
  char magic[5];
  int x;

  NSFInfo = new NSFINFO();

  fp->rewind();
  fp->read(magic, 5);

  if(!memcmp(magic, "NESM\x1a", 5))
  {
   fp->rewind();
   LoadNSF(fp);
  }
  else if(!memcmp(magic, "NSFE", 4))
  {
   fp->rewind();
   LoadNSFE(NSFInfo, fp, 0);
  }

  if(NSFInfo->LoadAddr < 0x6000)
   throw MDFN_Error(0, _("Load address is invalid!"));

  if(NSFInfo->TotalSongs < 1)
   throw MDFN_Error(0, _("Total number of songs is less than 1!"));

  BSon = 0;
  for(x=0;x<8;x++)
   BSon |= NSFInfo->BankSwitch[x];

  MDFNGameInfo->GameType = GMT_PLAYER;

  if(NSFInfo->GameName.size())
   MDFNGameInfo->name = NSFInfo->GameName;

  for(x=0;;x++)
  {
   if(NSFROM[x]==0x20)
   {
    NSFROM[x+1]=NSFInfo->InitAddr&0xFF;
    NSFROM[x+2]=NSFInfo->InitAddr>>8;
    NSFROM[x+8]=NSFInfo->PlayAddr&0xFF;
    NSFROM[x+9]=NSFInfo->PlayAddr>>8;
    break;
   }
  }

  if(NSFInfo->VideoSystem == 0)
   MDFNGameInfo->VideoSystem = VIDSYS_NTSC;
  else if(NSFInfo->VideoSystem == 1)
   MDFNGameInfo->VideoSystem = VIDSYS_PAL;

  MDFN_printf(_("NSF Loaded.  File information:\n\n"));
  MDFN_indent(1);
  if(NSFInfo->GameName.size())
   MDFN_printf(_("Game/Album Name:\t%s\n"), NSFInfo->GameName.c_str());
  if(NSFInfo->Artist.size())
   MDFN_printf(_("Music Artist:\t%s\n"), NSFInfo->Artist.c_str());
  if(NSFInfo->Copyright.size())
   MDFN_printf(_("Copyright:\t\t%s\n"), NSFInfo->Copyright.c_str());
  if(NSFInfo->Ripper.size())
   MDFN_printf(_("Ripper:\t\t%s\n"), NSFInfo->Ripper.c_str());

  if(NSFInfo->SoundChip)
  {
   static const char *tab[6]={"Konami VRCVI","Konami VRCVII","Nintendo FDS","Nintendo MMC5","Namco 106","Sunsoft FME-07"};

   for(x=0;x<6;x++)
    if(NSFInfo->SoundChip&(1<<x))
    {
     MDFN_printf(_("Expansion hardware:  %s\n"), tab[x]);
     //NSFInfo->SoundChip=1<<x;	/* Prevent confusing weirdness if more than one bit is set. */
     //break;
    }
  }

  if(BSon)
   MDFN_printf(_("Bank-switched\n"));
  MDFN_printf(_("Load address:  $%04x\nInit address:  $%04x\nPlay address:  $%04x\n"),NSFInfo->LoadAddr,NSFInfo->InitAddr,NSFInfo->PlayAddr);
  MDFN_printf("%s\n",(NSFInfo->VideoSystem&1)?"PAL":"NTSC");
  MDFN_printf(_("Starting song:  %d / %d\n\n"),NSFInfo->StartingSong + 1,NSFInfo->TotalSongs);

  if(NSFInfo->SoundChip&4)
   ExWRAM = new uint8[32768+8192];
  else
   ExWRAM = new uint8[8192];

  MDFN_indent(-1);

  gt->Power = NSF_Power;
  gt->Reset = NSF_Reset;
  gt->SaveNV = NULL;
  gt->Kill = NSF_Kill;
  gt->StateAction = NSF_StateAction;

  Player_Init(NSFInfo->TotalSongs, NSFInfo->GameName, NSFInfo->Artist, NSFInfo->Copyright, NSFInfo->SongNames);

  MDFNGameInfo->DesiredInput.push_back("gamepad");
  MDFNGameInfo->DesiredInput.push_back("none");
  MDFNGameInfo->DesiredInput.push_back("none");
  MDFNGameInfo->DesiredInput.push_back("none");
  MDFNGameInfo->DesiredInput.push_back("none");
 }
示例#9
0
static int Load(const char *name, MDFNFILE *fp)
{
 uint32 real_rom_size;

 if(fp->size < 65536)
 {
  MDFN_PrintError(_("%s ROM image is too small."), MDFNGameInfo->fullname);
  return(0);
 }

 if(!memcmp(fp->data + fp->size - 0x20, "WSRF", 4))
 {
  const uint8 *wsr_footer = fp->data + fp->size - 0x20;

  IsWSR = TRUE;
  WSRCurrentSong = wsr_footer[0x5];

  Player_Init(256, "", "", "");
 }
 else
  IsWSR = false;

 real_rom_size = (fp->size + 0xFFFF) & ~0xFFFF;
 rom_size = round_up_pow2(real_rom_size); //fp->size);

 wsCartROM = (uint8 *)calloc(1, rom_size);


 // This real_rom_size vs rom_size funny business is intended primarily for handling
 // WSR files.
 if(real_rom_size < rom_size)
  memset(wsCartROM, 0xFF, rom_size - real_rom_size);

 memcpy(wsCartROM + (rom_size - real_rom_size), fp->data, fp->size);

 MDFN_printf(_("ROM:       %dKiB\n"), real_rom_size / 1024);
 md5_context md5;
 md5.starts();
 md5.update(wsCartROM, rom_size);
 md5.finish(MDFNGameInfo->MD5);
 MDFN_printf(_("ROM MD5:   0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());

 uint8 header[10];
 memcpy(header, wsCartROM + rom_size - 10, 10);

 {
  const char *developer_name = "???";
  for(unsigned int x = 0; x < sizeof(Developers) / sizeof(DLEntry); x++)
  {
   if(Developers[x].id == header[0])
   {
    developer_name = Developers[x].name;
    break;
   }
  }
  MDFN_printf(_("Developer: %s (0x%02x)\n"), developer_name, header[0]);
 }

 uint32 SRAMSize = 0;
 eeprom_size = 0;

 switch(header[5])
 {
  case 0x01: SRAMSize = 8*1024; break;
  case 0x02: SRAMSize = 32*1024; break;
  case 0x03: SRAMSize = 16 * 65536; break;
  case 0x04: SRAMSize = 32 * 65536; break; // Dicing Knight!

  case 0x10: eeprom_size = 128; break;
  case 0x20: eeprom_size = 2*1024; break;
  case 0x50: eeprom_size = 1024; break;
 }

 //printf("%02x\n", header[5]);

 if(eeprom_size)
  MDFN_printf(_("EEPROM:  %d bytes\n"), eeprom_size);

 if(SRAMSize)
  MDFN_printf(_("Battery-backed RAM:  %d bytes\n"), SRAMSize);

 MDFN_printf(_("Recorded Checksum:  0x%04x\n"), header[8] | (header[9] << 8));
 {
  uint16 real_crc = 0;
  for(unsigned int i = 0; i < rom_size - 2; i++)
   real_crc += wsCartROM[i];
  MDFN_printf(_("Real Checksum:      0x%04x\n"), real_crc);
 }

 if((header[8] | (header[9] << 8)) == 0x8de1 && (header[0]==0x01)&&(header[2]==0x27)) /* Detective Conan */
 {
  //puts("HAX");
  /* WS cpu is using cache/pipeline or there's protected ROM bank where pointing CS */
  wsCartROM[0xfffe8]=0xea;
  wsCartROM[0xfffe9]=0x00;
  wsCartROM[0xfffea]=0x00;
  wsCartROM[0xfffeb]=0x00;
  wsCartROM[0xfffec]=0x20;
 }

 if(!IsWSR)
 {
  if(header[6] & 0x1)
   MDFNGameInfo->rotated = MDFN_ROTATE90;
 }

 MDFNMP_Init(16384, (1 << 20) / 1024);

 #ifdef WANT_DEBUGGER
 WSwanDBG_Init();
 #endif

 v30mz_init(WSwan_readmem20, WSwan_writemem20, WSwan_readport, WSwan_writeport);
 WSwan_MemoryInit(MDFN_GetSettingB("wswan.language"), wsc, SRAMSize, IsWSR); // EEPROM and SRAM are loaded in this func.
 WSwan_GfxInit();
 MDFNGameInfo->fps = (uint32)((uint64)3072000 * 65536 * 256 / (159*256));
 MDFNGameInfo->GameSetMD5Valid = FALSE;

 WSwan_SoundInit();

 wsMakeTiles();

 Reset();

 return(1);
}
 /*
  * Class:     com_ericsson_lispmediaplayer_Player
  * Method:    playerInit
  * Signature: ()I
  */
 JNIEXPORT jint JNICALL Java_com_ericsson_lispmediaplayer_Player_playerInit
 (JNIEnv *env, jobject object)
 {
     return Player_Init();
 }
示例#11
0
int deviceInit(config_parameters *parms, DeviceHandle *handle)
{
    static struct timespec lockStatusWaitTime;
    static struct timeval now;
    int i;
    uint32_t freqHz = parms->frequency*MHZ;
    /*Initialize tuner device*/
    if (Tuner_Init())
    {
        printf("\n%s : ERROR Tuner_Init() fail\n", __FUNCTION__);
        return -1;
    }

    // printf("%s: after Tuner_Init\n", __FUNCTION__);
    /* Register tuner status callback */
    gettimeofday(&now, NULL);
    lockStatusWaitTime.tv_sec = now.tv_sec + 10;
    if (Tuner_Register_Status_Callback(tunerStatusCallback))
    {
        printf("\n%s : ERROR Tuner_Register_Status_Callback() fail\n", __FUNCTION__);
    }
    // printf("%s: After Tuner_Register_Status_Callback(tunerStatusCallback) %u\n", __FUNCTION__, freqHz);
    /*Lock to frequency*/
    if (!Tuner_Lock_To_Frequency(freqHz, parms->bandwidth, parms->module))
    {
        printf("\n%s: INFO Tuner_Lock_To_Frequency(): %u Hz - success!\n", __FUNCTION__, freqHz);
    }
    else
    {
        printf("\n%s: ERROR Tuner_Lock_To_Frequency(): %u Hz - fail!\n", __FUNCTION__, freqHz);
        Tuner_Deinit();
        return -1;
    }
    /* Wait for tuner to lock*/
    pthread_mutex_lock(&statusMutex);
    if (ETIMEDOUT == pthread_cond_timedwait(&statusCondition, &statusMutex, &lockStatusWaitTime))
    {
        printf("\n%s:ERROR Lock timeout exceeded!\n", __FUNCTION__);
        Tuner_Deinit();
        return -1;
    }
    pthread_mutex_unlock(&statusMutex);
    //  printf("%s: Tuner locked\n", __FUNCTION__);


    if (Player_Init(&(handle->playerHandle)))
    {
        Tuner_Deinit();
        return -1;
    }
    //printf("%s: Player inited\n", __FUNCTION__);

    if (Player_Source_Open(handle->playerHandle, &(handle->sourceHandle)))
    {
        Player_Deinit(handle->playerHandle);
        Tuner_Deinit();
        return -1;
    }
    //printf("%s: Player_Source_Open\n", __FUNCTION__);

    if (Player_Stream_Create(handle->playerHandle, handle->sourceHandle, parms->vPid, parms->vType, &(handle->vStreamHandle)))
    {
        printf("%s Player_Source_Open failed", __FUNCTION__);
        Player_Source_Close(handle->playerHandle, handle->sourceHandle);
        Player_Deinit(handle->playerHandle);
        Tuner_Deinit();
        return ERROR;
    }
    if (Player_Stream_Create(handle->playerHandle, handle->sourceHandle, parms->aPid, parms->aType, &(handle->aStreamHandle)))
    {
        printf("%s Player_Source_Open failed", __FUNCTION__);
        Player_Source_Close(handle->playerHandle, handle->sourceHandle);
        Player_Deinit(handle->playerHandle);
        Tuner_Deinit();
        return ERROR;
    }
    else
    {
        printf("%s audio opened", __FUNCTION__);
    }
    //   printf("Audio %d %d \n", parms->aPid, parms->aType);
    //  printf("Video %d %d \n", parms->vPid, parms->vType);
    apid = parms->aPid;
    vpid = parms->vPid;
    //printf("%s: Player_Stream_Create\n", __FUNCTION__);
    drawTextInfo(1, vpid, apid, 1);
    drawTextInfo(1, vpid, apid, 1);
    if (initPatParsing(handle) != NO_ERROR)
    {
        return ERROR;
    }

    pmtTable = (PmtTable**) malloc(patTable->serviceInfoCount * sizeof (PmtTable*));
    for (i = 1; i < patTable->serviceInfoCount; i++)
    {
        indicator = i;
        pmtTable[i] = (PmtTable*) malloc(sizeof (PmtTable));
        pmtTable[i]->pmtHeader = (PmtHeader*) malloc(sizeof (PmtHeader));
        //  printf("pmt table %d\n", i);
        if (initPmtParsing(handle, patTable->patServiceInfoArray[i].pid) != NO_ERROR)
        {
            deviceDeInit(handle);
            return ERROR;
        }
    }
    //initEitParsing(handle);
    globHandle = handle;
    parsedTag = 1;
    return NO_ERROR;
}
示例#12
0
bool_t Context_Init(const tchar_t* Name,const tchar_t* Version,int Id,const tchar_t* CmdLine,void* Application)
{
	context* p = malloc(sizeof(context));
	if (!p) return 0;

#ifdef PREALLOC
	{ int i; for (i=0;i<PREALLOC;++i) q[i] = malloc(65536); }
#endif

	memset(p,0,sizeof(context));
	p->Version = CONTEXT_VERSION;
	p->ProgramId = Id;
	p->ProgramName = Name;
	p->ProgramVersion = Version;
	p->CmdLine = CmdLine;
	p->Lang = DefaultLang();
	p->StartUpMemory = AvailMemory();
	p->LowMemory = p->StartUpMemory < LOWMEMORY_LIMIT;
	p->Application = Application;

	SetContext(p);

	Mem_Init();
	DynCode_Init();
	String_Init();
	PCM_Init();
	Blit_Init();
	Node_Init();
	Platform_Init();
	Stream_Init();
	Advanced_Init();
	Flow_Init();
	Codec_Init();
	Audio_Init();
	Video_Init();
	Format_Init();
	Playlist_Init();
	FormatBase_Init();
	NullOutput_Init();
	RawAudio_Init();
	RawImage_Init();
	Timer_Init();
	IDCT_Init();
	Overlay_Init();
	M3U_Init();
	PLS_Init();
	ASX_Init();
	WaveOut_Init();
	SoftIDCT_Init();
#if defined(CONFIG_SUBS)
	SubTitle_Init();
#endif
#if defined(TARGET_PALMOS)
	OverlayHIRES_Init();
	//Win_Init();
	//About_Init();
	//BenchResult_Init();
	//MediaInfo_Init();
	//Settings_Init();
	ASF_Init();
	AVI_Init();
	WAV_Init();
	MP4_Init();
	MPG_Init();
	NSV_Init();
	Law_Init();
	ADPCM_Init();
#elif defined(TARGET_WIN32) || defined(TARGET_WINCE)
#if defined(TARGET_WINCE)
	if (QueryPlatform(PLATFORM_TYPENO) != TYPE_SMARTPHONE)
	{
		OverlayRAW_Init();
		OverlayGAPI_Init();
	}
	else
	{
		OverlayGAPI_Init(); // prefer GAPI with smartphones (Sagem MyS-7 crashes with Raw FrameBuffer?)
		OverlayRAW_Init();
	}
	OverlayDirect_Init();
	OverlayS1D13806_Init();
#else
	OverlayConsole_Init();
#endif
	OverlayXScale_Init();
	OverlayDDraw_Init(); // after GAPI and RAW and XScale
	OverlayFlyTV_Init();
	OverlayGDI_Init();
#elif defined(TARGET_SYMBIAN)
	OverlaySymbian_Init();
#endif
#ifdef NO_PLUGINS
	Static_Init();
#else
	Plugins_Init();
#endif
	Association_Init(); // after all formats are registered
	Color_Init(); 
	Equalizer_Init();
	Player_Init(); // after all output drivers are registered
	return 1;
}