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; }
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; }
#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(); } });