aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llstartup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llstartup.cpp')
-rw-r--r--linden/indra/newview/llstartup.cpp487
1 files changed, 272 insertions, 215 deletions
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 36809ee..914b993 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -45,13 +45,10 @@
45#include "audioengine_fmod.h" 45#include "audioengine_fmod.h"
46#endif 46#endif
47 47
48#include "audiosettings.h"
49#include "llares.h" 48#include "llares.h"
50#include "llcachename.h" 49#include "llcachename.h"
51#include "llcameraview.h"
52#include "llviewercontrol.h" 50#include "llviewercontrol.h"
53#include "lldir.h" 51#include "lldir.h"
54#include "lleconomy.h"
55#include "llerrorcontrol.h" 52#include "llerrorcontrol.h"
56#include "llfiltersd2xmlrpc.h" 53#include "llfiltersd2xmlrpc.h"
57#include "llfocusmgr.h" 54#include "llfocusmgr.h"
@@ -84,6 +81,7 @@
84#include "llcolorscheme.h" 81#include "llcolorscheme.h"
85#include "llconsole.h" 82#include "llconsole.h"
86#include "llcontainerview.h" 83#include "llcontainerview.h"
84#include "llfloaterstats.h"
87#include "lldebugview.h" 85#include "lldebugview.h"
88#include "lldrawable.h" 86#include "lldrawable.h"
89#include "lleventnotifier.h" 87#include "lleventnotifier.h"
@@ -91,8 +89,10 @@
91#include "llfeaturemanager.h" 89#include "llfeaturemanager.h"
92#include "llfirstuse.h" 90#include "llfirstuse.h"
93#include "llfloateractivespeakers.h" 91#include "llfloateractivespeakers.h"
92#include "llfloatercamera.h"
94#include "llfloaterchat.h" 93#include "llfloaterchat.h"
95#include "llfloatergesture.h" 94#include "llfloatergesture.h"
95#include "llfloaterhud.h"
96#include "llfloaterland.h" 96#include "llfloaterland.h"
97#include "llfloatertopobjects.h" 97#include "llfloatertopobjects.h"
98#include "llfloatertos.h" 98#include "llfloatertos.h"
@@ -322,8 +322,6 @@ BOOL idle_startup()
322 static LLString password; 322 static LLString password;
323 static std::vector<const char*> requested_options; 323 static std::vector<const char*> requested_options;
324 324
325 static U32 region_size = 256;
326 static F32 region_scale = 1.f;
327 static U64 first_sim_handle = 0; 325 static U64 first_sim_handle = 0;
328 static LLHost first_sim; 326 static LLHost first_sim;
329 static std::string first_sim_seed_cap; 327 static std::string first_sim_seed_cap;
@@ -374,11 +372,11 @@ BOOL idle_startup()
374 // Initialize stuff that doesn't need data from simulators 372 // Initialize stuff that doesn't need data from simulators
375 // 373 //
376 374
377 if (gFeatureManagerp->isSafe()) 375 if (LLFeatureManager::getInstance()->isSafe())
378 { 376 {
379 gViewerWindow->alertXml("DisplaySetToSafe"); 377 gViewerWindow->alertXml("DisplaySetToSafe");
380 } 378 }
381 else if ((gSavedSettings.getS32("LastFeatureVersion") < gFeatureManagerp->getVersion()) && 379 else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) &&
382 (gSavedSettings.getS32("LastFeatureVersion") != 0)) 380 (gSavedSettings.getS32("LastFeatureVersion") != 0))
383 { 381 {
384 gViewerWindow->alertXml("DisplaySetToRecommended"); 382 gViewerWindow->alertXml("DisplaySetToRecommended");
@@ -388,7 +386,7 @@ BOOL idle_startup()
388 gViewerWindow->alertXml(gViewerWindow->getInitAlert()); 386 gViewerWindow->alertXml(gViewerWindow->getInitAlert());
389 } 387 }
390 388
391 gSavedSettings.setS32("LastFeatureVersion", gFeatureManagerp->getVersion()); 389 gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
392 390
393 LLString xml_file = LLUI::locateSkin("xui_version.xml"); 391 LLString xml_file = LLUI::locateSkin("xui_version.xml");
394 LLXMLNodePtr root; 392 LLXMLNodePtr root;
@@ -445,7 +443,7 @@ BOOL idle_startup()
445 { 443 {
446 fclose(found_template); 444 fclose(found_template);
447 445
448 U32 port = gAgent.mViewerPort; 446 U32 port = gSavedSettings.getU32("UserConnectionPort");
449 447
450 if ((NET_USE_OS_ASSIGNED_PORT == port) && // if nothing specified on command line (-port) 448 if ((NET_USE_OS_ASSIGNED_PORT == port) && // if nothing specified on command line (-port)
451 (gSavedSettings.getBOOL("ConnectionPortEnabled"))) 449 (gSavedSettings.getBOOL("ConnectionPortEnabled")))
@@ -495,7 +493,7 @@ BOOL idle_startup()
495 invalid_message_callback, 493 invalid_message_callback,
496 NULL); 494 NULL);
497 495
498 if (gSavedSettings.getBOOL("LogMessages") || gLogMessages) 496 if (gSavedSettings.getBOOL("LogMessages"))
499 { 497 {
500 llinfos << "Message logging activated!" << llendl; 498 llinfos << "Message logging activated!" << llendl;
501 msg->startLogging(); 499 msg->startLogging();
@@ -514,32 +512,32 @@ BOOL idle_startup()
514 } 512 }
515 gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS); 513 gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS);
516 514
517 msg->mPacketRing.setDropPercentage(gPacketDropPercentage); 515
518 if (gInBandwidth != 0.f) 516 F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
517 msg->mPacketRing.setDropPercentage(dropPercent);
518
519 F32 inBandwidth = gSavedSettings.getF32("InBandwidth");
520 F32 outBandwidth = gSavedSettings.getF32("OutBandwidth");
521 if (inBandwidth != 0.f)
519 { 522 {
520 llinfos << "Setting packetring incoming bandwidth to " << gInBandwidth << llendl; 523 llinfos << "Setting packetring incoming bandwidth to " << inBandwidth << llendl;
521 msg->mPacketRing.setUseInThrottle(TRUE); 524 msg->mPacketRing.setUseInThrottle(TRUE);
522 msg->mPacketRing.setInBandwidth(gInBandwidth); 525 msg->mPacketRing.setInBandwidth(inBandwidth);
523 } 526 }
524 if (gOutBandwidth != 0.f) 527 if (outBandwidth != 0.f)
525 { 528 {
526 llinfos << "Setting packetring outgoing bandwidth to " << gOutBandwidth << llendl; 529 llinfos << "Setting packetring outgoing bandwidth to " << outBandwidth << llendl;
527 msg->mPacketRing.setUseOutThrottle(TRUE); 530 msg->mPacketRing.setUseOutThrottle(TRUE);
528 msg->mPacketRing.setOutBandwidth(gOutBandwidth); 531 msg->mPacketRing.setOutBandwidth(outBandwidth);
529 } 532 }
530 } 533 }
531 534
532 // initialize the economy
533 gGlobalEconomy = new LLGlobalEconomy();
534
535
536
537 //------------------------------------------------- 535 //-------------------------------------------------
538 // Init audio, which may be needed for prefs dialog 536 // Init audio, which may be needed for prefs dialog
539 // or audio cues in connection UI. 537 // or audio cues in connection UI.
540 //------------------------------------------------- 538 //-------------------------------------------------
541 539
542 if (gUseAudio) 540 if (FALSE == gSavedSettings.getBOOL("NoAudio"))
543 { 541 {
544#if LL_FMOD 542#if LL_FMOD
545 gAudiop = (LLAudioEngine *) new LLAudioEngine_FMOD(); 543 gAudiop = (LLAudioEngine *) new LLAudioEngine_FMOD();
@@ -584,14 +582,13 @@ BOOL idle_startup()
584 582
585 show_connect_box = FALSE; 583 show_connect_box = FALSE;
586 } 584 }
587 else if( !gCmdLineFirstName.empty() 585 else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
588 && !gCmdLineLastName.empty() 586 {
589 && !gCmdLinePassword.empty()) 587 LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
590 { 588 firstname = cmd_line_login[0].asString();
591 firstname = gCmdLineFirstName; 589 lastname = cmd_line_login[1].asString();
592 lastname = gCmdLineLastName;
593 590
594 LLMD5 pass((unsigned char*)gCmdLinePassword.c_str()); 591 LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
595 char md5pass[33]; /* Flawfinder: ignore */ 592 char md5pass[33]; /* Flawfinder: ignore */
596 pass.hex_digest(md5pass); 593 pass.hex_digest(md5pass);
597 password = md5pass; 594 password = md5pass;
@@ -602,9 +599,9 @@ BOOL idle_startup()
602#else 599#else
603 show_connect_box = FALSE; 600 show_connect_box = FALSE;
604#endif 601#endif
605 gAutoLogin = TRUE; 602 gSavedSettings.setBOOL("AutoLogin", TRUE);
606 } 603 }
607 else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin")) 604 else if (gSavedSettings.getBOOL("AutoLogin"))
608 { 605 {
609 firstname = gSavedSettings.getString("FirstName"); 606 firstname = gSavedSettings.getString("FirstName");
610 lastname = gSavedSettings.getString("LastName"); 607 lastname = gSavedSettings.getString("LastName");
@@ -695,24 +692,19 @@ BOOL idle_startup()
695 // skip directly to message template verification 692 // skip directly to message template verification
696 LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); 693 LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
697 } 694 }
698 695
699 // Create selection manager 696 // *NOTE: This is where LLViewerParcelMgr::getInstance() used to get allocated before becoming LLViewerParcelMgr::getInstance().
700 // Must be done before menus created, because many enabled callbacks 697
701 // require its existance. 698 // *NOTE: This is where gHUDManager used to bet allocated before becoming LLHUDManager::getInstance().
702 gSelectMgr = new LLSelectMgr(); 699
703 gParcelMgr = new LLViewerParcelMgr(); 700 // *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance().
704 gHUDManager = new LLHUDManager();
705 gMuteListp = new LLMuteList();
706 701
707 // Initialize UI 702 // Initialize UI
708 if (!gNoRender) 703 if (!gNoRender)
709 { 704 {
710 // Initialize all our tools. Must be done after saved settings loaded. 705 // Initialize all our tools. Must be done after saved settings loaded.
711 if ( gToolMgr == NULL ) 706 // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton.
712 { 707 LLToolMgr::getInstance()->initTools();
713 gToolMgr = new LLToolMgr();
714 gToolMgr->initTools();
715 }
716 708
717 // Quickly get something onscreen to look at. 709 // Quickly get something onscreen to look at.
718 gViewerWindow->initWorldUI(); 710 gViewerWindow->initWorldUI();
@@ -779,19 +771,17 @@ BOOL idle_startup()
779 // create necessary directories 771 // create necessary directories
780 // *FIX: these mkdir's should error check 772 // *FIX: these mkdir's should error check
781 gDirUtilp->setLindenUserDir(firstname.c_str(), lastname.c_str()); 773 gDirUtilp->setLindenUserDir(firstname.c_str(), lastname.c_str());
774 LLFile::mkdir(gDirUtilp->getLindenUserDir().c_str());
782 775
776 // Set PerAccountSettingsFile to the default value.
777 gSavedSettings.setString("PerAccountSettingsFile",
778 gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
779 LLAppViewer::instance()->getSettingsFileName("PerAccount")
780 )
781 );
783 782
784 LLFile::mkdir(gDirUtilp->getLindenUserDir().c_str()); 783 // Overwrite default user settings with user settings
785 784 LLAppViewer::instance()->loadSettingsFromDirectory(LL_PATH_PER_SL_ACCOUNT);
786 // the mute list is loaded in the llmutelist class.
787
788 gSavedSettings.loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml"));
789
790 // handle the per account settings setup
791 gPerAccountSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE);
792
793 // per account settings. Set defaults here if not found. If we get a bunch of these, eventually move to a function.
794 gSavedPerAccountSettings.loadFromFile(gPerAccountSettingsFileName);
795 785
796 // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation 786 // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation
797 // and startup time is close enough if we don't have a real value. 787 // and startup time is close enough if we don't have a real value.
@@ -826,7 +816,7 @@ BOOL idle_startup()
826 gSavedSettings.setS32("ServerChoice", gGridChoice); 816 gSavedSettings.setS32("ServerChoice", gGridChoice);
827 if (gGridChoice == GRID_INFO_OTHER) 817 if (gGridChoice == GRID_INFO_OTHER)
828 { 818 {
829 snprintf(gGridName, MAX_STRING, "%s", server_label.c_str());/* Flawfinder: ignore */ 819 gGridName = server_label;/* Flawfinder: ignore */
830 } 820 }
831 821
832 if ( user_picked_server ) 822 if ( user_picked_server )
@@ -919,18 +909,15 @@ BOOL idle_startup()
919//#define LL_MINIMIAL_REQUESTED_OPTIONS 909//#define LL_MINIMIAL_REQUESTED_OPTIONS
920 gDebugInfo["GridName"] = gGridInfo[gGridChoice].mLabel; 910 gDebugInfo["GridName"] = gGridInfo[gGridChoice].mLabel;
921 911
922 lldebugs << "STATE_LOGIN_AUTH_INIT" << llendl; 912 // *Note: this is where gUserAuth used to be created.
923 if (!gUserAuthp) 913
924 {
925 gUserAuthp = new LLUserAuth();
926 }
927 requested_options.clear(); 914 requested_options.clear();
928 requested_options.push_back("inventory-root"); 915 requested_options.push_back("inventory-root");
929 requested_options.push_back("inventory-skeleton"); 916 requested_options.push_back("inventory-skeleton");
930 //requested_options.push_back("inventory-meat"); 917 //requested_options.push_back("inventory-meat");
931 //requested_options.push_back("inventory-skel-targets"); 918 //requested_options.push_back("inventory-skel-targets");
932#if (!defined LL_MINIMIAL_REQUESTED_OPTIONS) 919#if (!defined LL_MINIMIAL_REQUESTED_OPTIONS)
933 if(gRequestInventoryLibrary) 920 if(FALSE == gSavedSettings.getBOOL("NoInventoryLibrary"))
934 { 921 {
935 requested_options.push_back("inventory-lib-root"); 922 requested_options.push_back("inventory-lib-root");
936 requested_options.push_back("inventory-lib-owner"); 923 requested_options.push_back("inventory-lib-owner");
@@ -947,9 +934,10 @@ BOOL idle_startup()
947 requested_options.push_back("buddy-list"); 934 requested_options.push_back("buddy-list");
948 requested_options.push_back("ui-config"); 935 requested_options.push_back("ui-config");
949#endif 936#endif
937 requested_options.push_back("tutorial_setting");
950 requested_options.push_back("login-flags"); 938 requested_options.push_back("login-flags");
951 requested_options.push_back("global-textures"); 939 requested_options.push_back("global-textures");
952 if(gGodConnect) 940 if(gSavedSettings.getBOOL("ConnectAsGod"))
953 { 941 {
954 gSavedSettings.setBOOL("UseDebugMenus", TRUE); 942 gSavedSettings.setBOOL("UseDebugMenus", TRUE);
955 requested_options.push_back("god-connect"); 943 requested_options.push_back("god-connect");
@@ -1008,7 +996,7 @@ BOOL idle_startup()
1008 996
1009 // TODO if statement here to use web_login_key 997 // TODO if statement here to use web_login_key
1010 sAuthUriNum = llclamp(sAuthUriNum, 0, (S32)sAuthUris.size()-1); 998 sAuthUriNum = llclamp(sAuthUriNum, 0, (S32)sAuthUris.size()-1);
1011 gUserAuthp->authenticate( 999 LLUserAuth::getInstance()->authenticate(
1012 sAuthUris[sAuthUriNum].c_str(), 1000 sAuthUris[sAuthUriNum].c_str(),
1013 auth_method.c_str(), 1001 auth_method.c_str(),
1014 firstname.c_str(), 1002 firstname.c_str(),
@@ -1019,7 +1007,6 @@ BOOL idle_startup()
1019 gSkipOptionalUpdate, 1007 gSkipOptionalUpdate,
1020 gAcceptTOS, 1008 gAcceptTOS,
1021 gAcceptCriticalMessage, 1009 gAcceptCriticalMessage,
1022 gViewerDigest,
1023 gLastExecEvent, 1010 gLastExecEvent,
1024 requested_options, 1011 requested_options,
1025 hashed_mac_string, 1012 hashed_mac_string,
@@ -1039,17 +1026,13 @@ BOOL idle_startup()
1039 // in curl, so take "may appear frozen" out of progress bar. JC 1026 // in curl, so take "may appear frozen" out of progress bar. JC
1040 auth_desc = "Logging in..."; 1027 auth_desc = "Logging in...";
1041 set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); 1028 set_startup_status(progress, auth_desc.c_str(), auth_message.c_str());
1042 if (!gUserAuthp)
1043 {
1044 llerrs << "No userauth in STATE_LOGIN_NO_DATA_YET!" << llendl;
1045 }
1046 // Process messages to keep from dropping circuit. 1029 // Process messages to keep from dropping circuit.
1047 LLMessageSystem* msg = gMessageSystem; 1030 LLMessageSystem* msg = gMessageSystem;
1048 while (msg->checkAllMessages(gFrameCount, gServicePump)) 1031 while (msg->checkAllMessages(gFrameCount, gServicePump))
1049 { 1032 {
1050 } 1033 }
1051 msg->processAcks(); 1034 msg->processAcks();
1052 LLUserAuth::UserAuthcode error = gUserAuthp->authResponse(); 1035 LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse();
1053 if(LLUserAuth::E_NO_RESPONSE_YET == error) 1036 if(LLUserAuth::E_NO_RESPONSE_YET == error)
1054 { 1037 {
1055 //llinfos << "waiting..." << llendl; 1038 //llinfos << "waiting..." << llendl;
@@ -1064,17 +1047,13 @@ BOOL idle_startup()
1064 if(STATE_LOGIN_DOWNLOADING == LLStartUp::getStartupState()) 1047 if(STATE_LOGIN_DOWNLOADING == LLStartUp::getStartupState())
1065 { 1048 {
1066 lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl; 1049 lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl;
1067 if (!gUserAuthp)
1068 {
1069 llerrs << "No userauth in STATE_LOGIN_DOWNLOADING!" << llendl;
1070 }
1071 // Process messages to keep from dropping circuit. 1050 // Process messages to keep from dropping circuit.
1072 LLMessageSystem* msg = gMessageSystem; 1051 LLMessageSystem* msg = gMessageSystem;
1073 while (msg->checkAllMessages(gFrameCount, gServicePump)) 1052 while (msg->checkAllMessages(gFrameCount, gServicePump))
1074 { 1053 {
1075 } 1054 }
1076 msg->processAcks(); 1055 msg->processAcks();
1077 LLUserAuth::UserAuthcode error = gUserAuthp->authResponse(); 1056 LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse();
1078 if(LLUserAuth::E_DOWNLOADING == error) 1057 if(LLUserAuth::E_DOWNLOADING == error)
1079 { 1058 {
1080 //llinfos << "downloading..." << llendl; 1059 //llinfos << "downloading..." << llendl;
@@ -1095,14 +1074,14 @@ BOOL idle_startup()
1095 const char* reason_response = NULL; 1074 const char* reason_response = NULL;
1096 const char* message_response = NULL; 1075 const char* message_response = NULL;
1097 BOOL successful_login = FALSE; 1076 BOOL successful_login = FALSE;
1098 LLUserAuth::UserAuthcode error = gUserAuthp->authResponse(); 1077 LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse();
1099 // reset globals 1078 // reset globals
1100 gAcceptTOS = FALSE; 1079 gAcceptTOS = FALSE;
1101 gAcceptCriticalMessage = FALSE; 1080 gAcceptCriticalMessage = FALSE;
1102 switch(error) 1081 switch(error)
1103 { 1082 {
1104 case LLUserAuth::E_OK: 1083 case LLUserAuth::E_OK:
1105 login_response = gUserAuthp->getResponse("login"); 1084 login_response = LLUserAuth::getInstance()->getResponse("login");
1106 if(login_response && (0 == strcmp(login_response, "true"))) 1085 if(login_response && (0 == strcmp(login_response, "true")))
1107 { 1086 {
1108 // Yay, login! 1087 // Yay, login!
@@ -1111,10 +1090,10 @@ BOOL idle_startup()
1111 else if(login_response && (0 == strcmp(login_response, "indeterminate"))) 1090 else if(login_response && (0 == strcmp(login_response, "indeterminate")))
1112 { 1091 {
1113 llinfos << "Indeterminate login..." << llendl; 1092 llinfos << "Indeterminate login..." << llendl;
1114 sAuthUris = LLSRV::rewriteURI(gUserAuthp->getResponse("next_url")); 1093 sAuthUris = LLSRV::rewriteURI(LLUserAuth::getInstance()->getResponse("next_url"));
1115 sAuthUriNum = 0; 1094 sAuthUriNum = 0;
1116 auth_method = gUserAuthp->getResponse("next_method"); 1095 auth_method = LLUserAuth::getInstance()->getResponse("next_method");
1117 auth_message = gUserAuthp->getResponse("message"); 1096 auth_message = LLUserAuth::getInstance()->getResponse("message");
1118 if(auth_method.substr(0, 5) == "login") 1097 if(auth_method.substr(0, 5) == "login")
1119 { 1098 {
1120 auth_desc.assign("Authenticating..."); 1099 auth_desc.assign("Authenticating...");
@@ -1131,8 +1110,8 @@ BOOL idle_startup()
1131 else 1110 else
1132 { 1111 {
1133 emsg << "Login failed.\n"; 1112 emsg << "Login failed.\n";
1134 reason_response = gUserAuthp->getResponse("reason"); 1113 reason_response = LLUserAuth::getInstance()->getResponse("reason");
1135 message_response = gUserAuthp->getResponse("message"); 1114 message_response = LLUserAuth::getInstance()->getResponse("message");
1136 1115
1137 if (gHideLinks && reason_response && (0 == strcmp(reason_response, "disabled"))) 1116 if (gHideLinks && reason_response && (0 == strcmp(reason_response, "disabled")))
1138 { 1117 {
@@ -1195,7 +1174,7 @@ BOOL idle_startup()
1195 } 1174 }
1196 if(reason_response && (0 == strcmp(reason_response, "update"))) 1175 if(reason_response && (0 == strcmp(reason_response, "update")))
1197 { 1176 {
1198 auth_message = gUserAuthp->getResponse("message"); 1177 auth_message = LLUserAuth::getInstance()->getResponse("message");
1199 if (show_connect_box) 1178 if (show_connect_box)
1200 { 1179 {
1201 update_app(TRUE, auth_message); 1180 update_app(TRUE, auth_message);
@@ -1210,7 +1189,7 @@ BOOL idle_startup()
1210 if(reason_response && (0 == strcmp(reason_response, "optional"))) 1189 if(reason_response && (0 == strcmp(reason_response, "optional")))
1211 { 1190 {
1212 llinfos << "Login got optional update" << llendl; 1191 llinfos << "Login got optional update" << llendl;
1213 auth_message = gUserAuthp->getResponse("message"); 1192 auth_message = LLUserAuth::getInstance()->getResponse("message");
1214 if (show_connect_box) 1193 if (show_connect_box)
1215 { 1194 {
1216 update_app(FALSE, auth_message); 1195 update_app(FALSE, auth_message);
@@ -1230,7 +1209,7 @@ BOOL idle_startup()
1230 if (sAuthUriNum >= (int) sAuthUris.size() - 1) 1209 if (sAuthUriNum >= (int) sAuthUris.size() - 1)
1231 { 1210 {
1232 emsg << "Unable to connect to " << LLAppViewer::instance()->getSecondLifeTitle() << ".\n"; 1211 emsg << "Unable to connect to " << LLAppViewer::instance()->getSecondLifeTitle() << ".\n";
1233 emsg << gUserAuthp->errorMessage(); 1212 emsg << LLUserAuth::getInstance()->errorMessage();
1234 } else { 1213 } else {
1235 sAuthUriNum++; 1214 sAuthUriNum++;
1236 std::ostringstream s; 1215 std::ostringstream s;
@@ -1238,7 +1217,6 @@ BOOL idle_startup()
1238 << (sAuthUriNum + 1) << ". "; 1217 << (sAuthUriNum + 1) << ". ";
1239 auth_desc = s.str(); 1218 auth_desc = s.str();
1240 LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); 1219 LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE );
1241 sAuthUriNum++;
1242 return do_normal_idle; 1220 return do_normal_idle;
1243 } 1221 }
1244 break; 1222 break;
@@ -1247,33 +1225,27 @@ BOOL idle_startup()
1247 // Version update and we're not showing the dialog 1225 // Version update and we're not showing the dialog
1248 if(quit) 1226 if(quit)
1249 { 1227 {
1250 delete gUserAuthp; 1228 LLUserAuth::getInstance()->reset();
1251 gUserAuthp = NULL;
1252 LLAppViewer::instance()->forceQuit(); 1229 LLAppViewer::instance()->forceQuit();
1253 return FALSE; 1230 return FALSE;
1254 } 1231 }
1255 1232
1256 if(successful_login) 1233 if(successful_login)
1257 { 1234 {
1258 if (!gUserAuthp)
1259 {
1260 llerrs << "No userauth on successful login!" << llendl;
1261 }
1262
1263 // unpack login data needed by the application 1235 // unpack login data needed by the application
1264 const char* text; 1236 const char* text;
1265 text = gUserAuthp->getResponse("agent_id"); 1237 text = LLUserAuth::getInstance()->getResponse("agent_id");
1266 if(text) gAgentID.set(text); 1238 if(text) gAgentID.set(text);
1267 gDebugInfo["AgentID"] = text; 1239 gDebugInfo["AgentID"] = text;
1268 1240
1269 text = gUserAuthp->getResponse("session_id"); 1241 text = LLUserAuth::getInstance()->getResponse("session_id");
1270 if(text) gAgentSessionID.set(text); 1242 if(text) gAgentSessionID.set(text);
1271 gDebugInfo["SessionID"] = text; 1243 gDebugInfo["SessionID"] = text;
1272 1244
1273 text = gUserAuthp->getResponse("secure_session_id"); 1245 text = LLUserAuth::getInstance()->getResponse("secure_session_id");
1274 if(text) gAgent.mSecureSessionID.set(text); 1246 if(text) gAgent.mSecureSessionID.set(text);
1275 1247
1276 text = gUserAuthp->getResponse("first_name"); 1248 text = LLUserAuth::getInstance()->getResponse("first_name");
1277 if(text) 1249 if(text)
1278 { 1250 {
1279 // Remove quotes from string. Login.cgi sends these to force 1251 // Remove quotes from string. Login.cgi sends these to force
@@ -1282,7 +1254,7 @@ BOOL idle_startup()
1282 LLString::replaceChar(firstname, '"', ' '); 1254 LLString::replaceChar(firstname, '"', ' ');
1283 LLString::trim(firstname); 1255 LLString::trim(firstname);
1284 } 1256 }
1285 text = gUserAuthp->getResponse("last_name"); 1257 text = LLUserAuth::getInstance()->getResponse("last_name");
1286 if(text) lastname.assign(text); 1258 if(text) lastname.assign(text);
1287 gSavedSettings.setString("FirstName", firstname); 1259 gSavedSettings.setString("FirstName", firstname);
1288 gSavedSettings.setString("LastName", lastname); 1260 gSavedSettings.setString("LastName", lastname);
@@ -1298,7 +1270,7 @@ BOOL idle_startup()
1298 gSavedSettings.setBOOL("RememberPassword", remember_password); 1270 gSavedSettings.setBOOL("RememberPassword", remember_password);
1299 gSavedSettings.setBOOL("LoginLastLocation", gSavedSettings.getBOOL("LoginLastLocation")); 1271 gSavedSettings.setBOOL("LoginLastLocation", gSavedSettings.getBOOL("LoginLastLocation"));
1300 1272
1301 text = gUserAuthp->getResponse("agent_access"); 1273 text = LLUserAuth::getInstance()->getResponse("agent_access");
1302 if(text && (text[0] == 'M')) 1274 if(text && (text[0] == 'M'))
1303 { 1275 {
1304 gAgent.setTeen(false); 1276 gAgent.setTeen(false);
@@ -1308,15 +1280,15 @@ BOOL idle_startup()
1308 gAgent.setTeen(true); 1280 gAgent.setTeen(true);
1309 } 1281 }
1310 1282
1311 text = gUserAuthp->getResponse("start_location"); 1283 text = LLUserAuth::getInstance()->getResponse("start_location");
1312 if(text) agent_start_location.assign(text); 1284 if(text) agent_start_location.assign(text);
1313 text = gUserAuthp->getResponse("circuit_code"); 1285 text = LLUserAuth::getInstance()->getResponse("circuit_code");
1314 if(text) 1286 if(text)
1315 { 1287 {
1316 gMessageSystem->mOurCircuitCode = strtoul(text, NULL, 10); 1288 gMessageSystem->mOurCircuitCode = strtoul(text, NULL, 10);
1317 } 1289 }
1318 const char* sim_ip_str = gUserAuthp->getResponse("sim_ip"); 1290 const char* sim_ip_str = LLUserAuth::getInstance()->getResponse("sim_ip");
1319 const char* sim_port_str = gUserAuthp->getResponse("sim_port"); 1291 const char* sim_port_str = LLUserAuth::getInstance()->getResponse("sim_port");
1320 if(sim_ip_str && sim_port_str) 1292 if(sim_ip_str && sim_port_str)
1321 { 1293 {
1322 U32 sim_port = strtoul(sim_port_str, NULL, 10); 1294 U32 sim_port = strtoul(sim_port_str, NULL, 10);
@@ -1326,8 +1298,8 @@ BOOL idle_startup()
1326 gMessageSystem->enableCircuit(first_sim, TRUE); 1298 gMessageSystem->enableCircuit(first_sim, TRUE);
1327 } 1299 }
1328 } 1300 }
1329 const char* region_x_str = gUserAuthp->getResponse("region_x"); 1301 const char* region_x_str = LLUserAuth::getInstance()->getResponse("region_x");
1330 const char* region_y_str = gUserAuthp->getResponse("region_y"); 1302 const char* region_y_str = LLUserAuth::getInstance()->getResponse("region_y");
1331 if(region_x_str && region_y_str) 1303 if(region_x_str && region_y_str)
1332 { 1304 {
1333 U32 region_x = strtoul(region_x_str, NULL, 10); 1305 U32 region_x = strtoul(region_x_str, NULL, 10);
@@ -1335,7 +1307,7 @@ BOOL idle_startup()
1335 first_sim_handle = to_region_handle(region_x, region_y); 1307 first_sim_handle = to_region_handle(region_x, region_y);
1336 } 1308 }
1337 1309
1338 const char* look_at_str = gUserAuthp->getResponse("look_at"); 1310 const char* look_at_str = LLUserAuth::getInstance()->getResponse("look_at");
1339 if (look_at_str) 1311 if (look_at_str)
1340 { 1312 {
1341#if !LL_WINDOWS && !LL_DARWIN 1313#if !LL_WINDOWS && !LL_DARWIN
@@ -1348,10 +1320,10 @@ BOOL idle_startup()
1348 agent_start_look_at = ll_vector3_from_sd(sd); 1320 agent_start_look_at = ll_vector3_from_sd(sd);
1349 } 1321 }
1350 1322
1351 text = gUserAuthp->getResponse("seed_capability"); 1323 text = LLUserAuth::getInstance()->getResponse("seed_capability");
1352 if (text) first_sim_seed_cap = text; 1324 if (text) first_sim_seed_cap = text;
1353 1325
1354 text = gUserAuthp->getResponse("seconds_since_epoch"); 1326 text = LLUserAuth::getInstance()->getResponse("seconds_since_epoch");
1355 if(text) 1327 if(text)
1356 { 1328 {
1357 U32 server_utc_time = strtoul(text, NULL, 10); 1329 U32 server_utc_time = strtoul(text, NULL, 10);
@@ -1362,7 +1334,7 @@ BOOL idle_startup()
1362 } 1334 }
1363 } 1335 }
1364 1336
1365 const char* home_location = gUserAuthp->getResponse("home"); 1337 const char* home_location = LLUserAuth::getInstance()->getResponse("home");
1366 if(home_location) 1338 if(home_location)
1367 { 1339 {
1368#if !LL_WINDOWS && !LL_DARWIN 1340#if !LL_WINDOWS && !LL_DARWIN
@@ -1379,9 +1351,9 @@ BOOL idle_startup()
1379 gAgent.setHomePosRegion(region_handle, position); 1351 gAgent.setHomePosRegion(region_handle, position);
1380 } 1352 }
1381 1353
1382 gAgent.mMOTD.assign(gUserAuthp->getResponse("message")); 1354 gAgent.mMOTD.assign(LLUserAuth::getInstance()->getResponse("message"));
1383 LLUserAuth::options_t options; 1355 LLUserAuth::options_t options;
1384 if(gUserAuthp->getOptions("inventory-root", options)) 1356 if(LLUserAuth::getInstance()->getOptions("inventory-root", options))
1385 { 1357 {
1386 LLUserAuth::response_t::iterator it; 1358 LLUserAuth::response_t::iterator it;
1387 it = options[0].find("folder_id"); 1359 it = options[0].find("folder_id");
@@ -1393,7 +1365,7 @@ BOOL idle_startup()
1393 } 1365 }
1394 1366
1395 options.clear(); 1367 options.clear();
1396 if(gUserAuthp->getOptions("login-flags", options)) 1368 if(LLUserAuth::getInstance()->getOptions("login-flags", options))
1397 { 1369 {
1398 LLUserAuth::response_t::iterator it; 1370 LLUserAuth::response_t::iterator it;
1399 LLUserAuth::response_t::iterator no_flag = options[0].end(); 1371 LLUserAuth::response_t::iterator no_flag = options[0].end();
@@ -1421,7 +1393,7 @@ BOOL idle_startup()
1421 } 1393 }
1422 } 1394 }
1423 options.clear(); 1395 options.clear();
1424 if (gUserAuthp->getOptions("initial-outfit", options) 1396 if (LLUserAuth::getInstance()->getOptions("initial-outfit", options)
1425 && !options.empty()) 1397 && !options.empty())
1426 { 1398 {
1427 LLUserAuth::response_t::iterator it; 1399 LLUserAuth::response_t::iterator it;
@@ -1439,7 +1411,7 @@ BOOL idle_startup()
1439 } 1411 }
1440 1412
1441 options.clear(); 1413 options.clear();
1442 if(gUserAuthp->getOptions("global-textures", options)) 1414 if(LLUserAuth::getInstance()->getOptions("global-textures", options))
1443 { 1415 {
1444 // Extract sun and moon texture IDs. These are used 1416 // Extract sun and moon texture IDs. These are used
1445 // in the LLVOSky constructor, but I can't figure out 1417 // in the LLVOSky constructor, but I can't figure out
@@ -1488,7 +1460,7 @@ BOOL idle_startup()
1488 args["[ERROR_MESSAGE]"] = emsg.str(); 1460 args["[ERROR_MESSAGE]"] = emsg.str();
1489 gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); 1461 gViewerWindow->alertXml("ErrorMessage", args, login_alert_done);
1490 reset_login(); 1462 reset_login();
1491 gAutoLogin = FALSE; 1463 gSavedSettings.setBOOL("AutoLogin", FALSE);
1492 show_connect_box = TRUE; 1464 show_connect_box = TRUE;
1493 } 1465 }
1494 1466
@@ -1508,7 +1480,7 @@ BOOL idle_startup()
1508 args["[ERROR_MESSAGE]"] = emsg.str(); 1480 args["[ERROR_MESSAGE]"] = emsg.str();
1509 gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); 1481 gViewerWindow->alertXml("ErrorMessage", args, login_alert_done);
1510 reset_login(); 1482 reset_login();
1511 gAutoLogin = FALSE; 1483 gSavedSettings.setBOOL("AutoLogin", FALSE);
1512 show_connect_box = TRUE; 1484 show_connect_box = TRUE;
1513 // Don't save an incorrect password to disk. 1485 // Don't save an incorrect password to disk.
1514 save_password_to_disk(NULL); 1486 save_password_to_disk(NULL);
@@ -1532,7 +1504,7 @@ BOOL idle_startup()
1532 1504
1533 // Since we connected, save off the settings so the user doesn't have to 1505 // Since we connected, save off the settings so the user doesn't have to
1534 // type the name/password again if we crash. 1506 // type the name/password again if we crash.
1535 gSavedSettings.saveToFile(gSettingsFileName, TRUE); 1507 gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
1536 1508
1537 // 1509 //
1538 // Initialize classes w/graphics stuff. 1510 // Initialize classes w/graphics stuff.
@@ -1554,11 +1526,11 @@ BOOL idle_startup()
1554 1526
1555 display_startup(); 1527 display_startup();
1556 1528
1529 // This is where we used to initialize gWorldp. Original comment said:
1557 // World initialization must be done after above window init 1530 // World initialization must be done after above window init
1558 gWorldp = new LLWorld(region_size, region_scale);
1559 1531
1560 // User might have overridden far clip 1532 // User might have overridden far clip
1561 gWorldp->setLandFarClip( gAgent.mDrawDistance ); 1533 LLWorld::getInstance()->setLandFarClip( gAgent.mDrawDistance );
1562 1534
1563 // Before we create the first region, we need to set the agent's mOriginGlobal 1535 // Before we create the first region, we need to set the agent's mOriginGlobal
1564 // This is necessary because creating objects before this is set will result in a 1536 // This is necessary because creating objects before this is set will result in a
@@ -1566,9 +1538,9 @@ BOOL idle_startup()
1566 1538
1567 gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); 1539 gAgent.initOriginGlobal(from_region_handle(first_sim_handle));
1568 1540
1569 gWorldp->addRegion(first_sim_handle, first_sim); 1541 LLWorld::getInstance()->addRegion(first_sim_handle, first_sim);
1570 1542
1571 LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); 1543 LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(first_sim_handle);
1572 llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; 1544 llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl;
1573 1545
1574 LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); 1546 LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
@@ -1604,7 +1576,7 @@ BOOL idle_startup()
1604 { 1576 {
1605 update_texture_fetch(); 1577 update_texture_fetch();
1606 1578
1607 if ( gViewerWindow != NULL && gToolMgr != NULL ) 1579 if ( gViewerWindow != NULL)
1608 { // This isn't the first logon attempt, so show the UI 1580 { // This isn't the first logon attempt, so show the UI
1609 gViewerWindow->setNormalControlsVisible( TRUE ); 1581 gViewerWindow->setNormalControlsVisible( TRUE );
1610 } 1582 }
@@ -1615,11 +1587,16 @@ BOOL idle_startup()
1615 1587
1616 if (gSavedSettings.getBOOL("ShowCameraControls")) 1588 if (gSavedSettings.getBOOL("ShowCameraControls"))
1617 { 1589 {
1618 LLFloaterCamera::show(NULL); 1590 LLFloaterCamera::showInstance();
1619 } 1591 }
1620 if (gSavedSettings.getBOOL("ShowMovementControls")) 1592 if (gSavedSettings.getBOOL("ShowMovementControls"))
1621 { 1593 {
1622 LLFloaterMove::show(NULL); 1594 LLFloaterMove::showInstance();
1595 }
1596
1597 if (gSavedSettings.getBOOL("ShowActiveSpeakers"))
1598 {
1599 LLFloaterActiveSpeakers::showInstance();
1623 } 1600 }
1624 1601
1625 if (!gNoRender) 1602 if (!gNoRender)
@@ -1630,7 +1607,7 @@ BOOL idle_startup()
1630 LLError::logToFixedBuffer(gDebugView->mDebugConsolep); 1607 LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
1631 // set initial visibility of debug console 1608 // set initial visibility of debug console
1632 gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole")); 1609 gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
1633 gDebugView->mStatViewp->setVisible(gSavedSettings.getBOOL("ShowDebugStats")); 1610 gDebugView->mFloaterStatsp->setVisible(gSavedSettings.getBOOL("ShowDebugStats"));
1634 } 1611 }
1635 1612
1636 // 1613 //
@@ -1660,18 +1637,14 @@ BOOL idle_startup()
1660 LLAppViewer::instance()->loadNameCache(); 1637 LLAppViewer::instance()->loadNameCache();
1661 } 1638 }
1662 1639
1663 // Data storage for map of world. 1640 // *Note: this is where gWorldMap used to be initialized.
1664 if ( gWorldMap == NULL )
1665 {
1666 gWorldMap = new LLWorldMap();
1667 }
1668 1641
1669 // register null callbacks for audio until the audio system is initialized 1642 // register null callbacks for audio until the audio system is initialized
1670 gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL); 1643 gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL);
1671 gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL); 1644 gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL);
1672 1645
1673 //reset statistics 1646 //reset statistics
1674 gViewerStats->resetStats(); 1647 LLViewerStats::getInstance()->resetStats();
1675 1648
1676 if (!gNoRender) 1649 if (!gNoRender)
1677 { 1650 {
@@ -1701,14 +1674,14 @@ BOOL idle_startup()
1701 } 1674 }
1702 1675
1703 // Make sure agent knows correct aspect ratio 1676 // Make sure agent knows correct aspect ratio
1704 gCamera->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight()); 1677 LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight());
1705 if (gViewerWindow->mWindow->getFullscreen()) 1678 if (gViewerWindow->mWindow->getFullscreen())
1706 { 1679 {
1707 gCamera->setAspect(gViewerWindow->getDisplayAspectRatio()); 1680 LLViewerCamera::getInstance()->setAspect(gViewerWindow->getDisplayAspectRatio());
1708 } 1681 }
1709 else 1682 else
1710 { 1683 {
1711 gCamera->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight()); 1684 LLViewerCamera::getInstance()->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight());
1712 } 1685 }
1713 1686
1714 // Move agent to starting location. The position handed to us by 1687 // Move agent to starting location. The position handed to us by
@@ -1821,10 +1794,10 @@ BOOL idle_startup()
1821 // But not on first login, because you can't see your avatar then 1794 // But not on first login, because you can't see your avatar then
1822 if (!gAgent.isFirstLogin()) 1795 if (!gAgent.isFirstLogin())
1823 { 1796 {
1824 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); 1797 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
1825 effectp->setPositionGlobal(gAgent.getPositionGlobal()); 1798 effectp->setPositionGlobal(gAgent.getPositionGlobal());
1826 effectp->setColor(LLColor4U(gAgent.getEffectColor())); 1799 effectp->setColor(LLColor4U(gAgent.getEffectColor()));
1827 gHUDManager->sendEffects(); 1800 LLHUDManager::getInstance()->sendEffects();
1828 } 1801 }
1829 1802
1830 LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT 1803 LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT
@@ -1870,17 +1843,12 @@ BOOL idle_startup()
1870 //--------------------------------------------------------------------- 1843 //---------------------------------------------------------------------
1871 if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) 1844 if (STATE_INVENTORY_SEND == LLStartUp::getStartupState())
1872 { 1845 {
1873 if (!gUserAuthp)
1874 {
1875 llerrs << "No userauth in STATE_INVENTORY_SEND!" << llendl;
1876 }
1877
1878 // unpack thin inventory 1846 // unpack thin inventory
1879 LLUserAuth::options_t options; 1847 LLUserAuth::options_t options;
1880 options.clear(); 1848 options.clear();
1881 //bool dump_buffer = false; 1849 //bool dump_buffer = false;
1882 1850
1883 if(gUserAuthp->getOptions("inventory-lib-root", options) 1851 if(LLUserAuth::getInstance()->getOptions("inventory-lib-root", options)
1884 && !options.empty()) 1852 && !options.empty())
1885 { 1853 {
1886 // should only be one 1854 // should only be one
@@ -1892,7 +1860,7 @@ BOOL idle_startup()
1892 } 1860 }
1893 } 1861 }
1894 options.clear(); 1862 options.clear();
1895 if(gUserAuthp->getOptions("inventory-lib-owner", options) 1863 if(LLUserAuth::getInstance()->getOptions("inventory-lib-owner", options)
1896 && !options.empty()) 1864 && !options.empty())
1897 { 1865 {
1898 // should only be one 1866 // should only be one
@@ -1904,7 +1872,7 @@ BOOL idle_startup()
1904 } 1872 }
1905 } 1873 }
1906 options.clear(); 1874 options.clear();
1907 if(gUserAuthp->getOptions("inventory-skel-lib", options) 1875 if(LLUserAuth::getInstance()->getOptions("inventory-skel-lib", options)
1908 && gInventoryLibraryOwner.notNull()) 1876 && gInventoryLibraryOwner.notNull())
1909 { 1877 {
1910 if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner)) 1878 if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner))
@@ -1913,7 +1881,7 @@ BOOL idle_startup()
1913 } 1881 }
1914 } 1882 }
1915 options.clear(); 1883 options.clear();
1916 if(gUserAuthp->getOptions("inventory-skeleton", options)) 1884 if(LLUserAuth::getInstance()->getOptions("inventory-skeleton", options))
1917 { 1885 {
1918 if(!gInventory.loadSkeleton(options, gAgent.getID())) 1886 if(!gInventory.loadSkeleton(options, gAgent.getID()))
1919 { 1887 {
@@ -1923,7 +1891,7 @@ BOOL idle_startup()
1923 } 1891 }
1924 1892
1925 options.clear(); 1893 options.clear();
1926 if(gUserAuthp->getOptions("buddy-list", options)) 1894 if(LLUserAuth::getInstance()->getOptions("buddy-list", options))
1927 { 1895 {
1928 LLUserAuth::options_t::iterator it = options.begin(); 1896 LLUserAuth::options_t::iterator it = options.begin();
1929 LLUserAuth::options_t::iterator end = options.end(); 1897 LLUserAuth::options_t::iterator end = options.end();
@@ -1954,7 +1922,7 @@ BOOL idle_startup()
1954 } 1922 }
1955 1923
1956 options.clear(); 1924 options.clear();
1957 if(gUserAuthp->getOptions("ui-config", options)) 1925 if(LLUserAuth::getInstance()->getOptions("ui-config", options))
1958 { 1926 {
1959 LLUserAuth::options_t::iterator it = options.begin(); 1927 LLUserAuth::options_t::iterator it = options.begin();
1960 LLUserAuth::options_t::iterator end = options.end(); 1928 LLUserAuth::options_t::iterator end = options.end();
@@ -1971,18 +1939,41 @@ BOOL idle_startup()
1971 } 1939 }
1972 } 1940 }
1973 } 1941 }
1942 options.clear();
1943 if(LLUserAuth::getInstance()->getOptions("tutorial_setting", options))
1944 {
1945 LLUserAuth::options_t::iterator it = options.begin();
1946 LLUserAuth::options_t::iterator end = options.end();
1947 for (; it != end; ++it)
1948 {
1949 LLUserAuth::response_t::const_iterator option_it;
1950 option_it = (*it).find("tutorial_url");
1951 if(option_it != (*it).end())
1952 {
1953 LLFloaterHUD::sTutorialUrl = option_it->second;
1954 }
1955 option_it = (*it).find("use_tutorial");
1956 if(option_it != (*it).end())
1957 {
1958 if (option_it->second == "true")
1959 {
1960 LLFloaterHUD::show();
1961 }
1962 }
1963 }
1964 }
1974 1965
1975 options.clear(); 1966 options.clear();
1976 if(gUserAuthp->getOptions("event_categories", options)) 1967 if(LLUserAuth::getInstance()->getOptions("event_categories", options))
1977 { 1968 {
1978 LLEventInfo::loadCategories(options); 1969 LLEventInfo::loadCategories(options);
1979 } 1970 }
1980 if(gUserAuthp->getOptions("event_notifications", options)) 1971 if(LLUserAuth::getInstance()->getOptions("event_notifications", options))
1981 { 1972 {
1982 gEventNotifier.load(options); 1973 gEventNotifier.load(options);
1983 } 1974 }
1984 options.clear(); 1975 options.clear();
1985 if(gUserAuthp->getOptions("classified_categories", options)) 1976 if(LLUserAuth::getInstance()->getOptions("classified_categories", options))
1986 { 1977 {
1987 LLClassifiedInfo::loadCategories(options); 1978 LLClassifiedInfo::loadCategories(options);
1988 } 1979 }
@@ -1997,7 +1988,7 @@ BOOL idle_startup()
1997 LLLandmark::registerCallbacks(msg); 1988 LLLandmark::registerCallbacks(msg);
1998 1989
1999 // request mute list 1990 // request mute list
2000 gMuteListp->requestFromServer(gAgent.getID()); 1991 LLMuteList::getInstance()->requestFromServer(gAgent.getID());
2001 1992
2002 // Get L$ and ownership credit information 1993 // Get L$ and ownership credit information
2003 msg->newMessageFast(_PREHASH_MoneyBalanceRequest); 1994 msg->newMessageFast(_PREHASH_MoneyBalanceRequest);
@@ -2035,13 +2026,12 @@ BOOL idle_startup()
2035 // We have a region, and just did a big inventory download. 2026 // We have a region, and just did a big inventory download.
2036 // We can estimate the user's connection speed, and set their 2027 // We can estimate the user's connection speed, and set their
2037 // max bandwidth accordingly. JC 2028 // max bandwidth accordingly. JC
2038 if (gSavedSettings.getBOOL("FirstLoginThisInstall") 2029 if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
2039 && gUserAuthp)
2040 { 2030 {
2041 // This is actually a pessimistic computation, because TCP may not have enough 2031 // This is actually a pessimistic computation, because TCP may not have enough
2042 // time to ramp up on the (small) default inventory file to truly measure max 2032 // time to ramp up on the (small) default inventory file to truly measure max
2043 // bandwidth. JC 2033 // bandwidth. JC
2044 F64 rate_bps = gUserAuthp->getLastTransferRateBPS(); 2034 F64 rate_bps = LLUserAuth::getInstance()->getLastTransferRateBPS();
2045 const F32 FAST_RATE_BPS = 600.f * 1024.f; 2035 const F32 FAST_RATE_BPS = 600.f * 1024.f;
2046 const F32 FASTER_RATE_BPS = 750.f * 1024.f; 2036 const F32 FASTER_RATE_BPS = 750.f * 1024.f;
2047 F32 max_bandwidth = gViewerThrottle.getMaxBandwidth(); 2037 F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
@@ -2076,7 +2066,7 @@ BOOL idle_startup()
2076 gSavedSettings.setString( "NextLoginLocation", "" ); 2066 gSavedSettings.setString( "NextLoginLocation", "" );
2077 2067
2078 // and make sure it's saved 2068 // and make sure it's saved
2079 gSavedSettings.saveToFile( gSettingsFileName, TRUE ); 2069 gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
2080 }; 2070 };
2081 2071
2082 if (!gNoRender) 2072 if (!gNoRender)
@@ -2088,7 +2078,7 @@ BOOL idle_startup()
2088 // many gesture downloads, if this is the user's first 2078 // many gesture downloads, if this is the user's first
2089 // time on this machine or -purge has been run. 2079 // time on this machine or -purge has been run.
2090 LLUserAuth::options_t gesture_options; 2080 LLUserAuth::options_t gesture_options;
2091 if (gUserAuthp->getOptions("gestures", gesture_options)) 2081 if (LLUserAuth::getInstance()->getOptions("gestures", gesture_options))
2092 { 2082 {
2093 llinfos << "Gesture Manager loading " << gesture_options.size() 2083 llinfos << "Gesture Manager loading " << gesture_options.size()
2094 << llendl; 2084 << llendl;
@@ -2228,8 +2218,9 @@ BOOL idle_startup()
2228 else 2218 else
2229 { 2219 {
2230 update_texture_fetch(); 2220 update_texture_fetch();
2231 set_startup_status(0.60f + 0.40f * timeout_frac, "Precaching...", 2221 set_startup_status(0.60f + 0.40f * timeout_frac,
2232 gAgent.mMOTD.c_str()); 2222 "Loading world...",
2223 gAgent.mMOTD.c_str());
2233 } 2224 }
2234 2225
2235 return do_normal_idle; 2226 return do_normal_idle;
@@ -2251,7 +2242,7 @@ BOOL idle_startup()
2251 else if (wearables_time > MAX_WEARABLES_TIME) 2242 else if (wearables_time > MAX_WEARABLES_TIME)
2252 { 2243 {
2253 gViewerWindow->alertXml("ClothingLoading"); 2244 gViewerWindow->alertXml("ClothingLoading");
2254 gViewerStats->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); 2245 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG);
2255 LLStartUp::setStartupState( STATE_CLEANUP ); 2246 LLStartUp::setStartupState( STATE_CLEANUP );
2256 } 2247 }
2257 else 2248 else
@@ -2298,9 +2289,6 @@ BOOL idle_startup()
2298 // On first start, ask user for gender 2289 // On first start, ask user for gender
2299 dialog_choose_gender_first_start(); 2290 dialog_choose_gender_first_start();
2300 2291
2301 // setup voice
2302 LLFirstUse::useVoice();
2303
2304 // Start automatic replay if the flag is set. 2292 // Start automatic replay if the flag is set.
2305 if (gSavedSettings.getBOOL("StatsAutoRun")) 2293 if (gSavedSettings.getBOOL("StatsAutoRun"))
2306 { 2294 {
@@ -2311,13 +2299,9 @@ BOOL idle_startup()
2311 2299
2312 // If we've got a startup URL, dispatch it 2300 // If we've got a startup URL, dispatch it
2313 LLStartUp::dispatchURL(); 2301 LLStartUp::dispatchURL();
2314 2302
2315 // Clean up the userauth stuff. 2303 // Clean up the userauth stuff.
2316 if (gUserAuthp) 2304 LLUserAuth::getInstance()->reset();
2317 {
2318 delete gUserAuthp;
2319 gUserAuthp = NULL;
2320 }
2321 2305
2322 LLStartUp::setStartupState( STATE_STARTED ); 2306 LLStartUp::setStartupState( STATE_STARTED );
2323 2307
@@ -2367,7 +2351,7 @@ void login_show()
2367 2351
2368 if( GRID_INFO_OTHER == gGridChoice ) 2352 if( GRID_INFO_OTHER == gGridChoice )
2369 { 2353 {
2370 LLPanelLogin::addServer( gGridName, GRID_INFO_OTHER ); 2354 LLPanelLogin::addServer( gGridName.c_str(), GRID_INFO_OTHER );
2371 } 2355 }
2372 else 2356 else
2373 { 2357 {
@@ -2415,7 +2399,7 @@ void login_callback(S32 option, void *userdata)
2415 { 2399 {
2416 // turn off the setting and write out to disk 2400 // turn off the setting and write out to disk
2417 gSavedSettings.setBOOL("RememberPassword", FALSE); 2401 gSavedSettings.setBOOL("RememberPassword", FALSE);
2418 gSavedSettings.saveToFile(gSettingsFileName, TRUE); 2402 gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
2419 2403
2420 // stomp the saved password on disk 2404 // stomp the saved password on disk
2421 save_password_to_disk(NULL); 2405 save_password_to_disk(NULL);
@@ -2609,7 +2593,7 @@ void login_alert_status(S32 option, void* user_data)
2609void update_app(BOOL mandatory, const std::string& auth_msg) 2593void update_app(BOOL mandatory, const std::string& auth_msg)
2610{ 2594{
2611 // store off config state, as we might quit soon 2595 // store off config state, as we might quit soon
2612 gSavedSettings.saveToFile(gSettingsFileName, TRUE); 2596 gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
2613 2597
2614 std::ostringstream message; 2598 std::ostringstream message;
2615 2599
@@ -2709,7 +2693,7 @@ void update_dialog_callback(S32 option, void *userdata)
2709 // *TODO change userserver to be grid on both viewer and sim, since 2693 // *TODO change userserver to be grid on both viewer and sim, since
2710 // userserver no longer exists. 2694 // userserver no longer exists.
2711 query_map["userserver"] = gGridName; 2695 query_map["userserver"] = gGridName;
2712 query_map["channel"] = gChannelName; 2696 query_map["channel"] = gSavedSettings.getString("VersionChannelName");
2713 // *TODO constantize this guy 2697 // *TODO constantize this guy
2714 LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map); 2698 LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map);
2715 2699
@@ -3037,7 +3021,7 @@ void init_stat_view()
3037 3021
3038 LLRect rect; 3022 LLRect rect;
3039 LLStatBar *stat_barp; 3023 LLStatBar *stat_barp;
3040 rect = gDebugView->mStatViewp->getRect(); 3024 rect = gDebugView->mFloaterStatsp->getRect();
3041 3025
3042 // 3026 //
3043 // Viewer advanced stats 3027 // Viewer advanced stats
@@ -3048,9 +3032,9 @@ void init_stat_view()
3048 // Viewer Basic 3032 // Viewer Basic
3049 // 3033 //
3050 stat_viewp = new LLStatView("basic stat view", "Basic", "OpenDebugStatBasic", rect); 3034 stat_viewp = new LLStatView("basic stat view", "Basic", "OpenDebugStatBasic", rect);
3051 gDebugView->mStatViewp->addChildAtEnd(stat_viewp); 3035 gDebugView->mFloaterStatsp->addStatView(stat_viewp);
3052 3036
3053 stat_barp = stat_viewp->addStat("FPS", &(gViewerStats->mFPSStat)); 3037 stat_barp = stat_viewp->addStat("FPS", &(LLViewerStats::getInstance()->mFPSStat));
3054 stat_barp->setUnitLabel(" fps"); 3038 stat_barp->setUnitLabel(" fps");
3055 stat_barp->mMinBar = 0.f; 3039 stat_barp->mMinBar = 0.f;
3056 stat_barp->mMaxBar = 45.f; 3040 stat_barp->mMaxBar = 45.f;
@@ -3060,7 +3044,7 @@ void init_stat_view()
3060 stat_barp->mDisplayBar = TRUE; 3044 stat_barp->mDisplayBar = TRUE;
3061 stat_barp->mDisplayHistory = TRUE; 3045 stat_barp->mDisplayHistory = TRUE;
3062 3046
3063 stat_barp = stat_viewp->addStat("Bandwidth", &(gViewerStats->mKBitStat)); 3047 stat_barp = stat_viewp->addStat("Bandwidth", &(LLViewerStats::getInstance()->mKBitStat));
3064 stat_barp->setUnitLabel(" kbps"); 3048 stat_barp->setUnitLabel(" kbps");
3065 stat_barp->mMinBar = 0.f; 3049 stat_barp->mMinBar = 0.f;
3066 stat_barp->mMaxBar = 900.f; 3050 stat_barp->mMaxBar = 900.f;
@@ -3069,7 +3053,7 @@ void init_stat_view()
3069 stat_barp->mDisplayBar = TRUE; 3053 stat_barp->mDisplayBar = TRUE;
3070 stat_barp->mDisplayHistory = FALSE; 3054 stat_barp->mDisplayHistory = FALSE;
3071 3055
3072 stat_barp = stat_viewp->addStat("Packet Loss", &(gViewerStats->mPacketsLostPercentStat)); 3056 stat_barp = stat_viewp->addStat("Packet Loss", &(LLViewerStats::getInstance()->mPacketsLostPercentStat));
3073 stat_barp->setUnitLabel(" %"); 3057 stat_barp->setUnitLabel(" %");
3074 stat_barp->mMinBar = 0.f; 3058 stat_barp->mMinBar = 0.f;
3075 stat_barp->mMaxBar = 5.f; 3059 stat_barp->mMaxBar = 5.f;
@@ -3080,7 +3064,7 @@ void init_stat_view()
3080 stat_barp->mDisplayMean = TRUE; 3064 stat_barp->mDisplayMean = TRUE;
3081 stat_barp->mPrecision = 1; 3065 stat_barp->mPrecision = 1;
3082 3066
3083 stat_barp = stat_viewp->addStat("Ping Sim", &(gViewerStats->mSimPingStat)); 3067 stat_barp = stat_viewp->addStat("Ping Sim", &(LLViewerStats::getInstance()->mSimPingStat));
3084 stat_barp->setUnitLabel(" msec"); 3068 stat_barp->setUnitLabel(" msec");
3085 stat_barp->mMinBar = 0.f; 3069 stat_barp->mMinBar = 0.f;
3086 stat_barp->mMaxBar = 1000.f; 3070 stat_barp->mMaxBar = 1000.f;
@@ -3092,7 +3076,7 @@ void init_stat_view()
3092 3076
3093 3077
3094 stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect); 3078 stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect);
3095 gDebugView->mStatViewp->addChildAtEnd(stat_viewp); 3079 gDebugView->mFloaterStatsp->addStatView(stat_viewp);
3096 3080
3097 3081
3098 LLStatView *render_statviewp; 3082 LLStatView *render_statviewp;
@@ -3200,31 +3184,31 @@ void init_stat_view()
3200 net_statviewp = new LLStatView("network stat view", "Network", "OpenDebugStatNet", rect); 3184 net_statviewp = new LLStatView("network stat view", "Network", "OpenDebugStatNet", rect);
3201 stat_viewp->addChildAtEnd(net_statviewp); 3185 stat_viewp->addChildAtEnd(net_statviewp);
3202 3186
3203 stat_barp = net_statviewp->addStat("Packets In", &(gViewerStats->mPacketsInStat)); 3187 stat_barp = net_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mPacketsInStat));
3204 stat_barp->setUnitLabel("/sec"); 3188 stat_barp->setUnitLabel("/sec");
3205 stat_barp->mDisplayBar = FALSE; 3189 stat_barp->mDisplayBar = FALSE;
3206 3190
3207 stat_barp = net_statviewp->addStat("Packets Out", &(gViewerStats->mPacketsOutStat)); 3191 stat_barp = net_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mPacketsOutStat));
3208 stat_barp->setUnitLabel("/sec"); 3192 stat_barp->setUnitLabel("/sec");
3209 stat_barp->mDisplayBar = FALSE; 3193 stat_barp->mDisplayBar = FALSE;
3210 3194
3211 stat_barp = net_statviewp->addStat("Objects", &(gViewerStats->mObjectKBitStat)); 3195 stat_barp = net_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mObjectKBitStat));
3212 stat_barp->setUnitLabel(" kbps"); 3196 stat_barp->setUnitLabel(" kbps");
3213 stat_barp->mDisplayBar = FALSE; 3197 stat_barp->mDisplayBar = FALSE;
3214 3198
3215 stat_barp = net_statviewp->addStat("Texture", &(gViewerStats->mTextureKBitStat)); 3199 stat_barp = net_statviewp->addStat("Texture", &(LLViewerStats::getInstance()->mTextureKBitStat));
3216 stat_barp->setUnitLabel(" kbps"); 3200 stat_barp->setUnitLabel(" kbps");
3217 stat_barp->mDisplayBar = FALSE; 3201 stat_barp->mDisplayBar = FALSE;
3218 3202
3219 stat_barp = net_statviewp->addStat("Asset", &(gViewerStats->mAssetKBitStat)); 3203 stat_barp = net_statviewp->addStat("Asset", &(LLViewerStats::getInstance()->mAssetKBitStat));
3220 stat_barp->setUnitLabel(" kbps"); 3204 stat_barp->setUnitLabel(" kbps");
3221 stat_barp->mDisplayBar = FALSE; 3205 stat_barp->mDisplayBar = FALSE;
3222 3206
3223 stat_barp = net_statviewp->addStat("Layers", &(gViewerStats->mLayersKBitStat)); 3207 stat_barp = net_statviewp->addStat("Layers", &(LLViewerStats::getInstance()->mLayersKBitStat));
3224 stat_barp->setUnitLabel(" kbps"); 3208 stat_barp->setUnitLabel(" kbps");
3225 stat_barp->mDisplayBar = FALSE; 3209 stat_barp->mDisplayBar = FALSE;
3226 3210
3227 stat_barp = net_statviewp->addStat("Actual In", &(gViewerStats->mActualInKBitStat)); 3211 stat_barp = net_statviewp->addStat("Actual In", &(LLViewerStats::getInstance()->mActualInKBitStat));
3228 stat_barp->setUnitLabel(" kbps"); 3212 stat_barp->setUnitLabel(" kbps");
3229 stat_barp->mMinBar = 0.f; 3213 stat_barp->mMinBar = 0.f;
3230 stat_barp->mMaxBar = 1024.f; 3214 stat_barp->mMaxBar = 1024.f;
@@ -3233,7 +3217,7 @@ void init_stat_view()
3233 stat_barp->mDisplayBar = TRUE; 3217 stat_barp->mDisplayBar = TRUE;
3234 stat_barp->mDisplayHistory = FALSE; 3218 stat_barp->mDisplayHistory = FALSE;
3235 3219
3236 stat_barp = net_statviewp->addStat("Actual Out", &(gViewerStats->mActualOutKBitStat)); 3220 stat_barp = net_statviewp->addStat("Actual Out", &(LLViewerStats::getInstance()->mActualOutKBitStat));
3237 stat_barp->setUnitLabel(" kbps"); 3221 stat_barp->setUnitLabel(" kbps");
3238 stat_barp->mMinBar = 0.f; 3222 stat_barp->mMinBar = 0.f;
3239 stat_barp->mMaxBar = 512.f; 3223 stat_barp->mMaxBar = 512.f;
@@ -3242,7 +3226,7 @@ void init_stat_view()
3242 stat_barp->mDisplayBar = TRUE; 3226 stat_barp->mDisplayBar = TRUE;
3243 stat_barp->mDisplayHistory = FALSE; 3227 stat_barp->mDisplayHistory = FALSE;
3244 3228
3245 stat_barp = net_statviewp->addStat("VFS Pending Ops", &(gViewerStats->mVFSPendingOperations)); 3229 stat_barp = net_statviewp->addStat("VFS Pending Ops", &(LLViewerStats::getInstance()->mVFSPendingOperations));
3246 stat_barp->setUnitLabel(" "); 3230 stat_barp->setUnitLabel(" ");
3247 stat_barp->mPerSec = FALSE; 3231 stat_barp->mPerSec = FALSE;
3248 stat_barp->mDisplayBar = FALSE; 3232 stat_barp->mDisplayBar = FALSE;
@@ -3250,9 +3234,9 @@ void init_stat_view()
3250 3234
3251 // Simulator stats 3235 // Simulator stats
3252 LLStatView *sim_statviewp = new LLStatView("sim stat view", "Simulator", "OpenDebugStatSim", rect); 3236 LLStatView *sim_statviewp = new LLStatView("sim stat view", "Simulator", "OpenDebugStatSim", rect);
3253 gDebugView->mStatViewp->addChildAtEnd(sim_statviewp); 3237 gDebugView->mFloaterStatsp->addStatView(sim_statviewp);
3254 3238
3255 stat_barp = sim_statviewp->addStat("Time Dilation", &(gViewerStats->mSimTimeDilation)); 3239 stat_barp = sim_statviewp->addStat("Time Dilation", &(LLViewerStats::getInstance()->mSimTimeDilation));
3256 stat_barp->mPrecision = 2; 3240 stat_barp->mPrecision = 2;
3257 stat_barp->mMinBar = 0.f; 3241 stat_barp->mMinBar = 0.f;
3258 stat_barp->mMaxBar = 1.f; 3242 stat_barp->mMaxBar = 1.f;
@@ -3262,7 +3246,7 @@ void init_stat_view()
3262 stat_barp->mDisplayBar = FALSE; 3246 stat_barp->mDisplayBar = FALSE;
3263 stat_barp->mDisplayMean = FALSE; 3247 stat_barp->mDisplayMean = FALSE;
3264 3248
3265 stat_barp = sim_statviewp->addStat("Sim FPS", &(gViewerStats->mSimFPS)); 3249 stat_barp = sim_statviewp->addStat("Sim FPS", &(LLViewerStats::getInstance()->mSimFPS));
3266 stat_barp->mMinBar = 0.f; 3250 stat_barp->mMinBar = 0.f;
3267 stat_barp->mMaxBar = 200.f; 3251 stat_barp->mMaxBar = 200.f;
3268 stat_barp->mTickSpacing = 20.f; 3252 stat_barp->mTickSpacing = 20.f;
@@ -3271,7 +3255,7 @@ void init_stat_view()
3271 stat_barp->mDisplayBar = FALSE; 3255 stat_barp->mDisplayBar = FALSE;
3272 stat_barp->mDisplayMean = FALSE; 3256 stat_barp->mDisplayMean = FALSE;
3273 3257
3274 stat_barp = sim_statviewp->addStat("Physics FPS", &(gViewerStats->mSimPhysicsFPS)); 3258 stat_barp = sim_statviewp->addStat("Physics FPS", &(LLViewerStats::getInstance()->mSimPhysicsFPS));
3275 stat_barp->mPrecision = 1; 3259 stat_barp->mPrecision = 1;
3276 stat_barp->mMinBar = 0.f; 3260 stat_barp->mMinBar = 0.f;
3277 stat_barp->mMaxBar = 66.f; 3261 stat_barp->mMaxBar = 66.f;
@@ -3281,7 +3265,42 @@ void init_stat_view()
3281 stat_barp->mDisplayBar = FALSE; 3265 stat_barp->mDisplayBar = FALSE;
3282 stat_barp->mDisplayMean = FALSE; 3266 stat_barp->mDisplayMean = FALSE;
3283 3267
3284 stat_barp = sim_statviewp->addStat("Agent Updates/Sec", &(gViewerStats->mSimAgentUPS)); 3268 LLStatView *phys_details_viewp;
3269 phys_details_viewp = new LLStatView("phys detail view", "Physics Details", "", rect);
3270 sim_statviewp->addChildAtEnd(phys_details_viewp);
3271
3272 stat_barp = phys_details_viewp->addStat("Pinned Objects", &(LLViewerStats::getInstance()->mPhysicsPinnedTasks));
3273 stat_barp->mPrecision = 0;
3274 stat_barp->mMinBar = 0.f;
3275 stat_barp->mMaxBar = 500.f;
3276 stat_barp->mTickSpacing = 10.f;
3277 stat_barp->mLabelSpacing = 40.f;
3278 stat_barp->mPerSec = FALSE;
3279 stat_barp->mDisplayBar = FALSE;
3280 stat_barp->mDisplayMean = FALSE;
3281
3282 stat_barp = phys_details_viewp->addStat("Low LOD Objects", &(LLViewerStats::getInstance()->mPhysicsLODTasks));
3283 stat_barp->mPrecision = 0;
3284 stat_barp->mMinBar = 0.f;
3285 stat_barp->mMaxBar = 500.f;
3286 stat_barp->mTickSpacing = 10.f;
3287 stat_barp->mLabelSpacing = 40.f;
3288 stat_barp->mPerSec = FALSE;
3289 stat_barp->mDisplayBar = FALSE;
3290 stat_barp->mDisplayMean = FALSE;
3291
3292 stat_barp = phys_details_viewp->addStat("Memory Allocated", &(LLViewerStats::getInstance()->mPhysicsMemoryAllocated));
3293 stat_barp->setUnitLabel(" MB");
3294 stat_barp->mPrecision = 0;
3295 stat_barp->mMinBar = 0.f;
3296 stat_barp->mMaxBar = 1024.f;
3297 stat_barp->mTickSpacing = 128.f;
3298 stat_barp->mLabelSpacing = 256.f;
3299 stat_barp->mPerSec = FALSE;
3300 stat_barp->mDisplayBar = FALSE;
3301 stat_barp->mDisplayMean = FALSE;
3302
3303 stat_barp = sim_statviewp->addStat("Agent Updates/Sec", &(LLViewerStats::getInstance()->mSimAgentUPS));
3285 stat_barp->mPrecision = 1; 3304 stat_barp->mPrecision = 1;
3286 stat_barp->mMinBar = 0.f; 3305 stat_barp->mMinBar = 0.f;
3287 stat_barp->mMaxBar = 100.f; 3306 stat_barp->mMaxBar = 100.f;
@@ -3291,7 +3310,7 @@ void init_stat_view()
3291 stat_barp->mDisplayBar = FALSE; 3310 stat_barp->mDisplayBar = FALSE;
3292 stat_barp->mDisplayMean = FALSE; 3311 stat_barp->mDisplayMean = FALSE;
3293 3312
3294 stat_barp = sim_statviewp->addStat("Main Agents", &(gViewerStats->mSimMainAgents)); 3313 stat_barp = sim_statviewp->addStat("Main Agents", &(LLViewerStats::getInstance()->mSimMainAgents));
3295 stat_barp->mPrecision = 0; 3314 stat_barp->mPrecision = 0;
3296 stat_barp->mMinBar = 0.f; 3315 stat_barp->mMinBar = 0.f;
3297 stat_barp->mMaxBar = 80.f; 3316 stat_barp->mMaxBar = 80.f;
@@ -3301,7 +3320,7 @@ void init_stat_view()
3301 stat_barp->mDisplayBar = FALSE; 3320 stat_barp->mDisplayBar = FALSE;
3302 stat_barp->mDisplayMean = FALSE; 3321 stat_barp->mDisplayMean = FALSE;
3303 3322
3304 stat_barp = sim_statviewp->addStat("Child Agents", &(gViewerStats->mSimChildAgents)); 3323 stat_barp = sim_statviewp->addStat("Child Agents", &(LLViewerStats::getInstance()->mSimChildAgents));
3305 stat_barp->mPrecision = 0; 3324 stat_barp->mPrecision = 0;
3306 stat_barp->mMinBar = 0.f; 3325 stat_barp->mMinBar = 0.f;
3307 stat_barp->mMaxBar = 40.f; 3326 stat_barp->mMaxBar = 40.f;
@@ -3311,7 +3330,7 @@ void init_stat_view()
3311 stat_barp->mDisplayBar = FALSE; 3330 stat_barp->mDisplayBar = FALSE;
3312 stat_barp->mDisplayMean = FALSE; 3331 stat_barp->mDisplayMean = FALSE;
3313 3332
3314 stat_barp = sim_statviewp->addStat("Objects", &(gViewerStats->mSimObjects)); 3333 stat_barp = sim_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mSimObjects));
3315 stat_barp->mPrecision = 0; 3334 stat_barp->mPrecision = 0;
3316 stat_barp->mMinBar = 0.f; 3335 stat_barp->mMinBar = 0.f;
3317 stat_barp->mMaxBar = 30000.f; 3336 stat_barp->mMaxBar = 30000.f;
@@ -3321,7 +3340,7 @@ void init_stat_view()
3321 stat_barp->mDisplayBar = FALSE; 3340 stat_barp->mDisplayBar = FALSE;
3322 stat_barp->mDisplayMean = FALSE; 3341 stat_barp->mDisplayMean = FALSE;
3323 3342
3324 stat_barp = sim_statviewp->addStat("Active Objects", &(gViewerStats->mSimActiveObjects)); 3343 stat_barp = sim_statviewp->addStat("Active Objects", &(LLViewerStats::getInstance()->mSimActiveObjects));
3325 stat_barp->mPrecision = 0; 3344 stat_barp->mPrecision = 0;
3326 stat_barp->mMinBar = 0.f; 3345 stat_barp->mMinBar = 0.f;
3327 stat_barp->mMaxBar = 800.f; 3346 stat_barp->mMaxBar = 800.f;
@@ -3331,7 +3350,7 @@ void init_stat_view()
3331 stat_barp->mDisplayBar = FALSE; 3350 stat_barp->mDisplayBar = FALSE;
3332 stat_barp->mDisplayMean = FALSE; 3351 stat_barp->mDisplayMean = FALSE;
3333 3352
3334 stat_barp = sim_statviewp->addStat("Active Scripts", &(gViewerStats->mSimActiveScripts)); 3353 stat_barp = sim_statviewp->addStat("Active Scripts", &(LLViewerStats::getInstance()->mSimActiveScripts));
3335 stat_barp->mPrecision = 0; 3354 stat_barp->mPrecision = 0;
3336 stat_barp->mMinBar = 0.f; 3355 stat_barp->mMinBar = 0.f;
3337 stat_barp->mMaxBar = 800.f; 3356 stat_barp->mMaxBar = 800.f;
@@ -3341,7 +3360,7 @@ void init_stat_view()
3341 stat_barp->mDisplayBar = FALSE; 3360 stat_barp->mDisplayBar = FALSE;
3342 stat_barp->mDisplayMean = FALSE; 3361 stat_barp->mDisplayMean = FALSE;
3343 3362
3344 stat_barp = sim_statviewp->addStat("Script Perf", &(gViewerStats->mSimLSLIPS)); 3363 stat_barp = sim_statviewp->addStat("Script Perf", &(LLViewerStats::getInstance()->mSimLSLIPS));
3345 stat_barp->setUnitLabel(" ips"); 3364 stat_barp->setUnitLabel(" ips");
3346 stat_barp->mPrecision = 0; 3365 stat_barp->mPrecision = 0;
3347 stat_barp->mMinBar = 0.f; 3366 stat_barp->mMinBar = 0.f;
@@ -3352,7 +3371,7 @@ void init_stat_view()
3352 stat_barp->mDisplayBar = FALSE; 3371 stat_barp->mDisplayBar = FALSE;
3353 stat_barp->mDisplayMean = FALSE; 3372 stat_barp->mDisplayMean = FALSE;
3354 3373
3355 stat_barp = sim_statviewp->addStat("Packets In", &(gViewerStats->mSimInPPS)); 3374 stat_barp = sim_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mSimInPPS));
3356 stat_barp->setUnitLabel(" pps"); 3375 stat_barp->setUnitLabel(" pps");
3357 stat_barp->mPrecision = 0; 3376 stat_barp->mPrecision = 0;
3358 stat_barp->mMinBar = 0.f; 3377 stat_barp->mMinBar = 0.f;
@@ -3363,7 +3382,7 @@ void init_stat_view()
3363 stat_barp->mDisplayBar = FALSE; 3382 stat_barp->mDisplayBar = FALSE;
3364 stat_barp->mDisplayMean = FALSE; 3383 stat_barp->mDisplayMean = FALSE;
3365 3384
3366 stat_barp = sim_statviewp->addStat("Packets Out", &(gViewerStats->mSimOutPPS)); 3385 stat_barp = sim_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mSimOutPPS));
3367 stat_barp->setUnitLabel(" pps"); 3386 stat_barp->setUnitLabel(" pps");
3368 stat_barp->mPrecision = 0; 3387 stat_barp->mPrecision = 0;
3369 stat_barp->mMinBar = 0.f; 3388 stat_barp->mMinBar = 0.f;
@@ -3374,7 +3393,7 @@ void init_stat_view()
3374 stat_barp->mDisplayBar = FALSE; 3393 stat_barp->mDisplayBar = FALSE;
3375 stat_barp->mDisplayMean = FALSE; 3394 stat_barp->mDisplayMean = FALSE;
3376 3395
3377 stat_barp = sim_statviewp->addStat("Pending Downloads", &(gViewerStats->mSimPendingDownloads)); 3396 stat_barp = sim_statviewp->addStat("Pending Downloads", &(LLViewerStats::getInstance()->mSimPendingDownloads));
3378 stat_barp->mPrecision = 0; 3397 stat_barp->mPrecision = 0;
3379 stat_barp->mMinBar = 0.f; 3398 stat_barp->mMinBar = 0.f;
3380 stat_barp->mMaxBar = 800.f; 3399 stat_barp->mMaxBar = 800.f;
@@ -3384,7 +3403,7 @@ void init_stat_view()
3384 stat_barp->mDisplayBar = FALSE; 3403 stat_barp->mDisplayBar = FALSE;
3385 stat_barp->mDisplayMean = FALSE; 3404 stat_barp->mDisplayMean = FALSE;
3386 3405
3387 stat_barp = sim_statviewp->addStat("Pending Uploads", &(gViewerStats->mSimPendingUploads)); 3406 stat_barp = sim_statviewp->addStat("Pending Uploads", &(LLViewerStats::getInstance()->mSimPendingUploads));
3388 stat_barp->mPrecision = 0; 3407 stat_barp->mPrecision = 0;
3389 stat_barp->mMinBar = 0.f; 3408 stat_barp->mMinBar = 0.f;
3390 stat_barp->mMaxBar = 100.f; 3409 stat_barp->mMaxBar = 100.f;
@@ -3394,7 +3413,7 @@ void init_stat_view()
3394 stat_barp->mDisplayBar = FALSE; 3413 stat_barp->mDisplayBar = FALSE;
3395 stat_barp->mDisplayMean = FALSE; 3414 stat_barp->mDisplayMean = FALSE;
3396 3415
3397 stat_barp = sim_statviewp->addStat("Total Unacked Bytes", &(gViewerStats->mSimTotalUnackedBytes)); 3416 stat_barp = sim_statviewp->addStat("Total Unacked Bytes", &(LLViewerStats::getInstance()->mSimTotalUnackedBytes));
3398 stat_barp->setUnitLabel(" kb"); 3417 stat_barp->setUnitLabel(" kb");
3399 stat_barp->mPrecision = 0; 3418 stat_barp->mPrecision = 0;
3400 stat_barp->mMinBar = 0.f; 3419 stat_barp->mMinBar = 0.f;
@@ -3409,7 +3428,7 @@ void init_stat_view()
3409 sim_time_viewp = new LLStatView("sim perf view", "Time (ms)", "", rect); 3428 sim_time_viewp = new LLStatView("sim perf view", "Time (ms)", "", rect);
3410 sim_statviewp->addChildAtEnd(sim_time_viewp); 3429 sim_statviewp->addChildAtEnd(sim_time_viewp);
3411 3430
3412 stat_barp = sim_time_viewp->addStat("Total Frame Time", &(gViewerStats->mSimFrameMsec)); 3431 stat_barp = sim_time_viewp->addStat("Total Frame Time", &(LLViewerStats::getInstance()->mSimFrameMsec));
3413 stat_barp->setUnitLabel("ms"); 3432 stat_barp->setUnitLabel("ms");
3414 stat_barp->mPrecision = 1; 3433 stat_barp->mPrecision = 1;
3415 stat_barp->mMinBar = 0.f; 3434 stat_barp->mMinBar = 0.f;
@@ -3420,7 +3439,7 @@ void init_stat_view()
3420 stat_barp->mDisplayBar = FALSE; 3439 stat_barp->mDisplayBar = FALSE;
3421 stat_barp->mDisplayMean = FALSE; 3440 stat_barp->mDisplayMean = FALSE;
3422 3441
3423 stat_barp = sim_time_viewp->addStat("Net Time", &(gViewerStats->mSimNetMsec)); 3442 stat_barp = sim_time_viewp->addStat("Net Time", &(LLViewerStats::getInstance()->mSimNetMsec));
3424 stat_barp->setUnitLabel("ms"); 3443 stat_barp->setUnitLabel("ms");
3425 stat_barp->mPrecision = 1; 3444 stat_barp->mPrecision = 1;
3426 stat_barp->mMinBar = 0.f; 3445 stat_barp->mMinBar = 0.f;
@@ -3431,7 +3450,7 @@ void init_stat_view()
3431 stat_barp->mDisplayBar = FALSE; 3450 stat_barp->mDisplayBar = FALSE;
3432 stat_barp->mDisplayMean = FALSE; 3451 stat_barp->mDisplayMean = FALSE;
3433 3452
3434 stat_barp = sim_time_viewp->addStat("Sim Time (Physics)", &(gViewerStats->mSimSimPhysicsMsec)); 3453 stat_barp = sim_time_viewp->addStat("Sim Time (Physics)", &(LLViewerStats::getInstance()->mSimSimPhysicsMsec));
3435 stat_barp->setUnitLabel("ms"); 3454 stat_barp->setUnitLabel("ms");
3436 stat_barp->mPrecision = 1; 3455 stat_barp->mPrecision = 1;
3437 stat_barp->mMinBar = 0.f; 3456 stat_barp->mMinBar = 0.f;
@@ -3442,7 +3461,45 @@ void init_stat_view()
3442 stat_barp->mDisplayBar = FALSE; 3461 stat_barp->mDisplayBar = FALSE;
3443 stat_barp->mDisplayMean = FALSE; 3462 stat_barp->mDisplayMean = FALSE;
3444 3463
3445 stat_barp = sim_time_viewp->addStat("Sim Time (Other)", &(gViewerStats->mSimSimOtherMsec)); 3464 LLStatView *physics_time_viewp;
3465 physics_time_viewp = new LLStatView("physics perf view", "Physics Details (ms)", "", rect);
3466 sim_time_viewp->addChildAtEnd(physics_time_viewp);
3467 {
3468 stat_barp = physics_time_viewp->addStat("Physics Step", &(LLViewerStats::getInstance()->mSimSimPhysicsStepMsec));
3469 stat_barp->setUnitLabel("ms");
3470 stat_barp->mPrecision = 1;
3471 stat_barp->mMinBar = 0.f;
3472 stat_barp->mMaxBar = 40.f;
3473 stat_barp->mTickSpacing = 10.f;
3474 stat_barp->mLabelSpacing = 20.f;
3475 stat_barp->mPerSec = FALSE;
3476 stat_barp->mDisplayBar = FALSE;
3477 stat_barp->mDisplayMean = FALSE;
3478
3479 stat_barp = physics_time_viewp->addStat("Update Shapes", &(LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec));
3480 stat_barp->setUnitLabel("ms");
3481 stat_barp->mPrecision = 1;
3482 stat_barp->mMinBar = 0.f;
3483 stat_barp->mMaxBar = 40.f;
3484 stat_barp->mTickSpacing = 10.f;
3485 stat_barp->mLabelSpacing = 20.f;
3486 stat_barp->mPerSec = FALSE;
3487 stat_barp->mDisplayBar = FALSE;
3488 stat_barp->mDisplayMean = FALSE;
3489
3490 stat_barp = physics_time_viewp->addStat("Other", &(LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec));
3491 stat_barp->setUnitLabel("ms");
3492 stat_barp->mPrecision = 1;
3493 stat_barp->mMinBar = 0.f;
3494 stat_barp->mMaxBar = 40.f;
3495 stat_barp->mTickSpacing = 10.f;
3496 stat_barp->mLabelSpacing = 20.f;
3497 stat_barp->mPerSec = FALSE;
3498 stat_barp->mDisplayBar = FALSE;
3499 stat_barp->mDisplayMean = FALSE;
3500 }
3501
3502 stat_barp = sim_time_viewp->addStat("Sim Time (Other)", &(LLViewerStats::getInstance()->mSimSimOtherMsec));
3446 stat_barp->setUnitLabel("ms"); 3503 stat_barp->setUnitLabel("ms");
3447 stat_barp->mPrecision = 1; 3504 stat_barp->mPrecision = 1;
3448 stat_barp->mMinBar = 0.f; 3505 stat_barp->mMinBar = 0.f;
@@ -3453,7 +3510,7 @@ void init_stat_view()
3453 stat_barp->mDisplayBar = FALSE; 3510 stat_barp->mDisplayBar = FALSE;
3454 stat_barp->mDisplayMean = FALSE; 3511 stat_barp->mDisplayMean = FALSE;
3455 3512
3456 stat_barp = sim_time_viewp->addStat("Agent Time", &(gViewerStats->mSimAgentMsec)); 3513 stat_barp = sim_time_viewp->addStat("Agent Time", &(LLViewerStats::getInstance()->mSimAgentMsec));
3457 stat_barp->setUnitLabel("ms"); 3514 stat_barp->setUnitLabel("ms");
3458 stat_barp->mPrecision = 1; 3515 stat_barp->mPrecision = 1;
3459 stat_barp->mMinBar = 0.f; 3516 stat_barp->mMinBar = 0.f;
@@ -3464,7 +3521,7 @@ void init_stat_view()
3464 stat_barp->mDisplayBar = FALSE; 3521 stat_barp->mDisplayBar = FALSE;
3465 stat_barp->mDisplayMean = FALSE; 3522 stat_barp->mDisplayMean = FALSE;
3466 3523
3467 stat_barp = sim_time_viewp->addStat("Images Time", &(gViewerStats->mSimImagesMsec)); 3524 stat_barp = sim_time_viewp->addStat("Images Time", &(LLViewerStats::getInstance()->mSimImagesMsec));
3468 stat_barp->setUnitLabel("ms"); 3525 stat_barp->setUnitLabel("ms");
3469 stat_barp->mPrecision = 1; 3526 stat_barp->mPrecision = 1;
3470 stat_barp->mMinBar = 0.f; 3527 stat_barp->mMinBar = 0.f;
@@ -3475,7 +3532,7 @@ void init_stat_view()
3475 stat_barp->mDisplayBar = FALSE; 3532 stat_barp->mDisplayBar = FALSE;
3476 stat_barp->mDisplayMean = FALSE; 3533 stat_barp->mDisplayMean = FALSE;
3477 3534
3478 stat_barp = sim_time_viewp->addStat("Script Time", &(gViewerStats->mSimScriptMsec)); 3535 stat_barp = sim_time_viewp->addStat("Script Time", &(LLViewerStats::getInstance()->mSimScriptMsec));
3479 stat_barp->setUnitLabel("ms"); 3536 stat_barp->setUnitLabel("ms");
3480 stat_barp->mPrecision = 1; 3537 stat_barp->mPrecision = 1;
3481 stat_barp->mMinBar = 0.f; 3538 stat_barp->mMinBar = 0.f;
@@ -3486,10 +3543,10 @@ void init_stat_view()
3486 stat_barp->mDisplayBar = FALSE; 3543 stat_barp->mDisplayBar = FALSE;
3487 stat_barp->mDisplayMean = FALSE; 3544 stat_barp->mDisplayMean = FALSE;
3488 3545
3489 LLRect r = gDebugView->mStatViewp->getRect(); 3546 LLRect r = gDebugView->mFloaterStatsp->getRect();
3490 3547
3491 // Reshape based on the parameters we set. 3548 // Reshape based on the parameters we set.
3492 gDebugView->mStatViewp->reshape(r.getWidth(), r.getHeight()); 3549 gDebugView->mFloaterStatsp->reshape(r.getWidth(), r.getHeight());
3493} 3550}
3494 3551
3495void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32) 3552void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32)