예제 #1
0
// =================================================================================
// Wrapper
// I don't want the imported functions to be global
// =================================================================================
void ScriptHook::ScriptWait(DWORD dwTime)
{
#ifndef GTA_LUA_TEST_EXE
	scriptWait(dwTime);
#else
	Sleep(dwTime);
#endif
}
예제 #2
0
void ScriptMainLoop()
{
	while (ManagedInit())
	{
		while (ManagedTick())
		{
			scriptWait(0);
		}
	}
}
예제 #3
0
void ScriptMainSetup()
{
	sGameReloaded = true;
	sMainFib = GetCurrentFiber();

	if (sScriptFib == nullptr)
	{
		// Create our own fiber for the common language runtime once
		sScriptFib = CreateFiber(0, reinterpret_cast<LPFIBER_START_ROUTINE>(&ScriptMainLoop), nullptr);
	}

	while (true)
	{
		// Yield execution
		scriptWait(0);

		// Switch to our own fiber and wait for it to switch back
		SwitchToFiber(sScriptFib);
	}
}