Exemple #1
0
int Application::main(int &argc, char **argv) {
    app = new App(argc, argv);
#if !defined(PLATFORM_WIN)
    app->setWindowIcon(QIcon(":/bsnes.png"));
#else
    //Windows port uses 256x256 icon from resource file
    CoInitialize(0);
    utf8_args(argc, argv);
#endif

    initPaths(argv[0]);
    locateFile(configFilename = "bsnes-qt.cfg", true);
    locateFile(styleSheetFilename = "style.qss", false);

    string customStylesheet;
    if(customStylesheet.readfile(styleSheetFilename) == true) {
        app->setStyleSheet((const char*)customStylesheet);
    } else {
        app->setStyleSheet(defaultStylesheet);
    }

    config().load(configFilename);
    mapper().bind();
    init();

    //initialize libsnes
    snes_set_video_refresh(bsnes_video_refresh);
    snes_set_audio_sample(bsnes_audio_sample);
    snes_set_input_poll(bsnes_input_poll);
    snes_set_input_state(bsnes_input_state);
    snes_init();

    //this used to disable the option if libsupergame was not installed;
    //after porting bsnes-qt to a standalone application, that's not possible through libsnes
    mainWindow->system_loadSpecial_superGameBoy->setVisible(true);

    if(argc == 2) {
        //if valid file was specified on the command-line, attempt to load it now
        cartridge.loadNormal(argv[1]);
    }

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(run()));
    timer->start(0);
    app->exec();

    //QbWindow::close() saves window geometry for next run
    for(unsigned i = 0; i < windowList.size(); i++) {
        windowList[i]->close();
    }

    cartridge.unload();
    config().save(configFilename);
    return 0;
}
int Application::main(int &argc, char **argv) {
  app = new App(argc, argv);
  #if !defined(PLATFORM_WIN)
    #if defined(PLATFORM_OSX)
    app->setWindowIcon(QIcon(":/bsnes_512.png"));
    #else
    app->setWindowIcon(QIcon(":/bsnes.png"));
    #endif
  #else
  //Windows port uses 256x256 icon from resource file
  CoInitialize(0);
  utf8_args(argc, argv);
  #endif

  initPaths(argv[0]);
  locateFile(configFilename = "bsnes-qt.cfg", true);
  locateFile(styleSheetFilename = "style.qss", false);

  string customStylesheet;
  if(customStylesheet.readfile(styleSheetFilename) == true) {
    app->setStyleSheet((const char*)customStylesheet);
  } else {
    app->setStyleSheet(defaultStylesheet);
  }

  config().load(configFilename);
  mapper().bind();
  init();
  SNES::system.init(&interface);
  mainWindow->system_loadSpecial_superGameBoy->setVisible(SNES::supergameboy.opened());

  if(argc == 2) {
    //if valid file was specified on the command-line, attempt to load it now
    cartridge.loadNormal(argv[1]);
  }

  timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(run()));
  timer->start(0);
  app->exec();

  //QbWindow::close() saves window geometry for next run
  for(unsigned i = 0; i < windowList.size(); i++) {
    windowList[i]->close();
  }

  cartridge.unload();
  config().save(configFilename);
  return 0;
}
Exemple #3
0
int main(int argc, char **argv) {
  #if defined(PLATFORM_WINDOWS)
  utf8_args(argc, argv);
  #endif

  //convert file to game folder; purify will then invoke dasShiny with game folder
  if(argc == 2 && !directory::exists(argv[1]) && file::exists(argv[1])) {
    invoke("purify", argv[1]);
    return 0;
  }

  new Application(argc, argv);
  delete application;
  return 0;
}
Exemple #4
0
int main(int argc, char** argv) {
  #if defined(PLATFORM_WINDOWS)
  utf8_args(argc, argv);
  #endif

  if(argc != 2 || !directory::exists(argv[1])) {
    print("loki v", Emulator::Version, "\n");
    print("usage: loki /path/game.sfc/\n");
    return 0;
  }

  Application::setName("loki");
  new Program(argv[1]);
  delete program;

  return 0;
}