bool CGbaLoader::LoadNor(void)
{
  bool load=false;
  FILE* gbaFile=fopen(iFileName.c_str(),"rb");
  if(gbaFile)
  {
    u8* buf=(u8*)malloc(LEN_NOR);
    if(buf)
    {
      //erase
      cExpansion::OpenNorWrite();
      cExpansion::SetSerialMode();
      progressWnd().setTipText(LANG("progress window","erase nor" ));
      progressWnd().show();
      progressWnd().setPercent(0);
      for(u32 address=0;address<iSize&&address<MAX_NOR;address+=0x40000)
      {
        expansion().Block_Erase(address);
        progressWnd().setPercent(address*100/iSize);
      }
      progressWnd().setPercent(100);
      progressWnd().hide();
      //write
      progressWnd().setTipText(LANG("progress window","gba load" ));
      progressWnd().show();
      progressWnd().setPercent(0);
      for(u32 address=0;address<iSize&&address<MAX_NOR;address+=LEN_NOR)
      {
        memset(buf,0xff,LEN_NOR);
        fread(buf,LEN_NOR,1,gbaFile);
        expansion().WriteNorFlash(address,buf,LEN_NOR);
        progressWnd().setPercent(address*100/iSize);
      }
      progressWnd().setPercent(100);
      progressWnd().hide();

      CGbaWriterNor writer;
      u32 saveSize=CGbaPatcher(iSize,&writer,(u32*)0x08000000,cExpansion::ENorPage).Patch();
      cSram::CreateDefaultFile(iFileName.c_str(),saveSize);
/*
  FILE *log;
  log=fopen("fat0:/test.bin","wb");
  fwrite((void*)0x08000000,iSize,1,log);
  fclose(log);
// */
      cExpansion::CloseNorWrite();
      load=true;
      free(buf);
    }
    fclose(gbaFile);
  }
  return load;
}
Exemple #2
0
void System::load() {
  audio.coprocessor_enable(false);

  bus.map_reset();
  bus.map_xml();

  cpu.enable();
  ppu.enable();

  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.load();
  if(cartridge.mode() == Cartridge::Mode::Bsx) bsxcartridge.load();
  if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.load();
  #if defined(GAMEBOY)
  if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.load();
  #endif

  if(cartridge.has_bsx_slot()) bsxflash.load();
  if(cartridge.has_nss_dip()) nss.load();
  if(cartridge.has_superfx()) superfx.load();
  if(cartridge.has_sa1()) sa1.load();
  if(cartridge.has_necdsp()) necdsp.load();
  if(cartridge.has_hitachidsp()) hitachidsp.load();
  if(cartridge.has_armdsp()) armdsp.load();
  if(cartridge.has_srtc()) srtc.load();
  if(cartridge.has_sdd1()) sdd1.load();
  if(cartridge.has_spc7110()) spc7110.load();
  if(cartridge.has_obc1()) obc1.load();
  if(cartridge.has_msu1()) msu1.load();
  if(cartridge.has_link()) link.load();

  serialize_init();
  cheat.init();
}
Exemple #3
0
void System::power() {
  random.seed((unsigned)time(0));

  cpu.power();
  smp.power();
  dsp.power();
  ppu.power();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.power();
  if(cartridge.hasICD2()) icd2.power();
  if(cartridge.hasMCC()) mcc.power();
  if(cartridge.hasNSSDIP()) nss.power();
  if(cartridge.hasEvent()) event.power();
  if(cartridge.hasSA1()) sa1.power();
  if(cartridge.hasSuperFX()) superfx.power();
  if(cartridge.hasARMDSP()) armdsp.power();
  if(cartridge.hasHitachiDSP()) hitachidsp.power();
  if(cartridge.hasNECDSP()) necdsp.power();
  if(cartridge.hasEpsonRTC()) epsonrtc.power();
  if(cartridge.hasSharpRTC()) sharprtc.power();
  if(cartridge.hasSPC7110()) spc7110.power();
  if(cartridge.hasSDD1()) sdd1.power();
  if(cartridge.hasOBC1()) obc1.power();
  if(cartridge.hasMSU1()) msu1.power();

  if(cartridge.hasSatellaviewSlot()) satellaviewcartridge.power();

  reset();
}
Exemple #4
0
int main(int argc, char* argv[])
{
	char cNomImgLue[250];
	char out[250] = "out.ppm";

	int lignes, colonnes, nTaille, S;

	if (argc == 1) {
		sscanf (out, "%s", cNomImgLue);
	} else if (argc == 2) {
		sscanf (argv[1],"%s",cNomImgLue);
	} else {
		printf("to many arguments");
	}


	OCTET *ImgIn, *ImgOut, *ImgOut1;

	lire_nb_lignes_colonnes_image_ppm(cNomImgLue, &lignes, &colonnes);
	nTaille = lignes * colonnes * 3;

	allocation_tableau(ImgIn, OCTET, nTaille);
	lire_image_ppm(cNomImgLue, ImgIn, lignes * colonnes);
	allocation_tableau(ImgOut, OCTET, nTaille);

	expansion(ImgIn, ImgOut, lignes, colonnes);

	ecrire_image_ppm(out, ImgOut,  lignes, colonnes);
	free(ImgIn);

	return 1;
}
Exemple #5
0
void System::power() {
  random.seed((unsigned)time(0));

  cpu.power();
  smp.power();
  dsp.power();
  ppu.power();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.power();
  if(cartridge.has_gb_slot()) icd2.power();
  if(cartridge.has_bs_cart()) bsxcartridge.power();
  if(cartridge.has_nss_dip()) nss.power();
  if(cartridge.has_event()) event.power();
  if(cartridge.has_sa1()) sa1.power();
  if(cartridge.has_superfx()) superfx.power();
  if(cartridge.has_armdsp()) armdsp.power();
  if(cartridge.has_hitachidsp()) hitachidsp.power();
  if(cartridge.has_necdsp()) necdsp.power();
  if(cartridge.has_epsonrtc()) epsonrtc.power();
  if(cartridge.has_sharprtc()) sharprtc.power();
  if(cartridge.has_spc7110()) spc7110.power();
  if(cartridge.has_sdd1()) sdd1.power();
  if(cartridge.has_obc1()) obc1.power();
  if(cartridge.has_hsu1()) hsu1.power();
  if(cartridge.has_msu1()) msu1.power();
  if(cartridge.has_bs_slot()) satellaviewcartridge.power();

  reset();
}
Exemple #6
0
TextRun InlineTextBox::constructTextRun(
    const ComputedStyle& style,
    StringView string,
    int maximumLength,
    StringBuilder* charactersWithHyphen) const {
  if (charactersWithHyphen) {
    const AtomicString& hyphenString = style.hyphenString();
    charactersWithHyphen->reserveCapacity(string.length() +
                                          hyphenString.length());
    charactersWithHyphen->append(string);
    charactersWithHyphen->append(hyphenString);
    string = charactersWithHyphen->toString();
    maximumLength = string.length();
  }

  ASSERT(maximumLength >= static_cast<int>(string.length()));

  TextRun run(string, textPos().toFloat(), expansion(), expansionBehavior(),
              direction(),
              dirOverride() || style.rtlOrdering() == EOrder::Visual);
  run.setTabSize(!style.collapseWhiteSpace(), style.getTabSize());
  run.setTextJustify(style.getTextJustify());

  // Propagate the maximum length of the characters buffer to the TextRun, even
  // when we're only processing a substring.
  run.setCharactersLength(maximumLength);
  ASSERT(run.charactersLength() >= run.length());
  return run;
}
Exemple #7
0
void System::power() {
  random.seed((unsigned)time(0));

  cpu.power();
  smp.power();
  dsp.power();
  ppu.power();

  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.power();
  if(cartridge.has_gb_slot()) icd2.power();
  if(cartridge.has_bs_cart()) bsxcartridge.power();
  if(cartridge.has_bs_slot()) bsxflash.power();
  if(cartridge.has_nss_dip()) nss.power();
  if(cartridge.has_superfx()) superfx.power();
  if(cartridge.has_sa1()) sa1.power();
  if(cartridge.has_necdsp()) necdsp.power();
  if(cartridge.has_hitachidsp()) hitachidsp.power();
  if(cartridge.has_armdsp()) armdsp.power();
  if(cartridge.has_srtc()) srtc.power();
  if(cartridge.has_sdd1()) sdd1.power();
  if(cartridge.has_spc7110()) spc7110.power();
  if(cartridge.has_obc1()) obc1.power();
  if(cartridge.has_msu1()) msu1.power();
  if(cartridge.has_link()) link.power();

  reset();
}
void CGbaWriterNor::Commit(void)
{
  u8* backupBuffer=NULL;
  if(iCurPage!=0)
  {
    backupBuffer=(u8*)malloc(0x4000);
    if(backupBuffer) memcpy(backupBuffer,(void*)0x08004000,0x4000);
  }
  expansion().Block_Erase(iCurPage);
  for(u32 ii=0;ii<8;ii++)
    expansion().WriteNorFlash(iCurPage+ii*0x8000,iBuffer+ii*0x8000,0x8000);
  if(backupBuffer&&memcmp(backupBuffer,(void*)0x08004000,0x4000)!=0)
  {
    expansion().WriteNorFlash(0x4000,backupBuffer,0x4000);
    free(backupBuffer);
  }
}
bool CGbaLoader::StoreOldSave(std::string& aFileName)
{
  bool res=false;
  const u8 sign[]="ACEKARD R.P.G GBA SIGN*";
  u8 buffer[sizeof(sign)];
  expansion().SetRampage(0);
  cExpansion::ReadSram(0x0A000000,buffer,sizeof(buffer));
  if(memcmp(buffer,sign,sizeof(buffer))) //old save
  {
    if(aFileName!="")
    {
      cSram::SaveSramToFile(aFileName.c_str(),0);
      res=true;
    }
    expansion().SetRampage(0);
    cExpansion::WriteSram(0x0A000000,sign,sizeof(sign));
  }
  return res;
}
    typename DownhillSimplexMethod< DIM >::Converged DownhillSimplexMethod< DIM >::optimize( const ParamsT& initial )
    {
        assert( m_refl > 0.0 );
        assert( m_exp > 1.0 );
        assert( m_exp > m_refl );
        assert( 0 < m_contr && m_contr < 1 );
        assert( 0 < m_shri && m_shri < 1 );
        assert( m_initFactor > 0.0 );

        // Prepare optimization
        m_iterations = 0;
        createInitials( initial );

        Converged conv = CONVERGED_NO;
        Step next = STEP_START;
        while( next != STEP_EXIT )
        {
            switch( next )
            {
                case STEP_START:
                    order();
                    conv = converged();
                    if( conv != CONVERGED_NO )
                    {
                        next = STEP_EXIT;
                        break;
                    }
                    ++m_iterations;
                    centroid();
                    next = STEP_REFLECTION;
                    break;
                case STEP_REFLECTION:
                    next = reflection();
                    break;
                case STEP_EXPANSION:
                    next = expansion();
                    break;
                case STEP_CONTRACTION:
                    next = contraction();
                    break;
                case STEP_SHRINKAGE:
                    next = shrinkage();
                    break;
                default:
                    std::cerr << "Undefined control flow!";
                    next = STEP_EXIT;
                    break;
            }
        }

        return conv;
    }
Exemple #11
0
void System::load() {
  string manifest = string::read({interface->path(ID::System), "manifest.bml"});
  auto document = Markup::Document(manifest);

  interface->loadRequest(ID::IPLROM, document["system/smp/rom/name"].data);
  if(!file::exists({interface->path(ID::System), document["system/smp/rom/name"].data})) {
    interface->notify("Error: required Super Famicom firmware ipl.rom not found\nFile should be accessible from PWD or from its expected path: ", interface->path(ID::System));
  }

  region = configuration.region;
  expansion = configuration.expansion_port;
  if(region == Region::Autodetect) {
    region = (cartridge.region() == Cartridge::Region::NTSC ? Region::NTSC : Region::PAL);
  }

  cpu_frequency = region() == Region::NTSC ? 21477272 : 21281370;
  apu_frequency = 24607104;

  audio.coprocessor_enable(false);

  bus.map_reset();
  bus.map_xml();

  cpu.enable();
  ppu.enable();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.load();
  if(cartridge.has_gb_slot()) icd2.load();
  if(cartridge.has_bs_cart()) bsxcartridge.load();
  if(cartridge.has_nss_dip()) nss.load();
  if(cartridge.has_event()) event.load();
  if(cartridge.has_sa1()) sa1.load();
  if(cartridge.has_superfx()) superfx.load();
  if(cartridge.has_armdsp()) armdsp.load();
  if(cartridge.has_hitachidsp()) hitachidsp.load();
  if(cartridge.has_necdsp()) necdsp.load();
  if(cartridge.has_epsonrtc()) epsonrtc.load();
  if(cartridge.has_sharprtc()) sharprtc.load();
  if(cartridge.has_spc7110()) spc7110.load();
  if(cartridge.has_sdd1()) sdd1.load();
  if(cartridge.has_obc1()) obc1.load();
  if(cartridge.has_hsu1()) hsu1.load();
  if(cartridge.has_msu1()) msu1.load();
  if(cartridge.has_bs_slot()) satellaviewcartridge.load();
  if(cartridge.has_st_slots()) sufamiturboA.load(), sufamiturboB.load();

  // Note: pre-computing the size of the data structure has been disabled
  //  due to the input recorder.
  //serialize_init();
}
Exemple #12
0
void System::load() {
  string manifest = string::read({interface->path(ID::System), "manifest.bml"});
  auto document = Markup::Document(manifest);

  interface->loadRequest(ID::IPLROM, document["system/smp/rom/name"].data);
  if(!file::exists({interface->path(ID::System), document["system/smp/rom/name"].data})) {
    interface->notify("Error: required Super Famicom firmware ipl.rom not found.\n");
  }

  region = config.region;
  expansion = config.expansion_port;
  if(region == Region::Autodetect) {
    region = (cartridge.region() == Cartridge::Region::NTSC ? Region::NTSC : Region::PAL);
  }

  cpu_frequency = region() == Region::NTSC ? config.cpu.ntsc_frequency : config.cpu.pal_frequency;
  apu_frequency = region() == Region::NTSC ? config.smp.ntsc_frequency : config.smp.pal_frequency;

  audio.coprocessor_enable(false);

  bus.map_reset();
  bus.map_xml();

  cpu.enable();
  ppu.enable();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.load();
  if(cartridge.has_gb_slot()) icd2.load();
  if(cartridge.has_bs_cart()) bsxcartridge.load();
  if(cartridge.has_nss_dip()) nss.load();
  if(cartridge.has_event()) event.load();
  if(cartridge.has_sa1()) sa1.load();
  if(cartridge.has_superfx()) superfx.load();
  if(cartridge.has_armdsp()) armdsp.load();
  if(cartridge.has_hitachidsp()) hitachidsp.load();
  if(cartridge.has_necdsp()) necdsp.load();
  if(cartridge.has_epsonrtc()) epsonrtc.load();
  if(cartridge.has_sharprtc()) sharprtc.load();
  if(cartridge.has_spc7110()) spc7110.load();
  if(cartridge.has_sdd1()) sdd1.load();
  if(cartridge.has_obc1()) obc1.load();
  if(cartridge.has_hsu1()) hsu1.load();
  if(cartridge.has_msu1()) msu1.load();
  if(cartridge.has_bs_slot()) satellaviewcartridge.load();
  if(cartridge.has_st_slots()) sufamiturboA.load(), sufamiturboB.load();

  serialize_init();
  cheat.init();
}
Exemple #13
0
void System::load() {
//string manifest = string::read({interface->path(ID::System), "manifest.bml"});
  interface->loadRequest(ID::SystemManifest, "manifest.bml", true);
  auto document = BML::unserialize(information.manifest);

  if(auto iplrom = document["system/smp/rom/name"].text()) {
    interface->loadRequest(ID::IPLROM, iplrom, true);
  }

  region = configuration.region;
  expansion = configuration.expansion_port;
  if(region == Region::Autodetect) {
    region = (cartridge.region() == Cartridge::Region::NTSC ? Region::NTSC : Region::PAL);
  }

  cpu_frequency = region() == Region::NTSC ? 21477272 : 21281370;
  apu_frequency = 24607104;

  audio.coprocessor_enable(false);

  bus.reset();
  bus.map();

  cpu.enable();
  ppu.enable();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.load();
  if(cartridge.hasICD2()) icd2.load();
  if(cartridge.hasMCC()) mcc.load();
  if(cartridge.hasNSSDIP()) nss.load();
  if(cartridge.hasEvent()) event.load();
  if(cartridge.hasSA1()) sa1.load();
  if(cartridge.hasSuperFX()) superfx.load();
  if(cartridge.hasARMDSP()) armdsp.load();
  if(cartridge.hasHitachiDSP()) hitachidsp.load();
  if(cartridge.hasNECDSP()) necdsp.load();
  if(cartridge.hasEpsonRTC()) epsonrtc.load();
  if(cartridge.hasSharpRTC()) sharprtc.load();
  if(cartridge.hasSPC7110()) spc7110.load();
  if(cartridge.hasSDD1()) sdd1.load();
  if(cartridge.hasOBC1()) obc1.load();
  if(cartridge.hasMSU1()) msu1.load();

  if(cartridge.hasSatellaviewSlot()) satellaviewcartridge.load();
  if(cartridge.hasSufamiTurboSlots()) sufamiturboA.load(), sufamiturboB.load();

  serialize_init();
}
Exemple #14
0
void System::unload() {
  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.unload();
  if(cartridge.has_gb_slot()) icd2.unload();
  if(cartridge.has_bs_cart()) bsxcartridge.unload();
  if(cartridge.has_bs_slot()) bsxflash.unload();
  if(cartridge.has_st_slots()) sufamiturbo.unload();
  if(cartridge.has_nss_dip()) nss.unload();
  if(cartridge.has_superfx()) superfx.unload();
  if(cartridge.has_sa1()) sa1.unload();
  if(cartridge.has_necdsp()) necdsp.unload();
  if(cartridge.has_hitachidsp()) hitachidsp.unload();
  if(cartridge.has_armdsp()) armdsp.unload();
  if(cartridge.has_srtc()) srtc.unload();
  if(cartridge.has_sdd1()) sdd1.unload();
  if(cartridge.has_spc7110()) spc7110.unload();
  if(cartridge.has_obc1()) obc1.unload();
  if(cartridge.has_msu1()) msu1.unload();
  if(cartridge.has_link()) link.unload();
}
Exemple #15
0
void System::reset() {
  cpu.reset();
  smp.reset();
  dsp.reset();
  ppu.reset();

  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.reset();

  if(cartridge.mode() == Cartridge::Mode::Bsx) bsxcartridge.reset();
  #if defined(GAMEBOY)
  if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.reset();
  #endif

  if(cartridge.has_bsx_slot()) bsxflash.reset();
  if(cartridge.has_nss_dip()) nss.reset();
  if(cartridge.has_superfx()) superfx.reset();
  if(cartridge.has_sa1()) sa1.reset();
  if(cartridge.has_necdsp()) necdsp.reset();
  if(cartridge.has_hitachidsp()) hitachidsp.reset();
  if(cartridge.has_armdsp()) armdsp.reset();
  if(cartridge.has_srtc()) srtc.reset();
  if(cartridge.has_sdd1()) sdd1.reset();
  if(cartridge.has_spc7110()) spc7110.reset();
  if(cartridge.has_obc1()) obc1.reset();
  if(cartridge.has_msu1()) msu1.reset();
  if(cartridge.has_link()) link.reset();

  #if defined(GAMEBOY)
  if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) cpu.coprocessors.append(&icd2);
  #endif
  if(cartridge.has_superfx()) cpu.coprocessors.append(&superfx);
  if(cartridge.has_sa1()) cpu.coprocessors.append(&sa1);
  if(cartridge.has_necdsp()) cpu.coprocessors.append(&necdsp);
  if(cartridge.has_hitachidsp()) cpu.coprocessors.append(&hitachidsp);
  if(cartridge.has_armdsp()) cpu.coprocessors.append(&armdsp);
  if(cartridge.has_msu1()) cpu.coprocessors.append(&msu1);
  if(cartridge.has_link()) cpu.coprocessors.append(&link);

  scheduler.init();
  input.connect(0, config.controller_port1);
  input.connect(1, config.controller_port2);
}
Exemple #16
0
int main()
{
	clrscr();
	cout<<"Enter Filename:";
	cin>>filename;
	create();
	getch();
	dispmnt();
	getch();
	dispmdt();
	getch();
	dispala1();
	getch();
	expansion();
	dispala2();
	getch();
	dispexp();
	getch();
	return 0;
}
Exemple #17
0
void System::reset() {
  cpu.reset();
  smp.reset();
  dsp.reset();
  ppu.reset();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.reset();
  if(cartridge.has_gb_slot()) icd2.reset();
  if(cartridge.has_bs_cart()) bsxcartridge.reset();
  if(cartridge.has_nss_dip()) nss.reset();
  if(cartridge.has_event()) event.reset();
  if(cartridge.has_sa1()) sa1.reset();
  if(cartridge.has_superfx()) superfx.reset();
  if(cartridge.has_armdsp()) armdsp.reset();
  if(cartridge.has_hitachidsp()) hitachidsp.reset();
  if(cartridge.has_necdsp()) necdsp.reset();
  if(cartridge.has_epsonrtc()) epsonrtc.reset();
  if(cartridge.has_sharprtc()) sharprtc.reset();
  if(cartridge.has_spc7110()) spc7110.reset();
  if(cartridge.has_sdd1()) sdd1.reset();
  if(cartridge.has_obc1()) obc1.reset();
  if(cartridge.has_hsu1()) hsu1.reset();
  if(cartridge.has_msu1()) msu1.reset();
  if(cartridge.has_bs_slot()) satellaviewcartridge.reset();

  if(cartridge.has_gb_slot()) cpu.coprocessors.append(&icd2);
  if(cartridge.has_event()) cpu.coprocessors.append(&event);
  if(cartridge.has_sa1()) cpu.coprocessors.append(&sa1);
  if(cartridge.has_superfx()) cpu.coprocessors.append(&superfx);
  if(cartridge.has_armdsp()) cpu.coprocessors.append(&armdsp);
  if(cartridge.has_hitachidsp()) cpu.coprocessors.append(&hitachidsp);
  if(cartridge.has_necdsp()) cpu.coprocessors.append(&necdsp);
  if(cartridge.has_epsonrtc()) cpu.coprocessors.append(&epsonrtc);
  if(cartridge.has_sharprtc()) cpu.coprocessors.append(&sharprtc);
  if(cartridge.has_spc7110()) cpu.coprocessors.append(&spc7110);
  if(cartridge.has_msu1()) cpu.coprocessors.append(&msu1);

  scheduler.init();
  input.connect(0, configuration.controller_port1);
  input.connect(1, configuration.controller_port2);
}
Exemple #18
0
void System::reset() {
  cpu.reset();
  smp.reset();
  dsp.reset();
  ppu.reset();

  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.reset();
  if(cartridge.hasICD2()) icd2.reset();
  if(cartridge.hasMCC()) mcc.reset();
  if(cartridge.hasNSSDIP()) nss.reset();
  if(cartridge.hasEvent()) event.reset();
  if(cartridge.hasSA1()) sa1.reset();
  if(cartridge.hasSuperFX()) superfx.reset();
  if(cartridge.hasARMDSP()) armdsp.reset();
  if(cartridge.hasHitachiDSP()) hitachidsp.reset();
  if(cartridge.hasNECDSP()) necdsp.reset();
  if(cartridge.hasEpsonRTC()) epsonrtc.reset();
  if(cartridge.hasSharpRTC()) sharprtc.reset();
  if(cartridge.hasSPC7110()) spc7110.reset();
  if(cartridge.hasSDD1()) sdd1.reset();
  if(cartridge.hasOBC1()) obc1.reset();
  if(cartridge.hasMSU1()) msu1.reset();

  if(cartridge.hasSatellaviewSlot()) satellaviewcartridge.reset();

  if(cartridge.hasICD2()) cpu.coprocessors.append(&icd2);
  if(cartridge.hasEvent()) cpu.coprocessors.append(&event);
  if(cartridge.hasSA1()) cpu.coprocessors.append(&sa1);
  if(cartridge.hasSuperFX()) cpu.coprocessors.append(&superfx);
  if(cartridge.hasARMDSP()) cpu.coprocessors.append(&armdsp);
  if(cartridge.hasHitachiDSP()) cpu.coprocessors.append(&hitachidsp);
  if(cartridge.hasNECDSP()) cpu.coprocessors.append(&necdsp);
  if(cartridge.hasEpsonRTC()) cpu.coprocessors.append(&epsonrtc);
  if(cartridge.hasSharpRTC()) cpu.coprocessors.append(&sharprtc);
  if(cartridge.hasSPC7110()) cpu.coprocessors.append(&spc7110);
  if(cartridge.hasMSU1()) cpu.coprocessors.append(&msu1);

  scheduler.init();
  input.connect(0, configuration.controller_port1);
  input.connect(1, configuration.controller_port2);
}
Exemple #19
0
void System::unload() {
  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.unload();
  if(cartridge.has_gb_slot()) icd2.unload();
  if(cartridge.has_bs_cart()) bsxcartridge.unload();
  if(cartridge.has_nss_dip()) nss.unload();
  if(cartridge.has_event()) event.unload();
  if(cartridge.has_sa1()) sa1.unload();
  if(cartridge.has_superfx()) superfx.unload();
  if(cartridge.has_armdsp()) armdsp.unload();
  if(cartridge.has_hitachidsp()) hitachidsp.unload();
  if(cartridge.has_necdsp()) necdsp.unload();
  if(cartridge.has_epsonrtc()) epsonrtc.unload();
  if(cartridge.has_sharprtc()) sharprtc.unload();
  if(cartridge.has_spc7110()) spc7110.unload();
  if(cartridge.has_sdd1()) sdd1.unload();
  if(cartridge.has_obc1()) obc1.unload();
  if(cartridge.has_hsu1()) hsu1.unload();
  if(cartridge.has_msu1()) msu1.unload();
  if(cartridge.has_bs_slot()) satellaviewcartridge.unload();
  if(cartridge.has_st_slots()) sufamiturboA.unload(), sufamiturboB.unload();
}
Exemple #20
0
void System::unload() {
  if(expansion() == ExpansionPortDevice::Satellaview) satellaviewbaseunit.unload();
  if(cartridge.hasICD2()) icd2.unload();
  if(cartridge.hasMCC()) mcc.unload();
  if(cartridge.hasNSSDIP()) nss.unload();
  if(cartridge.hasEvent()) event.unload();
  if(cartridge.hasSA1()) sa1.unload();
  if(cartridge.hasSuperFX()) superfx.unload();
  if(cartridge.hasARMDSP()) armdsp.unload();
  if(cartridge.hasHitachiDSP()) hitachidsp.unload();
  if(cartridge.hasNECDSP()) necdsp.unload();
  if(cartridge.hasEpsonRTC()) epsonrtc.unload();
  if(cartridge.hasSharpRTC()) sharprtc.unload();
  if(cartridge.hasSPC7110()) spc7110.unload();
  if(cartridge.hasSDD1()) sdd1.unload();
  if(cartridge.hasOBC1()) obc1.unload();
  if(cartridge.hasMSU1()) msu1.unload();

  if(cartridge.hasSatellaviewSlot()) satellaviewcartridge.unload();
  if(cartridge.hasSufamiTurboSlots()) sufamiturboA.unload(), sufamiturboB.unload();
}
Exemple #21
0
void System::unload() {
  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.unload();
  if(cartridge.mode() == Cartridge::Mode::Bsx) bsxcartridge.unload();
  if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.unload();
  #if defined(GAMEBOY)
  if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.unload();
  #endif

  if(cartridge.has_bsx_slot()) bsxflash.unload();
  if(cartridge.has_nss_dip()) nss.unload();
  if(cartridge.has_superfx()) superfx.unload();
  if(cartridge.has_sa1()) sa1.unload();
  if(cartridge.has_necdsp()) necdsp.unload();
  if(cartridge.has_hitachidsp()) hitachidsp.unload();
  if(cartridge.has_armdsp()) armdsp.unload();
  if(cartridge.has_srtc()) srtc.unload();
  if(cartridge.has_sdd1()) sdd1.unload();
  if(cartridge.has_spc7110()) spc7110.unload();
  if(cartridge.has_obc1()) obc1.unload();
  if(cartridge.has_msu1()) msu1.unload();
  if(cartridge.has_link()) link.unload();
}
Exemple #22
0
void System::load() {
  region = config.region;
  expansion = config.expansion_port;
  if(region == Region::Autodetect) {
    region = (cartridge.region() == Cartridge::Region::NTSC ? Region::NTSC : Region::PAL);
  }

  cpu_frequency = region() == Region::NTSC ? config.cpu.ntsc_frequency : config.cpu.pal_frequency;
  apu_frequency = region() == Region::NTSC ? config.smp.ntsc_frequency : config.smp.pal_frequency;

  audio.coprocessor_enable(false);

  bus.map_reset();
  bus.map_xml();

  cpu.enable();
  ppu.enable();

  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.load();
  if(cartridge.has_gb_slot()) icd2.load();
  if(cartridge.has_bs_cart()) bsxcartridge.load();
  if(cartridge.has_bs_slot()) bsxflash.load();
  if(cartridge.has_st_slots()) sufamiturbo.load();
  if(cartridge.has_nss_dip()) nss.load();
  if(cartridge.has_superfx()) superfx.load();
  if(cartridge.has_sa1()) sa1.load();
  if(cartridge.has_necdsp()) necdsp.load();
  if(cartridge.has_hitachidsp()) hitachidsp.load();
  if(cartridge.has_armdsp()) armdsp.load();
  if(cartridge.has_srtc()) srtc.load();
  if(cartridge.has_sdd1()) sdd1.load();
  if(cartridge.has_spc7110()) spc7110.load();
  if(cartridge.has_obc1()) obc1.load();
  if(cartridge.has_msu1()) msu1.load();
  if(cartridge.has_link()) link.load();

  serialize_init();
  cheat.init();
}
Exemple #23
0
void System::power() {
  random.seed((unsigned)interface()->randomSeed());

  region = config.region;
  expansion = config.expansion_port;
  if(region == Region::Autodetect) {
    region = (cartridge.region() == Cartridge::Region::NTSC ? Region::NTSC : Region::PAL);
  }

  cpu_frequency = region() == Region::NTSC ? config.cpu.ntsc_frequency : config.cpu.pal_frequency;
  apu_frequency = region() == Region::NTSC ? config.smp.ntsc_frequency : config.smp.pal_frequency;

  cpu.power();
  smp.power();
  dsp.power();
  ppu.power();

  if(expansion() == ExpansionPortDevice::BSX) bsxsatellaview.power();
  if(cartridge.mode() == Cartridge::Mode::Bsx) bsxcartridge.power();
  #if defined(GAMEBOY)
  if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.power();
  #endif

  if(cartridge.has_bsx_slot()) bsxflash.power();
  if(cartridge.has_nss_dip()) nss.power();
  if(cartridge.has_superfx()) superfx.power();
  if(cartridge.has_sa1()) sa1.power();
  if(cartridge.has_necdsp()) necdsp.power();
  if(cartridge.has_hitachidsp()) hitachidsp.power();
  if(cartridge.has_armdsp()) armdsp.power();
  if(cartridge.has_srtc()) srtc.power();
  if(cartridge.has_sdd1()) sdd1.power();
  if(cartridge.has_spc7110()) spc7110.power();
  if(cartridge.has_obc1()) obc1.power();
  if(cartridge.has_msu1()) msu1.power();
  if(cartridge.has_link()) link.power();

  reset();
}
bool CGbaLoader::Load(bool aForce,bool aNotStart)
{
  if(!expansion().IsValid()) return false;
  bool load=false,nor=false;
  struct stat st;
  if(-1==stat(iFileName.c_str(),&st))
  {
    return false;
  }
  iSize=st.st_size;
  if(iSize>MAX_PSRAM)
  {
    nor=true;
  }
  else if(iSize>MAX_NOR)
  {
    akui::messageBox( NULL, LANG("gba warn", "title"), LANG("gba warn", "text"), MB_OK );
    return false;
  }

  FILE* gbaFile=fopen(iFileName.c_str(),"rb");
  if(gbaFile)
  {
    sGBAHeader header;
    fread(&header,1,sizeof(header),gbaFile);
    fclose(gbaFile);
    if(header.is96h==0x96)
    {
      load=LoadInternal(nor,aForce);
    }
  }
  if(!aNotStart&&load&&!CheckLink())
  {
    StartGBA();
  }
  return load;
}
Exemple #25
0
 /* Handle a "footnote".
    footnote *{this is a footnote}
    where "*" is the (optional) marker character for this note. */
void
cm_footnote (void)
{
  char *marker;
  char *note;

  get_until ("{", &marker);
  canon_white (marker);

  if (macro_expansion_output_stream && !executing_string)
    append_to_expansion_output (input_text_offset + 1); /* include the { */

  /* Read the argument in braces. */
  if (curchar () != '{')
    {
      line_error (_("`%c%s' needs an argument `{...}', not just `%s'"),
                  COMMAND_PREFIX, command, marker);
      free (marker);
      return;
    }
  else
    {
      int len;
      int braces = 1;
      int loc = ++input_text_offset;

      while (braces)
        {
          if (loc == input_text_length)
            {
              line_error (_("No closing brace for footnote `%s'"), marker);
              return;
            }

          if (input_text[loc] == '{')
            braces++;
          else if (input_text[loc] == '}')
            braces--;
          else if (input_text[loc] == '\n')
            line_number++;

          loc++;
        }

      len = (loc - input_text_offset) - 1;
      note = xmalloc (len + 1);
      memcpy (note, &input_text[input_text_offset], len);
      note[len] = 0;
      input_text_offset = loc;
    }

  /* Must write the macro-expanded argument to the macro expansion
     output stream.  This is like the case in index_add_arg.  */
  if (macro_expansion_output_stream && !executing_string)
    {
      /* Calling me_execute_string on a lone } provokes an error, since
         as far as the reader knows there is no matching {.  We wrote
         the { above in the call to append_to_expansion_output. */
      me_execute_string_keep_state (note, "}");
    }

  if (!current_node || !*current_node)
    {
      line_error (_("Footnote defined without parent node"));
      free (marker);
      free (note);
      return;
    }

  /* output_pending_notes is non-reentrant (it uses a global data
     structure pending_notes, which it frees before it returns), and
     TeX doesn't grok footnotes inside footnotes anyway.  Disallow
     that.  */
  if (already_outputting_pending_notes)
    {
      line_error (_("Footnotes inside footnotes are not allowed"));
      free (marker);
      free (note);
      return;
    }

  if (!*marker)
    {
      free (marker);

      if (number_footnotes)
        {
          marker = xmalloc (10);
          sprintf (marker, "%d", current_footnote_number);
        }
      else
        marker = xstrdup ("*");
    }

  if (xml)
    xml_insert_footnote (note);
  else 
    {
  remember_note (marker, note);

  /* fixme: html: footnote processing needs work; we currently ignore
     the style requested; we could clash with a node name of the form
     `fn-<n>', though that's unlikely. */
  if (html)
    {
      /* Hyperlink also serves as an anchor (mnemonic: fnd is footnote
         definition.)  */
      add_html_elt ("<a rel=\"footnote\" href=");
      add_word_args ("\"#fn-%d\" name=\"fnd-%d\"><sup>%s</sup></a>",
		     current_footnote_number, current_footnote_number,
                     marker);
    }
  else
    /* Your method should at least insert MARKER. */
    switch (footnote_style)
      {
      case separate_node:
        add_word_args ("(%s)", marker);
        execute_string (" (*note %s-Footnote-%d::)",
                        current_node, current_footnote_number);
        if (first_footnote_this_node)
          {
            char *temp_string, *expanded_ref;

            temp_string = xmalloc (strlen (current_node)
                                   + strlen ("-Footnotes") + 1);

            strcpy (temp_string, current_node);
            strcat (temp_string, "-Footnotes");
            expanded_ref = expansion (temp_string, 0);
            remember_node_reference (expanded_ref, line_number,
                                     followed_reference);
            free (temp_string);
            free (expanded_ref);
            first_footnote_this_node = 0;
          }
        break;

      case end_node:
        add_word_args ("(%s)", marker);
        break;

      default:
        break;
      }
  current_footnote_number++;
    }
  free (marker);
  free (note);
}
void Expansion::optimizeAlg(int nIterations)
{
    expansion(nIterations);
}
Exemple #27
0
 KernelMatrixProxy operator()(const std::vector<target_type>& t,
                              const std::vector<source_type>& s) const {
   return KernelMatrixProxy(expansion(), t, s);
 }
Exemple #28
0
void
cm_inforef (int arg)
{
  if (arg == START)
    {
      char *node = get_xref_token (1); /* expands all macros in inforef */
      char *pname = get_xref_token (0);
      char *file = get_xref_token (0);

      /* (see comments at cm_xref).  */
      if (!*node)
        line_error (_("First argument to @inforef may not be empty"));

      if (xml && !docbook)
        {
          xml_insert_element (INFOREF, START);
          xml_insert_element (INFOREFNODENAME, START);
          execute_string ("%s", node);
          xml_insert_element (INFOREFNODENAME, END);
          if (*pname)
            {
              xml_insert_element (INFOREFREFNAME, START);
              execute_string ("%s", pname);
              xml_insert_element (INFOREFREFNAME, END);
            }
          xml_insert_element (INFOREFINFONAME, START);
          execute_string ("%s", file);
          xml_insert_element (INFOREFINFONAME, END);

          xml_insert_element (INFOREF, END);
        }
      else if (html)
        {
          char *tem;

          add_word ((char *) _("see "));
          /* html fixxme: revisit this */
          add_html_elt ("<a href=");
          if (splitting)
            execute_string ("\"../%s/", file);
          else
            execute_string ("\"%s.html", file);
          tem = expansion (node, 0);
          add_anchor_name (tem, 1);
          add_word ("\">");
          execute_string ("%s", *pname ? pname : tem);
          add_word ("</a>");
          free (tem);
        }
      else
        {
          if (*pname)
            execute_string ("*note %s: (%s)%s", pname, file, node);
          else
            execute_string ("*note (%s)%s::", file, node);
        }

      free (node);
      free (pname);
      free (file);
    }
}
Exemple #29
0
/* Make a cross reference. */
void
cm_xref (int arg)
{
  if (arg == START)
    {
      char *arg1 = get_xref_token (1); /* expands all macros in xref */
      char *arg2 = get_xref_token (0);
      char *arg3 = get_xref_token (0);
      char *arg4 = get_xref_token (0);
      char *arg5 = get_xref_token (0);
      char *tem;

      /* "@xref{,Foo,, Bar, Baz} is not valid usage of @xref.  The
         first argument must never be blank." --rms.
         We hereby comply by disallowing such constructs.  */
      if (!*arg1)
        line_error (_("First argument to cross-reference may not be empty"));

      if (docbook)
        {
          if (!ref_flag)
            add_word (px_ref_flag || printing_index
                ? (char *) _("see ") : (char *) _("See "));

          if (!*arg4 && !*arg5)
            {
              char *arg1_id = xml_id (arg1);

              if (*arg2 || *arg3)
                {
                  xml_insert_element_with_attribute (XREFNODENAME, START,
                                                     "linkend=\"%s\"", arg1_id);
                  free (arg1_id);
                  execute_string ("%s", *arg3 ? arg3 : arg2);
                  xml_insert_element (XREFNODENAME, END);
                }
              else
                {
                  xml_insert_element_with_attribute (XREF, START,
                                                     "linkend=\"%s\"", arg1_id);
                  xml_insert_element (XREF, END);
                  free (arg1_id);
                }
            }
          else if (*arg5)
            {
              add_word_args (_("See section ``%s'' in "), *arg3 ? arg3 : arg1);
              xml_insert_element (CITE, START);
              add_word (arg5);
              xml_insert_element (CITE, END);
            }
          else if (*arg4)
            {
              /* Very sad, we are losing xrefs made to ``info only'' books.  */
            }
        }
      else if (xml)
        {
          if (!ref_flag)
            add_word_args ("%s", px_ref_flag ? _("see ") : _("See "));

          xml_insert_element (XREF, START);
          xml_insert_element (XREFNODENAME, START);
          execute_string ("%s", arg1);
          xml_insert_element (XREFNODENAME, END);
          if (*arg2)
            {
              xml_insert_element (XREFINFONAME, START);
              execute_string ("%s", arg2);
              xml_insert_element (XREFINFONAME, END);
            }
          if (*arg3)
            {
              xml_insert_element (XREFPRINTEDDESC, START);
              execute_string ("%s", arg3);
              xml_insert_element (XREFPRINTEDDESC, END);
            }
          if (*arg4)
            {
              xml_insert_element (XREFINFOFILE, START);
              execute_string ("%s", arg4);
              xml_insert_element (XREFINFOFILE, END);
            }
          if (*arg5)
            {
              xml_insert_element (XREFPRINTEDNAME, START);
              execute_string ("%s", arg5);
              xml_insert_element (XREFPRINTEDNAME, END);
            }
          xml_insert_element (XREF, END);
        }
      else if (html)
        {
          if (!ref_flag)
            add_word_args ("%s", px_ref_flag ? _("see ") : _("See "));
        }
      else
        add_word_args ("%s", px_ref_flag ? "*note " : "*Note ");

      if (!xml)
        {
          if (*arg5 || *arg4)
            {
              /* arg1 - node name
                 arg2 - reference name
                 arg3 - title or topic (and reference name if arg2 is NULL)
                 arg4 - info file name
                 arg5 - printed manual title  */
              char *ref_name;

              if (!*arg2)
                {
                  if (*arg3)
                    ref_name = arg3;
                  else
                    ref_name = arg1;
                }
              else
                ref_name = arg2;

              if (html)
                { /* More to do eventually, down to Unicode
                     Normalization Form C.  See the HTML Xref nodes in
                     the manual.  */
                  char *file_arg = arg4;
                  add_html_elt ("<a href=");

                  {
                    /* If there's a directory part, ignore it.  */
                    char *p = strrchr (file_arg, '/');
                    if (p)
                      file_arg = p + 1;

                  /* If there's a dot, make it a NULL terminator, so the
                     extension does not get into the way.  */
                    p = strrchr (file_arg , '.');
                    if (p != NULL)
                      *p = 0;
                  }
                  
                  if (! *file_arg)
                warning (_("Empty file name for HTML cross reference in `%s'"),
                           arg4);

                  /* Note that if we are splitting, and the referenced
                     tag is an anchor rather than a node, we will
                     produce a reference to a file whose name is
                     derived from the anchor name.  However, only
                     nodes create files, so we are referencing a
                     non-existent file.  cm_anchor, which see, deals
                     with that problem.  */
                  if (splitting)
                    execute_string ("\"../%s/", file_arg);
                  else
                    execute_string ("\"%s.html", file_arg);
                  /* Do not collapse -- to -, etc., in references.  */
                  in_fixed_width_font++;
                  tem = expansion (arg1, 0); /* expand @-commands in node */
                  in_fixed_width_font--;
                  add_anchor_name (tem, 1);
                  free (tem);
                  add_word ("\">");
                  execute_string ("%s",ref_name);
                  add_word ("</a>");
                }
              else
                {
                  execute_string ("%s:", ref_name);
                  in_fixed_width_font++;
                  execute_string (" (%s)%s", arg4, arg1);
                  add_xref_punctuation ();
                  in_fixed_width_font--;
                }

              /* Free all of the arguments found. */
              if (arg1) free (arg1);
              if (arg2) free (arg2);
              if (arg3) free (arg3);
              if (arg4) free (arg4);
              if (arg5) free (arg5);
              return;
            }
          else
            remember_node_reference (arg1, line_number, followed_reference);

          if (*arg3)
            {
              if (html)
                {
                  add_html_elt ("<a href=\"");
                  in_fixed_width_font++;
                  tem = expansion (arg1, 0);
                  in_fixed_width_font--;
                  add_anchor_name (tem, 1);
                  free (tem);
                  add_word ("\">");
                  execute_string ("%s", *arg2 ? arg2 : arg3);
                  add_word ("</a>");
                }
              else
                {
                  execute_string ("%s:", *arg2 ? arg2 : arg3);
                  in_fixed_width_font++;
                  execute_string (" %s", arg1);
                  add_xref_punctuation ();
                  in_fixed_width_font--;
                }
            }
          else
            {
              if (html)
                {
                  add_html_elt ("<a href=\"");
                  in_fixed_width_font++;
                  tem = expansion (arg1, 0);
                  in_fixed_width_font--;
                  add_anchor_name (tem, 1);
                  free (tem);
                  add_word ("\">");
                  if (*arg2)
                    execute_string ("%s", arg2);
                  else
                    {
                      char *fref = get_float_ref (arg1);
                      execute_string ("%s", fref ? fref : arg1);
                      free (fref);
                    }
                  add_word ("</a>");
                }
              else
                {
                  if (*arg2)
                    {
                      execute_string ("%s:", arg2);
                      in_fixed_width_font++;
                      execute_string (" %s", arg1);
                      add_xref_punctuation ();
                      in_fixed_width_font--;
                    }
                  else
                    {
                      char *fref = get_float_ref (arg1);
                      if (fref)
                        { /* Reference is being made to a float.  */
                          execute_string ("%s:", fref);
                          in_fixed_width_font++;
                          execute_string (" %s", arg1);
                          add_xref_punctuation ();
                          in_fixed_width_font--;
                        }
                      else
                        {
                          in_fixed_width_font++;
                          execute_string ("%s::", arg1);
                          in_fixed_width_font--;
                        }
                    }
                }
            }
        }
      /* Free all of the arguments found. */
      if (arg1) free (arg1);
      if (arg2) free (arg2);
      if (arg3) free (arg3);
      if (arg4) free (arg4);
      if (arg5) free (arg5);
    }
  else
    { /* Check that the next non-whitespace character is valid to follow
         an xref (so Info readers can find the node names).
         `input_text_offset' is pointing at the "}" which ended the xref
         command.  This is not used for @pxref or @ref, since we insert
         the necessary punctuation above, if needed.  */
      int temp = next_nonwhitespace_character ();

      if (temp == -1)
        warning (_("End of file reached while looking for `.' or `,'"));
      else if (temp != '.' && temp != ',')
        warning (_("`.' or `,' must follow @%s, not `%c'"), command, temp);
    }
}
 /** @brief Returns the matrix element K(i,j) */
 inline value_type operator()(size_type i, size_type j) const {
   FMMTL_ASSERT(i < rows());
   FMMTL_ASSERT(j < cols());
   return expansion()(target(i), source(j));
 }