Example #1
0
// Create the CPU thread, which is a CPU + Video thread in Single Core mode.
static void CpuThread()
{
	DeclareAsCPUThread();

	const SConfig& _CoreParameter = SConfig::GetInstance();

	VideoBackendBase* video_backend = g_video_backend;
	if (_CoreParameter.bCPUThread)
	{
		Common::SetCurrentThreadName("CPU thread");
	}
	else
	{
		Common::SetCurrentThreadName("CPU-GPU thread");
		video_backend->Video_Prepare();
	}

	if (_CoreParameter.bFastmem)
		EMM::InstallExceptionHandler(); // Let's run under memory watch

	if (!s_state_filename.empty())
		State::LoadAs(s_state_filename);

	s_is_started = true;


	#ifdef USE_GDBSTUB
	#ifndef _WIN32
	if (!_CoreParameter.gdb_socket.empty())
	{
		gdb_init_local(_CoreParameter.gdb_socket.data());
		gdb_break();
	}
	else
	#endif
	if (_CoreParameter.iGDBPort > 0)
	{
		gdb_init(_CoreParameter.iGDBPort);
		// break at next instruction (the first instruction)
		gdb_break();
	}
	#endif

#ifdef USE_MEMORYWATCHER
	MemoryWatcher::Init();
#endif

	// Enter CPU run loop. When we leave it - we are done.
	CPU::Run();

	s_is_started = false;

	if (!_CoreParameter.bCPUThread)
		video_backend->Video_Cleanup();

	if (_CoreParameter.bFastmem)
		EMM::UninstallExceptionHandler();

	return;
}
Example #2
0
// Create the CPU thread, which is a CPU + Video thread in Single Core mode.
static void CpuThread()
{
  DeclareAsCPUThread();

  const SConfig& _CoreParameter = SConfig::GetInstance();

  if (_CoreParameter.bCPUThread)
  {
    Common::SetCurrentThreadName("CPU thread");
  }
  else
  {
    Common::SetCurrentThreadName("CPU-GPU thread");
    g_video_backend->Video_Prepare();
  }

  // This needs to be delayed until after the video backend is ready.
  DolphinAnalytics::Instance()->ReportGameStart();

  if (_CoreParameter.bFastmem)
    EMM::InstallExceptionHandler();  // Let's run under memory watch

  if (!s_state_filename.empty())
  {
    // Needs to PauseAndLock the Core
    // NOTE: EmuThread should have left us in CPU_STEPPING so nothing will happen
    //   until after the job is serviced.
    QueueHostJob([] {
      // Recheck in case Movie cleared it since.
      if (!s_state_filename.empty())
        State::LoadAs(s_state_filename);
    });
  }

  s_is_started = true;
  CPUSetInitialExecutionState();

#ifdef USE_GDBSTUB
#ifndef _WIN32
  if (!_CoreParameter.gdb_socket.empty())
  {
    gdb_init_local(_CoreParameter.gdb_socket.data());
    gdb_break();
  }
  else
#endif
      if (_CoreParameter.iGDBPort > 0)
  {
    gdb_init(_CoreParameter.iGDBPort);
    // break at next instruction (the first instruction)
    gdb_break();
  }
#endif

#ifdef USE_MEMORYWATCHER
  MemoryWatcher::Init();
#endif

  // Enter CPU run loop. When we leave it - we are done.
  CPU::Run();

  s_is_started = false;

  if (!_CoreParameter.bCPUThread)
    g_video_backend->Video_Cleanup();

  if (_CoreParameter.bFastmem)
    EMM::UninstallExceptionHandler();

  return;
}