コード例 #1
0
ファイル: System.cpp プロジェクト: Carter07/ppsspp
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
	INFO_LOG(BOOT, "PPSSPP %s", PPSSPP_GIT_VERSION);

	coreParameter = coreParam;
	coreParameter.errorString = "";

	if (g_Config.bSeparateCPUThread) {
		Core_ListenShutdown(System_Wake);
		CPU_SetState(CPU_THREAD_PENDING);
		cpuThread = new std::thread(&CPU_RunLoop);
		cpuThread->detach();
		CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady);
	} else {
		CPU_Init();
	}

	bool success = coreParameter.fileToStart != "";
	*error_string = coreParameter.errorString;
	if (success) {
		success = GPU_Init();
		if (!success) {
			PSP_Shutdown();
			*error_string = "Unable to initialize rendering engine.";
		}
	}
	return success;
}
コード例 #2
0
ファイル: System.cpp プロジェクト: dutea/ppsspp
bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
	if (pspIsIniting) {
		return false;
	}

#if defined(_WIN32) && defined(_M_X64)
	INFO_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION);
#elif defined(_WIN32) && !defined(_M_X64)
	INFO_LOG(BOOT, "PPSSPP %s Windows 32 bit", PPSSPP_GIT_VERSION);
#else
	INFO_LOG(BOOT, "PPSSPP %s", PPSSPP_GIT_VERSION);
#endif
	coreParameter = coreParam;
	coreParameter.errorString = "";
	pspIsIniting = true;

	if (g_Config.bSeparateCPUThread) {
		Core_ListenShutdown(System_Wake);
		CPU_SetState(CPU_THREAD_PENDING);
		cpuThread = new std::thread(&CPU_RunLoop);
		cpuThread->detach();
	} else {
		CPU_Init();
	}

	*error_string = coreParameter.errorString;
	return coreParameter.fileToStart != "";
}
コード例 #3
0
ファイル: System.cpp プロジェクト: Alceris/ppsspp
void PSP_RunLoopUntil(u64 globalticks) {
	SaveState::Process();
	if (coreState == CORE_POWERDOWN || coreState == CORE_ERROR) {
		return;
	}

	// Switch the CPU thread on or off, as the case may be.
	bool useCPUThread = g_Config.bSeparateCPUThread;
	if (useCPUThread && cpuThread == nullptr) {
		// Need to start the cpu thread.
		Core_ListenShutdown(System_Wake);
		CPU_SetState(CPU_THREAD_RESUME);
		cpuThread = new std::thread(&CPU_RunLoop);
		cpuThreadID = cpuThread->get_id();
		cpuThread->detach();
		if (gpu) {
			gpu->SetThreadEnabled(true);
		}
		CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady);
	} else if (!useCPUThread && cpuThread != nullptr) {
		CPU_SetState(CPU_THREAD_QUIT);
		CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown);
		delete cpuThread;
		cpuThread = nullptr;
		cpuThreadID = std::thread::id();
		if (gpu) {
			gpu->SetThreadEnabled(false);
		}
	}

	if (cpuThread != nullptr) {
		// Tell the gpu a new frame is about to begin, before we start the CPU.
		gpu->SyncBeginFrame();

		cpuThreadUntil = globalticks;
		if (CPU_NextState(CPU_THREAD_RUNNING, CPU_THREAD_EXECUTE)) {
			// The CPU doesn't actually respect cpuThreadUntil well, especially when skipping frames.
			// TODO: Something smarter?  Or force CPU to bail periodically?
			while (!CPU_IsReady()) {
				gpu->RunEventsUntil(CoreTiming::GetTicks() + msToCycles(1000));
				if (coreState != CORE_RUNNING) {
					CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady);
				}
			}
		} else {
			ERROR_LOG(CPU, "Unable to execute CPU run loop, unexpected state: %d", cpuThreadState);
		}
	} else {
		mipsr4k.RunLoopUntil(globalticks);
	}

	gpu->CleanupBeforeUI();
}
コード例 #4
0
ファイル: System.cpp プロジェクト: Alceris/ppsspp
bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
	if (pspIsIniting || pspIsQuiting) {
		return false;
	}

#if defined(_WIN32) && defined(_M_X64)
	INFO_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION);
#elif defined(_WIN32) && !defined(_M_X64)
	INFO_LOG(BOOT, "PPSSPP %s Windows 32 bit", PPSSPP_GIT_VERSION);
#else
	INFO_LOG(BOOT, "PPSSPP %s", PPSSPP_GIT_VERSION);
#endif
	
	GraphicsContext *temp = coreParameter.graphicsContext;
	coreParameter = coreParam;
	if (coreParameter.graphicsContext == nullptr) {
		coreParameter.graphicsContext = temp;
	}
	coreParameter.errorString = "";
	pspIsIniting = true;

	if (g_Config.bSeparateCPUThread) {
		Core_ListenShutdown(System_Wake);
		CPU_SetState(CPU_THREAD_PENDING);
		cpuThread = new std::thread(&CPU_RunLoop);
		cpuThreadID = cpuThread->get_id();
		cpuThread->detach();
	} else {
		CPU_Init();
	}

	*error_string = coreParameter.errorString;
	bool success = coreParameter.fileToStart != "";
	if (!success) {
		pspIsIniting = false;
	}
	return success;
}
コード例 #5
0
ファイル: System.cpp プロジェクト: 18859966862/ppsspp
bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
	if (pspIsIniting) {
		return false;
	}

#if defined(_WIN32) && defined(_M_X64)
	INFO_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION);
#elif defined(_WIN32) && !defined(_M_X64)
	INFO_LOG(BOOT, "PPSSPP %s Windows 32 bit", PPSSPP_GIT_VERSION);
#else
	INFO_LOG(BOOT, "PPSSPP %s", PPSSPP_GIT_VERSION);
#endif
	coreParameter = coreParam;
	coreParameter.errorString = "";
	pspIsIniting = true;

	if (g_Config.bSeparateCPUThread) {
		Core_ListenShutdown(System_Wake);
		CPU_SetState(CPU_THREAD_PENDING);
		cpuThread = new std::thread(&CPU_RunLoop);
#ifdef _XBOX
		SuspendThread(cpuThread->native_handle());
		XSetThreadProcessor(cpuThread->native_handle(), 2);
		ResumeThread(cpuThread->native_handle());
#endif
		cpuThreadID = cpuThread->get_id();
		cpuThread->detach();
	} else {
		CPU_Init();
	}

	*error_string = coreParameter.errorString;
	bool success = coreParameter.fileToStart != "";
	if (!success) {
		pspIsIniting = false;
	}
	return success;
}