コード例 #1
0
ファイル: loki.cpp プロジェクト: quequotion/higan-qq
Program::Program(string pathname) {
  program = this;

  basepath = nall::programpath();
  userpath = {nall::configpath(), "loki/"};
  sharedpath = {nall::sharedpath(), "loki/"};
  directory::create(userpath);

  new Settings;
  new InputManager;
  new Interface;
  new Debugger;
  new Presentation;
  new Terminal;

  presentation->setVisible();
  terminal->setVisible();
  Application::processEvents();

  video.driver(settings->video.driver);
  video.set(Video::Handle, presentation->viewport.handle());
  video.set(Video::Synchronize, settings->video.synchronize);
  video.set(Video::Filter, Video::FilterNearest);
  if(video.init() == false) { video.driver("None"); video.init(); }

  audio.driver(settings->audio.driver);
  audio.set(Audio::Handle, presentation->viewport.handle());
  audio.set(Audio::Synchronize, settings->audio.synchronize);
  audio.set(Audio::Frequency, 48000u);
  if(audio.init() == false) { audio.driver("None"); audio.init(); }

  input.driver(settings->input.driver);
  input.set(Input::Handle, presentation->viewport.handle());
  if(input.init() == false) { input.driver("None"); input.init(); }
  input.onChange = {&Terminal::inputEvent, terminal};

  dspaudio.setPrecision(16);
  dspaudio.setBalance(0.0);
  dspaudio.setFrequency(32000);
  dspaudio.setResampler(DSP::ResampleEngine::Hermite);
  dspaudio.setResamplerFrequency(48000);

  presentation->showSplash();

  inputManager->load();
  interface->load(pathname);
  debugger->load();
  terminal->load();

  Application::main = {&Program::main, this};
  Application::run();

  terminal->unload();
  debugger->unload();
  interface->unload();
  inputManager->unload();
  settings->unload();
}
コード例 #2
0
ファイル: ethos.cpp プロジェクト: cbartol/termboy
Program::Program(int argc, char** argv) {
  program = this;

  basepath = dir(realpath(argv[0]));
  userpath = {nall::configpath(), "termboy/"};
  sharedpath = {nall::sharedpath(), "termboy/"};
  directory::create(userpath);

  bootstrap();
  active = nullptr;

  config = new ConfigurationSettings;
  utility = new Utility;

  audio.driver("ALSA");

  if(audio.init() == false) {
    audio.driver("None");
    audio.init();
  }

  init_curses();
  inputManager = new InputManager();
  inputManager->setupKeyboard();

  dspaudio.setPrecision(16);
  dspaudio.setBalance(0.0);
  dspaudio.setFrequency(96000);

  utility->synchronizeRuby();
  utility->updateShader();

  if(argc >= 2)
    utility->loadMedia(argv[1]);

  //TODO:  This is bad! Remove hardcoded string and use appropriate path
  //TODO:  periodically sync RAM in case of crash?
  Ananke ananke;
  ananke.sync("/home/dobyrch/ROMs/Game Boy/pokemon_blue.gb");
  while(true) {
    main();
  }

  utility->unload();
  //config->save();
}
コード例 #3
0
ファイル: ethos.cpp プロジェクト: zeromus/dasShiny
Application::Application(int argc, char **argv) {
  application = this;
  quit = false;
  pause = false;
  autopause = false;

  basepath = realpath(argv[0]);
  userpath = {nall::configpath(), "dasShiny/"};
  directory::create(userpath);

  bootstrap();
  active = nullptr;

  if(Intrinsics::platform() == Intrinsics::Platform::Windows) {
    normalFont = "Tahoma, 8";
    boldFont = "Tahoma, 8, Bold";
    titleFont = "Tahoma, 16, Bold";
    monospaceFont = "Lucida Console, 8";
  } else {
    normalFont = "Sans, 8";
    boldFont = "Sans, 8, Bold";
    titleFont = "Sans, 16, Bold";
    monospaceFont = "Liberation Mono, 8";
  }

  config = new Configuration;
  video.driver(config->video.driver);
  audio.driver(config->audio.driver);
  input.driver(config->input.driver);

  utility = new Utility;
  inputManager = new InputManager;
  windowManager = new WindowManager;
  browser = new Browser;
  presentation = new Presentation;
  dipSwitches = new DipSwitches;
  videoSettings = new VideoSettings;
  audioSettings = new AudioSettings;
  inputSettings = new InputSettings;
  hotkeySettings = new HotkeySettings;
  timingSettings = new TimingSettings;
  driverSettings = new DriverSettings;
  settings = new Settings;
  cheatDatabase = new CheatDatabase;
  cheatEditor = new CheatEditor;
  stateManager = new StateManager;
  windowManager->loadGeometry();
  presentation->setVisible();

  video.set(Video::Handle, presentation->viewport.handle());
  if(!video.cap(Video::Depth) || !video.set(Video::Depth, depth = 30u)) {
    video.set(Video::Depth, depth = 24u);
  }
  if(video.init() == false) { video.driver("None"); video.init(); }

  audio.set(Audio::Handle, presentation->viewport.handle());
  if(audio.init() == false) { audio.driver("None"); audio.init(); }

  input.set(Input::Handle, presentation->viewport.handle());
  if(input.init() == false) { input.driver("None"); input.init(); }

  dspaudio.setPrecision(16);
  dspaudio.setBalance(0.0);
  dspaudio.setFrequency(96000);

  utility->synchronizeRuby();
  utility->updateShader();

  if(argc >= 2) commandLineLoad(argv[1]);

  while(quit == false) {
    OS::processEvents();
    run();
  }

  utility->unload();
  config->save();
  browser->saveConfiguration();
  inputManager->saveConfiguration();
  windowManager->saveGeometry();
}