aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llstartup.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llstartup.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llstartup.cpp1007
1 files changed, 254 insertions, 753 deletions
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 5f25dc3..aeb313f 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -113,6 +114,7 @@
113#include "llinventorymodel.h" 114#include "llinventorymodel.h"
114#include "llinventoryview.h" 115#include "llinventoryview.h"
115#include "llkeyboard.h" 116#include "llkeyboard.h"
117#include "llloginhandler.h" // gLoginHandler, SLURL support
116#include "llpanellogin.h" 118#include "llpanellogin.h"
117#include "llmutelist.h" 119#include "llmutelist.h"
118#include "llnotify.h" 120#include "llnotify.h"
@@ -127,12 +129,14 @@
127#include "llpanelgroupnotices.h" 129#include "llpanelgroupnotices.h"
128#include "llpreview.h" 130#include "llpreview.h"
129#include "llpreviewscript.h" 131#include "llpreviewscript.h"
132#include "llproductinforequest.h"
130#include "llsecondlifeurls.h" 133#include "llsecondlifeurls.h"
131#include "llselectmgr.h" 134#include "llselectmgr.h"
132#include "llsky.h" 135#include "llsky.h"
133#include "llsrv.h" 136#include "llsrv.h"
134#include "llstatview.h" 137#include "llstatview.h"
135#include "lltrans.h" 138#include "lltrans.h"
139#include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance
136#include "llsurface.h" 140#include "llsurface.h"
137#include "lltexturecache.h" 141#include "lltexturecache.h"
138#include "lltexturefetch.h" 142#include "lltexturefetch.h"
@@ -230,22 +234,19 @@ EStartupState LLStartUp::gStartupState = STATE_FIRST;
230 234
231void login_show(); 235void login_show();
232void login_callback(S32 option, void* userdata); 236void login_callback(S32 option, void* userdata);
233std::string load_password_from_disk();
234void save_password_to_disk(const char* hashed_password);
235bool is_hex_string(U8* str, S32 len); 237bool is_hex_string(U8* str, S32 len);
236void show_first_run_dialog(); 238void show_first_run_dialog();
237void first_run_dialog_callback(S32 option, void* userdata); 239bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
238void set_startup_status(const F32 frac, const std::string& string, const std::string& msg); 240void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
239void login_alert_status(S32 option, void* user_data); 241bool login_alert_status(const LLSD& notification, const LLSD& response);
240void update_app(BOOL mandatory, const std::string& message); 242void update_app(BOOL mandatory, const std::string& message);
241void update_dialog_callback(S32 option, void *userdata); 243bool update_dialog_callback(const LLSD& notification, const LLSD& response);
242void login_packet_failed(void**, S32 result); 244void login_packet_failed(void**, S32 result);
243void use_circuit_callback(void**, S32 result); 245void use_circuit_callback(void**, S32 result);
244void register_viewer_callbacks(LLMessageSystem* msg); 246void register_viewer_callbacks(LLMessageSystem* msg);
245void init_stat_view(); 247void init_stat_view();
246void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32); 248void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32);
247void dialog_choose_gender_first_start(); 249bool callback_choose_gender(const LLSD& notification, const LLSD& response);
248void callback_choose_gender(S32 option, void* userdata);
249void init_start_screen(S32 location_id); 250void init_start_screen(S32 location_id);
250void release_start_screen(); 251void release_start_screen();
251void reset_login(); 252void reset_login();
@@ -350,7 +351,6 @@ bool idle_startup()
350 static S32 location_which = START_LOCATION_ID_LAST; 351 static S32 location_which = START_LOCATION_ID_LAST;
351 352
352 static bool show_connect_box = true; 353 static bool show_connect_box = true;
353 static BOOL remember_password = TRUE;
354 354
355 static bool stipend_since_login = false; 355 static bool stipend_since_login = false;
356 356
@@ -386,16 +386,16 @@ bool idle_startup()
386 386
387 if (LLFeatureManager::getInstance()->isSafe()) 387 if (LLFeatureManager::getInstance()->isSafe())
388 { 388 {
389 gViewerWindow->alertXml("DisplaySetToSafe"); 389 LLNotifications::instance().add("DisplaySetToSafe");
390 } 390 }
391 else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) && 391 else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) &&
392 (gSavedSettings.getS32("LastFeatureVersion") != 0)) 392 (gSavedSettings.getS32("LastFeatureVersion") != 0))
393 { 393 {
394 gViewerWindow->alertXml("DisplaySetToRecommended"); 394 LLNotifications::instance().add("DisplaySetToRecommended");
395 } 395 }
396 else if (!gViewerWindow->getInitAlert().empty()) 396 else if (!gViewerWindow->getInitAlert().empty())
397 { 397 {
398 gViewerWindow->alertXml(gViewerWindow->getInitAlert()); 398 LLNotifications::instance().add(gViewerWindow->getInitAlert());
399 } 399 }
400 400
401 gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion()); 401 gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
@@ -418,10 +418,11 @@ bool idle_startup()
418 } 418 }
419 if (!xml_ok) 419 if (!xml_ok)
420 { 420 {
421 // *TODO:translate (maybe - very unlikely error message) 421 // If XML is bad, there's a good possibility that notifications.xml is ALSO bad.
422 // Note: alerts.xml may be invalid - if this gets translated it will need to be in the code 422 // If that's so, then we'll get a fatal error on attempting to load it,
423 std::string bad_xui_msg = "An error occured while updating Second Life. Please download the latest version from www.secondlife.com."; 423 // which will display a nontranslatable error message that says so.
424 LLAppViewer::instance()->earlyExit(bad_xui_msg); 424 // Otherwise, we'll display a reasonable error message that IS translatable.
425 LLAppViewer::instance()->earlyExit("BadInstallation");
425 } 426 }
426 // 427 //
427 // Statistics stuff 428 // Statistics stuff
@@ -439,9 +440,9 @@ bool idle_startup()
439 440
440 if (ll_init_ares() == NULL || !gAres->isInitialized()) 441 if (ll_init_ares() == NULL || !gAres->isInitialized())
441 { 442 {
442 LL_WARNS("AppInit") << "Could not start address resolution system" << LL_ENDL; 443 std::string diagnostic = "Could not start address resolution system";
443 std::string msg = LLTrans::getString("LoginFailedNoNetwork"); 444 LL_WARNS("AppInit") << diagnostic << LL_ENDL;
444 LLAppViewer::instance()->earlyExit(msg); 445 LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
445 } 446 }
446 447
447 // 448 //
@@ -478,6 +479,14 @@ bool idle_startup()
478 } 479 }
479 480
480 LLHTTPSender::setDefaultSender(new LLNullHTTPSender()); 481 LLHTTPSender::setDefaultSender(new LLNullHTTPSender());
482
483 // TODO parameterize
484 const F32 circuit_heartbeat_interval = 5;
485 const F32 circuit_timeout = 100;
486
487 const LLUseCircuitCodeResponder* responder = NULL;
488 bool failure_is_fatal = true;
489
481 if(!start_messaging_system( 490 if(!start_messaging_system(
482 message_template_path, 491 message_template_path,
483 port, 492 port,
@@ -485,11 +494,15 @@ bool idle_startup()
485 LL_VERSION_MINOR, 494 LL_VERSION_MINOR,
486 LL_VERSION_PATCH, 495 LL_VERSION_PATCH,
487 FALSE, 496 FALSE,
488 std::string())) 497 std::string(),
498 responder,
499 failure_is_fatal,
500 circuit_heartbeat_interval,
501 circuit_timeout))
489 { 502 {
490 std::string msg = LLTrans::getString("LoginFailedNoNetwork"); 503 std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
491 msg.append(llformat(" Error: %d", gMessageSystem->getErrorCode())); 504 LL_WARNS("AppInit") << diagnostic << LL_ENDL;
492 LLAppViewer::instance()->earlyExit(msg); 505 LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
493 } 506 }
494 507
495 #if LL_WINDOWS 508 #if LL_WINDOWS
@@ -512,7 +525,7 @@ bool idle_startup()
512 } 525 }
513 else 526 else
514 { 527 {
515 LLAppViewer::instance()->earlyExit("Message Template " + message_template_path + " not found."); 528 LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().insert("PATH", message_template_path));
516 } 529 }
517 530
518 if(gMessageSystem && gMessageSystem->isOK()) 531 if(gMessageSystem && gMessageSystem->isOK())
@@ -642,16 +655,23 @@ bool idle_startup()
642 // 655 //
643 // Log on to system 656 // Log on to system
644 // 657 //
645 if ((!gLoginHandler.mFirstName.empty() && 658 if (!LLStartUp::sSLURLCommand.empty())
646 !gLoginHandler.mLastName.empty() &&
647 !gLoginHandler.mWebLoginKey.isNull())
648 || gLoginHandler.parseDirectLogin(LLStartUp::sSLURLCommand) )
649 { 659 {
650 firstname = gLoginHandler.mFirstName; 660 // this might be a secondlife:///app/login URL
651 lastname = gLoginHandler.mLastName; 661 gLoginHandler.parseDirectLogin(LLStartUp::sSLURLCommand);
652 web_login_key = gLoginHandler.mWebLoginKey; 662 }
663 if (!gLoginHandler.getFirstName().empty()
664 || !gLoginHandler.getLastName().empty()
665 || !gLoginHandler.getWebLoginKey().isNull() )
666 {
667 // We have at least some login information on a SLURL
668 firstname = gLoginHandler.getFirstName();
669 lastname = gLoginHandler.getLastName();
670 web_login_key = gLoginHandler.getWebLoginKey();
653 671
654 show_connect_box = false; 672 // Show the login screen if we don't have everything
673 show_connect_box =
674 firstname.empty() || lastname.empty() || web_login_key.isNull();
655 } 675 }
656 else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) 676 else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
657 { 677 {
@@ -663,7 +683,6 @@ bool idle_startup()
663 char md5pass[33]; /* Flawfinder: ignore */ 683 char md5pass[33]; /* Flawfinder: ignore */
664 pass.hex_digest(md5pass); 684 pass.hex_digest(md5pass);
665 password = md5pass; 685 password = md5pass;
666 remember_password = gSavedSettings.getBOOL("RememberPassword");
667 686
668#ifdef USE_VIEWER_AUTH 687#ifdef USE_VIEWER_AUTH
669 show_connect_box = true; 688 show_connect_box = true;
@@ -676,9 +695,8 @@ bool idle_startup()
676 { 695 {
677 firstname = gSavedSettings.getString("FirstName"); 696 firstname = gSavedSettings.getString("FirstName");
678 lastname = gSavedSettings.getString("LastName"); 697 lastname = gSavedSettings.getString("LastName");
679 password = load_password_from_disk(); 698 password = LLStartUp::loadPasswordFromDisk();
680 gSavedSettings.setBOOL("RememberPassword", TRUE); 699 gSavedSettings.setBOOL("RememberPassword", TRUE);
681 remember_password = TRUE;
682 700
683#ifdef USE_VIEWER_AUTH 701#ifdef USE_VIEWER_AUTH
684 show_connect_box = true; 702 show_connect_box = true;
@@ -692,8 +710,7 @@ bool idle_startup()
692 // a valid grid is selected 710 // a valid grid is selected
693 firstname = gSavedSettings.getString("FirstName"); 711 firstname = gSavedSettings.getString("FirstName");
694 lastname = gSavedSettings.getString("LastName"); 712 lastname = gSavedSettings.getString("LastName");
695 password = load_password_from_disk(); 713 password = LLStartUp::loadPasswordFromDisk();
696 remember_password = gSavedSettings.getBOOL("RememberPassword");
697 show_connect_box = true; 714 show_connect_box = true;
698 } 715 }
699 716
@@ -722,8 +739,6 @@ bool idle_startup()
722 LL_DEBUGS("AppInit") << "Initializing Window" << LL_ENDL; 739 LL_DEBUGS("AppInit") << "Initializing Window" << LL_ENDL;
723 740
724 gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); 741 gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
725 // Push our window frontmost
726 gViewerWindow->getWindow()->show();
727 742
728 timeout_count = 0; 743 timeout_count = 0;
729 744
@@ -732,7 +747,7 @@ bool idle_startup()
732 // Load all the name information out of the login view 747 // Load all the name information out of the login view
733 // NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't 748 // NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
734 // show the login view until login_show() is called below. 749 // show the login view until login_show() is called below.
735 // LLPanelLogin::getFields(firstname, lastname, password, remember_password); 750 // LLPanelLogin::getFields(firstname, lastname, password);
736 751
737 if (gNoRender) 752 if (gNoRender)
738 { 753 {
@@ -744,7 +759,7 @@ bool idle_startup()
744 // Show the login dialog 759 // Show the login dialog
745 login_show(); 760 login_show();
746 // connect dialog is already shown, so fill in the names 761 // connect dialog is already shown, so fill in the names
747 LLPanelLogin::setFields( firstname, lastname, password, remember_password ); 762 LLPanelLogin::setFields( firstname, lastname, password);
748 763
749 LLPanelLogin::giveFocus(); 764 LLPanelLogin::giveFocus();
750 765
@@ -779,6 +794,10 @@ bool idle_startup()
779 gLoginMenuBarView->setVisible( TRUE ); 794 gLoginMenuBarView->setVisible( TRUE );
780 gLoginMenuBarView->setEnabled( TRUE ); 795 gLoginMenuBarView->setEnabled( TRUE );
781 796
797 // Push our window frontmost
798 gViewerWindow->getWindow()->show();
799 display_startup();
800
782 // DEV-16927. The following code removes errant keystrokes that happen while the window is being 801 // DEV-16927. The following code removes errant keystrokes that happen while the window is being
783 // first made visible. 802 // first made visible.
784#ifdef _WIN32 803#ifdef _WIN32
@@ -802,18 +821,18 @@ bool idle_startup()
802 if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) 821 if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
803 { 822 {
804 //reset the values that could have come in from a slurl 823 //reset the values that could have come in from a slurl
805 if (!gLoginHandler.mWebLoginKey.isNull()) 824 if (!gLoginHandler.getWebLoginKey().isNull())
806 { 825 {
807 firstname = gLoginHandler.mFirstName; 826 firstname = gLoginHandler.getFirstName();
808 lastname = gLoginHandler.mLastName; 827 lastname = gLoginHandler.getLastName();
809 web_login_key = gLoginHandler.mWebLoginKey; 828 web_login_key = gLoginHandler.getWebLoginKey();
810 } 829 }
811 830
812 if (show_connect_box) 831 if (show_connect_box)
813 { 832 {
814 // TODO if not use viewer auth 833 // TODO if not use viewer auth
815 // Load all the name information out of the login view 834 // Load all the name information out of the login view
816 LLPanelLogin::getFields(firstname, lastname, password, remember_password); 835 LLPanelLogin::getFields(&firstname, &lastname, &password);
817 // end TODO 836 // end TODO
818 837
819 // HACK: Try to make not jump on login 838 // HACK: Try to make not jump on login
@@ -825,16 +844,6 @@ bool idle_startup()
825 gSavedSettings.setString("FirstName", firstname); 844 gSavedSettings.setString("FirstName", firstname);
826 gSavedSettings.setString("LastName", lastname); 845 gSavedSettings.setString("LastName", lastname);
827 846
828 if (remember_password)
829 {
830 save_password_to_disk(password.c_str());
831 }
832 else
833 {
834 save_password_to_disk(NULL);
835 }
836 gSavedSettings.setBOOL("RememberPassword", remember_password);
837
838 LL_INFOS("AppInit") << "Attempting login as: " << firstname << " " << lastname << LL_ENDL; 847 LL_INFOS("AppInit") << "Attempting login as: " << firstname << " " << lastname << LL_ENDL;
839 gDebugInfo["LoginName"] = firstname + " " + lastname; 848 gDebugInfo["LoginName"] = firstname + " " + lastname;
840 } 849 }
@@ -847,12 +856,12 @@ bool idle_startup()
847 // Set PerAccountSettingsFile to the default value. 856 // Set PerAccountSettingsFile to the default value.
848 gSavedSettings.setString("PerAccountSettingsFile", 857 gSavedSettings.setString("PerAccountSettingsFile",
849 gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 858 gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
850 LLAppViewer::instance()->getSettingsFileName("PerAccount") 859 LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")
851 ) 860 )
852 ); 861 );
853 862
854 // Overwrite default user settings with user settings 863 // Overwrite default user settings with user settings
855 LLAppViewer::instance()->loadSettingsFromDirectory(LL_PATH_PER_SL_ACCOUNT); 864 LLAppViewer::instance()->loadSettingsFromDirectory("Account");
856 865
857 // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation 866 // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation
858 // and startup time is close enough if we don't have a real value. 867 // and startup time is close enough if we don't have a real value.
@@ -1341,24 +1350,44 @@ bool idle_startup()
1341 gSavedSettings.setString("FirstName", firstname); 1350 gSavedSettings.setString("FirstName", firstname);
1342 gSavedSettings.setString("LastName", lastname); 1351 gSavedSettings.setString("LastName", lastname);
1343 1352
1344 if (remember_password) 1353 if (gSavedSettings.getBOOL("RememberPassword"))
1345 { 1354 {
1346 save_password_to_disk(password.c_str()); 1355 // Successful login means the password is valid, so save it.
1356 LLStartUp::savePasswordToDisk(password);
1347 } 1357 }
1348 else 1358 else
1349 { 1359 {
1350 save_password_to_disk(NULL); 1360 // Don't leave password from previous session sitting around
1361 // during this login session.
1362 LLStartUp::deletePasswordFromDisk();
1351 } 1363 }
1352 gSavedSettings.setBOOL("RememberPassword", remember_password);
1353 1364
1354 text = LLUserAuth::getInstance()->getResponse("agent_access"); 1365 // this is their actual ability to access content
1355 if(!text.empty() && (text[0] == 'M')) 1366 text = LLUserAuth::getInstance()->getResponse("agent_access_max");
1367 if (!text.empty())
1356 { 1368 {
1357 gAgent.setTeen(false); 1369 // agent_access can be 'A', 'M', and 'PG'.
1370 gAgent.setMaturity(text[0]);
1358 } 1371 }
1359 else 1372
1373 // this is the value of their preference setting for that content
1374 // which will always be <= agent_access_max
1375 text = LLUserAuth::getInstance()->getResponse("agent_region_access");
1376 if (!text.empty())
1377 {
1378 int preferredMaturity = LLAgent::convertTextToMaturity(text[0]);
1379 gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
1380 }
1381 // During the AO transition, this flag will be true. Then the flag will
1382 // go away. After the AO transition, this code and all the code that
1383 // uses it can be deleted.
1384 text = LLUserAuth::getInstance()->getResponse("ao_transition");
1385 if (!text.empty())
1360 { 1386 {
1361 gAgent.setTeen(true); 1387 if (text == "1")
1388 {
1389 gAgent.setAOTransition();
1390 }
1362 } 1391 }
1363 1392
1364 text = LLUserAuth::getInstance()->getResponse("start_location"); 1393 text = LLUserAuth::getInstance()->getResponse("start_location");
@@ -1531,9 +1560,9 @@ bool idle_startup()
1531 exit(0); 1560 exit(0);
1532 } 1561 }
1533 // Bounce back to the login screen. 1562 // Bounce back to the login screen.
1534 LLStringUtil::format_map_t args; 1563 LLSD args;
1535 args["[ERROR_MESSAGE]"] = emsg.str(); 1564 args["ERROR_MESSAGE"] = emsg.str();
1536 gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); 1565 LLNotifications::instance().add("ErrorMessage", args, LLSD(), login_alert_done);
1537 reset_login(); 1566 reset_login();
1538 gSavedSettings.setBOOL("AutoLogin", FALSE); 1567 gSavedSettings.setBOOL("AutoLogin", FALSE);
1539 show_connect_box = true; 1568 show_connect_box = true;
@@ -1542,7 +1571,7 @@ bool idle_startup()
1542 // Pass the user information to the voice chat server interface. 1571 // Pass the user information to the voice chat server interface.
1543 gVoiceClient->userAuthorized(firstname, lastname, gAgentID); 1572 gVoiceClient->userAuthorized(firstname, lastname, gAgentID);
1544 } 1573 }
1545 else 1574 else // if(successful_login)
1546 { 1575 {
1547 if (gNoRender) 1576 if (gNoRender)
1548 { 1577 {
@@ -1551,14 +1580,12 @@ bool idle_startup()
1551 exit(0); 1580 exit(0);
1552 } 1581 }
1553 // Bounce back to the login screen. 1582 // Bounce back to the login screen.
1554 LLStringUtil::format_map_t args; 1583 LLSD args;
1555 args["[ERROR_MESSAGE]"] = emsg.str(); 1584 args["ERROR_MESSAGE"] = emsg.str();
1556 gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); 1585 LLNotifications::instance().add("ErrorMessage", args, LLSD(), login_alert_done);
1557 reset_login(); 1586 reset_login();
1558 gSavedSettings.setBOOL("AutoLogin", FALSE); 1587 gSavedSettings.setBOOL("AutoLogin", FALSE);
1559 show_connect_box = true; 1588 show_connect_box = true;
1560 // Don't save an incorrect password to disk.
1561 save_password_to_disk(NULL);
1562 } 1589 }
1563 return FALSE; 1590 return FALSE;
1564 } 1591 }
@@ -1669,11 +1696,14 @@ bool idle_startup()
1669 gLoginMenuBarView->setVisible( FALSE ); 1696 gLoginMenuBarView->setVisible( FALSE );
1670 gLoginMenuBarView->setEnabled( FALSE ); 1697 gLoginMenuBarView->setEnabled( FALSE );
1671 1698
1672 gFloaterMap->setVisible( gSavedSettings.getBOOL("ShowMiniMap") );
1673
1674 LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0); 1699 LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0);
1675 gViewerWindow->adjustControlRectanglesForFirstUse(window); 1700 gViewerWindow->adjustControlRectanglesForFirstUse(window);
1676 1701
1702 if(gSavedSettings.getBOOL("ShowMiniMap"))
1703 {
1704 LLFloaterMap::showInstance();
1705 }
1706
1677 if (gSavedSettings.getBOOL("ShowCameraControls")) 1707 if (gSavedSettings.getBOOL("ShowCameraControls"))
1678 { 1708 {
1679 LLFloaterCamera::showInstance(); 1709 LLFloaterCamera::showInstance();
@@ -1701,7 +1731,10 @@ bool idle_startup()
1701 LLError::logToFixedBuffer(gDebugView->mDebugConsolep); 1731 LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
1702 // set initial visibility of debug console 1732 // set initial visibility of debug console
1703 gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole")); 1733 gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
1704 gDebugView->mFloaterStatsp->setVisible(gSavedSettings.getBOOL("ShowDebugStats")); 1734 if (gSavedSettings.getBOOL("ShowDebugStats"))
1735 {
1736 LLFloaterStats::showInstance();
1737 }
1705 } 1738 }
1706 1739
1707 // 1740 //
@@ -1768,6 +1801,7 @@ bool idle_startup()
1768 } 1801 }
1769 1802
1770 // Make sure agent knows correct aspect ratio 1803 // Make sure agent knows correct aspect ratio
1804 // FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
1771 LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight()); 1805 LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight());
1772 if (gViewerWindow->mWindow->getFullscreen()) 1806 if (gViewerWindow->mWindow->getFullscreen())
1773 { 1807 {
@@ -1777,6 +1811,8 @@ bool idle_startup()
1777 { 1811 {
1778 LLViewerCamera::getInstance()->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight()); 1812 LLViewerCamera::getInstance()->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight());
1779 } 1813 }
1814 // Initialize FOV
1815 LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle"));
1780 1816
1781 // Move agent to starting location. The position handed to us by 1817 // Move agent to starting location. The position handed to us by
1782 // the space server is in global coordinates, but the agent frame 1818 // the space server is in global coordinates, but the agent frame
@@ -1793,7 +1829,13 @@ bool idle_startup()
1793 { 1829 {
1794 LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; 1830 LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
1795 // Initialize all of the viewer object classes for the first time (doing things like texture fetches. 1831 // Initialize all of the viewer object classes for the first time (doing things like texture fetches.
1832 LLGLState::checkStates();
1833 LLGLState::checkTextureChannels();
1834
1796 gSky.init(initial_sun_direction); 1835 gSky.init(initial_sun_direction);
1836
1837 LLGLState::checkStates();
1838 LLGLState::checkTextureChannels();
1797 } 1839 }
1798 1840
1799 LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL; 1841 LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL;
@@ -2100,13 +2142,7 @@ bool idle_startup()
2100 2142
2101 // Get L$ and ownership credit information 2143 // Get L$ and ownership credit information
2102 llinfos << "Requesting Money Balance" << llendl; 2144 llinfos << "Requesting Money Balance" << llendl;
2103 msg->newMessageFast(_PREHASH_MoneyBalanceRequest); 2145 LLStatusBar::sendMoneyBalanceRequest();
2104 msg->nextBlockFast(_PREHASH_AgentData);
2105 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
2106 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
2107 msg->nextBlockFast(_PREHASH_MoneyData);
2108 msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
2109 gAgent.sendReliableMessage();
2110 2146
2111 // request all group information 2147 // request all group information
2112 llinfos << "Requesting Agent Data" << llendl; 2148 llinfos << "Requesting Agent Data" << llendl;
@@ -2278,23 +2314,23 @@ bool idle_startup()
2278 // location is not your expected location. So, if this is 2314 // location is not your expected location. So, if this is
2279 // your first login, then you do not have an expectation, 2315 // your first login, then you do not have an expectation,
2280 // thus, do not show this alert. 2316 // thus, do not show this alert.
2281 LLStringUtil::format_map_t args; 2317 LLSD args;
2282 if (url_ok) 2318 if (url_ok)
2283 { 2319 {
2284 args["[TYPE]"] = "desired"; 2320 args["TYPE"] = "desired";
2285 args["[HELP]"] = ""; 2321 args["HELP"] = "";
2286 } 2322 }
2287 else if (gSavedSettings.getBOOL("LoginLastLocation")) 2323 else if (gSavedSettings.getBOOL("LoginLastLocation"))
2288 { 2324 {
2289 args["[TYPE]"] = "last"; 2325 args["TYPE"] = "last";
2290 args["[HELP]"] = ""; 2326 args["HELP"] = "";
2291 } 2327 }
2292 else 2328 else
2293 { 2329 {
2294 args["[TYPE]"] = "home"; 2330 args["TYPE"] = "home";
2295 args["[HELP]"] = "You may want to set a new home location."; 2331 args["HELP"] = "You may want to set a new home location.";
2296 } 2332 }
2297 gViewerWindow->alertXml("AvatarMoved", args); 2333 LLNotifications::instance().add("AvatarMoved", args);
2298 } 2334 }
2299 else 2335 else
2300 { 2336 {
@@ -2365,8 +2401,14 @@ bool idle_startup()
2365 { 2401 {
2366 update_texture_fetch(); 2402 update_texture_fetch();
2367 set_startup_status(0.60f + 0.30f * timeout_frac, 2403 set_startup_status(0.60f + 0.30f * timeout_frac,
2368 "Loading world...", 2404 LLTrans::getString("LoginPrecaching"),
2369 gAgent.mMOTD); 2405 gAgent.mMOTD);
2406 display_startup();
2407 if (!LLViewerShaderMgr::sInitialized)
2408 {
2409 LLViewerShaderMgr::sInitialized = TRUE;
2410 LLViewerShaderMgr::instance()->setShaders();
2411 }
2370 } 2412 }
2371 2413
2372 return TRUE; 2414 return TRUE;
@@ -2389,16 +2431,15 @@ bool idle_startup()
2389 // initial outfit, but if the load hasn't started 2431 // initial outfit, but if the load hasn't started
2390 // already then something is wrong so fall back 2432 // already then something is wrong so fall back
2391 // to generic outfits. JC 2433 // to generic outfits. JC
2392 gViewerWindow->alertXml("WelcomeChooseSex", 2434 LLNotifications::instance().add("WelcomeChooseSex", LLSD(), LLSD(),
2393 callback_choose_gender, NULL); 2435 callback_choose_gender);
2394 LLStartUp::setStartupState( STATE_CLEANUP ); 2436 LLStartUp::setStartupState( STATE_CLEANUP );
2395 return TRUE; 2437 return TRUE;
2396 } 2438 }
2397 2439
2398 if (wearables_time > MAX_WEARABLES_TIME) 2440 if (wearables_time > MAX_WEARABLES_TIME)
2399 { 2441 {
2400 // It's taken too long to load, show the world 2442 LLNotifications::instance().add("ClothingLoading");
2401 gViewerWindow->alertXml("ClothingLoading");
2402 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); 2443 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG);
2403 LLStartUp::setStartupState( STATE_CLEANUP ); 2444 LLStartUp::setStartupState( STATE_CLEANUP );
2404 return TRUE; 2445 return TRUE;
@@ -2418,7 +2459,7 @@ bool idle_startup()
2418 else 2459 else
2419 { 2460 {
2420 // OK to just get the wearables 2461 // OK to just get the wearables
2421 if ( gAgent.getWearablesLoaded() ) 2462 if ( gAgent.areWearablesLoaded() )
2422 { 2463 {
2423 // We have our clothing, proceed. 2464 // We have our clothing, proceed.
2424 //llinfos << "wearables loaded" << llendl; 2465 //llinfos << "wearables loaded" << llendl;
@@ -2474,6 +2515,11 @@ bool idle_startup()
2474 // If we've got a startup URL, dispatch it 2515 // If we've got a startup URL, dispatch it
2475 LLStartUp::dispatchURL(); 2516 LLStartUp::dispatchURL();
2476 2517
2518 // Retrieve information about the land data
2519 // (just accessing this the first time will fetch it,
2520 // then the data is cached for the viewer's lifetime)
2521 LLProductInfoRequestManager::instance();
2522
2477 // Clean up the userauth stuff. 2523 // Clean up the userauth stuff.
2478 LLUserAuth::getInstance()->reset(); 2524 LLUserAuth::getInstance()->reset();
2479 2525
@@ -2549,16 +2595,11 @@ void login_callback(S32 option, void *userdata)
2549 { 2595 {
2550 // Make sure we don't save the password if the user is trying to clear it. 2596 // Make sure we don't save the password if the user is trying to clear it.
2551 std::string first, last, password; 2597 std::string first, last, password;
2552 BOOL remember = TRUE; 2598 LLPanelLogin::getFields(&first, &last, &password);
2553 LLPanelLogin::getFields(first, last, password, remember); 2599 if (!gSavedSettings.getBOOL("RememberPassword"))
2554 if (!remember)
2555 { 2600 {
2556 // turn off the setting and write out to disk 2601 // turn off the setting and write out to disk
2557 gSavedSettings.setBOOL("RememberPassword", FALSE);
2558 gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE ); 2602 gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
2559
2560 // stomp the saved password on disk
2561 save_password_to_disk(NULL);
2562 } 2603 }
2563 2604
2564 // Next iteration through main loop should shut down the app cleanly. 2605 // Next iteration through main loop should shut down the app cleanly.
@@ -2576,8 +2617,18 @@ void login_callback(S32 option, void *userdata)
2576 } 2617 }
2577} 2618}
2578 2619
2579std::string load_password_from_disk() 2620
2621// static
2622std::string LLStartUp::loadPasswordFromDisk()
2580{ 2623{
2624 // Only load password if we also intend to save it (otherwise the user
2625 // wonders what we're doing behind his back). JC
2626 BOOL remember_password = gSavedSettings.getBOOL("RememberPassword");
2627 if (!remember_password)
2628 {
2629 return std::string("");
2630 }
2631
2581 std::string hashed_password(""); 2632 std::string hashed_password("");
2582 2633
2583 // Look for legacy "marker" password from settings.ini 2634 // Look for legacy "marker" password from settings.ini
@@ -2629,41 +2680,45 @@ std::string load_password_from_disk()
2629 return hashed_password; 2680 return hashed_password;
2630} 2681}
2631 2682
2632void save_password_to_disk(const char* hashed_password) 2683
2684// static
2685void LLStartUp::savePasswordToDisk(const std::string& hashed_password)
2633{ 2686{
2634 std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, 2687 std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
2635 "password.dat"); 2688 "password.dat");
2636 if (!hashed_password) 2689 LLFILE* fp = LLFile::fopen(filepath, "wb"); /* Flawfinder: ignore */
2690 if (!fp)
2637 { 2691 {
2638 // No password, remove the file. 2692 return;
2639 LLFile::remove(filepath);
2640 } 2693 }
2641 else
2642 {
2643 LLFILE* fp = LLFile::fopen(filepath, "wb"); /* Flawfinder: ignore */
2644 if (!fp)
2645 {
2646 return;
2647 }
2648
2649 // Encipher with MAC address
2650 const S32 HASHED_LENGTH = 32;
2651 U8 buffer[HASHED_LENGTH+1];
2652 2694
2653 LLStringUtil::copy((char*)buffer, hashed_password, HASHED_LENGTH+1); 2695 // Encipher with MAC address
2696 const S32 HASHED_LENGTH = 32;
2697 U8 buffer[HASHED_LENGTH+1];
2654 2698
2655 LLXORCipher cipher(gMACAddress, 6); 2699 LLStringUtil::copy((char*)buffer, hashed_password.c_str(), HASHED_LENGTH+1);
2656 cipher.encrypt(buffer, HASHED_LENGTH);
2657 2700
2658 if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1) 2701 LLXORCipher cipher(gMACAddress, 6);
2659 { 2702 cipher.encrypt(buffer, HASHED_LENGTH);
2660 LL_WARNS("AppInit") << "Short write" << LL_ENDL;
2661 }
2662 2703
2663 fclose(fp); 2704 if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1)
2705 {
2706 LL_WARNS("AppInit") << "Short write" << LL_ENDL;
2664 } 2707 }
2708
2709 fclose(fp);
2710}
2711
2712
2713// static
2714void LLStartUp::deletePasswordFromDisk()
2715{
2716 std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
2717 "password.dat");
2718 LLFile::remove(filepath);
2665} 2719}
2666 2720
2721
2667bool is_hex_string(U8* str, S32 len) 2722bool is_hex_string(U8* str, S32 len)
2668{ 2723{
2669 bool rv = true; 2724 bool rv = true;
@@ -2700,11 +2755,12 @@ bool is_hex_string(U8* str, S32 len)
2700 2755
2701void show_first_run_dialog() 2756void show_first_run_dialog()
2702{ 2757{
2703 gViewerWindow->alertXml("FirstRun", first_run_dialog_callback, NULL); 2758 LLNotifications::instance().add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
2704} 2759}
2705 2760
2706void first_run_dialog_callback(S32 option, void* userdata) 2761bool first_run_dialog_callback(const LLSD& notification, const LLSD& response)
2707{ 2762{
2763 S32 option = LLNotification::getSelectedOption(notification, response);
2708 if (0 == option) 2764 if (0 == option)
2709 { 2765 {
2710 LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL; 2766 LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL;
@@ -2712,6 +2768,7 @@ void first_run_dialog_callback(S32 option, void* userdata)
2712 } 2768 }
2713 2769
2714 LLPanelLogin::giveFocus(); 2770 LLPanelLogin::giveFocus();
2771 return false;
2715} 2772}
2716 2773
2717 2774
@@ -2724,8 +2781,9 @@ void set_startup_status(const F32 frac, const std::string& string, const std::st
2724 gViewerWindow->setProgressMessage(msg); 2781 gViewerWindow->setProgressMessage(msg);
2725} 2782}
2726 2783
2727void login_alert_status(S32 option, void* user_data) 2784bool login_alert_status(const LLSD& notification, const LLSD& response)
2728{ 2785{
2786 S32 option = LLNotification::getSelectedOption(notification, response);
2729 // Buttons 2787 // Buttons
2730 switch( option ) 2788 switch( option )
2731 { 2789 {
@@ -2744,6 +2802,7 @@ void login_alert_status(S32 option, void* user_data)
2744 } 2802 }
2745 2803
2746 LLPanelLogin::giveFocus(); 2804 LLPanelLogin::giveFocus();
2805 return false;
2747} 2806}
2748 2807
2749void update_app(BOOL mandatory, const std::string& auth_msg) 2808void update_app(BOOL mandatory, const std::string& auth_msg)
@@ -2759,67 +2818,66 @@ void update_app(BOOL mandatory, const std::string& auth_msg)
2759 { 2818 {
2760 msg = "(" + auth_msg + ") \n"; 2819 msg = "(" + auth_msg + ") \n";
2761 } 2820 }
2762 LLStringUtil::format_map_t args;
2763 args["[MESSAGE]"] = msg;
2764
2765 // represent a bool as a null/non-null pointer
2766 void *mandatoryp = mandatory ? &mandatory : NULL;
2767 2821
2822 LLSD args;
2823 args["MESSAGE"] = msg;
2824
2825 LLSD payload;
2826 payload["mandatory"] = mandatory;
2827
2828/*
2829 We're constructing one of the following 6 strings here:
2830 "DownloadWindowsMandatory"
2831 "DownloadWindowsReleaseForDownload"
2832 "DownloadWindows"
2833 "DownloadMacMandatory"
2834 "DownloadMacReleaseForDownload"
2835 "DownloadMac"
2836
2837 I've called them out explicitly in this comment so that they can be grepped for.
2838
2839 Also, we assume that if we're not Windows we're Mac. If we ever intend to support
2840 Linux with autoupdate, this should be an explicit #elif LL_DARWIN, but
2841 we'd rather deliver the wrong message than no message, so until Linux is supported
2842 we'll leave it alone.
2843 */
2844 std::string notification_name = "Download";
2845
2768#if LL_WINDOWS 2846#if LL_WINDOWS
2769 if (mandatory) 2847 notification_name += "Windows";
2770 {
2771 gViewerWindow->alertXml("DownloadWindowsMandatory", args,
2772 update_dialog_callback,
2773 mandatoryp);
2774 }
2775 else
2776 {
2777#if LL_RELEASE_FOR_DOWNLOAD
2778 gViewerWindow->alertXml("DownloadWindowsReleaseForDownload", args,
2779 update_dialog_callback,
2780 mandatoryp);
2781#else 2848#else
2782 gViewerWindow->alertXml("DownloadWindows", args, 2849 notification_name += "Mac";
2783 update_dialog_callback,
2784 mandatoryp);
2785#endif 2850#endif
2786 } 2851
2787#else
2788 if (mandatory) 2852 if (mandatory)
2789 { 2853 {
2790 gViewerWindow->alertXml("DownloadMacMandatory", args, 2854 notification_name += "Mandatory";
2791 update_dialog_callback,
2792 mandatoryp);
2793 } 2855 }
2794 else 2856 else
2795 { 2857 {
2796#if LL_RELEASE_FOR_DOWNLOAD 2858#if LL_RELEASE_FOR_DOWNLOAD
2797 gViewerWindow->alertXml("DownloadMacReleaseForDownload", args, 2859 notification_name += "ReleaseForDownload";
2798 update_dialog_callback,
2799 mandatoryp);
2800#else
2801 gViewerWindow->alertXml("DownloadMac", args,
2802 update_dialog_callback,
2803 mandatoryp);
2804#endif 2860#endif
2805 } 2861 }
2806#endif 2862
2807 2863 LLNotifications::instance().add(notification_name, args, payload, update_dialog_callback);
2864
2808} 2865}
2809 2866
2810 2867bool update_dialog_callback(const LLSD& notification, const LLSD& response)
2811void update_dialog_callback(S32 option, void *userdata)
2812{ 2868{
2813 bool mandatory = userdata != NULL; 2869 S32 option = LLNotification::getSelectedOption(notification, response);
2870 std::string update_exe_path;
2871 bool mandatory = notification["payload"]["mandatory"].asBoolean();
2814 2872
2815#if !LL_RELEASE_FOR_DOWNLOAD 2873#if !LL_RELEASE_FOR_DOWNLOAD
2816 if (option == 2) 2874 if (option == 2)
2817 { 2875 {
2818 LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); 2876 LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT );
2819 return; 2877 return false;
2820 } 2878 }
2821#endif 2879#endif
2822 2880
2823 if (option == 1) 2881 if (option == 1)
2824 { 2882 {
2825 // ...user doesn't want to do it 2883 // ...user doesn't want to do it
@@ -2833,7 +2891,7 @@ void update_dialog_callback(S32 option, void *userdata)
2833 { 2891 {
2834 LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); 2892 LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT );
2835 } 2893 }
2836 return; 2894 return false;
2837 } 2895 }
2838 2896
2839 LLSD query_map = LLSD::emptyMap(); 2897 LLSD query_map = LLSD::emptyMap();
@@ -2844,12 +2902,15 @@ void update_dialog_callback(S32 option, void *userdata)
2844 query_map["os"] = "mac"; 2902 query_map["os"] = "mac";
2845#elif LL_LINUX 2903#elif LL_LINUX
2846 query_map["os"] = "lnx"; 2904 query_map["os"] = "lnx";
2905#elif LL_SOLARIS
2906 query_map["os"] = "sol";
2847#endif 2907#endif
2848 // *TODO change userserver to be grid on both viewer and sim, since 2908 // *TODO change userserver to be grid on both viewer and sim, since
2849 // userserver no longer exists. 2909 // userserver no longer exists.
2850 query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel(); 2910 query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
2851 query_map["channel"] = gSavedSettings.getString("VersionChannelName"); 2911 query_map["channel"] = gSavedSettings.getString("VersionChannelName");
2852 // *TODO constantize this guy 2912 // *TODO constantize this guy
2913 // *NOTE: This URL is also used in win_setup/lldownloader.cpp
2853 LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map); 2914 LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map);
2854 2915
2855 if(LLAppViewer::sUpdaterInfo) 2916 if(LLAppViewer::sUpdaterInfo)
@@ -2868,7 +2929,7 @@ void update_dialog_callback(S32 option, void *userdata)
2868 // We're hosed, bail 2929 // We're hosed, bail
2869 LL_WARNS("AppInit") << "LLDir::getTempFilename() failed" << LL_ENDL; 2930 LL_WARNS("AppInit") << "LLDir::getTempFilename() failed" << LL_ENDL;
2870 LLAppViewer::instance()->forceQuit(); 2931 LLAppViewer::instance()->forceQuit();
2871 return; 2932 return false;
2872 } 2933 }
2873 2934
2874 LLAppViewer::sUpdaterInfo->mUpdateExePath += ".exe"; 2935 LLAppViewer::sUpdaterInfo->mUpdateExePath += ".exe";
@@ -2889,7 +2950,7 @@ void update_dialog_callback(S32 option, void *userdata)
2889 2950
2890 LL_WARNS("AppInit") << "Unable to copy the updater!" << LL_ENDL; 2951 LL_WARNS("AppInit") << "Unable to copy the updater!" << LL_ENDL;
2891 LLAppViewer::instance()->forceQuit(); 2952 LLAppViewer::instance()->forceQuit();
2892 return; 2953 return false;
2893 } 2954 }
2894 2955
2895 // if a sim name was passed in via command line parameter (typically through a SLURL) 2956 // if a sim name was passed in via command line parameter (typically through a SLURL)
@@ -2927,12 +2988,13 @@ void update_dialog_callback(S32 option, void *userdata)
2927 // Run the auto-updater. 2988 // Run the auto-updater.
2928 system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */ 2989 system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */
2929 2990
2930#elif LL_LINUX 2991#elif LL_LINUX || LL_SOLARIS
2931 OSMessageBox("Automatic updating is not yet implemented for Linux.\n" 2992 OSMessageBox("Automatic updating is not yet implemented for Linux.\n"
2932 "Please download the latest version from www.secondlife.com.", 2993 "Please download the latest version from www.secondlife.com.",
2933 LLStringUtil::null, OSMB_OK); 2994 LLStringUtil::null, OSMB_OK);
2934#endif 2995#endif
2935 LLAppViewer::instance()->forceQuit(); 2996 LLAppViewer::instance()->forceQuit();
2997 return false;
2936} 2998}
2937 2999
2938void use_circuit_callback(void**, S32 result) 3000void use_circuit_callback(void**, S32 result)
@@ -2946,8 +3008,7 @@ void use_circuit_callback(void**, S32 result)
2946 { 3008 {
2947 // Make sure user knows something bad happened. JC 3009 // Make sure user knows something bad happened. JC
2948 LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL; 3010 LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
2949 gViewerWindow->alertXml("LoginPacketNeverReceived", 3011 LLNotifications::instance().add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
2950 login_alert_status, NULL);
2951 reset_login(); 3012 reset_login();
2952 } 3013 }
2953 else 3014 else
@@ -3150,570 +3211,6 @@ void init_stat_view()
3150 LLFrameStatView *frameviewp = gDebugView->mFrameStatView; 3211 LLFrameStatView *frameviewp = gDebugView->mFrameStatView;
3151 frameviewp->setup(gFrameStats); 3212 frameviewp->setup(gFrameStats);
3152 frameviewp->mShowPercent = FALSE; 3213 frameviewp->mShowPercent = FALSE;
3153
3154 LLRect rect;
3155 LLStatBar *stat_barp;
3156 rect = gDebugView->mFloaterStatsp->getRect();
3157
3158 //
3159 // Viewer advanced stats
3160 //
3161 LLStatView *stat_viewp = NULL;
3162
3163 //
3164 // Viewer Basic
3165 //
3166 stat_viewp = new LLStatView("basic stat view", "Basic", "OpenDebugStatBasic", rect);
3167 gDebugView->mFloaterStatsp->addStatView(stat_viewp);
3168
3169 stat_barp = stat_viewp->addStat("FPS", &(LLViewerStats::getInstance()->mFPSStat));
3170 stat_barp->setUnitLabel(" fps");
3171 stat_barp->mMinBar = 0.f;
3172 stat_barp->mMaxBar = 45.f;
3173 stat_barp->mTickSpacing = 7.5f;
3174 stat_barp->mLabelSpacing = 15.f;
3175 stat_barp->mPrecision = 1;
3176 stat_barp->mDisplayBar = TRUE;
3177 stat_barp->mDisplayHistory = TRUE;
3178
3179 stat_barp = stat_viewp->addStat("Bandwidth", &(LLViewerStats::getInstance()->mKBitStat));
3180 stat_barp->setUnitLabel(" kbps");
3181 stat_barp->mMinBar = 0.f;
3182 stat_barp->mMaxBar = 900.f;
3183 stat_barp->mTickSpacing = 100.f;
3184 stat_barp->mLabelSpacing = 300.f;
3185 stat_barp->mDisplayBar = TRUE;
3186 stat_barp->mDisplayHistory = FALSE;
3187
3188 stat_barp = stat_viewp->addStat("Packet Loss", &(LLViewerStats::getInstance()->mPacketsLostPercentStat));
3189 stat_barp->setUnitLabel(" %");
3190 stat_barp->mMinBar = 0.f;
3191 stat_barp->mMaxBar = 5.f;
3192 stat_barp->mTickSpacing = 1.f;
3193 stat_barp->mLabelSpacing = 1.f;
3194 stat_barp->mDisplayBar = FALSE;
3195 stat_barp->mPerSec = FALSE;
3196 stat_barp->mDisplayMean = TRUE;
3197 stat_barp->mPrecision = 1;
3198
3199 stat_barp = stat_viewp->addStat("Ping Sim", &(LLViewerStats::getInstance()->mSimPingStat));
3200 stat_barp->setUnitLabel(" msec");
3201 stat_barp->mMinBar = 0.f;
3202 stat_barp->mMaxBar = 1000.f;
3203 stat_barp->mTickSpacing = 100.f;
3204 stat_barp->mLabelSpacing = 200.f;
3205 stat_barp->mDisplayBar = FALSE;
3206 stat_barp->mPerSec = FALSE;
3207 stat_barp->mDisplayMean = FALSE;
3208
3209
3210 stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect);
3211 gDebugView->mFloaterStatsp->addStatView(stat_viewp);
3212
3213
3214 LLStatView *render_statviewp;
3215 render_statviewp = new LLStatView("render stat view", "Render", "OpenDebugStatRender", rect);
3216 stat_viewp->addChildAtEnd(render_statviewp);
3217
3218 stat_barp = render_statviewp->addStat("KTris Drawn", &(gPipeline.mTrianglesDrawnStat));
3219 stat_barp->setUnitLabel("/fr");
3220 stat_barp->mMinBar = 0.f;
3221 stat_barp->mMaxBar = 500.f;
3222 stat_barp->mTickSpacing = 100.f;
3223 stat_barp->mLabelSpacing = 500.f;
3224 stat_barp->mPrecision = 1;
3225 stat_barp->mPerSec = FALSE;
3226
3227 stat_barp = render_statviewp->addStat("KTris Drawn", &(gPipeline.mTrianglesDrawnStat));
3228 stat_barp->setUnitLabel("/sec");
3229 stat_barp->mMinBar = 0.f;
3230 stat_barp->mMaxBar = 3000.f;
3231 stat_barp->mTickSpacing = 250.f;
3232 stat_barp->mLabelSpacing = 1000.f;
3233 stat_barp->mPrecision = 1;
3234
3235 stat_barp = render_statviewp->addStat("Total Objs", &(gObjectList.mNumObjectsStat));
3236 stat_barp->mMinBar = 0.f;
3237 stat_barp->mMaxBar = 10000.f;
3238 stat_barp->mTickSpacing = 2500.f;
3239 stat_barp->mLabelSpacing = 5000.f;
3240 stat_barp->mPerSec = FALSE;
3241 stat_barp->mDisplayBar = FALSE;
3242
3243 stat_barp = render_statviewp->addStat("New Objs", &(gObjectList.mNumNewObjectsStat));
3244 stat_barp->setLabel("New Objs");
3245 stat_barp->setUnitLabel("/sec");
3246 stat_barp->mMinBar = 0.f;
3247 stat_barp->mMaxBar = 1000.f;
3248 stat_barp->mTickSpacing = 100.f;
3249 stat_barp->mLabelSpacing = 500.f;
3250 stat_barp->mPerSec = TRUE;
3251 stat_barp->mDisplayBar = FALSE;
3252
3253
3254 // Texture statistics
3255 LLStatView *texture_statviewp;
3256 texture_statviewp = new LLStatView("texture stat view", "Texture", "", rect);
3257 render_statviewp->addChildAtEnd(texture_statviewp);
3258
3259 stat_barp = texture_statviewp->addStat("Count", &(gImageList.sNumImagesStat));
3260 stat_barp->setUnitLabel("");
3261 stat_barp->mMinBar = 0.f;
3262 stat_barp->mMaxBar = 8000.f;
3263 stat_barp->mTickSpacing = 2000.f;
3264 stat_barp->mLabelSpacing = 4000.f;
3265 stat_barp->mPerSec = FALSE;
3266 stat_barp->mDisplayBar = FALSE;
3267
3268 stat_barp = texture_statviewp->addStat("Raw Count", &(gImageList.sNumRawImagesStat));
3269 stat_barp->setUnitLabel("");
3270 stat_barp->mMinBar = 0.f;
3271 stat_barp->mMaxBar = 8000.f;
3272 stat_barp->mTickSpacing = 2000.f;
3273 stat_barp->mLabelSpacing = 4000.f;
3274 stat_barp->mPerSec = FALSE;
3275 stat_barp->mDisplayBar = FALSE;
3276
3277 stat_barp = texture_statviewp->addStat("GL Mem", &(gImageList.sGLTexMemStat));
3278 stat_barp->setUnitLabel("");
3279 stat_barp->mMinBar = 0.f;
3280 stat_barp->mMaxBar = 400.f;
3281 stat_barp->mTickSpacing = 100.f;
3282 stat_barp->mLabelSpacing = 200.f;
3283 stat_barp->mPrecision = 1;
3284 stat_barp->mPerSec = FALSE;
3285
3286 stat_barp = texture_statviewp->addStat("Formatted Mem", &(gImageList.sFormattedMemStat));
3287 stat_barp->setUnitLabel("");
3288 stat_barp->mMinBar = 0.f;
3289 stat_barp->mMaxBar = 400.f;
3290 stat_barp->mTickSpacing = 100.f;
3291 stat_barp->mLabelSpacing = 200.f;
3292 stat_barp->mPrecision = 1;
3293 stat_barp->mPerSec = FALSE;
3294
3295 stat_barp = texture_statviewp->addStat("Raw Mem", &(gImageList.sRawMemStat));
3296 stat_barp->setUnitLabel("");
3297 stat_barp->mMinBar = 0.f;
3298 stat_barp->mMaxBar = 400.f;
3299 stat_barp->mTickSpacing = 100.f;
3300 stat_barp->mLabelSpacing = 200.f;
3301 stat_barp->mPrecision = 1;
3302 stat_barp->mPerSec = FALSE;
3303
3304 stat_barp = texture_statviewp->addStat("Bound Mem", &(gImageList.sGLBoundMemStat));
3305 stat_barp->setUnitLabel("");
3306 stat_barp->mMinBar = 0.f;
3307 stat_barp->mMaxBar = 400.f;
3308 stat_barp->mTickSpacing = 100.f;
3309 stat_barp->mLabelSpacing = 200.f;
3310 stat_barp->mPrecision = 1;
3311 stat_barp->mPerSec = FALSE;
3312
3313
3314 // Network statistics
3315 LLStatView *net_statviewp;
3316 net_statviewp = new LLStatView("network stat view", "Network", "OpenDebugStatNet", rect);
3317 stat_viewp->addChildAtEnd(net_statviewp);
3318
3319 stat_barp = net_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mPacketsInStat));
3320 stat_barp->setUnitLabel("/sec");
3321 stat_barp->mDisplayBar = FALSE;
3322
3323 stat_barp = net_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mPacketsOutStat));
3324 stat_barp->setUnitLabel("/sec");
3325 stat_barp->mDisplayBar = FALSE;
3326
3327 stat_barp = net_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mObjectKBitStat));
3328 stat_barp->setUnitLabel(" kbps");
3329 stat_barp->mDisplayBar = FALSE;
3330
3331 stat_barp = net_statviewp->addStat("Texture", &(LLViewerStats::getInstance()->mTextureKBitStat));
3332 stat_barp->setUnitLabel(" kbps");
3333 stat_barp->mDisplayBar = FALSE;
3334
3335 stat_barp = net_statviewp->addStat("Asset", &(LLViewerStats::getInstance()->mAssetKBitStat));
3336 stat_barp->setUnitLabel(" kbps");
3337 stat_barp->mDisplayBar = FALSE;
3338
3339 stat_barp = net_statviewp->addStat("Layers", &(LLViewerStats::getInstance()->mLayersKBitStat));
3340 stat_barp->setUnitLabel(" kbps");
3341 stat_barp->mDisplayBar = FALSE;
3342
3343 stat_barp = net_statviewp->addStat("Actual In", &(LLViewerStats::getInstance()->mActualInKBitStat));
3344 stat_barp->setUnitLabel(" kbps");
3345 stat_barp->mMinBar = 0.f;
3346 stat_barp->mMaxBar = 1024.f;
3347 stat_barp->mTickSpacing = 128.f;
3348 stat_barp->mLabelSpacing = 256.f;
3349 stat_barp->mDisplayBar = TRUE;
3350 stat_barp->mDisplayHistory = FALSE;
3351
3352 stat_barp = net_statviewp->addStat("Actual Out", &(LLViewerStats::getInstance()->mActualOutKBitStat));
3353 stat_barp->setUnitLabel(" kbps");
3354 stat_barp->mMinBar = 0.f;
3355 stat_barp->mMaxBar = 512.f;
3356 stat_barp->mTickSpacing = 128.f;
3357 stat_barp->mLabelSpacing = 256.f;
3358 stat_barp->mDisplayBar = TRUE;
3359 stat_barp->mDisplayHistory = FALSE;
3360
3361 stat_barp = net_statviewp->addStat("VFS Pending Ops", &(LLViewerStats::getInstance()->mVFSPendingOperations));
3362 stat_barp->setUnitLabel(" ");
3363 stat_barp->mPerSec = FALSE;
3364 stat_barp->mDisplayBar = FALSE;
3365
3366
3367 // Simulator stats
3368 LLStatView *sim_statviewp = new LLStatView("sim stat view", "Simulator", "OpenDebugStatSim", rect);
3369 gDebugView->mFloaterStatsp->addStatView(sim_statviewp);
3370
3371 stat_barp = sim_statviewp->addStat("Time Dilation", &(LLViewerStats::getInstance()->mSimTimeDilation));
3372 stat_barp->mPrecision = 2;
3373 stat_barp->mMinBar = 0.f;
3374 stat_barp->mMaxBar = 1.f;
3375 stat_barp->mTickSpacing = 0.25f;
3376 stat_barp->mLabelSpacing = 0.5f;
3377 stat_barp->mPerSec = FALSE;
3378 stat_barp->mDisplayBar = FALSE;
3379 stat_barp->mDisplayMean = FALSE;
3380
3381 stat_barp = sim_statviewp->addStat("Sim FPS", &(LLViewerStats::getInstance()->mSimFPS));
3382 stat_barp->mMinBar = 0.f;
3383 stat_barp->mMaxBar = 200.f;
3384 stat_barp->mTickSpacing = 20.f;
3385 stat_barp->mLabelSpacing = 100.f;
3386 stat_barp->mPerSec = FALSE;
3387 stat_barp->mDisplayBar = FALSE;
3388 stat_barp->mDisplayMean = FALSE;
3389
3390 stat_barp = sim_statviewp->addStat("Physics FPS", &(LLViewerStats::getInstance()->mSimPhysicsFPS));
3391 stat_barp->mPrecision = 1;
3392 stat_barp->mMinBar = 0.f;
3393 stat_barp->mMaxBar = 66.f;
3394 stat_barp->mTickSpacing = 33.f;
3395 stat_barp->mLabelSpacing = 33.f;
3396 stat_barp->mPerSec = FALSE;
3397 stat_barp->mDisplayBar = FALSE;
3398 stat_barp->mDisplayMean = FALSE;
3399
3400 LLStatView *phys_details_viewp;
3401 phys_details_viewp = new LLStatView("phys detail view", "Physics Details", "", rect);
3402 sim_statviewp->addChildAtEnd(phys_details_viewp);
3403
3404 stat_barp = phys_details_viewp->addStat("Pinned Objects", &(LLViewerStats::getInstance()->mPhysicsPinnedTasks));
3405 stat_barp->mPrecision = 0;
3406 stat_barp->mMinBar = 0.f;
3407 stat_barp->mMaxBar = 500.f;
3408 stat_barp->mTickSpacing = 10.f;
3409 stat_barp->mLabelSpacing = 40.f;
3410 stat_barp->mPerSec = FALSE;
3411 stat_barp->mDisplayBar = FALSE;
3412 stat_barp->mDisplayMean = FALSE;
3413
3414 stat_barp = phys_details_viewp->addStat("Low LOD Objects", &(LLViewerStats::getInstance()->mPhysicsLODTasks));
3415 stat_barp->mPrecision = 0;
3416 stat_barp->mMinBar = 0.f;
3417 stat_barp->mMaxBar = 500.f;
3418 stat_barp->mTickSpacing = 10.f;
3419 stat_barp->mLabelSpacing = 40.f;
3420 stat_barp->mPerSec = FALSE;
3421 stat_barp->mDisplayBar = FALSE;
3422 stat_barp->mDisplayMean = FALSE;
3423
3424 stat_barp = phys_details_viewp->addStat("Memory Allocated", &(LLViewerStats::getInstance()->mPhysicsMemoryAllocated));
3425 stat_barp->setUnitLabel(" MB");
3426 stat_barp->mPrecision = 0;
3427 stat_barp->mMinBar = 0.f;
3428 stat_barp->mMaxBar = 1024.f;
3429 stat_barp->mTickSpacing = 128.f;
3430 stat_barp->mLabelSpacing = 256.f;
3431 stat_barp->mPerSec = FALSE;
3432 stat_barp->mDisplayBar = FALSE;
3433 stat_barp->mDisplayMean = FALSE;
3434
3435 stat_barp = sim_statviewp->addStat("Agent Updates/Sec", &(LLViewerStats::getInstance()->mSimAgentUPS));
3436 stat_barp->mPrecision = 1;
3437 stat_barp->mMinBar = 0.f;
3438 stat_barp->mMaxBar = 100.f;
3439 stat_barp->mTickSpacing = 25.f;
3440 stat_barp->mLabelSpacing = 50.f;
3441 stat_barp->mPerSec = FALSE;
3442 stat_barp->mDisplayBar = FALSE;
3443 stat_barp->mDisplayMean = FALSE;
3444
3445 stat_barp = sim_statviewp->addStat("Main Agents", &(LLViewerStats::getInstance()->mSimMainAgents));
3446 stat_barp->mPrecision = 0;
3447 stat_barp->mMinBar = 0.f;
3448 stat_barp->mMaxBar = 80.f;
3449 stat_barp->mTickSpacing = 10.f;
3450 stat_barp->mLabelSpacing = 40.f;
3451 stat_barp->mPerSec = FALSE;
3452 stat_barp->mDisplayBar = FALSE;
3453 stat_barp->mDisplayMean = FALSE;
3454
3455 stat_barp = sim_statviewp->addStat("Child Agents", &(LLViewerStats::getInstance()->mSimChildAgents));
3456 stat_barp->mPrecision = 0;
3457 stat_barp->mMinBar = 0.f;
3458 stat_barp->mMaxBar = 40.f;
3459 stat_barp->mTickSpacing = 5.f;
3460 stat_barp->mLabelSpacing = 10.f;
3461 stat_barp->mPerSec = FALSE;
3462 stat_barp->mDisplayBar = FALSE;
3463 stat_barp->mDisplayMean = FALSE;
3464
3465 stat_barp = sim_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mSimObjects));
3466 stat_barp->mPrecision = 0;
3467 stat_barp->mMinBar = 0.f;
3468 stat_barp->mMaxBar = 30000.f;
3469 stat_barp->mTickSpacing = 5000.f;
3470 stat_barp->mLabelSpacing = 10000.f;
3471 stat_barp->mPerSec = FALSE;
3472 stat_barp->mDisplayBar = FALSE;
3473 stat_barp->mDisplayMean = FALSE;
3474
3475 stat_barp = sim_statviewp->addStat("Active Objects", &(LLViewerStats::getInstance()->mSimActiveObjects));
3476 stat_barp->mPrecision = 0;
3477 stat_barp->mMinBar = 0.f;
3478 stat_barp->mMaxBar = 800.f;
3479 stat_barp->mTickSpacing = 100.f;
3480 stat_barp->mLabelSpacing = 200.f;
3481 stat_barp->mPerSec = FALSE;
3482 stat_barp->mDisplayBar = FALSE;
3483 stat_barp->mDisplayMean = FALSE;
3484
3485 stat_barp = sim_statviewp->addStat("Active Scripts", &(LLViewerStats::getInstance()->mSimActiveScripts));
3486 stat_barp->mPrecision = 0;
3487 stat_barp->mMinBar = 0.f;
3488 stat_barp->mMaxBar = 800.f;
3489 stat_barp->mTickSpacing = 100.f;
3490 stat_barp->mLabelSpacing = 200.f;
3491 stat_barp->mPerSec = FALSE;
3492 stat_barp->mDisplayBar = FALSE;
3493 stat_barp->mDisplayMean = FALSE;
3494
3495 stat_barp = sim_statviewp->addStat("Script Events", &(LLViewerStats::getInstance()->mSimScriptEPS));
3496 stat_barp->setUnitLabel(" eps");
3497 stat_barp->mPrecision = 0;
3498 stat_barp->mMinBar = 0.f;
3499 stat_barp->mMaxBar = 20000.f;
3500 stat_barp->mTickSpacing = 2500.f;
3501 stat_barp->mLabelSpacing = 5000.f;
3502 stat_barp->mPerSec = FALSE;
3503 stat_barp->mDisplayBar = FALSE;
3504 stat_barp->mDisplayMean = FALSE;
3505
3506 stat_barp = sim_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mSimInPPS));
3507 stat_barp->setUnitLabel(" pps");
3508 stat_barp->mPrecision = 0;
3509 stat_barp->mMinBar = 0.f;
3510 stat_barp->mMaxBar = 2000.f;
3511 stat_barp->mTickSpacing = 250.f;
3512 stat_barp->mLabelSpacing = 1000.f;
3513 stat_barp->mPerSec = FALSE;
3514 stat_barp->mDisplayBar = FALSE;
3515 stat_barp->mDisplayMean = FALSE;
3516
3517 stat_barp = sim_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mSimOutPPS));
3518 stat_barp->setUnitLabel(" pps");
3519 stat_barp->mPrecision = 0;
3520 stat_barp->mMinBar = 0.f;
3521 stat_barp->mMaxBar = 2000.f;
3522 stat_barp->mTickSpacing = 250.f;
3523 stat_barp->mLabelSpacing = 1000.f;
3524 stat_barp->mPerSec = FALSE;
3525 stat_barp->mDisplayBar = FALSE;
3526 stat_barp->mDisplayMean = FALSE;
3527
3528 stat_barp = sim_statviewp->addStat("Pending Downloads", &(LLViewerStats::getInstance()->mSimPendingDownloads));
3529 stat_barp->mPrecision = 0;
3530 stat_barp->mMinBar = 0.f;
3531 stat_barp->mMaxBar = 800.f;
3532 stat_barp->mTickSpacing = 100.f;
3533 stat_barp->mLabelSpacing = 200.f;
3534 stat_barp->mPerSec = FALSE;
3535 stat_barp->mDisplayBar = FALSE;
3536 stat_barp->mDisplayMean = FALSE;
3537
3538 stat_barp = sim_statviewp->addStat("Pending Uploads", &(LLViewerStats::getInstance()->mSimPendingUploads));
3539 stat_barp->mPrecision = 0;
3540 stat_barp->mMinBar = 0.f;
3541 stat_barp->mMaxBar = 100.f;
3542 stat_barp->mTickSpacing = 25.f;
3543 stat_barp->mLabelSpacing = 50.f;
3544 stat_barp->mPerSec = FALSE;
3545 stat_barp->mDisplayBar = FALSE;
3546 stat_barp->mDisplayMean = FALSE;
3547
3548 stat_barp = sim_statviewp->addStat("Total Unacked Bytes", &(LLViewerStats::getInstance()->mSimTotalUnackedBytes));
3549 stat_barp->setUnitLabel(" kb");
3550 stat_barp->mPrecision = 0;
3551 stat_barp->mMinBar = 0.f;
3552 stat_barp->mMaxBar = 100000.f;
3553 stat_barp->mTickSpacing = 25000.f;
3554 stat_barp->mLabelSpacing = 50000.f;
3555 stat_barp->mPerSec = FALSE;
3556 stat_barp->mDisplayBar = FALSE;
3557 stat_barp->mDisplayMean = FALSE;
3558
3559 LLStatView *sim_time_viewp;
3560 sim_time_viewp = new LLStatView("sim perf view", "Time (ms)", "", rect);
3561 sim_statviewp->addChildAtEnd(sim_time_viewp);
3562
3563 stat_barp = sim_time_viewp->addStat("Total Frame Time", &(LLViewerStats::getInstance()->mSimFrameMsec));
3564 stat_barp->setUnitLabel("ms");
3565 stat_barp->mPrecision = 1;
3566 stat_barp->mMinBar = 0.f;
3567 stat_barp->mMaxBar = 40.f;
3568 stat_barp->mTickSpacing = 10.f;
3569 stat_barp->mLabelSpacing = 20.f;
3570 stat_barp->mPerSec = FALSE;
3571 stat_barp->mDisplayBar = FALSE;
3572 stat_barp->mDisplayMean = FALSE;
3573
3574 stat_barp = sim_time_viewp->addStat("Net Time", &(LLViewerStats::getInstance()->mSimNetMsec));
3575 stat_barp->setUnitLabel("ms");
3576 stat_barp->mPrecision = 1;
3577 stat_barp->mMinBar = 0.f;
3578 stat_barp->mMaxBar = 40.f;
3579 stat_barp->mTickSpacing = 10.f;
3580 stat_barp->mLabelSpacing = 20.f;
3581 stat_barp->mPerSec = FALSE;
3582 stat_barp->mDisplayBar = FALSE;
3583 stat_barp->mDisplayMean = FALSE;
3584
3585 stat_barp = sim_time_viewp->addStat("Physics Time", &(LLViewerStats::getInstance()->mSimSimPhysicsMsec));
3586 stat_barp->setUnitLabel("ms");
3587 stat_barp->mPrecision = 1;
3588 stat_barp->mMinBar = 0.f;
3589 stat_barp->mMaxBar = 40.f;
3590 stat_barp->mTickSpacing = 10.f;
3591 stat_barp->mLabelSpacing = 20.f;
3592 stat_barp->mPerSec = FALSE;
3593 stat_barp->mDisplayBar = FALSE;
3594 stat_barp->mDisplayMean = FALSE;
3595
3596 stat_barp = sim_time_viewp->addStat("Simulation Time", &(LLViewerStats::getInstance()->mSimSimOtherMsec));
3597 stat_barp->setUnitLabel("ms");
3598 stat_barp->mPrecision = 1;
3599 stat_barp->mMinBar = 0.f;
3600 stat_barp->mMaxBar = 40.f;
3601 stat_barp->mTickSpacing = 10.f;
3602 stat_barp->mLabelSpacing = 20.f;
3603 stat_barp->mPerSec = FALSE;
3604 stat_barp->mDisplayBar = FALSE;
3605 stat_barp->mDisplayMean = FALSE;
3606
3607 stat_barp = sim_time_viewp->addStat("Agent Time", &(LLViewerStats::getInstance()->mSimAgentMsec));
3608 stat_barp->setUnitLabel("ms");
3609 stat_barp->mPrecision = 1;
3610 stat_barp->mMinBar = 0.f;
3611 stat_barp->mMaxBar = 40.f;
3612 stat_barp->mTickSpacing = 10.f;
3613 stat_barp->mLabelSpacing = 20.f;
3614 stat_barp->mPerSec = FALSE;
3615 stat_barp->mDisplayBar = FALSE;
3616 stat_barp->mDisplayMean = FALSE;
3617
3618 stat_barp = sim_time_viewp->addStat("Images Time", &(LLViewerStats::getInstance()->mSimImagesMsec));
3619 stat_barp->setUnitLabel("ms");
3620 stat_barp->mPrecision = 1;
3621 stat_barp->mMinBar = 0.f;
3622 stat_barp->mMaxBar = 40.f;
3623 stat_barp->mTickSpacing = 10.f;
3624 stat_barp->mLabelSpacing = 20.f;
3625 stat_barp->mPerSec = FALSE;
3626 stat_barp->mDisplayBar = FALSE;
3627 stat_barp->mDisplayMean = FALSE;
3628
3629 stat_barp = sim_time_viewp->addStat("Script Time", &(LLViewerStats::getInstance()->mSimScriptMsec));
3630 stat_barp->setUnitLabel("ms");
3631 stat_barp->mPrecision = 1;
3632 stat_barp->mMinBar = 0.f;
3633 stat_barp->mMaxBar = 40.f;
3634 stat_barp->mTickSpacing = 10.f;
3635 stat_barp->mLabelSpacing = 20.f;
3636 stat_barp->mPerSec = FALSE;
3637 stat_barp->mDisplayBar = FALSE;
3638 stat_barp->mDisplayMean = FALSE;
3639
3640 stat_barp = sim_time_viewp->addStat("Spare Time", &(LLViewerStats::getInstance()->mSimSpareMsec));
3641 stat_barp->setUnitLabel("ms");
3642 stat_barp->mPrecision = 1;
3643 stat_barp->mMinBar = 0.f;
3644 stat_barp->mMaxBar = 40.f;
3645 stat_barp->mTickSpacing = 10.f;
3646 stat_barp->mLabelSpacing = 20.f;
3647 stat_barp->mPerSec = FALSE;
3648 stat_barp->mDisplayBar = FALSE;
3649 stat_barp->mDisplayMean = FALSE;
3650
3651
3652 // 2nd level time blocks under 'Details' second
3653 LLStatView *detailed_time_viewp;
3654 detailed_time_viewp = new LLStatView("sim perf view", "Time Details (ms)", "", rect);
3655 sim_time_viewp->addChildAtEnd(detailed_time_viewp);
3656 {
3657 stat_barp = detailed_time_viewp->addStat(" Physics Step", &(LLViewerStats::getInstance()->mSimSimPhysicsStepMsec));
3658 stat_barp->setUnitLabel("ms");
3659 stat_barp->mPrecision = 1;
3660 stat_barp->mMinBar = 0.f;
3661 stat_barp->mMaxBar = 40.f;
3662 stat_barp->mTickSpacing = 10.f;
3663 stat_barp->mLabelSpacing = 20.f;
3664 stat_barp->mPerSec = FALSE;
3665 stat_barp->mDisplayBar = FALSE;
3666 stat_barp->mDisplayMean = FALSE;
3667
3668 stat_barp = detailed_time_viewp->addStat(" Update Physics Shapes", &(LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec));
3669 stat_barp->setUnitLabel("ms");
3670 stat_barp->mPrecision = 1;
3671 stat_barp->mMinBar = 0.f;
3672 stat_barp->mMaxBar = 40.f;
3673 stat_barp->mTickSpacing = 10.f;
3674 stat_barp->mLabelSpacing = 20.f;
3675 stat_barp->mPerSec = FALSE;
3676 stat_barp->mDisplayBar = FALSE;
3677 stat_barp->mDisplayMean = FALSE;
3678
3679 stat_barp = detailed_time_viewp->addStat(" Physics Other", &(LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec));
3680 stat_barp->setUnitLabel("ms");
3681 stat_barp->mPrecision = 1;
3682 stat_barp->mMinBar = 0.f;
3683 stat_barp->mMaxBar = 40.f;
3684 stat_barp->mTickSpacing = 10.f;
3685 stat_barp->mLabelSpacing = 20.f;
3686 stat_barp->mPerSec = FALSE;
3687 stat_barp->mDisplayBar = FALSE;
3688 stat_barp->mDisplayMean = FALSE;
3689
3690 stat_barp = detailed_time_viewp->addStat(" Sleep Time", &(LLViewerStats::getInstance()->mSimSleepMsec));
3691 stat_barp->setUnitLabel("ms");
3692 stat_barp->mPrecision = 1;
3693 stat_barp->mMinBar = 0.f;
3694 stat_barp->mMaxBar = 40.f;
3695 stat_barp->mTickSpacing = 10.f;
3696 stat_barp->mLabelSpacing = 20.f;
3697 stat_barp->mPerSec = FALSE;
3698 stat_barp->mDisplayBar = FALSE;
3699 stat_barp->mDisplayMean = FALSE;
3700
3701 stat_barp = detailed_time_viewp->addStat(" Pump IO", &(LLViewerStats::getInstance()->mSimPumpIOMsec));
3702 stat_barp->setUnitLabel("ms");
3703 stat_barp->mPrecision = 1;
3704 stat_barp->mMinBar = 0.f;
3705 stat_barp->mMaxBar = 40.f;
3706 stat_barp->mTickSpacing = 10.f;
3707 stat_barp->mLabelSpacing = 20.f;
3708 stat_barp->mPerSec = FALSE;
3709 stat_barp->mDisplayBar = FALSE;
3710 stat_barp->mDisplayMean = FALSE;
3711 }
3712
3713 LLRect r = gDebugView->mFloaterStatsp->getRect();
3714
3715 // Reshape based on the parameters we set.
3716 gDebugView->mFloaterStatsp->reshape(r.getWidth(), r.getHeight());
3717} 3214}
3718 3215
3719void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32) 3216void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32)
@@ -3731,8 +3228,9 @@ const S32 OPT_CLOSED_WINDOW = -1;
3731const S32 OPT_MALE = 0; 3228const S32 OPT_MALE = 0;
3732const S32 OPT_FEMALE = 1; 3229const S32 OPT_FEMALE = 1;
3733 3230
3734void callback_choose_gender(S32 option, void* userdata) 3231bool callback_choose_gender(const LLSD& notification, const LLSD& response)
3735{ 3232{
3233 S32 option = LLNotification::getSelectedOption(notification, response);
3736 switch(option) 3234 switch(option)
3737 { 3235 {
3738 case OPT_MALE: 3236 case OPT_MALE:
@@ -3745,6 +3243,7 @@ void callback_choose_gender(S32 option, void* userdata)
3745 LLStartUp::loadInitialOutfit( FEMALE_OUTFIT_FOLDER, "female" ); 3243 LLStartUp::loadInitialOutfit( FEMALE_OUTFIT_FOLDER, "female" );
3746 break; 3244 break;
3747 } 3245 }
3246 return false;
3748} 3247}
3749 3248
3750void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, 3249void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
@@ -3787,8 +3286,8 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
3787 // This is really misnamed -- it means we have started loading 3286 // This is really misnamed -- it means we have started loading
3788 // an outfit/shape that will give the avatar a gender eventually. JC 3287 // an outfit/shape that will give the avatar a gender eventually. JC
3789 gAgent.setGenderChosen(TRUE); 3288 gAgent.setGenderChosen(TRUE);
3289
3790} 3290}
3791
3792 3291
3793// Loads a bitmap to display during load 3292// Loads a bitmap to display during load
3794// location_id = 0 => last position 3293// location_id = 0 => last position
@@ -3910,8 +3409,7 @@ void reset_login()
3910 } 3409 }
3911 3410
3912 // Hide any other stuff 3411 // Hide any other stuff
3913 if ( gFloaterMap ) 3412 LLFloaterMap::hideInstance();
3914 gFloaterMap->setVisible( FALSE );
3915} 3413}
3916 3414
3917//--------------------------------------------------------------------------- 3415//---------------------------------------------------------------------------
@@ -3941,8 +3439,9 @@ bool LLStartUp::dispatchURL()
3941 // ok, if we've gotten this far and have a startup URL 3439 // ok, if we've gotten this far and have a startup URL
3942 if (!sSLURLCommand.empty()) 3440 if (!sSLURLCommand.empty())
3943 { 3441 {
3944 const bool from_external_browser = true; 3442 LLWebBrowserCtrl* web = NULL;
3945 LLURLDispatcher::dispatch(sSLURLCommand, from_external_browser); 3443 const bool trusted_browser = false;
3444 LLURLDispatcher::dispatch(sSLURLCommand, web, trusted_browser);
3946 } 3445 }
3947 else if (LLURLSimString::parse()) 3446 else if (LLURLSimString::parse())
3948 { 3447 {
@@ -3958,17 +3457,19 @@ bool LLStartUp::dispatchURL()
3958 || (dy*dy > SLOP*SLOP) ) 3457 || (dy*dy > SLOP*SLOP) )
3959 { 3458 {
3960 std::string url = LLURLSimString::getURL(); 3459 std::string url = LLURLSimString::getURL();
3961 const bool from_external_browser = true; 3460 LLWebBrowserCtrl* web = NULL;
3962 LLURLDispatcher::dispatch(url, from_external_browser); 3461 const bool trusted_browser = false;
3462 LLURLDispatcher::dispatch(url, web, trusted_browser);
3963 } 3463 }
3964 return true; 3464 return true;
3965 } 3465 }
3966 return false; 3466 return false;
3967} 3467}
3968 3468
3969void login_alert_done(S32 option, void* user_data) 3469bool login_alert_done(const LLSD& notification, const LLSD& response)
3970{ 3470{
3971 LLPanelLogin::giveFocus(); 3471 LLPanelLogin::giveFocus();
3472 return false;
3972} 3473}
3973 3474
3974 3475