summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-05 11:00:11 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-05 11:00:11 -0400
commit000a23ba0534fdf9bfc4a1b051b7cee0adceef3e (patch)
tree776fe10c7aaf76371a889f79c48c3c9405fd5a4e /indra/newview/llappviewer.cpp
parent7ac4c3b56e5246fceaa73e7c9c665d3c04827d6c (diff)
parentbacf9cfeab90bd1ffad827fa3c34ced985c768a2 (diff)
Merge branch 'develop' into release/luau-scripting
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp287
1 files changed, 164 insertions, 123 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c0096c8d6d..789aaab70d 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -64,7 +64,6 @@
#include "llluamanager.h"
#include "llurlfloaterdispatchhandler.h"
#include "llviewerjoystick.h"
-#include "llallocator.h"
#include "llcalc.h"
#include "llconversationlog.h"
#if LL_WINDOWS
@@ -273,11 +272,6 @@ using namespace LL;
#include "glib.h"
#endif // (LL_LINUX) && LL_GTK
-#if LL_MSVC
-// disable boost::lexical_cast warning
-#pragma warning (disable:4702)
-#endif
-
static LLAppViewerListener sAppViewerListener(LLAppViewer::instance);
////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor
@@ -344,24 +338,23 @@ F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME;
S32 gPendingMetricsUploads = 0;
-bool gDisconnected = false;
+bool gDisconnected = false;
-// used to restore texture state after a mode switch
-LLFrameTimer gRestoreGLTimer;
-bool gRestoreGL = false;
-bool gUseWireframe = false;
+// Used to restore texture state after a mode switch
+LLFrameTimer gRestoreGLTimer;
+bool gRestoreGL = false;
+bool gUseWireframe = false;
-LLMemoryInfo gSysMemory;
U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp
std::string gLastVersionChannel;
-LLVector3 gWindVec(3.0, 3.0, 0.0);
-LLVector3 gRelativeWindVec(0.0, 0.0, 0.0);
+LLVector3 gWindVec(3.0, 3.0, 0.0);
+LLVector3 gRelativeWindVec(0.0, 0.0, 0.0);
-U32 gPacketsIn = 0;
+U32 gPacketsIn = 0;
-bool gPrintMessagesThisFrame = false;
+bool gPrintMessagesThisFrame = false;
bool gRandomizeFramerate = false;
bool gPeriodicSlowFrame = false;
@@ -463,7 +456,7 @@ void idle_afk_check()
{
// check idle timers
F32 current_idle = gAwayTriggerTimer.getElapsedTimeF32();
- F32 afk_timeout = gSavedSettings.getS32("AFKTimeout");
+ F32 afk_timeout = (F32)gSavedSettings.getS32("AFKTimeout");
if (afk_timeout && (current_idle > afk_timeout) && ! gAgent.getAFK())
{
LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL;
@@ -654,6 +647,7 @@ LLAppViewer::LLAppViewer()
mSavedFinalSnapshot(false),
mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded.
mQuitRequested(false),
+ mClosingFloaters(false),
mLogoutRequestSent(false),
mLastAgentControlFlags(0),
mLastAgentForceUpdate(0),
@@ -759,7 +753,11 @@ bool LLAppViewer::init()
// inits from settings.xml and from strings.xml
if (!initConfiguration())
+ {
+ LL_WARNS("InitInfo") << "initConfiguration() failed." << LL_ENDL;
+ // quit immediately
return false;
+ }
LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
@@ -781,8 +779,6 @@ bool LLAppViewer::init()
LLError::setFatalFunction([rc](const std::string&){ _exit(rc); });
}
- mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling"));
-
// Initialize the non-LLCurl libcurl library. Should be called
// before consumers (LLTextureFetch).
mAppCoreHttp.init();
@@ -791,14 +787,12 @@ bool LLAppViewer::init()
LLMachineID::init();
+ if (gSavedSettings.getBOOL("QAModeMetrics"))
{
- if (gSavedSettings.getBOOL("QAModeMetrics"))
- {
- app_metrics_qa_mode = true;
- app_metrics_interval = METRICS_INTERVAL_QA;
- }
- LLViewerAssetStatsFF::init();
+ app_metrics_qa_mode = true;
+ app_metrics_interval = METRICS_INTERVAL_QA;
}
+ LLViewerAssetStatsFF::init();
initThreads();
LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ;
@@ -811,10 +805,24 @@ bool LLAppViewer::init()
settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
settings_map["account"] = &gSavedPerAccountSettings;
- LLUI::initParamSingleton(settings_map,
+ LLUI::createInstance(settings_map,
LLUIImageList::getInstance(),
ui_audio_callback,
deferred_ui_audio_callback);
+
+ if (gSavedSettings.getBOOL("SpellCheck"))
+ {
+ std::list<std::string> dict_list;
+ std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
+ boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
+ if (!dict_list.empty())
+ {
+ LLSpellChecker::setUseSpellCheck(dict_list.front());
+ dict_list.pop_front();
+ LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
+ }
+ }
+
LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
// NOW LLUI::getLanguage() should work. gDirUtilp must know the language
@@ -914,9 +922,11 @@ bool LLAppViewer::init()
// do any necessary set-up for accepting incoming SLURLs from apps
initSLURLHandler();
- if(false == initHardwareTest())
+ if (!initHardwareTest())
{
// Early out from user choice.
+ LL_WARNS("InitInfo") << "initHardwareTest() failed." << LL_ENDL;
+ // quit immediately
return false;
}
LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ;
@@ -931,11 +941,11 @@ bool LLAppViewer::init()
if (!initCache())
{
+ std::string msg = LLTrans::getString("MBUnableToAccessFile");
+ OSMessageBox(msg.c_str(), LLStringUtil::null, OSMB_OK);
LL_WARNS("InitInfo") << "Failed to init cache" << LL_ENDL;
- std::ostringstream msg;
- msg << LLTrans::getString("MBUnableToAccessFile");
- OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK);
- return 0;
+ // quit immediately
+ return false;
}
LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ;
@@ -964,10 +974,13 @@ bool LLAppViewer::init()
gGLManager.printGLInfoString();
// If we don't have the right GL requirements, exit.
+ // ? AG: It seems we never set mHasRequirements to false
if (!gGLManager.mHasRequirements)
{
- // already handled with a MBVideoDrvErr
- return 0;
+ // Already handled with a MBVideoDrvErr
+ LL_WARNS("InitInfo") << "gGLManager.mHasRequirements is false." << LL_ENDL;
+ // quit immediately
+ return false;
}
// Without SSE2 support we will crash almost immediately, warn here.
@@ -975,15 +988,15 @@ bool LLAppViewer::init()
{
// can't use an alert here since we're exiting and
// all hell breaks lose.
- OSMessageBox(
- LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"),
- LLStringUtil::null,
- OSMB_OK);
- return 0;
+ std::string msg = LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2");
+ OSMessageBox(msg.c_str(), LLStringUtil::null, OSMB_OK);
+ LL_WARNS("InitInfo") << "SSE2 is not supported" << LL_ENDL;
+ // quit immediately
+ return false;
}
// alert the user if they are using unsupported hardware
- if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
+ if (!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
{
bool unsupported = false;
LLSD args;
@@ -999,19 +1012,21 @@ bool LLAppViewer::init()
U64Bytes minRAM;
minRAMString >> minRAM;
- if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN)
+ if (!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN)
{
minSpecs += LLNotifications::instance().getGlobalString("UnsupportedGPU");
minSpecs += "\n";
unsupported = true;
}
- if(gSysCPU.getMHz() < minCPU)
+
+ if (gSysCPU.getMHz() < minCPU)
{
minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU");
minSpecs += "\n";
unsupported = true;
}
- if(gSysMemory.getPhysicalMemoryKB() < minRAM)
+
+ if (gSysMemory.getPhysicalMemoryKB() < minRAM)
{
minSpecs += LLNotifications::instance().getGlobalString("UnsupportedRAM");
minSpecs += "\n";
@@ -1023,15 +1038,14 @@ bool LLAppViewer::init()
LLNotificationsUtil::add("UnknownGPU");
}
- if(unsupported)
+ if (unsupported)
{
- if(!gSavedSettings.controlExists("WarnUnsupportedHardware")
+ if (!gSavedSettings.controlExists("WarnUnsupportedHardware")
|| gSavedSettings.getBOOL("WarnUnsupportedHardware"))
{
args["MINSPECS"] = minSpecs;
LLNotificationsUtil::add("UnsupportedHardware", args );
}
-
}
}
@@ -1123,12 +1137,13 @@ bool LLAppViewer::init()
LLViewerJoystick::getInstance()->init(false);
}
- try {
+ try
+ {
initializeSecHandler();
}
catch (LLProtectedDataException&)
{
- LLNotificationsUtil::add("CorruptedProtectedDataStore");
+ LLNotificationsUtil::add("CorruptedProtectedDataStore");
}
gGLActive = false;
@@ -1269,7 +1284,7 @@ bool LLAppViewer::init()
//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");
- if(language == "ja" || language == "pl")
+ if (language == "ja" || language == "pl")
{
LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames"));
LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames"));
@@ -1314,6 +1329,7 @@ bool LLAppViewer::init()
//LLSimpleton creations
LLEnvironment::createInstance();
LLWorld::createInstance();
+ LLViewerStatsRecorder::createInstance();
LLSelectMgr::createInstance();
LLViewerCamera::createInstance();
LL::GLTFSceneManager::createInstance();
@@ -1494,13 +1510,13 @@ bool LLAppViewer::doFrame()
}
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop")
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop");
// canonical per-frame event
mainloop.post(newFrame);
}
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend")
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend");
// give listeners a chance to run
llcoro::suspend();
// if one of our coroutines threw an uncaught exception, rethrow it now
@@ -1510,7 +1526,7 @@ bool LLAppViewer::doFrame()
if (!LLApp::isExiting())
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df JoystickKeyboard" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df JoystickKeyboard");
pingMainloopTimeout("Main:JoystickKeyboard");
// Scan keyboard for movement keys. Command keys and typing
@@ -1533,7 +1549,7 @@ bool LLAppViewer::doFrame()
// Update state based on messages, user input, object idle.
{
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df pauseMainloopTimeout");
pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds!
}
@@ -1544,7 +1560,7 @@ bool LLAppViewer::doFrame()
}
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout");
resumeMainloopTimeout();
}
}
@@ -1591,7 +1607,7 @@ bool LLAppViewer::doFrame()
}
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df pauseMainloopTimeout");
pingMainloopTimeout("Main:Sleep");
pauseMainloopTimeout();
@@ -1600,14 +1616,14 @@ bool LLAppViewer::doFrame()
// Sleep and run background threads
{
//LL_RECORD_BLOCK_TIME(SLEEP2);
- LL_PROFILE_ZONE_WARN( "Sleep2" )
+ LL_PROFILE_ZONE_WARN("Sleep2");
// yield some time to the os based on command line option
static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1);
if(yield_time >= 0)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Yield");
- LL_PROFILE_ZONE_NUM( yield_time )
+ LL_PROFILE_ZONE_NUM(yield_time);
ms_sleep(yield_time);
}
@@ -1675,24 +1691,24 @@ bool LLAppViewer::doFrame()
}
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df gMeshRepo" )
- gMeshRepo.update() ;
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gMeshRepo");
+ gMeshRepo.update() ;
}
if(!total_work_pending) //pause texture fetching threads if nothing to process.
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df getTextureCache" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df getTextureCache");
LLAppViewer::getTextureCache()->pause();
LLAppViewer::getTextureFetch()->pause();
}
if(!total_io_pending) //pause file threads if nothing to process.
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df LLVFSThread" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLVFSThread");
LLLFSThread::sLocal->pause();
}
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" )
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout");
resumeMainloopTimeout();
}
pingMainloopTimeout("Main:End");
@@ -1720,7 +1736,7 @@ bool LLAppViewer::doFrame()
LL_INFOS() << "Exiting main_loop" << LL_ENDL;
}
}LLPerfStats::StatsRecorder::endFrame();
- LL_PROFILER_FRAME_END
+ LL_PROFILER_FRAME_END;
return ! LLApp::isRunning();
}
@@ -2005,7 +2021,7 @@ bool LLAppViewer::cleanup()
LL_INFOS() << "Saving Data" << LL_ENDL;
// Store the time of our current logoff
- gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
+ gSavedPerAccountSettings.setU32("LastLogoff", (U32)time_corrected());
if (LLEnvironment::instanceExists())
{
@@ -2217,9 +2233,11 @@ bool LLAppViewer::cleanup()
LL::GLTFSceneManager::deleteSingleton();
LLEnvironment::deleteSingleton();
LLSelectMgr::deleteSingleton();
+ LLViewerStatsRecorder::deleteSingleton();
LLViewerEventRecorder::deleteSingleton();
LLWorld::deleteSingleton();
LLVoiceClient::deleteSingleton();
+ LLUI::deleteSingleton();
// It's not at first obvious where, in this long sequence, a generic cleanup
// call OUGHT to go. So let's say this: as we migrate cleanup from
@@ -2273,10 +2291,10 @@ bool LLAppViewer::initThreads()
cores = llmin(cores, (S32) max_cores);
}
- // The only configurable thread count right now is ImageDecode
- // The viewer typically starts around 8 threads not including image decode,
- // so try to leave at least one core free
- S32 image_decode_count = llclamp(cores - 9, 1, 8);
+ // always use at least 2 threads for image decoding to prevent
+ // a single texture blocking all other textures from decoding
+ S32 image_decode_count = llclamp(cores - 6, 2, 16);
+
threadCounts["ImageDecode"] = image_decode_count;
gSavedSettings.setLLSD("ThreadPoolSizes", threadCounts);
@@ -2314,7 +2332,9 @@ void errorCallback(LLError::ELevel level, const std::string &error_string)
if (level == LLError::LEVEL_ERROR)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
- OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK);
+ std::string message = error_string +
+ "\n\n\nThis is a developer-only notification!\nThis notification won't be present in Release for download build";
+ OSMessageBox(message, LLTrans::getString("MBFatalError"), OSMB_OK);
#endif
gDebugInfo["FatalMessage"] = error_string;
@@ -2378,7 +2398,7 @@ void LLAppViewer::initLoggingAndGetLastDuration()
int log_stat_result = LLFile::stat(log_file, &log_file_stat);
if (0 == start_stat_result && 0 == log_stat_result)
{
- int elapsed_seconds = log_file_stat.st_ctime - start_marker_stat.st_ctime;
+ int elapsed_seconds = (int)(log_file_stat.st_ctime - start_marker_stat.st_ctime);
// only report a last run time if the last viewer was the same version
// because this stat will be counted against this version
if (markerIsSameVersion(start_marker_file_name))
@@ -2456,7 +2476,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
std::string full_settings_path;
if (file.file_name_setting.isProvided()
- && gSavedSettings.controlExists(file.file_name_setting))
+ && gSavedSettings.controlExists(file.file_name_setting()))
{
// try to find filename stored in file_name_setting control
full_settings_path = gSavedSettings.getString(file.file_name_setting());
@@ -2576,7 +2596,7 @@ bool tempSetControl(const std::string& name, const std::string& value)
bool LLAppViewer::initConfiguration()
{
- //Load settings files list
+ // Load settings files list
std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml");
LLXMLNodePtr root;
bool success = LLXMLNode::parseFile(settings_file_list, root, NULL);
@@ -2623,7 +2643,7 @@ bool LLAppViewer::initConfiguration()
// - load defaults
bool set_defaults = true;
- if(!loadSettingsFromDirectory("Default", set_defaults))
+ if (!loadSettingsFromDirectory("Default", set_defaults))
{
OSMessageBox(
"Unable to load default settings file. The installation may be corrupted.",
@@ -2640,13 +2660,12 @@ bool LLAppViewer::initConfiguration()
#ifndef LL_RELEASE_FOR_DOWNLOAD
// provide developer build only overrides for these control variables that are not
// persisted to settings.xml
- LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers");
- if (c)
+ if (LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers"))
{
c->setValue(true, false);
}
- gSavedSettings.setBOOL("QAMode", true );
+ gSavedSettings.setBOOL("QAMode", true);
gSavedSettings.setS32("WatchdogEnabled", 0);
#endif
@@ -2679,7 +2698,7 @@ bool LLAppViewer::initConfiguration()
clp.configure(cmd_line_config, &gSavedSettings);
- if(!initParseCommandLine(clp))
+ if (!initParseCommandLine(clp))
{
handleCommandLineError(clp);
return false;
@@ -2689,7 +2708,7 @@ bool LLAppViewer::initConfiguration()
// If the user has specified a alternate settings file name.
// Load it now before loading the user_settings/settings.xml
- if(clp.hasOption("settings"))
+ if (clp.hasOption("settings"))
{
std::string user_settings_filename =
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
@@ -2731,7 +2750,7 @@ bool LLAppViewer::initConfiguration()
loadSettingsFromDirectory("UserSession");
// - apply command line settings
- if (! clp.notify())
+ if (!clp.notify())
{
handleCommandLineError(clp);
return false;
@@ -2740,7 +2759,7 @@ bool LLAppViewer::initConfiguration()
// Register the core crash option as soon as we can
// if we want gdb post-mortem on cores we need to be up and running
// ASAP or we might miss init issue etc.
- if(gSavedSettings.getBOOL("DisableCrashLogger"))
+ if (gSavedSettings.getBOOL("DisableCrashLogger"))
{
LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL;
disableCrashlogger();
@@ -2754,7 +2773,7 @@ bool LLAppViewer::initConfiguration()
initConsole();
}
- if(clp.hasOption("help"))
+ if (clp.hasOption("help"))
{
std::ostringstream msg;
msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp;
@@ -2768,17 +2787,17 @@ bool LLAppViewer::initConfiguration()
return false;
}
- if(clp.hasOption("set"))
+ if (clp.hasOption("set"))
{
const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set");
- if(0x1 & set_values.size())
+ if (0x1 & set_values.size())
{
LL_WARNS() << "Invalid '--set' parameter count." << LL_ENDL;
}
else
{
LLCommandLineParser::token_vector_t::const_iterator itr = set_values.begin();
- for(; itr != set_values.end(); ++itr)
+ for (; itr != set_values.end(); ++itr)
{
const std::string& name = *itr;
const std::string& value = *(++itr);
@@ -2790,12 +2809,13 @@ bool LLAppViewer::initConfiguration()
}
}
- if (clp.hasOption("logevents")) {
+ if (clp.hasOption("logevents"))
+ {
LLViewerEventRecorder::instance().setEventLoggingOn();
}
std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel"));
- if(! CmdLineChannel.empty())
+ if (!CmdLineChannel.empty())
{
LLVersionInfo::instance().resetChannel(CmdLineChannel);
}
@@ -2810,7 +2830,7 @@ bool LLAppViewer::initConfiguration()
}
std::string test_name(gSavedSettings.getString("LogMetrics"));
- if (! test_name.empty())
+ if (!test_name.empty())
{
LLTrace::BlockTimer::sMetricLog = true;
// '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test
@@ -2852,7 +2872,7 @@ bool LLAppViewer::initConfiguration()
}
const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
- if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString())
+ 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
@@ -2861,19 +2881,6 @@ bool LLAppViewer::initConfiguration()
gSavedSettings.getString("Language"));
}
- if (gSavedSettings.getBOOL("SpellCheck"))
- {
- std::list<std::string> dict_list;
- std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
- boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
- if (!dict_list.empty())
- {
- LLSpellChecker::setUseSpellCheck(dict_list.front());
- dict_list.pop_front();
- LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
- }
- }
-
if (gNonInteractive)
{
tempSetControl("AllowMultipleViewers", "true");
@@ -2886,7 +2893,6 @@ bool LLAppViewer::initConfiguration()
llassert_always(!gSavedSettings.getBOOL("SLURLPassToOtherInstance"));
}
-
// Handle slurl use. NOTE: Don't let SL-55321 reappear.
// This initial-SLURL logic, up through the call to
// sendURLToOtherInstance(), must precede LLSplashScreen::show() --
@@ -2912,21 +2918,21 @@ bool LLAppViewer::initConfiguration()
std::string starting_location;
std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation"));
- if(! cmd_line_login_location.empty())
+ if (!cmd_line_login_location.empty())
{
starting_location = cmd_line_login_location;
}
else
{
std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation"));
- if (! default_login_location.empty())
+ if (!default_login_location.empty())
{
starting_location = default_login_location;
}
}
LLSLURL start_slurl;
- if (! starting_location.empty())
+ if (!starting_location.empty())
{
start_slurl = starting_location;
LLStartUp::setStartSLURL(start_slurl);
@@ -2938,12 +2944,12 @@ bool LLAppViewer::initConfiguration()
// NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL()
std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
- if ( !nextLoginLocation.empty() )
+ if (!nextLoginLocation.empty())
{
LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<<nextLoginLocation<<LL_ENDL;
LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
}
- else if ( ( clp.hasOption("login") || clp.hasOption("autologin"))
+ else if ((clp.hasOption("login") || clp.hasOption("autologin"))
&& gSavedSettings.getString("CmdLineLoginLocation").empty())
{
// If automatic login from command line with --login switch
@@ -2999,7 +3005,7 @@ bool LLAppViewer::initConfiguration()
#endif
if (!gArgs.empty())
{
- gWindowTitle += std::string(" ") + gArgs;
+ gWindowTitle += std::string(" ") + gArgs;
}
LLStringUtil::truncate(gWindowTitle, 255);
@@ -3023,7 +3029,7 @@ bool LLAppViewer::initConfiguration()
// but make sure the setting is *not* persisted.
// Also see LLVivoxVoiceClient::voiceEnabled()
LLControlVariable* enable_voice = gSavedSettings.getControl("EnableVoiceChat");
- if(enable_voice)
+ if (enable_voice)
{
const bool DO_NOT_PERSIST = false;
enable_voice->setValue(LLSD(false), DO_NOT_PERSIST);
@@ -3134,6 +3140,13 @@ bool LLAppViewer::meetsRequirementsForMaximizedStart()
return maximizedOk;
}
+// virtual
+void LLAppViewer::sendOutOfDiskSpaceNotification()
+{
+ LL_WARNS() << "Out of disk space notification requested" << LL_ENDL;
+ LLNotificationsUtil::add("OutOfDiskSpace");
+}
+
bool LLAppViewer::initWindow()
{
LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
@@ -3227,8 +3240,8 @@ bool LLAppViewer::initWindow()
gSavedSettings.setBOOL("RenderInitError", false);
gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), true );
- //If we have a startup crash, it's usually near GL initialization, so simulate that.
- if(gCrashOnStartup)
+ // If we have a startup crash, it's usually near GL initialization, so simulate that.
+ if (gCrashOnStartup)
{
LLAppViewer::instance()->forceErrorLLError();
}
@@ -3481,7 +3494,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["LIBVLC_VERSION"] = "Undefined";
#endif
- S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
+ S32 packets_in = (S32)LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
if (packets_in > 0)
{
info["PACKETS_LOST"] = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST);
@@ -4030,7 +4043,6 @@ void LLAppViewer::forceQuit()
LLApp::setQuitting();
}
-//TODO: remove
void LLAppViewer::fastQuit(S32 error_code)
{
// finish pending transfers
@@ -4053,11 +4065,11 @@ void LLAppViewer::requestQuit()
LLViewerRegion* region = gAgent.getRegion();
- if( (LLStartUp::getStartupState() < STATE_STARTED) || !region )
+ if ((LLStartUp::getStartupState() < STATE_STARTED) || !region)
{
// If we have a region, make some attempt to send a logout request first.
// This prevents the halfway-logged-in avatar from hanging around inworld for a couple minutes.
- if(region)
+ if (region)
{
sendLogoutRequest();
}
@@ -4088,6 +4100,7 @@ void LLAppViewer::requestQuit()
{
// application is quitting
gFloaterView->closeAllChildren(true);
+ mClosingFloaters = true;
}
// Send preferences once, when exiting
@@ -4151,6 +4164,7 @@ void LLAppViewer::abortQuit()
{
LL_INFOS() << "abortQuit()" << LL_ENDL;
mQuitRequested = false;
+ mClosingFloaters = false;
}
void LLAppViewer::migrateCacheDirectory()
@@ -4671,6 +4685,10 @@ void LLAppViewer::idle()
LLGLTFMaterialList::flushUpdates();
+ static LLCachedControl<U32> downscale_method(gSavedSettings, "RenderDownScaleMethod");
+ gGLManager.mDownScaleMethod = downscale_method;
+ LLImageGL::updateClass();
+
// Service the WorkQueue we use for replies from worker threads.
// Use function statics for the timeslice setting so we only have to fetch
// and convert MainWorkTime once.
@@ -5095,15 +5113,21 @@ void LLAppViewer::idleShutdown()
}
// Wait for all floaters to get resolved
- if (gFloaterView
- && !gFloaterView->allChildrenClosed())
+ if (gFloaterView)
{
- return;
+ if (!mClosingFloaters)
+ {
+ // application is quitting
+ gFloaterView->closeAllChildren(true);
+ mClosingFloaters = true;
+ return;
+ }
+ if (!gFloaterView->allChildrenClosed())
+ {
+ return;
+ }
}
-
-
-
// ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup()
// *TODO: ugly
static bool saved_teleport_history = false;
@@ -5152,7 +5176,7 @@ void LLAppViewer::idleShutdown()
}
// All floaters are closed. Tell server we want to quit.
- if( !logoutRequestSent() )
+ if (!logoutRequestSent())
{
sendLogoutRequest();
@@ -5164,8 +5188,8 @@ void LLAppViewer::idleShutdown()
}
// Make sure that we quit if we haven't received a reply from the server.
- if( logoutRequestSent()
- && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime )
+ if (logoutRequestSent()
+ && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime)
{
forceQuit();
return;
@@ -5262,6 +5286,23 @@ void LLAppViewer::postToMainCoro(const LL::WorkQueue::Work& work)
gMainloopWork.post(work);
}
+void LLAppViewer::outOfMemorySoftQuit()
+{
+ if (!mQuitRequested)
+ {
+ // Todo:
+ // Find a way to free at least some memory to make it safer
+ // Pause decoding and mesh repositorie
+ getTextureCache()->pause();
+ getTextureFetch()->pause();
+ LLLFSThread::sLocal->pause();
+ gLogoutTimer.reset();
+ mQuitRequested = true;
+
+ LLError::LLUserWarningMsg::showOutOfMemory();
+ }
+}
+
void LLAppViewer::idleNameCache()
{
// Neither old nor new name cache can function before agent has a region