示例#1
0
static void LoadObjectsNowWrap(void* streaming, bool a2)
{
	uint64_t beginTime = GetTickCount64();

	ICoreGameInit* init = Instance<ICoreGameInit>::Get();

	init->SetData("gta-core-five:loadCaller", fmt::sprintf("%016x", (uintptr_t)_ReturnAddress()));
	init->SetData("gta-core-five:loadTime", fmt::sprintf("%d", beginTime));

	g_origLoadObjectsNow(streaming, a2);

	init->SetData("gta-core-five:loadCaller", "");

	uint64_t elapsedTime = (GetTickCount64() - beginTime);

	if (elapsedTime > 2000)
	{
		trace("Warning: LoadObjectsNow took %d msec (invoked from %016x)!\n", elapsedTime, (uintptr_t)_ReturnAddress());
		trace("---------------- DO FIX THE ABOVE ^\n");

		if (Instance<ICoreGameInit>::Get()->GetGameLoaded())
		{
			trace("---------------- IF YOU CAN NOT FIX IT AND THIS OCCURS DURING GAMEPLAY\n");
			trace("---------------- PLEASE CONTACT THE FIVEM DEVELOPERS ON https://forum.fivem.net/\n");
			trace("---------------- WITH THIS CITIZENFX.LOG FILE\n");
			trace("---------------- \n");
			trace("---------------- THIS BLOCKING LOAD _WILL_ CAUSE CLIENT GAME CRASHES\n");
		}
	}
}
示例#2
0
static int GlobalErrorHandler(int eType, const char* buffer)
{
	static thread_local bool inError = false;

	trace("GlobalError: %s\n", buffer);

	if (inError)
	{
		static thread_local bool inRecursiveError = false;

		if (inRecursiveError)
		{
			return SysError("RECURSIVE RECURSIVE ERROR");
		}

		inRecursiveError = true;
		return SysError(va("Recursive error: %s", buffer));
	}

	inError = true;

	if (eType == ERR_NORMAL)
	{
#if !defined(COMPILING_LAUNCH) && !defined(COMPILING_CONSOLE) && !defined(IS_FXSERVER)
		ICoreGameInit* gameInit = Instance<ICoreGameInit>::Get();
		bool handled = false;

		if (gameInit && gameInit->TriggerError(buffer))
		{
			handled = true;
		}
		
		if (gameInit && gameInit->GetGameLoaded())
		{
			gameInit->KillNetwork(ToWide(buffer).c_str());

			handled = true;
		}
		
		if (!handled)
#endif
		{
			return SysError(buffer);
		}
	}
	else
	{
		return SysError(buffer);
	}

	inError = false;

	return 0;
}
示例#3
0
static void GlobalErrorHandler(int eType, const char* buffer)
{
	static bool inError = false;

	trace("GlobalError: %s\n", buffer);

	if (inError)
	{
		static bool inRecursiveError = false;

		if (inRecursiveError)
		{
			SysError("RECURSIVE RECURSIVE ERROR");
		}

		inRecursiveError = true;
		SysError(va("Recursive error: %s", buffer));
	}

	inError = true;

	if (eType == ERR_NORMAL)
	{
	#if !defined(COMPILING_LAUNCH) && !defined(COMPILING_CONSOLE)
			// TODO: UI killer for pre-connected state
			ICoreGameInit* gameInit = Instance<ICoreGameInit>::Get();

			if (gameInit && gameInit->GetGameLoaded())
			{
				static wchar_t wbuffer[BUFFER_LENGTH];
				mbstowcs(wbuffer, buffer, _countof(wbuffer));

				gameInit->KillNetwork(wbuffer);
			}
			else
	#endif
		{
			SysError(buffer);
		}
	}
	else
	{
		SysError(buffer);
	}

	inError = false;
}
示例#4
0
#include <nutsnbolts.h>

#ifdef GTA_FIVE
static InitFunction initFunction([] ()
{
	NetLibrary::OnNetLibraryCreate.Connect([] (NetLibrary* library)
	{
		static NetLibrary* netLibrary = library;

		library->OnInitReceived.Connect([] (NetAddress server)
		{
			//nui::SetMainUI(false);

			//nui::DestroyFrame("mpMenu");

			ICoreGameInit* gameInit = Instance<ICoreGameInit>::Get();

			if (!gameInit->GetGameLoaded())
			{
				gameInit->LoadGameFirstLaunch([] ()
				{
					// download frame code
					Sleep(1);

					return netLibrary->AreDownloadsComplete();
				});
			}
			else
			{
				gameInit->ReloadGame();
			}