diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2018-04-11 08:39:10 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2018-04-11 08:39:10 -0400 |
commit | e9f1db15ccc1f1dc02f8cffb1afeacb759b8eae9 (patch) | |
tree | 1ff33116e55c3bbee16f7cd64a56b710491f4284 /indra/newview/llappviewer.cpp | |
parent | f82548b931af69a08d53818ec7a96a967c05151c (diff) | |
parent | 12ccb65603ec50ac80d85c4e023ec8e026c9e1f2 (diff) |
Automated merge with ssh://bitbucket.org/lindenlab/viewer-release
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 510 |
1 files changed, 257 insertions, 253 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 464e216cf0..dbfbe40bd5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llappviewer.cpp * @brief The LLAppViewer class definitions * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2012, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -198,7 +198,7 @@ #include "llfolderview.h" #include "llagentpilot.h" #include "llvovolume.h" -#include "llflexibleobject.h" +#include "llflexibleobject.h" #include "llvosurfacepatch.h" #include "llviewerfloaterreg.h" #include "llcommandlineparser.h" @@ -237,9 +237,9 @@ #include "llviewereventrecorder.h" // *FIX: These extern globals should be cleaned up. -// The globals either represent state/config/resource-storage of either -// this app, or another 'component' of the viewer. App globals should be -// moved into the app class, where as the other globals should be +// The globals either represent state/config/resource-storage of either +// this app, or another 'component' of the viewer. App globals should be +// moved into the app class, where as the other globals should be // moved out of here. // If a global symbol reference seems valid, it will be included // via header files above. @@ -284,9 +284,9 @@ BOOL gShowObjectUpdates = FALSE; BOOL gUseQuickTime = TRUE; eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; -S32 gLastExecDuration = -1; // (<0 indicates unknown) +S32 gLastExecDuration = -1; // (<0 indicates unknown) -#if LL_WINDOWS +#if LL_WINDOWS # define LL_PLATFORM_KEY "win" #elif LL_DARWIN # define LL_PLATFORM_KEY "mac" @@ -542,7 +542,7 @@ bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base) params.bottom_pad = 2; base->appendWidget(params," ",false); - + return true; } @@ -579,7 +579,7 @@ static void settings_to_globals() MENU_BAR_WIDTH = gSavedSettings.getS32("MenuBarWidth"); LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize")); - + LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLCoreProfile"); LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO"); LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic"); @@ -601,7 +601,7 @@ static void settings_to_globals() gAgentPilot.setNumRuns(gSavedSettings.getS32("StatsNumRuns")); gAgentPilot.setQuitAfterRuns(gSavedSettings.getBOOL("StatsQuitAfterRuns")); gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle")); - + gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale"); @@ -632,7 +632,7 @@ public: void run() { llofstream os(mFile.c_str()); - + while (!LLAppViewer::instance()->isQuitting()) { LLTrace::BlockTimer::writeLog(os); @@ -664,16 +664,16 @@ bool LLAppViewer::sendURLToOtherInstance(const std::string& url) // Static members. // The single viewer app. LLAppViewer* LLAppViewer::sInstance = NULL; -LLTextureCache* LLAppViewer::sTextureCache = NULL; -LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; -LLTextureFetch* LLAppViewer::sTextureFetch = NULL; +LLTextureCache* LLAppViewer::sTextureCache = NULL; +LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; +LLTextureFetch* LLAppViewer::sTextureFetch = NULL; std::string getRuntime() { return llformat("%.4f", (F32)LLTimer::getElapsedSeconds().value()); } -LLAppViewer::LLAppViewer() +LLAppViewer::LLAppViewer() : mMarkerFile(), mLogoutMarkerFile(), mReportedCrash(false), @@ -716,12 +716,12 @@ LLAppViewer::LLAppViewer() gLoggedInTime.stop(); initLoggingAndGetLastDuration(); - + processMarkerFiles(); // // OK to write stuff to logs now, we've now crash reported if necessary // - + LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString(), LLOSInfo::instance().getOSStringSimple()); } @@ -730,7 +730,7 @@ LLAppViewer::~LLAppViewer() delete mSettingsLocationList; destroyMainloopTimeout(); - + // If we got to this destructor somehow, the app didn't hang. removeMarkerFiles(); } @@ -757,7 +757,7 @@ void fast_exit(int rc) bool LLAppViewer::init() -{ +{ setupErrorHandling(mSecondInstance); // @@ -779,12 +779,12 @@ bool LLAppViewer::init() gDirUtilp->setSkinFolder("default", "en"); // initLoggingAndGetLastDuration(); - + // // OK to write stuff to logs now, we've now crash reported if necessary // init_default_trans_args(); - + if (!initConfiguration()) return false; @@ -823,11 +823,11 @@ bool LLAppViewer::init() // Initialize the non-LLCurl libcurl library. Should be called // before consumers (LLTextureFetch). mAppCoreHttp.init(); - + LL_INFOS("InitInfo") << "LLCore::Http initialized." << LL_ENDL ; LLMachineID::init(); - + { if (gSavedSettings.getBOOL("QAModeMetrics")) { @@ -902,7 +902,7 @@ bool LLAppViewer::init() LLKeyboard::setStringTranslatorFunc( LLTrans::getKeyboardString ); LLWeb::initClass(); // do this after LLUI - + // Provide the text fields with callbacks for opening Urls LLUrlAction::setOpenURLCallback(boost::bind(&LLWeb::loadURL, _1, LLStringUtil::null, LLStringUtil::null)); LLUrlAction::setOpenURLInternalCallback(boost::bind(&LLWeb::loadURLInternal, _1, LLStringUtil::null, LLStringUtil::null, false)); @@ -918,11 +918,11 @@ bool LLAppViewer::init() LLFloater::initClass(); ///////////////////////////////////////////////// - + LLToolMgr::getInstance(); // Initialize tool manager if not already instantiated - + LLViewerFloaterReg::registerFloaters(); - + ///////////////////////////////////////////////// // // Load settings files @@ -941,7 +941,7 @@ bool LLAppViewer::init() #else mime_types_name = "mime_types.xml"; #endif - LLMIMETypes::parseMIMETypes( mime_types_name ); + LLMIMETypes::parseMIMETypes( mime_types_name ); // Copy settings to globals. *TODO: Remove or move to appropriage class initializers settings_to_globals(); @@ -1001,7 +1001,7 @@ bool LLAppViewer::init() LLInitClassList::instance().fireCallbacks(); LLFolderViewItem::initClass(); // SJB: Needs to happen after initWindow(), not sure why but related to fonts - + gGLManager.getGLInfo(gDebugInfo); gGLManager.printGLInfoString(); @@ -1024,7 +1024,7 @@ bool LLAppViewer::init() // If we don't have the right GL requirements, exit. if (!gGLManager.mHasRequirements) - { + { // can't use an alert here since we're exiting and // all hell breaks lose. OSMessageBox( @@ -1036,7 +1036,7 @@ bool LLAppViewer::init() // Without SSE2 support we will crash almost immediately, warn here. if (!gSysCPU.hasSSE2()) - { + { // can't use an alert here since we're exiting and // all hell breaks lose. OSMessageBox( @@ -1052,7 +1052,7 @@ bool LLAppViewer::init() bool unsupported = false; LLSD args; std::string minSpecs; - + // get cpu data from xml std::stringstream minCPUString(LLNotifications::instance().getGlobalString("UnsupportedCPUAmount")); S32 minCPU = 0; @@ -1085,11 +1085,11 @@ bool LLAppViewer::init() if (LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_UNKNOWN) { LLNotificationsUtil::add("UnknownGPU"); - } - + } + if(unsupported) { - if(!gSavedSettings.controlExists("WarnUnsupportedHardware") + if(!gSavedSettings.controlExists("WarnUnsupportedHardware") || gSavedSettings.getBOOL("WarnUnsupportedHardware")) { args["MINSPECS"] = minSpecs; @@ -1099,17 +1099,21 @@ bool LLAppViewer::init() } } - char* PARENT = getenv("PARENT"); - if (! (PARENT && std::string(PARENT) == "SL_Launcher")) + // MAINT-8305: If we're processing a SLURL, skip the launcher check. + if (gSavedSettings.getString("CmdLineLoginLocation").empty()) { - // Don't directly run this executable. Please run the launcher, which - // will run the viewer itself. - // Naturally we do not consider this bulletproof. The point is to - // gently remind a user who *inadvertently* finds him/herself in this - // situation to do things the Right Way. Anyone who intentionally - // bypasses this mechanism needs no reminder that s/he's shooting - // him/herself in the foot. - LLNotificationsUtil::add("RunLauncher"); + const char* PARENT = getenv("PARENT"); + if (! (PARENT && std::string(PARENT) == "SL_Launcher")) + { + // Don't directly run this executable. Please run the launcher, which + // will run the viewer itself. + // Naturally we do not consider this bulletproof. The point is to + // gently remind a user who *inadvertently* finds him/herself in this + // situation to do things the Right Way. Anyone who intentionally + // bypasses this mechanism needs no reminder that s/he's shooting + // him/herself in the foot. + LLNotificationsUtil::add("RunLauncher"); + } } #if LL_WINDOWS @@ -1195,7 +1199,7 @@ bool LLAppViewer::init() LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; - //EXT-7013 - On windows for some locale (Japanese) standard + //EXT-7013 - On windows for some locale (Japanese) standard //datetime formatting functions didn't support some parameters such as "weekday". //Names for days and months localized in xml are also useful for Polish locale(STORM-107). std::string language = gSavedSettings.getString("Language"); @@ -1289,8 +1293,8 @@ void LLAppViewer::checkMemory() bool is_low = LLMemory::isMemoryPoolLow() ; - LLPipeline::throttleNewMemoryAllocation(is_low) ; - + LLPipeline::throttleNewMemoryAllocation(is_low) ; + if(is_low) { LLMemory::logMemoryInfo() ; @@ -1366,8 +1370,8 @@ bool LLAppViewer::frame() LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); if(mem_leak_instance) { - mem_leak_instance->idle() ; - } + mem_leak_instance->idle() ; + } // canonical per-frame event mainloop.post(newFrame); @@ -1393,7 +1397,7 @@ bool LLAppViewer::frame() // Update state based on messages, user input, object idle. { pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds! - + LL_RECORD_BLOCK_TIME(FTM_IDLE); idle(); @@ -1446,7 +1450,7 @@ bool LLAppViewer::frame() // Sleep and run background threads { LL_RECORD_BLOCK_TIME(FTM_SLEEP); - + // yield some time to the os based on command line option static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1); if(yield_time >= 0) @@ -1472,7 +1476,7 @@ bool LLAppViewer::frame() LLAppViewer::getImageDecodeThread()->pause(); } } - + if (mRandomizeFramerate) { ms_sleep(rand() % 200); @@ -1486,7 +1490,7 @@ bool LLAppViewer::frame() } S32 total_work_pending = 0; - S32 total_io_pending = 0; + S32 total_io_pending = 0; { S32 work_pending = 0; S32 io_pending = 0; @@ -1513,18 +1517,18 @@ bool LLAppViewer::frame() } gMeshRepo.update() ; - + if(!total_work_pending) //pause texture fetching threads if nothing to process. { LLAppViewer::getTextureCache()->pause(); LLAppViewer::getImageDecodeThread()->pause(); - LLAppViewer::getTextureFetch()->pause(); + LLAppViewer::getTextureFetch()->pause(); } if(!total_io_pending) //pause file threads if nothing to process. { - LLVFSThread::sLocal->pause(); - LLLFSThread::sLocal->pause(); - } + LLVFSThread::sLocal->pause(); + LLLFSThread::sLocal->pause(); + } //texture fetching debugger if(LLTextureFetchDebugger::isEnabled()) @@ -1533,7 +1537,7 @@ bool LLAppViewer::frame() LLFloaterReg::findTypedInstance<LLFloaterTextureFetchDebugger>("tex_fetch_debugger"); if(tex_fetch_debugger_instance) { - tex_fetch_debugger_instance->idle() ; + tex_fetch_debugger_instance->idle() ; } } @@ -1695,12 +1699,12 @@ bool LLAppViewer::cleanup() LLPluginProcessParent::shutdown(); LLVoiceClient::getInstance()->terminate(); - + disconnectViewer(); LL_INFOS() << "Viewer disconnected" << LL_ENDL; - display_cleanup(); + display_cleanup(); release_start_screen(); // just in case @@ -1725,7 +1729,7 @@ bool LLAppViewer::cleanup() } LLKeyframeDataCache::clear(); - + // End TransferManager before deleting systems it depends on (Audio, VFS, AssetStorage) #if 0 // this seems to get us stuck in an infinite loop... gTransferManager.cleanup(); @@ -1801,24 +1805,24 @@ bool LLAppViewer::cleanup() gViewerWindow->shutdownViews(); LL_INFOS() << "Cleaning up Inventory" << LL_ENDL; - + // Cleanup Inventory after the UI since it will delete any remaining observers // (Deleted observers should have already removed themselves) gInventory.cleanupInventory(); LL_INFOS() << "Cleaning up Selections" << LL_ENDL; - + // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); - + LL_INFOS() << "Shutting down OpenGL" << LL_ENDL; // Shut down OpenGL if( gViewerWindow) { gViewerWindow->shutdownGL(); - + // Destroy window, and make sure we're not fullscreen // This may generate window reshape and activation events. // Therefore must do this before destroying the message system. @@ -1828,26 +1832,26 @@ bool LLAppViewer::cleanup() } LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL; - + // viewer UI relies on keyboard so keep it aound until viewer UI isa gone delete gKeyboard; gKeyboard = NULL; // Turn off Space Navigator and similar devices LLViewerJoystick::getInstance()->terminate(); - + LL_INFOS() << "Cleaning up Objects" << LL_ENDL; - + LLViewerObject::cleanupVOClasses(); SUBSYSTEM_CLEANUP(LLAvatarAppearance); - + SUBSYSTEM_CLEANUP(LLAvatarAppearance); - + SUBSYSTEM_CLEANUP(LLPostProcess); LLTracker::cleanupInstance(); - + // *FIX: This is handled in LLAppViewerWin32::cleanup(). // I'm keeping the comment to remember its order in cleanup, // in case of unforseen dependency. @@ -1862,8 +1866,8 @@ bool LLAppViewer::cleanup() } LLPrimitive::cleanupVolumeManager(); - LL_INFOS() << "Additional Cleanup..." << LL_ENDL; - + LL_INFOS() << "Additional Cleanup..." << LL_ENDL; + LLViewerParcelMgr::cleanupGlobals(); // *Note: this is where gViewerStats used to be deleted. @@ -1876,7 +1880,7 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLWorldMapView); SUBSYSTEM_CLEANUP(LLFolderViewItem); SUBSYSTEM_CLEANUP(LLUI); - + // // Shut down the VFS's AFTER the decode manager cleans up (since it cleans up vfiles). // Also after viewerwindow is deleted, since it may have image pointers (which have vfiles) @@ -1887,18 +1891,18 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLVFile); LL_INFOS() << "Saving Data" << LL_ENDL; - + // Store the time of our current logoff gSavedPerAccountSettings.setU32("LastLogoff", time_corrected()); // Must do this after all panels have been deleted because panels that have persistent rects // save their rects on delete. gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - + LLUIColorTable::instance().saveUserSettings(); // PerAccountSettingsFile should be empty if no user has been logged on. - // *FIX:Mani This should get really saved in a "logoff" mode. + // *FIX:Mani This should get really saved in a "logoff" mode. if (gSavedSettings.getString("PerAccountSettingsFile").empty()) { LL_INFOS() << "Not saving per-account settings; don't know the account name yet." << LL_ENDL; @@ -1933,13 +1937,13 @@ bool LLAppViewer::cleanup() LL_INFOS() << "Purging all cache files on exit" << LL_ENDL; gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); } - + writeDebugInfo(); LLLocationHistory::getInstance()->save(); LLAvatarIconIDCache::getInstance()->save(); - + LLViewerMedia::saveCookieFile(); // Stop the plugin read thread if it's running. @@ -1975,9 +1979,9 @@ bool LLAppViewer::cleanup() // shotdown all worker threads before deleting them in case of co-dependencies mAppCoreHttp.requestStop(); sTextureFetch->shutdown(); - sTextureCache->shutdown(); + sTextureCache->shutdown(); sImageDecodeThread->shutdown(); - + sTextureFetch->shutDownTextureCacheThread() ; sTextureFetch->shutDownImageDecodeThread() ; @@ -2002,16 +2006,16 @@ bool LLAppViewer::cleanup() if (LLFastTimerView::sAnalyzePerformance) { LL_INFOS() << "Analyzing performance" << LL_ENDL; - + std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; - std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; + std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv"; LLFastTimerView::doAnalysis( gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name)); - } + } SUBSYSTEM_CLEANUP(LLMetricPerformanceTesterBasic) ; @@ -2024,7 +2028,7 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLViewerParcelMedia); gTextureList.shutdown(); // shutdown again in case a callback added something LLUIImageList::getInstance()->cleanUp(); - + // This should eventually be done in LLAppViewer SUBSYSTEM_CLEANUP(LLImage); SUBSYSTEM_CLEANUP(LLVFSThread); @@ -2039,21 +2043,21 @@ bool LLAppViewer::cleanup() #endif LL_INFOS() << "Misc Cleanup" << LL_ENDL; - + // For safety, the LLVFS has to be deleted *after* LLVFSThread. This should be cleaned up. // (LLVFS doesn't know about LLVFSThread so can't kill pending requests) -Steve delete gStaticVFS; gStaticVFS = NULL; delete gVFS; gVFS = NULL; - + gSavedSettings.cleanup(); LLUIColorTable::instance().clear(); LLWatchdog::getInstance()->cleanup(); LLViewerAssetStatsFF::cleanup(); - + // If we're exiting to launch an URL, do that here so the screen // is at the right resolution before we launch IE. if (!gLaunchFileOnQuit.empty()) @@ -2093,7 +2097,7 @@ bool LLAppViewer::cleanup() // all cleanup will get subsumed into the generic calls. So the calls you // still see above are calls that MUST happen before the generic cleanup // kicks in. - + // This calls every remaining LLSingleton's cleanupSingleton() method. // This method should perform any cleanup that might take significant // realtime, or might throw an exception. @@ -2148,7 +2152,7 @@ bool LLAppViewer::initThreads() LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), sImageDecodeThread, enable_threads && true, - app_metrics_qa_mode); + app_metrics_qa_mode); if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) { @@ -2174,7 +2178,7 @@ void errorCallback(const std::string &error_string) //Set the ErrorActivated global so we know to create a marker file gLLErrorActivated = true; - + LLError::crashAndLoop(error_string); } @@ -2230,7 +2234,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() gLastExecDuration = -1; // unknown } std::string duration_log_msg(duration_log_stream.str()); - + // Create a new start marker file for comparison with log file time for the next run LLAPRFile start_marker_file ; start_marker_file.open(start_marker_file_name, LL_APR_WB); @@ -2253,7 +2257,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, bool set_defaults) -{ +{ if (!mSettingsLocationList) { LL_ERRS() << "Invalid settings location list" << LL_ENDL; @@ -2285,7 +2289,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string full_settings_path; - if (file.file_name_setting.isProvided() + if (file.file_name_setting.isProvided() && gSavedSettings.controlExists(file.file_name_setting)) { // try to find filename stored in file_name_setting control @@ -2372,7 +2376,7 @@ namespace } // anonymous namespace bool LLAppViewer::initConfiguration() -{ +{ //Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); LLXMLNodePtr root; @@ -2391,17 +2395,17 @@ bool LLAppViewer::initConfiguration() { LL_ERRS() << "Invalid settings file list " << settings_file_list << LL_ENDL; } - + // The settings and command line parsing have a fragile // order-of-operation: // - load defaults from app_settings // - set procedural settings values // - read command line settings // - selectively apply settings needed to load user settings. - // - load overrides from user_settings + // - load overrides from user_settings // - apply command line settings (to override the overrides) // - load per account settings (happens in llstartup - + // - load defaults bool set_defaults = true; if(!loadSettingsFromDirectory("Default", set_defaults)) @@ -2415,7 +2419,7 @@ bool LLAppViewer::initConfiguration() initStrings(); // setup paths for LLTrans based on settings files only // - set procedural settings // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet - gSavedSettings.setString("ClientSettingsFile", + gSavedSettings.setString("ClientSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -2435,7 +2439,7 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setBOOL("QAMode", TRUE ); gSavedSettings.setS32("WatchdogEnabled", 0); #endif - + // These are warnings that appear on the first experience of that condition. // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse // for disable/reset ability @@ -2457,7 +2461,7 @@ bool LLAppViewer::initConfiguration() // LLFirstUse::addConfigVariable("FirstSculptedPrim"); // LLFirstUse::addConfigVariable("FirstVoice"); // LLFirstUse::addConfigVariable("FirstMedia"); - + // - read command line settings. LLControlGroupCLP clp; std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, @@ -2470,27 +2474,27 @@ bool LLAppViewer::initConfiguration() handleCommandLineError(clp); return false; } - - // - selectively apply settings + + // - selectively apply settings // If the user has specified a alternate settings file name. // Load it now before loading the user_settings/settings.xml if(clp.hasOption("settings")) { - std::string user_settings_filename = - gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, - clp.getOption("settings")[0]); + std::string user_settings_filename = + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, + clp.getOption("settings")[0]); gSavedSettings.setString("ClientSettingsFile", user_settings_filename); - LL_INFOS("Settings") << "Using command line specified settings filename: " + LL_INFOS("Settings") << "Using command line specified settings filename: " << user_settings_filename << LL_ENDL; } - // - load overrides from user_settings + // - load overrides from user_settings loadSettingsFromDirectory("User"); if (gSavedSettings.getBOOL("FirstRunThisInstall")) { - // Set firstrun flag to indicate that some further init actiona should be taken + // Set firstrun flag to indicate that some further init actiona should be taken // like determining screen DPI value and so on mIsFirstRun = true; @@ -2499,24 +2503,24 @@ bool LLAppViewer::initConfiguration() if (clp.hasOption("sessionsettings")) { - std::string session_settings_filename = clp.getOption("sessionsettings")[0]; + std::string session_settings_filename = clp.getOption("sessionsettings")[0]; gSavedSettings.setString("SessionSettingsFile", session_settings_filename); - LL_INFOS("Settings") << "Using session settings filename: " + LL_INFOS("Settings") << "Using session settings filename: " << session_settings_filename << LL_ENDL; } loadSettingsFromDirectory("Session"); if (clp.hasOption("usersessionsettings")) { - std::string user_session_settings_filename = clp.getOption("usersessionsettings")[0]; + std::string user_session_settings_filename = clp.getOption("usersessionsettings")[0]; gSavedSettings.setString("UserSessionSettingsFile", user_session_settings_filename); - LL_INFOS("Settings") << "Using user session settings filename: " + LL_INFOS("Settings") << "Using user session settings filename: " << user_session_settings_filename << LL_ENDL; } loadSettingsFromDirectory("UserSession"); - // - apply command line settings + // - apply command line settings if (! clp.notify()) { handleCommandLineError(clp); @@ -2615,9 +2619,9 @@ bool LLAppViewer::initConfiguration() if (gSavedSettings.getBOOL("LogPerformance")) { LLTrace::BlockTimer::sLog = true; - LLTrace::BlockTimer::sLogName = std::string("performance"); + LLTrace::BlockTimer::sLogName = std::string("performance"); } - + std::string test_name(gSavedSettings.getString("LogMetrics")); if (! test_name.empty()) { @@ -2658,20 +2662,20 @@ bool LLAppViewer::initConfiguration() // Handle slurl use. NOTE: Don't let SL-55321 reappear. - // *FIX: This init code should be made more robust to prevent - // the issue SL-55321 from returning. One thought is to allow - // only select options to be set from command line when a slurl - // is specified. More work on the settings system is needed to + // *FIX: This init code should be made more robust to prevent + // the issue SL-55321 from returning. One thought is to allow + // only select options to be set from command line when a slurl + // is specified. More work on the settings system is needed to // achieve this. For now... - // *NOTE:Mani The command line parser parses tokens and is - // setup to bail after parsing the '--url' option or the + // *NOTE:Mani The command line parser parses tokens and is + // setup to bail after parsing the '--url' option or the // first option specified without a '--option' flag (or - // any other option that uses the 'last_option' setting - + // any other option that uses the 'last_option' setting - // see LLControlGroupCLP::configure()) - // What can happen is that someone can use IE (or potentially - // other browsers) and do the rough equivalent of command + // What can happen is that someone can use IE (or potentially + // other browsers) and do the rough equivalent of command // injection and steal passwords. Phoenix. SL-55321 std::string starting_location; @@ -2695,8 +2699,8 @@ bool LLAppViewer::initConfiguration() { start_slurl = starting_location; LLStartUp::setStartSLURL(start_slurl); - if(start_slurl.getType() == LLSLURL::LOCATION) - { + if(start_slurl.getType() == LLSLURL::LOCATION) + { LLGridManager::getInstance()->setGridChoice(start_slurl.getGrid()); } } @@ -2710,7 +2714,7 @@ bool LLAppViewer::initConfiguration() (gSavedSettings.getBOOL("SLURLPassToOtherInstance"))) { if (sendURLToOtherInstance(start_slurl.getSLURLString())) - { + { // successfully handed off URL to existing instance, exit return false; } @@ -2718,7 +2722,7 @@ bool LLAppViewer::initConfiguration() const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) - { + { // Examining "Language" may not suffice -- see LLUI::getLanguage() // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much // good because we haven't yet called LLUI::initClass(). @@ -2957,8 +2961,8 @@ bool LLAppViewer::initWindow() LL_INFOS("AppInit") << "watchdog setting is done." << LL_ENDL; LLNotificationsUI::LLNotificationManager::getInstance(); - - + + #ifdef LL_DARWIN //Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later) LLOSInfo& os_info = LLOSInfo::instance(); @@ -2968,7 +2972,7 @@ bool LLAppViewer::initWindow() gViewerWindow->getWindow()->setOldResize(true); } #endif - + if (gSavedSettings.getBOOL("WindowMaximized")) { gViewerWindow->getWindow()->maximize(); @@ -2983,7 +2987,7 @@ bool LLAppViewer::initWindow() LLFeatureManager::getInstance()->setGraphicsLevel(*mForceGraphicsLevel, false); gSavedSettings.setU32("RenderQualityPerformance", *mForceGraphicsLevel); } - + // Set this flag in case we crash while initializing GL gSavedSettings.setBOOL("RenderInitError", TRUE); gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); @@ -3041,14 +3045,14 @@ void LLAppViewer::writeDebugInfo(bool isStatic) debug_filename = ( isStatic ? getStaticDebugFile() : getDynamicDebugFile() ); - + LL_INFOS() << "Opening debug file " << *debug_filename << LL_ENDL; llofstream out_file(debug_filename->c_str()); - + isStatic ? LLSDSerialize::toPrettyXML(gDebugInfo, out_file) : LLSDSerialize::toPrettyXML(gDebugInfo["Dynamic"], out_file); - - + + out_file.close(); } @@ -3162,7 +3166,7 @@ LLSD LLAppViewer::getViewerInfo() const version_string << version.serverType << " " << version.serverVersion << std::endl; info["VOICE_VERSION"] = version_string.str(); } - else + else { info["VOICE_VERSION"] = LLTrans::getString("NotConnected"); } @@ -3375,9 +3379,9 @@ void LLAppViewer::cleanupSavedSettings() gSavedSettings.setBOOL("UseEnergy", TRUE); // force toggle to turn off, since sends message to simulator gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc); - + gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates); - + if (gDebugView) { gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible()); @@ -3391,7 +3395,7 @@ void LLAppViewer::cleanupSavedSettings() if (!maximized) { LLCoordScreen window_pos; - + if (gViewerWindow->getWindow()->getPosition(&window_pos)) { gSavedSettings.setS32("WindowX", window_pos.mX); @@ -3416,10 +3420,10 @@ void LLAppViewer::removeCacheFiles(const std::string& file_mask) void LLAppViewer::writeSystemInfo() { - + if (! gDebugInfo.has("Dynamic") ) gDebugInfo["Dynamic"] = LLSD::emptyMap(); - + #if LL_WINDOWS gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log"); #else @@ -3442,13 +3446,13 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec(); gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE(); gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2(); - + gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value()); gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>()); gDebugInfo["OSInfo"] = LLOSInfo::instance().getOSStringSimple(); // The user is not logged on yet, but record the current grid choice login url - // which may have been the intended grid. + // which may have been the intended grid. gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId(); // *FIX:Mani - move this down in llappviewerwin32 @@ -3465,14 +3469,14 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; // Insert crash host url (url to post crash log to) if configured. This insures - // that the crash report will go to the proper location in the case of a + // that the crash report will go to the proper location in the case of a // prior freeze. std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl"); if(crashHostUrl != "") { gDebugInfo["CrashHostUrl"] = crashHostUrl; } - + // Dump some debugging info LL_INFOS("SystemInfo") << "Application: " << LLTrans::getString("APP_NAME") << LL_ENDL; LL_INFOS("SystemInfo") << "Version: " << LLVersionInfo::getChannelAndVersion() << LL_ENDL; @@ -3496,16 +3500,16 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["FirstLogin"] = (LLSD::Boolean) gAgent.isFirstLogin(); gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall"); gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); - + writeDebugInfo(); // Save out debug_info.log early, in case of crash. } #ifdef LL_WINDOWS -//For whatever reason, in Windows when using OOP server for breakpad, the callback to get the -//name of the dump file is not getting triggered by the breakpad library. Unfortunately they +//For whatever reason, in Windows when using OOP server for breakpad, the callback to get the +//name of the dump file is not getting triggered by the breakpad library. Unfortunately they //also didn't see fit to provide a simple query request across the pipe to get this name either. //Since we are putting our output in a runtime generated directory and we know the header data in -//the dump format, we can however use the following hack to identify our file. +//the dump format, we can however use the following hack to identify our file. // TODO make this a member function. void getFileList() { @@ -3569,19 +3573,19 @@ void LLAppViewer::handleViewerCrash() return; } pApp->mReportedCrash = TRUE; - + // Insert crash host url (url to post crash log to) if configured. std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl"); if(crashHostUrl != "") { gDebugInfo["Dynamic"]["CrashHostUrl"] = crashHostUrl; } - + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if ( parcel && parcel->getMusicURL()[0]) { gDebugInfo["Dynamic"]["ParcelMusicURL"] = parcel->getMusicURL(); - } + } if ( parcel && parcel->getMediaURL()[0]) { gDebugInfo["Dynamic"]["ParcelMediaURL"] = parcel->getMediaURL(); @@ -3603,7 +3607,7 @@ void LLAppViewer::handleViewerCrash() { gDebugInfo["Dynamic"]["CurrentSimHost"] = gAgent.getRegionHost().getHostName(); gDebugInfo["Dynamic"]["CurrentRegion"] = gAgent.getRegion()->getName(); - + const LLVector3& loc = gAgent.getPositionAgent(); gDebugInfo["Dynamic"]["CurrentLocationX"] = loc.mV[0]; gDebugInfo["Dynamic"]["CurrentLocationY"] = loc.mV[1]; @@ -3614,14 +3618,14 @@ void LLAppViewer::handleViewerCrash() { gDebugInfo["Dynamic"]["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); } - + // The crash is being handled here so set this value to false. // Otherwise the crash logger will think this crash was a freeze. gDebugInfo["Dynamic"]["CrashNotHandled"] = (LLSD::Boolean)false; - + //Write out the crash status file //Use marker file style setup, as that's the simplest, especially since - //we're already in a crash situation + //we're already in a crash situation if (gDirUtilp) { std::string crash_marker_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, @@ -3643,11 +3647,11 @@ void LLAppViewer::handleViewerCrash() else { LL_WARNS("MarkerFile") << "No gDirUtilp with which to create error marker file name" << LL_ENDL; - } - + } + #ifdef LL_WINDOWS Sleep(200); -#endif +#endif char *minidump_file = pApp->getMiniDumpFilename(); LL_DEBUGS("CRASHREPORT") << "minidump file name " << minidump_file << LL_ENDL; @@ -3661,10 +3665,10 @@ void LLAppViewer::handleViewerCrash() getFileList(); #else LL_WARNS("CRASHREPORT") << "no minidump file?" << LL_ENDL; -#endif +#endif } gDebugInfo["Dynamic"]["CrashType"]="crash"; - + if (gMessageSystem && gDirUtilp) { std::string filename; @@ -3679,7 +3683,7 @@ void LLAppViewer::handleViewerCrash() else { LL_WARNS("CRASHREPORT") << "problem recording stats" << LL_ENDL; - } + } } if (gMessageSystem) @@ -3695,8 +3699,8 @@ void LLAppViewer::handleViewerCrash() } // static -void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) -{ +void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) +{ std::string marker_version(LLVersionInfo::getChannelAndVersion()); if ( marker_version.length() > MAX_MARKER_LENGTH ) { @@ -3759,7 +3763,7 @@ void LLAppViewer::processMarkerFiles() // now test to see if this file is locked by a running process (try to open for write) LL_DEBUGS("MarkerFile") << "Checking exec marker file for lock..." << LL_ENDL; mMarkerFile.open(mMarkerFileName, LL_APR_WB); - apr_file_t* fMarker = mMarkerFile.getFileHandle() ; + apr_file_t* fMarker = mMarkerFile.getFileHandle() ; if (!fMarker) { LL_INFOS("MarkerFile") << "Exec marker file open failed - assume it is locked." << LL_ENDL; @@ -3775,7 +3779,7 @@ void LLAppViewer::processMarkerFiles() } else { - // No other instances; we've locked this file now, so record our version; delete on quit. + // No other instances; we've locked this file now, so record our version; delete on quit. recordMarkerVersion(mMarkerFile); LL_DEBUGS("MarkerFile") << "Exec marker file existed but was not locked; rewritten." << LL_ENDL; } @@ -3790,7 +3794,7 @@ void LLAppViewer::processMarkerFiles() // the file existed, is ours, and matched our version, so we can report on what it says LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found; last exec FROZE" << LL_ENDL; gLastExecEvent = LAST_EXEC_FROZE; - + } else { @@ -3801,12 +3805,12 @@ void LLAppViewer::processMarkerFiles() { // Create the marker file for this execution & lock it; it will be deleted on a clean exit apr_status_t s; - s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE); + s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE); if (s == APR_SUCCESS && mMarkerFile.getFileHandle()) { LL_DEBUGS("MarkerFile") << "Exec marker file '"<< mMarkerFileName << "' created." << LL_ENDL; - if (APR_SUCCESS == apr_file_lock(mMarkerFile.getFileHandle(), APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE)) + if (APR_SUCCESS == apr_file_lock(mMarkerFile.getFileHandle(), APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE)) { recordMarkerVersion(mMarkerFile); LL_DEBUGS("MarkerFile") << "Exec marker file locked." << LL_ENDL; @@ -3891,7 +3895,7 @@ void LLAppViewer::processMarkerFiles() void LLAppViewer::removeMarkerFiles() { if (!mSecondInstance) - { + { if (mMarkerFile.getFileHandle()) { mMarkerFile.close() ; @@ -3929,8 +3933,8 @@ void LLAppViewer::removeDumpDir() } void LLAppViewer::forceQuit() -{ - LLApp::setQuitting(); +{ + LLApp::setQuitting(); } //TODO: remove @@ -3944,10 +3948,10 @@ void LLAppViewer::fastQuit(S32 error_code) end_messaging_system(); // figure out the error code S32 final_error_code = error_code ? error_code : (S32)isError(); - // this isn't a crash + // this isn't a crash removeMarkerFiles(); // get outta here - _exit(final_error_code); + _exit(final_error_code); } void LLAppViewer::requestQuit() @@ -3955,7 +3959,7 @@ void LLAppViewer::requestQuit() LL_INFOS() << "requestQuit" << LL_ENDL; LLViewerRegion* region = gAgent.getRegion(); - + if( (LLStartUp::getStartupState() < STATE_STARTED) || !region ) { // If we have a region, make some attempt to send a logout request first. @@ -3964,7 +3968,7 @@ void LLAppViewer::requestQuit() { sendLogoutRequest(); } - + // Quit immediately forceQuit(); return; @@ -3978,13 +3982,13 @@ void LLAppViewer::requestQuit() { gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - + // Try to send last batch of avatar rez metrics. if (!gDisconnected && isAgentAvatarValid()) { gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -4143,7 +4147,7 @@ void dumpVFSCaches() gStaticVFS->dumpFiles(); SetCurrentDirectory(w_str); #endif - + LL_INFOS() << "========= Dynamic VFS ====" << LL_ENDL; gVFS->listFiles(); #if LL_WINDOWS @@ -4160,7 +4164,7 @@ void dumpVFSCaches() } //static -U32 LLAppViewer::getTextureCacheVersion() +U32 LLAppViewer::getTextureCacheVersion() { //viewer texture cache version, change if the texture cache format changes. const U32 TEXTURE_CACHE_VERSION = 8; @@ -4169,7 +4173,7 @@ U32 LLAppViewer::getTextureCacheVersion() } //static -U32 LLAppViewer::getObjectCacheVersion() +U32 LLAppViewer::getObjectCacheVersion() { // Viewer object cache version, change if object update // format changes. JC @@ -4186,10 +4190,10 @@ bool LLAppViewer::initCache() LLVOCache::getInstance()->setReadOnly(read_only); bool texture_cache_mismatch = false; - if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) + if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) { texture_cache_mismatch = true; - if(!read_only) + if(!read_only) { gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion()); } @@ -4207,10 +4211,10 @@ bool LLAppViewer::initCache() // STORM-1141 force purgeAllTextures to get called to prevent a crash here. -brad texture_cache_mismatch = true; } - + // We have moved the location of the cache directory over time. migrateCacheDirectory(); - + // Setup and verify the cache location std::string cache_location = gSavedSettings.getString("CacheLocation"); std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); @@ -4230,7 +4234,7 @@ bool LLAppViewer::initCache() gSavedSettings.setString("CacheLocation", ""); gSavedSettings.setString("CacheLocationTopFolder", ""); } - + if (mPurgeCache && !read_only) { LLSplashScreen::update(LLTrans::getString("StartupClearingCache")); @@ -4238,9 +4242,9 @@ bool LLAppViewer::initCache() } LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache")); - + // Init the texture cache - // Allocate 80% of the cache size for textures + // Allocate 80% of the cache size for textures const S32 MB = 1024 * 1024; const S64 MIN_CACHE_SIZE = 256 * MB; const S64 MAX_CACHE_SIZE = 9984ll * MB; @@ -4258,7 +4262,7 @@ bool LLAppViewer::initCache() LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ; LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS")); - + // Init the VFS vfs_size = llmin(vfs_size + extra, MAX_VFS_SIZE); vfs_size = (vfs_size / MB) * MB; // make sure it is MB aligned @@ -4270,7 +4274,7 @@ bool LLAppViewer::initCache() gSavedSettings.setU32("VFSOldSize", vfs_size_u32 / MB); } LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size / (1024*1024) << " MB" << LL_ENDL; - + // This has to happen BEFORE starting the vfs // time_t ltime; srand(time(NULL)); // Flawfinder: ignore @@ -4336,7 +4340,7 @@ bool LLAppViewer::initCache() LL_WARNS("AppCache") << "Removing old vfs data file " << old_vfs_data_file << LL_ENDL; LLFile::remove(old_vfs_data_file); LLFile::remove(old_vfs_index_file); - + // Just in case, nuke any other old cache files in the directory. std::string dir; dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); @@ -4362,7 +4366,7 @@ bool LLAppViewer::initCache() if (resize_vfs) { LL_DEBUGS("AppCache") << "Removing old vfs and re-sizing" << LL_ENDL; - + LLFile::remove(old_vfs_data_file); LLFile::remove(old_vfs_index_file); } @@ -4406,7 +4410,7 @@ bool LLAppViewer::initCache() dumpVFSCaches(); } #endif - + return true; } } @@ -4443,12 +4447,12 @@ std::string LLAppViewer::getSecondLifeTitle() const return LLTrans::getString("APP_NAME"); } -std::string LLAppViewer::getWindowTitle() const +std::string LLAppViewer::getWindowTitle() const { return gWindowTitle; } -// Callback from a dialog indicating user was logged out. +// Callback from a dialog indicating user was logged out. bool finish_disconnect(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -4476,7 +4480,7 @@ void LLAppViewer::forceDisconnect(const std::string& mesg) // do this again. return; } - + // *TODO: Translate the message if possible std::string big_reason = LLAgent::sTeleportErrorMessages[mesg]; if ( big_reason.size() == 0 ) @@ -4522,7 +4526,7 @@ void LLAppViewer::badNetworkHandler() "If the problem continues, see the Tech Support FAQ at: \n" "www.secondlife.com/support"; forceDisconnect(message.str()); - + LLApp::instance()->writeMiniDump(); } @@ -4587,7 +4591,7 @@ void LLAppViewer::saveNameCache() { LLAvatarNameCache::exportFile(name_cache_stream); } - + // real names cache if (gCacheName) { @@ -4605,7 +4609,7 @@ void LLAppViewer::saveNameCache() /*! @brief This class is an LLFrameTimer that can be created with an elapsed time that starts counting up from the given value rather than 0.0. - + Otherwise it behaves the same way as LLFrameTimer. */ class LLFrameStatsTimer : public LLFrameTimer @@ -4642,7 +4646,7 @@ static LLTrace::BlockTimerStatHandle FTM_HUD_EFFECTS("HUD Effects"); void LLAppViewer::idle() { pingMainloopTimeout("Main:Idle"); - + // Update frame timers static LLTimer idle_timer; @@ -4700,7 +4704,7 @@ void LLAppViewer::idle() gGLActive = FALSE; } - + F32 yaw = 0.f; // radians if (!gDisconnected) @@ -4708,8 +4712,8 @@ void LLAppViewer::idle() LL_RECORD_BLOCK_TIME(FTM_NETWORK); // Update spaceserver timeinfo LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw)); - - + + ////////////////////////////////////// // // Update simulator agent state @@ -4788,7 +4792,7 @@ void LLAppViewer::idle() if (!gDisconnected) { LL_RECORD_BLOCK_TIME(FTM_NETWORK); - + //////////////////////////////////////////////// // // Network processing @@ -4798,7 +4802,7 @@ void LLAppViewer::idle() // idleNameCache(); idleNetwork(); - + // Check for away from keyboard, kick idle agents. idle_afk_check(); @@ -4812,7 +4816,7 @@ void LLAppViewer::idle() // Handle the regular UI idle callbacks as well as // hover callbacks // - + #ifdef LL_DARWIN if (!mQuitRequested) //MAINT-4243 #endif @@ -4821,12 +4825,12 @@ void LLAppViewer::idle() // Do event notifications if necessary. Yes, we may want to move this elsewhere. gEventNotifier.update(); - + gIdleCallbacks.callFunctions(); gInventory.idleNotifyObservers(); LLAvatarTracker::instance().idleNotifyObservers(); } - + // Metrics logging (LLViewerAssetStats, etc.) { static LLTimer report_interval; @@ -4872,14 +4876,14 @@ void LLAppViewer::idle() } { - LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE); - + LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE); + if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { gObjectList.update(gAgent); } } - + ////////////////////////////////////// // // Deletes objects... @@ -4897,7 +4901,7 @@ void LLAppViewer::idle() LLDrawable::cleanupDeadDrawables(); } } - + // // After this point, in theory we should never see a dead object // in the various object/drawable lists. @@ -4927,7 +4931,7 @@ void LLAppViewer::idle() LL_RECORD_BLOCK_TIME(FTM_NETWORK); gVLManager.unpackData(); } - + ///////////////////////// // // Update surfaces, and surface textures as well. @@ -4939,25 +4943,25 @@ void LLAppViewer::idle() LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE); LLWorld::getInstance()->updateRegions(max_region_update_time); } - + ///////////////////////// // // Update weather effects // gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets - // Update wind vector + // Update wind vector LLVector3 wind_position_region; static LLVector3 average_wind; LLViewerRegion *regionp; - regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position + regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position if (regionp) { gWindVec = regionp->mWind.getVelocity(wind_position_region); // Compute average wind and use to drive motion of water - + average_wind = regionp->mWind.getAverage(); gSky.setWind(average_wind); //LLVOWater::setWind(average_wind); @@ -4966,13 +4970,13 @@ void LLAppViewer::idle() { gWindVec.setVec(0.0f, 0.0f, 0.0f); } - + ////////////////////////////////////// // // Sort and cull in the new renderer are moved to pipeline.cpp // Here, particles are updated and drawables are moved. // - + LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE); gPipeline.updateMove(); @@ -4983,7 +4987,7 @@ void LLAppViewer::idle() gAgentPilot.moveCamera(); } else if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { + { LLViewerJoystick::getInstance()->moveFlycam(); } else @@ -4998,7 +5002,7 @@ void LLAppViewer::idle() // update media focus LLViewerMediaFocus::getInstance()->update(); - + // Update marketplace LLMarketplaceInventoryImporter::update(); LLMarketplaceInventoryNotifications::update(); @@ -5014,7 +5018,7 @@ void LLAppViewer::idle() { LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); - + if (gAudiop) { audio_update_volume(false); @@ -5029,8 +5033,8 @@ void LLAppViewer::idle() // Execute deferred tasks. LLDeferredTaskList::instance().run(); - - // Handle shutdown process, for example, + + // Handle shutdown process, for example, // wait for floaters to close, send quit message, // forcibly quit if it has taken too long if (mQuitRequested) @@ -5053,7 +5057,7 @@ void LLAppViewer::idleShutdown() { gIMMgr->disconnectAllSessions(); } - + // Wait for all floaters to get resolved if (gFloaterView && !gFloaterView->allChildrenClosed()) @@ -5063,7 +5067,7 @@ void LLAppViewer::idleShutdown() - + // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() // *TODO: ugly static bool saved_teleport_history = false; @@ -5121,7 +5125,7 @@ void LLAppViewer::idleShutdown() } // Make sure that we quit if we haven't received a reply from the server. - if( logoutRequestSent() + if( logoutRequestSent() && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime ) { forceQuit(); @@ -5138,7 +5142,7 @@ void LLAppViewer::sendLogoutRequest() if (!mSecondInstance) { mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME); - + mLogoutMarkerFile.open(mLogoutMarkerFileName, LL_APR_WB); if (mLogoutMarkerFile.getFileHandle()) { @@ -5148,13 +5152,13 @@ void LLAppViewer::sendLogoutRequest() else { LL_WARNS("MarkerFile") << "Cannot create logout marker file " << mLogoutMarkerFileName << LL_ENDL; - } + } } else { LL_INFOS("MarkerFile") << "Did not logout marker file because this is a second instance" << LL_ENDL; } - + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_LogoutRequest); msg->nextBlockFast(_PREHASH_AgentData); @@ -5165,7 +5169,7 @@ void LLAppViewer::sendLogoutRequest() gLogoutTimer.reset(); gLogoutMaxTime = LOGOUT_REQUEST_TIME; mLogoutRequestSent = TRUE; - + if(LLVoiceClient::instanceExists()) { LLVoiceClient::getInstance()->leaveChannel(); @@ -5248,20 +5252,20 @@ static LLTrace::BlockTimerStatHandle FTM_CHECK_REGION_CIRCUIT("Check Region Circ void LLAppViewer::idleNetwork() { pingMainloopTimeout("idleNetwork"); - + gObjectList.mNumNewObjects = 0; S32 total_decoded = 0; if (!gSavedSettings.getBOOL("SpeedTest")) { LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode - + LLTimer check_message_timer; - // Read all available packets from network + // Read all available packets from network const S64 frame_count = gFrameCount; // U32->S64 F32 total_time = 0.0f; - while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) + while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) { if (gDoDisconnect) { @@ -5270,7 +5274,7 @@ void LLAppViewer::idleNetwork() // server going down, so this is OK. break; } - + total_decoded++; gPacketsIn++; @@ -5305,12 +5309,12 @@ void LLAppViewer::idleNetwork() CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; } #endif - + // we want to clear the control after sending out all necessary agent updates gAgent.resetControlFlags(); - + // Decode enqueued messages... S32 remaining_possible_decodes = MESSAGE_MAX_PER_FRAME - total_decoded; @@ -5357,7 +5361,7 @@ void LLAppViewer::disconnectViewer() } // // Cleanup after quitting. - // + // // Save snapshot for next time, if we made it through initialization LL_INFOS() << "Disconnecting viewer!" << LL_ENDL; @@ -5456,7 +5460,7 @@ void LLAppViewer::forceErrorBadMemoryAccess() { LL_WARNS() << "Forcing a deliberate bad memory access" << LL_ENDL; S32* crash = NULL; - *crash = 0xDEADBEEF; + *crash = 0xDEADBEEF; return; } @@ -5469,7 +5473,7 @@ void LLAppViewer::forceErrorInfiniteLoop() } return; } - + void LLAppViewer::forceErrorSoftwareException() { LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL; @@ -5508,7 +5512,7 @@ void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs) { secs = gSavedSettings.getF32("MainloopTimeoutDefault"); } - + mMainloopTimeout->setTimeout(secs); mMainloopTimeout->start(state); } @@ -5528,7 +5532,7 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) // { // LL_WARNS() << "!!!!!!!!!!!!! Its an error trap!!!!" << state << LL_ENDL; // } - + if(mMainloopTimeout) { if(secs < 0.0f) @@ -5558,12 +5562,12 @@ void LLAppViewer::handleLoginComplete() if ( parcel && parcel->getMusicURL()[0]) { gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL(); - } + } if ( parcel && parcel->getMediaURL()[0]) { gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL(); } - + gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile"); gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); |