aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llappviewer.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llappviewer.cpp')
-rw-r--r--linden/indra/newview/llappviewer.cpp299
1 files changed, 138 insertions, 161 deletions
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index cda3ba5..5baf7b6 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -47,9 +47,11 @@
47#include "llpumpio.h" 47#include "llpumpio.h"
48#include "llfloateractivespeakers.h" 48#include "llfloateractivespeakers.h"
49#include "llimpanel.h" 49#include "llimpanel.h"
50#include "llmimetypes.h"
50#include "llstartup.h" 51#include "llstartup.h"
51#include "llfocusmgr.h" 52#include "llfocusmgr.h"
52#include "llviewerjoystick.h" 53#include "llviewerjoystick.h"
54#include "llares.h"
53#include "llcurl.h" 55#include "llcurl.h"
54#include "llfloatersnapshot.h" 56#include "llfloatersnapshot.h"
55#include "llviewerwindow.h" 57#include "llviewerwindow.h"
@@ -59,6 +61,7 @@
59#include "llworldmap.h" 61#include "llworldmap.h"
60#include "llmutelist.h" 62#include "llmutelist.h"
61#include "llurldispatcher.h" 63#include "llurldispatcher.h"
64#include "llurlhistory.h"
62 65
63#include "llweb.h" 66#include "llweb.h"
64#include "llsecondlifeurls.h" 67#include "llsecondlifeurls.h"
@@ -76,7 +79,6 @@
76 79
77 80
78#include "llnotify.h" 81#include "llnotify.h"
79#include "llmediaengine.h"
80#include "llviewerkeyboard.h" 82#include "llviewerkeyboard.h"
81#include "lllfsthread.h" 83#include "lllfsthread.h"
82#include "llworkerthread.h" 84#include "llworkerthread.h"
@@ -97,9 +99,11 @@
97#include "llviewermenu.h" 99#include "llviewermenu.h"
98#include "llselectmgr.h" 100#include "llselectmgr.h"
99#include "lltracker.h" 101#include "lltracker.h"
100#include "llmozlib.h"
101#include "llviewerparcelmgr.h" 102#include "llviewerparcelmgr.h"
102#include "llworldmapview.h" 103#include "llworldmapview.h"
104#include "llpostprocess.h"
105#include "llwlparammanager.h"
106#include "llwaterparammanager.h"
103 107
104#include "lldebugview.h" 108#include "lldebugview.h"
105#include "llconsole.h" 109#include "llconsole.h"
@@ -127,6 +131,9 @@
127#include "llframestats.h" 131#include "llframestats.h"
128#include "llagentpilot.h" 132#include "llagentpilot.h"
129#include "llsrv.h" 133#include "llsrv.h"
134#include "llvovolume.h"
135#include "llflexibleobject.h"
136#include "llvosurfacepatch.h"
130 137
131// includes for idle() idleShutdown() 138// includes for idle() idleShutdown()
132#include "llviewercontrol.h" 139#include "llviewercontrol.h"
@@ -169,21 +176,6 @@ static char** gTempArgV;
169#if LL_WINDOWS && LL_LCD_COMPILE 176#if LL_WINDOWS && LL_LCD_COMPILE
170 #include "lllcd.h" 177 #include "lllcd.h"
171#endif 178#endif
172//
173#if LL_QUICKTIME_ENABLED
174 #if LL_DARWIN
175 #include <QuickTime/QuickTime.h>
176 #else
177 // quicktime specific includes
178 #include "MacTypes.h"
179 #include "QTML.h"
180 #include "Movies.h"
181 #include "FixMath.h"
182 #endif
183#endif
184//
185//////
186
187 179
188//---------------------------------------------------------------------------- 180//----------------------------------------------------------------------------
189// viewer.cpp - these are only used in viewer, should be easily moved. 181// viewer.cpp - these are only used in viewer, should be easily moved.
@@ -228,10 +220,6 @@ extern BOOL gbCapturing;
228extern BOOL gRandomizeFramerate; 220extern BOOL gRandomizeFramerate;
229extern BOOL gPeriodicSlowFrame; 221extern BOOL gPeriodicSlowFrame;
230 222
231#if LL_GSTREAMER_ENABLED
232void UnloadGStreamer();
233#endif
234
235//////////////////////////////////////////////////////////// 223////////////////////////////////////////////////////////////
236// All from the last globals push... 224// All from the last globals push...
237bool gVerifySSLCert = true; 225bool gVerifySSLCert = true;
@@ -257,6 +245,7 @@ BOOL gShowObjectUpdates = FALSE;
257BOOL gLogMessages = FALSE; 245BOOL gLogMessages = FALSE;
258std::string gChannelName = LL_CHANNEL; 246std::string gChannelName = LL_CHANNEL;
259BOOL gUseAudio = TRUE; 247BOOL gUseAudio = TRUE;
248BOOL gUseQuickTime = TRUE;
260LLString gCmdLineFirstName; 249LLString gCmdLineFirstName;
261LLString gCmdLineLastName; 250LLString gCmdLineLastName;
262LLString gCmdLinePassword; 251LLString gCmdLinePassword;
@@ -394,7 +383,6 @@ static const char USAGE[] = "\n"
394" -set <variable> <value> specify the value of a particular\n" 383" -set <variable> <value> specify the value of a particular\n"
395" configuration variable that\n" 384" configuration variable that\n"
396" overrides all other settings\n" 385" overrides all other settings\n"
397" -user <user_server_ip> specify userserver in dotted quad\n"
398#if !LL_RELEASE_FOR_DOWNLOAD 386#if !LL_RELEASE_FOR_DOWNLOAD
399" -sim <simulator_ip> specify the simulator ip address\n" 387" -sim <simulator_ip> specify the simulator ip address\n"
400#endif 388#endif
@@ -477,8 +465,6 @@ static void saved_settings_to_globals()
477 LLCOMBOBOX_WIDTH = 128; 465 LLCOMBOBOX_WIDTH = 128;
478 466
479 LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize")); 467 LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
480
481 LLVOSky::sNighttimeBrightness = gSavedSettings.getF32("RenderNightBrightness");
482 468
483 LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic"); 469 LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
484 LLVOVolume::sLODFactor = gSavedSettings.getF32("RenderVolumeLODFactor"); 470 LLVOVolume::sLODFactor = gSavedSettings.getF32("RenderVolumeLODFactor");
@@ -511,6 +497,11 @@ static void saved_settings_to_globals()
511 gHandleKeysAsync = gSavedSettings.getBOOL("AsyncKeyboard"); 497 gHandleKeysAsync = gSavedSettings.getBOOL("AsyncKeyboard");
512 LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips"); 498 LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips");
513 499
500 LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO");
501 LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors");
502 LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor");
503 LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //sqaure lod factor to get exponential range of [1,4]
504
514#if LL_VECTORIZE 505#if LL_VECTORIZE
515 if (gSysCPU.hasAltivec()) 506 if (gSysCPU.hasAltivec())
516 { 507 {
@@ -664,21 +655,6 @@ int parse_args(int argc, char **argv)
664 gGridChoice = GRID_INFO_YAMI; 655 gGridChoice = GRID_INFO_YAMI;
665 sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); 656 sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
666 } 657 }
667 else if (!strcmp(argv[j], "-user") && (++j < argc))
668 {
669 if (!strcmp(argv[j], "-"))
670 {
671 gGridChoice = GRID_INFO_LOCAL;
672 snprintf(gGridName, MAX_STRING, "%s", LOOPBACK_ADDRESS_STRING); // Flawfinder: ignore
673 }
674 else
675 {
676 gGridChoice = GRID_INFO_OTHER;
677 ip_string.assign( argv[j] );
678 LLString::trim(ip_string);
679 snprintf(gGridName, MAX_STRING, "%s", ip_string.c_str()); // Flawfinder: ignore
680 }
681 }
682 else if (!strcmp(argv[j], "-loginpage") && (++j < argc)) 658 else if (!strcmp(argv[j], "-loginpage") && (++j < argc))
683 { 659 {
684 LLAppViewer::instance()->setLoginPage(utf8str_trim(argv[j])); 660 LLAppViewer::instance()->setLoginPage(utf8str_trim(argv[j]));
@@ -1046,13 +1022,6 @@ bool LLAppViewer::init()
1046 gCurrentVersion = llformat("%s %d.%d.%d.%d", gChannelName.c_str(), LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VERSION_BUILD ); 1022 gCurrentVersion = llformat("%s %d.%d.%d.%d", gChannelName.c_str(), LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VERSION_BUILD );
1047 1023
1048 // 1024 //
1049 // Load the feature tables
1050 //
1051 llinfos << "Loading feature tables." << llendl;
1052
1053 gFeatureManagerp->loadFeatureTables();
1054 gFeatureManagerp->initCPUFeatureMasks();
1055
1056 // Merge with the command line overrides 1025 // Merge with the command line overrides
1057 gSavedSettings.applyOverrides(gCommandLineSettings); 1026 gSavedSettings.applyOverrides(gCommandLineSettings);
1058 1027
@@ -1196,6 +1165,9 @@ bool LLAppViewer::init()
1196 1165
1197 LLAgent::parseTeleportMessages("teleport_strings.xml"); 1166 LLAgent::parseTeleportMessages("teleport_strings.xml");
1198 1167
1168 // load MIME type -> media impl mappings
1169 LLMIMETypes::parseMIMETypes( "mime_types.xml" );
1170
1199 mCrashBehavior = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); 1171 mCrashBehavior = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING);
1200 1172
1201 LLVectorPerformanceOptions::initClass(); 1173 LLVectorPerformanceOptions::initClass();
@@ -1294,26 +1266,64 @@ bool LLAppViewer::init()
1294 llinfos << "Viewer Digest: " << gViewerDigest << llendl; 1266 llinfos << "Viewer Digest: " << gViewerDigest << llendl;
1295 1267
1296 // If we don't have the right GL requirements, exit. 1268 // If we don't have the right GL requirements, exit.
1297 // BUG: This should just be changed to a generic GL "Not good enough" flag 1269 if (!gGLManager.mHasRequirements && !gNoRender)
1298 if (!gGLManager.mHasMultitexture && !gNoRender) 1270 {
1299 { 1271 // can't use an alert here since we're existing and
1300 std::ostringstream msg; 1272 // all hell breaks lose.
1301 msg <<
1302 "You do not appear to have the proper hardware requirements "
1303 "for " << gSecondLife << ". " << gSecondLife << " requires an OpenGL graphics "
1304 "card that has multitexture support. If this is the case, "
1305 "you may want to make sure that you have the latest drivers for "
1306 "your graphics card, and service packs and patches for your "
1307 "operating system.\n"
1308 "If you continue to have problems, please go to: "
1309 "www.secondlife.com/support ";
1310 OSMessageBox( 1273 OSMessageBox(
1311 msg.str().c_str(), 1274 LLAlertDialog::getTemplateMessage("UnsupportedGLRequirements").c_str(),
1312 NULL, 1275 NULL,
1313 OSMB_OK); 1276 OSMB_OK);
1314 return 0; 1277 return 0;
1315 } 1278 }
1316 1279
1280 // alert the user if they are using unsupported hardware
1281 if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
1282 {
1283 bool unsupported = false;
1284 LLString::format_map_t args;
1285 LLString minSpecs;
1286
1287 // get cpu data from xml
1288 std::stringstream minCPUString(LLAlertDialog::getTemplateMessage("UnsupportedCPUAmount"));
1289 S32 minCPU = 0;
1290 minCPUString >> minCPU;
1291
1292 // get RAM data from XML
1293 std::stringstream minRAMString(LLAlertDialog::getTemplateMessage("UnsupportedRAMAmount"));
1294 U64 minRAM = 0;
1295 minRAMString >> minRAM;
1296 minRAM = minRAM * 1024 * 1024;
1297
1298 if(!gFeatureManagerp->isGPUSupported())
1299 {
1300 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedGPU");
1301 minSpecs += "\n";
1302 unsupported = true;
1303 }
1304 if(gSysCPU.getMhz() < minCPU)
1305 {
1306 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedCPU");
1307 minSpecs += "\n";
1308 unsupported = true;
1309 }
1310 if(gSysMemory.getPhysicalMemoryClamped() < minRAM)
1311 {
1312 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedRAM");
1313 minSpecs += "\n";
1314 unsupported = true;
1315 }
1316
1317 if(unsupported)
1318 {
1319 args["MINSPECS"] = minSpecs;
1320 gViewerWindow->alertXml("UnsupportedHardware", args );
1321
1322 // turn off flag
1323 gSavedSettings.setBOOL("AlertedUnsupportedHardware", TRUE);
1324 }
1325 }
1326
1317 // Save the current version to the prefs file 1327 // Save the current version to the prefs file
1318 gSavedSettings.setString("LastRunVersion", gCurrentVersion); 1328 gSavedSettings.setString("LastRunVersion", gCurrentVersion);
1319 1329
@@ -1332,7 +1342,7 @@ bool LLAppViewer::mainLoop()
1332 // Create IO Pump to use for HTTP Requests. 1342 // Create IO Pump to use for HTTP Requests.
1333 gServicePump = new LLPumpIO(gAPRPoolp); 1343 gServicePump = new LLPumpIO(gAPRPoolp);
1334 LLHTTPClient::setPump(*gServicePump); 1344 LLHTTPClient::setPump(*gServicePump);
1335 LLHTTPClient::setCABundle(gDirUtilp->getCAFile()); 1345 LLCurl::setCAFile(gDirUtilp->getCAFile());
1336 1346
1337 // initialize voice stuff here 1347 // initialize voice stuff here
1338 gLocalSpeakerMgr = new LLLocalSpeakerMgr(); 1348 gLocalSpeakerMgr = new LLLocalSpeakerMgr();
@@ -1371,6 +1381,7 @@ bool LLAppViewer::mainLoop()
1371 debugTime.reset(); 1381 debugTime.reset();
1372 } 1382 }
1373#endif 1383#endif
1384
1374 if (!LLApp::isExiting()) 1385 if (!LLApp::isExiting())
1375 { 1386 {
1376 // Scan keyboard for movement keys. Command keys and typing 1387 // Scan keyboard for movement keys. Command keys and typing
@@ -1391,10 +1402,14 @@ bool LLAppViewer::mainLoop()
1391 { 1402 {
1392 LLFastTimer t3(LLFastTimer::FTM_IDLE); 1403 LLFastTimer t3(LLFastTimer::FTM_IDLE);
1393 idle(); 1404 idle();
1394 LLCurl::process(); 1405
1395 // this pump is necessary to make the login screen show up 1406 {
1396 gServicePump->pump(); 1407 LLFastTimer t4(LLFastTimer::FTM_PUMP);
1397 gServicePump->callback(); 1408 gAres->process();
1409 // this pump is necessary to make the login screen show up
1410 gServicePump->pump();
1411 gServicePump->callback();
1412 }
1398 } 1413 }
1399 1414
1400 if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED)) 1415 if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED))
@@ -1468,7 +1483,7 @@ bool LLAppViewer::mainLoop()
1468 1483
1469 const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps 1484 const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps
1470 const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms 1485 const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms
1471 const F64 max_idle_time = run_multiple_threads ? min_idle_time : .005; // 5 ms 1486 const F64 max_idle_time = run_multiple_threads ? min_idle_time : llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second
1472 idleTimer.reset(); 1487 idleTimer.reset();
1473 while(1) 1488 while(1)
1474 { 1489 {
@@ -1596,32 +1611,6 @@ bool LLAppViewer::cleanup()
1596 llwarns << "Hack, skipping audio engine cleanup" << llendflush; 1611 llwarns << "Hack, skipping audio engine cleanup" << llendflush;
1597#endif 1612#endif
1598 1613
1599
1600 // moved to main application shutdown for now because it's non-trivial and only needs to be done once
1601 // (even though it goes against the media framework design)
1602
1603 LLMediaEngine::cleanupClass();
1604
1605#if LL_QUICKTIME_ENABLED
1606 if (gQuickTimeInitialized)
1607 {
1608 // clean up media stuff
1609 llinfos << "Cleaning up QuickTime" << llendl;
1610 ExitMovies ();
1611 #if LL_WINDOWS
1612 // Only necessary/available on Windows.
1613 TerminateQTML ();
1614 #endif
1615 }
1616 llinfos << "Quicktime cleaned up" << llendflush;
1617#endif
1618
1619#if LL_GSTREAMER_ENABLED
1620 llinfos << "Cleaning up GStreamer" << llendl;
1621 UnloadGStreamer();
1622 llinfos << "GStreamer cleaned up" << llendflush;
1623#endif
1624
1625 llinfos << "Cleaning up feature manager" << llendflush; 1614 llinfos << "Cleaning up feature manager" << llendflush;
1626 delete gFeatureManagerp; 1615 delete gFeatureManagerp;
1627 gFeatureManagerp = NULL; 1616 gFeatureManagerp = NULL;
@@ -1680,21 +1669,19 @@ bool LLAppViewer::cleanup()
1680 LLSelectMgr::cleanupGlobals(); 1669 LLSelectMgr::cleanupGlobals();
1681 1670
1682 LLViewerObject::cleanupVOClasses(); 1671 LLViewerObject::cleanupVOClasses();
1683 1672
1673 LLWaterParamManager::cleanupClass();
1674 LLWLParamManager::cleanupClass();
1675 LLPostProcess::cleanupClass();
1676
1684 LLTracker::cleanupInstance(); 1677 LLTracker::cleanupInstance();
1685 1678
1686#if LL_LIBXUL_ENABLED
1687 // this must be done after floater cleanup (delete gViewerWindow) since
1688 // floaters potentially need the manager to destroy their contents.
1689 LLMozLib::getInstance()->reset();
1690#endif
1691
1692 // *FIX: This is handled in LLAppViewerWin32::cleanup(). 1679 // *FIX: This is handled in LLAppViewerWin32::cleanup().
1693 // I'm keeping the comment to remember its order in cleanup, 1680 // I'm keeping the comment to remember its order in cleanup,
1694 // in case of unforseen dependency. 1681 // in case of unforseen dependency.
1695//#if LL_WINDOWS 1682 //#if LL_WINDOWS
1696// gDXHardware.cleanup(); 1683 // gDXHardware.cleanup();
1697//#endif // LL_WINDOWS 1684 //#endif // LL_WINDOWS
1698 1685
1699#if LL_WINDOWS && LL_LCD_COMPILE 1686#if LL_WINDOWS && LL_LCD_COMPILE
1700 // shut down the LCD window on a logitech keyboard, if there is one 1687 // shut down the LCD window on a logitech keyboard, if there is one
@@ -1751,6 +1738,9 @@ bool LLAppViewer::cleanup()
1751 gColors.cleanup(); 1738 gColors.cleanup();
1752 gCrashSettings.cleanup(); 1739 gCrashSettings.cleanup();
1753 1740
1741 // Save URL history file
1742 LLURLHistory::saveFile("url_history.xml");
1743
1754 if (gMuteListp) 1744 if (gMuteListp)
1755 { 1745 {
1756 // save mute list 1746 // save mute list
@@ -1829,7 +1819,7 @@ bool LLAppViewer::cleanup()
1829 end_messaging_system(); 1819 end_messaging_system();
1830 1820
1831 // *NOTE:Mani - The following call is not thread safe. 1821 // *NOTE:Mani - The following call is not thread safe.
1832 LLCurl::cleanup(); 1822 LLCurl::cleanupClass();
1833 1823
1834 // If we're exiting to launch an URL, do that here so the screen 1824 // If we're exiting to launch an URL, do that here so the screen
1835 // is at the right resolution before we launch IE. 1825 // is at the right resolution before we launch IE.
@@ -1933,17 +1923,6 @@ bool LLAppViewer::initEarlyConfiguration()
1933 { 1923 {
1934 sprintf(gGridName,"%s", gGridInfo[GRID_INFO_ARUNA].mName); 1924 sprintf(gGridName,"%s", gGridInfo[GRID_INFO_ARUNA].mName);
1935 } 1925 }
1936 else if (!strcmp(argv[j], "-user") && (++j < argc))
1937 {
1938 if (!strcmp(argv[j], "-"))
1939 {
1940 snprintf(gGridName, MAX_STRING, "%s", LOOPBACK_ADDRESS_STRING); // Flawfinder: ignore
1941 }
1942 else
1943 {
1944 snprintf(gGridName, MAX_STRING, "%s", argv[j]); // Flawfinder: ignore
1945 }
1946 }
1947 else if (!strcmp(argv[j], "-multiple")) 1926 else if (!strcmp(argv[j], "-multiple"))
1948 { 1927 {
1949 // Hack to detect -multiple so we can disable the marker file check (which will always fail) 1928 // Hack to detect -multiple so we can disable the marker file check (which will always fail)
@@ -2390,18 +2369,33 @@ bool LLAppViewer::initWindow()
2390 gViewerWindow->getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio")); 2369 gViewerWindow->getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
2391 } 2370 }
2392 2371
2372 if (!gNoRender)
2373 {
2374 //
2375 // Initialize GL stuff
2376 //
2377
2378 // Set this flag in case we crash while initializing GL
2379 gSavedSettings.setBOOL("RenderInitError", TRUE);
2380 gSavedSettings.saveToFile( gSettingsFileName, TRUE );
2381
2382 gPipeline.init();
2383 stop_glerror();
2384 gViewerWindow->initGLDefaults();
2385
2386 gSavedSettings.setBOOL("RenderInitError", FALSE);
2387 gSavedSettings.saveToFile( gSettingsFileName, TRUE );
2388 }
2389
2393 LLUI::sWindow = gViewerWindow->getWindow(); 2390 LLUI::sWindow = gViewerWindow->getWindow();
2394 2391
2395 LLAlertDialog::parseAlerts("alerts.xml"); 2392 LLAlertDialog::parseAlerts("alerts.xml");
2396 LLNotifyBox::parseNotify("notify.xml"); 2393 LLNotifyBox::parseNotify("notify.xml");
2397 2394
2398 LLMediaEngine::initClass(); 2395 // *TODO - remove this when merging into release
2399 2396 // DON'T Clean up the feature manager lookup table - settings are needed
2400 // 2397 // for setting the graphics level.
2401 // Clean up the feature manager lookup table - settings were updated 2398 //gFeatureManagerp->cleanupFeatureTables();
2402 // in the LLViewerWindow constructor
2403 //
2404 gFeatureManagerp->cleanupFeatureTables();
2405 2399
2406 // Show watch cursor 2400 // Show watch cursor
2407 gViewerWindow->setCursor(UI_CURSOR_WAIT); 2401 gViewerWindow->setCursor(UI_CURSOR_WAIT);
@@ -3206,6 +3200,14 @@ void LLAppViewer::loadNameCache()
3206 3200
3207 std::string name_cache; 3201 std::string name_cache;
3208 name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); 3202 name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
3203 llifstream cache_file(name_cache.c_str());
3204 if(cache_file.is_open())
3205 {
3206 if(gCacheName->importFile(cache_file)) return;
3207 }
3208
3209 // Try to load from the legacy format. This should go away after a
3210 // while. Phoenix 2008-01-30
3209 FILE* name_cache_fp = LLFile::fopen(name_cache.c_str(), "r"); // Flawfinder: ignore 3211 FILE* name_cache_fp = LLFile::fopen(name_cache.c_str(), "r"); // Flawfinder: ignore
3210 if (name_cache_fp) 3212 if (name_cache_fp)
3211 { 3213 {
@@ -3220,11 +3222,10 @@ void LLAppViewer::saveNameCache()
3220 3222
3221 std::string name_cache; 3223 std::string name_cache;
3222 name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); 3224 name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
3223 FILE* name_cache_fp = LLFile::fopen(name_cache.c_str(), "w"); // Flawfinder: ignore 3225 llofstream cache_file(name_cache.c_str());
3224 if (name_cache_fp) 3226 if(cache_file.is_open())
3225 { 3227 {
3226 gCacheName->exportFile(name_cache_fp); 3228 gCacheName->exportFile(cache_file);
3227 fclose(name_cache_fp);
3228 } 3229 }
3229} 3230}
3230 3231
@@ -3315,8 +3316,7 @@ void LLAppViewer::idle()
3315 if (!gDisconnected) 3316 if (!gDisconnected)
3316 { 3317 {
3317 LLFastTimer t(LLFastTimer::FTM_NETWORK); 3318 LLFastTimer t(LLFastTimer::FTM_NETWORK);
3318 3319 // Update spaceserver timeinfo
3319 // Update spaceserver timeinfo
3320 gWorldp->setSpaceTimeUSec(gWorldp->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC)); 3320 gWorldp->setSpaceTimeUSec(gWorldp->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC));
3321 3321
3322 3322
@@ -3419,8 +3419,6 @@ void LLAppViewer::idle()
3419 3419
3420 // Update statistics for this frame 3420 // Update statistics for this frame
3421 update_statistics(gFrameCount); 3421 update_statistics(gFrameCount);
3422
3423 gViewerWindow->updateDebugText();
3424 } 3422 }
3425 3423
3426 //////////////////////////////////////// 3424 ////////////////////////////////////////
@@ -3450,11 +3448,7 @@ void LLAppViewer::idle()
3450 // 3448 //
3451 LLCoordGL current_mouse = gViewerWindow->getCurrentMouse(); 3449 LLCoordGL current_mouse = gViewerWindow->getCurrentMouse();
3452 3450
3453// BOOL was_in_prelude = gAgent.inPrelude();
3454
3455 { 3451 {
3456 //LLFastTimer t(LLFastTimer::FTM_TEMP1);
3457
3458 // After agent and camera moved, figure out if we need to 3452 // After agent and camera moved, figure out if we need to
3459 // deselect objects. 3453 // deselect objects.
3460 gSelectMgr->deselectAllIfTooFar(); 3454 gSelectMgr->deselectAllIfTooFar();
@@ -3462,19 +3456,6 @@ void LLAppViewer::idle()
3462 } 3456 }
3463 3457
3464 { 3458 {
3465 LLFastTimer t(LLFastTimer::FTM_RESET_DRAWORDER);
3466
3467 //////////////////////////////////////////////
3468 //
3469 // Clear draw orders
3470 //
3471 // Should actually be done after render, but handlePerFrameHover actually does a "render"
3472 // to do its selection.
3473 //
3474
3475 gPipeline.resetDrawOrders();
3476 }
3477 {
3478 // Handle pending gesture processing 3459 // Handle pending gesture processing
3479 gGestureManager.update(); 3460 gGestureManager.update();
3480 3461
@@ -3491,11 +3472,6 @@ void LLAppViewer::idle()
3491 } 3472 }
3492 } 3473 }
3493 3474
3494 {
3495 LLFastTimer t(LLFastTimer::FTM_UPDATE_SKY);
3496 gSky.updateSky();
3497 }
3498
3499 ////////////////////////////////////// 3475 //////////////////////////////////////
3500 // 3476 //
3501 // Deletes objects... 3477 // Deletes objects...
@@ -3523,8 +3499,6 @@ void LLAppViewer::idle()
3523 // 3499 //
3524 3500
3525 { 3501 {
3526 //LLFastTimer t(LLFastTimer::FTM_TEMP3);
3527
3528 gFrameStats.start(LLFrameStats::UPDATE_EFFECTS); 3502 gFrameStats.start(LLFrameStats::UPDATE_EFFECTS);
3529 gSelectMgr->updateEffects(); 3503 gSelectMgr->updateEffects();
3530 gHUDManager->cleanupEffects(); 3504 gHUDManager->cleanupEffects();
@@ -3599,16 +3573,18 @@ void LLAppViewer::idle()
3599 // 3573 //
3600 gFrameStats.start(LLFrameStats::IMAGE_UPDATE); 3574 gFrameStats.start(LLFrameStats::IMAGE_UPDATE);
3601 3575
3602 LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); 3576 {
3603 3577 LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE);
3604 LLViewerImage::updateClass(gCamera->getVelocityStat()->getMean(), 3578
3605 gCamera->getAngularVelocityStat()->getMean()); 3579 LLViewerImage::updateClass(gCamera->getVelocityStat()->getMean(),
3580 gCamera->getAngularVelocityStat()->getMean());
3606 3581
3607 gBumpImageList.updateImages(); // must be called before gImageList version so that it's textures are thrown out first. 3582 gBumpImageList.updateImages(); // must be called before gImageList version so that it's textures are thrown out first.
3608 3583
3609 const F32 max_image_decode_time = 0.005f; // 5 ms decode time 3584 const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame)
3610 gImageList.updateImages(max_image_decode_time); 3585 gImageList.updateImages(max_image_decode_time);
3611 stop_glerror(); 3586 stop_glerror();
3587 }
3612 3588
3613 ////////////////////////////////////// 3589 //////////////////////////////////////
3614 // 3590 //
@@ -3618,6 +3594,7 @@ void LLAppViewer::idle()
3618 3594
3619 if (!gNoRender) 3595 if (!gNoRender)
3620 { 3596 {
3597 LLFastTimer t(LLFastTimer::FTM_WORLD_UPDATE);
3621 gFrameStats.start(LLFrameStats::UPDATE_MOVE); 3598 gFrameStats.start(LLFrameStats::UPDATE_MOVE);
3622 gPipeline.updateMove(); 3599 gPipeline.updateMove();
3623 3600