Ejemplo n.º 1
0
//load from command-line, etc
void Utility::loadMedia(string pathname) {
  pathname.transform("\\", "/");
  if(pathname.endswith("/")) pathname.rtrim("/");

  //if a filename was provided: convert to game folder and then load
  if(!directory::exists(pathname) && file::exists(pathname)) {
    //if(program->ananke.open() == false) return;
    //function<string (string)> open = program->ananke.sym("ananke_open");
    //if(!open) return;
    Ananke ananke;
    string name = ananke.open(pathname);
    if(name.empty()) return;
    return loadMedia(name);
  }

  if(!directory::exists(pathname)) return;
  string type = extension(pathname);

  //determine type by comparing extension against all emulation cores
  for(auto& emulator : program->emulator) {
    for(auto& media : emulator->media) {
      if(media.bootable == false) continue;
      if(type != media.type) continue;
      return loadMedia(emulator, media, {pathname, "/"});
    }
  }

  //MessageWindow().setText("Unable to determine media type.").warning();
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
extern "C" string ananke_open(const string &filename) {
  Ananke ananke;
  return ananke.open(filename);
}
Ejemplo n.º 4
0
extern "C" string ananke_sync(const string &pathname) {
  Ananke ananke;
  return ananke.sync(pathname);
}
Ejemplo n.º 5
0
extern "C" string ananke_browse(const string &filename) {
  Ananke ananke;
  return ananke.open();
}