Beispiel #1
0
void MainWindow::Play()
{
  // If we're in a paused game, start it up again.
  // Otherwise, play the selected game, if there is one.
  // Otherwise, play the default game.
  // Otherwise, play the last played game, if there is one.
  // Otherwise, prompt for a new game.
  if (Core::GetState() == Core::State::Paused)
  {
    Core::SetState(Core::State::Running);
    emit EmulationStarted();
  }
  else
  {
    QString selection = m_game_list->GetSelectedGame();
    if (selection.length() > 0)
    {
      StartGame(selection);
    }
    else
    {
      QString default_path = Settings::Instance().GetDefaultGame();
      if (!default_path.isEmpty() && QFile::exists(default_path))
      {
        StartGame(default_path);
      }
      else
      {
        Open();
      }
    }
  }
}
Beispiel #2
0
void MainWindow::StartGame(const QString& path)
{
	// If we're running, only start a new game once we've stopped the last.
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
	{
		if (!Stop())
			return;
	}
	// Boot up, show an error if it fails to load the game.
	if (!BootManager::BootCore(path.toStdString()))
	{
		QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
		return;
	}
	Settings().SetLastGame(path);
	ShowRenderWidget();
	emit EmulationStarted();
}
Beispiel #3
0
void MainWindow::StartGame(const QString& path)
{
  // If we're running, only start a new game once we've stopped the last.
  if (Core::GetState() != Core::State::Uninitialized)
  {
    if (!Stop())
      return;
  }
  // Boot up, show an error if it fails to load the game.
  if (!BootManager::BootCore(BootParameters::GenerateFromFile(path.toStdString())))
  {
    QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
    return;
  }
  ShowRenderWidget();
  emit EmulationStarted();

#ifdef Q_OS_WIN
  // Prevents Windows from sleeping, turning off the display, or idling
  EXECUTION_STATE shouldScreenSave =
      SConfig::GetInstance().bDisableScreenSaver ? ES_DISPLAY_REQUIRED : 0;
  SetThreadExecutionState(ES_CONTINUOUS | shouldScreenSave | ES_SYSTEM_REQUIRED);
#endif
}