aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llstartup.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llstartup.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llstartup.cpp240
1 files changed, 58 insertions, 182 deletions
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 2e7e609..69ac136 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -134,6 +134,7 @@
134#include "llui.h" 134#include "llui.h"
135#include "llurldispatcher.h" 135#include "llurldispatcher.h"
136#include "llurlsimstring.h" 136#include "llurlsimstring.h"
137#include "llurlhistory.h"
137#include "llurlwhitelist.h" 138#include "llurlwhitelist.h"
138#include "lluserauth.h" 139#include "lluserauth.h"
139#include "llvieweraudio.h" 140#include "llvieweraudio.h"
@@ -143,10 +144,12 @@
143#include "llviewergenericmessage.h" 144#include "llviewergenericmessage.h"
144#include "llviewergesture.h" 145#include "llviewergesture.h"
145#include "llviewerimagelist.h" 146#include "llviewerimagelist.h"
147#include "llviewermedia.h"
146#include "llviewermenu.h" 148#include "llviewermenu.h"
147#include "llviewermessage.h" 149#include "llviewermessage.h"
148#include "llviewernetwork.h" 150#include "llviewernetwork.h"
149#include "llviewerobjectlist.h" 151#include "llviewerobjectlist.h"
152#include "llviewerparcelmedia.h"
150#include "llviewerparcelmgr.h" 153#include "llviewerparcelmgr.h"
151#include "llviewerregion.h" 154#include "llviewerregion.h"
152#include "llviewerstats.h" 155#include "llviewerstats.h"
@@ -160,7 +163,6 @@
160#include "llxfermanager.h" 163#include "llxfermanager.h"
161#include "pipeline.h" 164#include "pipeline.h"
162#include "llappviewer.h" 165#include "llappviewer.h"
163#include "llmediaengine.h"
164#include "llfasttimerview.h" 166#include "llfasttimerview.h"
165#include "llfloatermap.h" 167#include "llfloatermap.h"
166#include "llweb.h" 168#include "llweb.h"
@@ -168,28 +170,15 @@
168#include "llnamelistctrl.h" 170#include "llnamelistctrl.h"
169#include "llnamebox.h" 171#include "llnamebox.h"
170#include "llnameeditor.h" 172#include "llnameeditor.h"
171 173#include "llpostprocess.h"
172#if LL_LIBXUL_ENABLED 174#include "llwlparammanager.h"
173#include "llmozlib.h" 175#include "llwaterparammanager.h"
174#endif // LL_LIBXUL_ENABLED
175 176
176#if LL_WINDOWS 177#if LL_WINDOWS
177#include "llwindebug.h" 178#include "llwindebug.h"
178#include "lldxhardware.h" 179#include "lldxhardware.h"
179#endif 180#endif
180 181
181#if LL_QUICKTIME_ENABLED
182#if LL_DARWIN
183#include <QuickTime/QuickTime.h>
184#else
185// quicktime specific includes
186#include "MacTypes.h"
187#include "QTML.h"
188#include "Movies.h"
189#include "FixMath.h"
190#endif
191#endif
192
193// 182//
194// exported globals 183// exported globals
195// 184//
@@ -213,8 +202,6 @@ LLPointer<LLImageGL> gStartImageGL;
213static LLHost gAgentSimHost; 202static LLHost gAgentSimHost;
214static BOOL gSkipOptionalUpdate = FALSE; 203static BOOL gSkipOptionalUpdate = FALSE;
215 204
216bool gUseQuickTime = true;
217bool gQuickTimeInitialized = false;
218static bool gGotUseCircuitCodeAck = false; 205static bool gGotUseCircuitCodeAck = false;
219LLString gInitialOutfit; 206LLString gInitialOutfit;
220LLString gInitialOutfitGender; // "male" or "female" 207LLString gInitialOutfitGender; // "male" or "female"
@@ -545,80 +532,7 @@ BOOL idle_startup()
545 // initialize the economy 532 // initialize the economy
546 gGlobalEconomy = new LLGlobalEconomy(); 533 gGlobalEconomy = new LLGlobalEconomy();
547 534
548 //---------------------------------------------------------------------
549 // LibXUL (Mozilla) initialization
550 //---------------------------------------------------------------------
551 #if LL_LIBXUL_ENABLED
552 set_startup_status(0.58f, "Initializing embedded web browser...", gAgent.mMOTD.c_str());
553 display_startup();
554 llinfos << "Initializing embedded web browser..." << llendl;
555
556 #if LL_DARWIN
557 // For Mac OS, we store both the shared libraries and the runtime files (chrome/, plugins/, etc) in
558 // Second Life.app/Contents/MacOS/. This matches the way Firefox is distributed on the Mac.
559 std::string componentDir(gDirUtilp->getExecutableDir());
560 #elif LL_WINDOWS
561 std::string componentDir( gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "" ) );
562 componentDir += gDirUtilp->getDirDelimiter();
563 #ifdef LL_DEBUG
564 componentDir += "mozilla_debug";
565 #else
566 componentDir += "mozilla";
567 #endif
568 #elif LL_LINUX
569 std::string componentDir( gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "" ) );
570 componentDir += gDirUtilp->getDirDelimiter();
571 componentDir += "mozilla-runtime-linux-i686";
572 #else
573 std::string componentDir( gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "" ) );
574 componentDir += gDirUtilp->getDirDelimiter();
575 componentDir += "mozilla";
576 #endif
577
578#if LL_LINUX
579 // Yuck, Mozilla init plays with the locale - push/pop
580 // the locale to protect it, as exotic/non-C locales
581 // causes our code lots of general critical weirdness
582 // and crashness. (SL-35450)
583 std::string saved_locale = setlocale(LC_ALL, NULL);
584#endif // LL_LINUX
585
586 // initialize Mozilla - pass in executable dir, location of extra dirs (chrome/, greprefs/, plugins/ etc.) and path to profile dir)
587
588 std::string application_dir;
589 std::string component_dir;
590 std::string profile_dir;
591 535
592#if LL_WINDOWS
593 // Fix strings passed into Mozilla; it expects local-codepage mbcs paths rather than UTF8
594 llutf16string temp_16str = utf8str_to_utf16str( gDirUtilp->getExecutableDir() );
595 application_dir = ll_convert_wide_to_string( (const wchar_t*) temp_16str.c_str() );
596
597 temp_16str = utf8str_to_utf16str( componentDir );
598 component_dir = ll_convert_wide_to_string( (const wchar_t*) temp_16str.c_str() );
599
600 temp_16str = utf8str_to_utf16str( gDirUtilp->getExpandedFilename( LL_PATH_MOZILLA_PROFILE, "" ).c_str() );
601 profile_dir = ll_convert_wide_to_string( (const wchar_t*) temp_16str.c_str() );
602#else
603 application_dir = gDirUtilp->getExecutableDir().c_str();
604 component_dir = componentDir.c_str();
605 profile_dir = gDirUtilp->getExpandedFilename( LL_PATH_MOZILLA_PROFILE, "" ).c_str();
606#endif
607
608 LLMozLib::getInstance()->init( application_dir, componentDir, profile_dir );
609
610#if LL_LINUX
611 setlocale(LC_ALL, saved_locale.c_str() );
612#endif // LL_LINUX
613
614 std::ostringstream codec;
615 codec << "[Second Life ";
616 codec << "(" << gChannelName << ")";
617 codec << " - " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD;
618 codec << "]";
619 LLMozLib::getInstance()->setBrowserAgentId( codec.str() );
620 LLMozLib::getInstance()->enableProxy( gSavedSettings.getBOOL("BrowserProxyEnabled"), gSavedSettings.getString("BrowserProxyAddress"), gSavedSettings.getS32("BrowserProxyPort") );
621 #endif
622 536
623 //------------------------------------------------- 537 //-------------------------------------------------
624 // Init audio, which may be needed for prefs dialog 538 // Init audio, which may be needed for prefs dialog
@@ -715,7 +629,29 @@ BOOL idle_startup()
715 show_connect_box = TRUE; 629 show_connect_box = TRUE;
716 } 630 }
717 631
632
718 // Go to the next startup state 633 // Go to the next startup state
634 LLStartUp::setStartupState( STATE_MEDIA_INIT );
635 return do_normal_idle;
636 }
637
638
639 //---------------------------------------------------------------------
640 // LLMediaEngine Init
641 //---------------------------------------------------------------------
642 if (STATE_MEDIA_INIT == LLStartUp::getStartupState())
643 {
644 llinfos << "Initializing Multimedia...." << llendl;
645 set_startup_status(0.03f, "Initializing Multimedia...", gAgent.mMOTD.c_str());
646 display_startup();
647 LLViewerMedia::initClass();
648 LLViewerParcelMedia::initClass();
649
650 if (gViewerWindow)
651 {
652 audio_update_volume(true);
653 }
654
719 LLStartUp::setStartupState( STATE_LOGIN_SHOW ); 655 LLStartUp::setStartupState( STATE_LOGIN_SHOW );
720 return do_normal_idle; 656 return do_normal_idle;
721 } 657 }
@@ -913,6 +849,9 @@ BOOL idle_startup()
913 &LLURLDispatcher::dispatchFromTextEditor, 849 &LLURLDispatcher::dispatchFromTextEditor,
914 &LLURLDispatcher::dispatchFromTextEditor ); 850 &LLURLDispatcher::dispatchFromTextEditor );
915 851
852 // Load URL History File
853 LLURLHistory::loadFile("url_history.xml");
854
916 //------------------------------------------------- 855 //-------------------------------------------------
917 // Handle startup progress screen 856 // Handle startup progress screen
918 //------------------------------------------------- 857 //-------------------------------------------------
@@ -955,7 +894,7 @@ BOOL idle_startup()
955 894
956 // Poke the VFS, which could potentially block for a while if 895 // Poke the VFS, which could potentially block for a while if
957 // Windows XP is acting up 896 // Windows XP is acting up
958 set_startup_status(0.05f, "Verifying cache files (can take 60-90 seconds)...", NULL); 897 set_startup_status(0.07f, "Verifying cache files (can take 60-90 seconds)...", NULL);
959 display_startup(); 898 display_startup();
960 899
961 gVFS->pokeFiles(); 900 gVFS->pokeFiles();
@@ -1398,8 +1337,13 @@ BOOL idle_startup()
1398 const char* look_at_str = gUserAuthp->getResponse("look_at"); 1337 const char* look_at_str = gUserAuthp->getResponse("look_at");
1399 if (look_at_str) 1338 if (look_at_str)
1400 { 1339 {
1401 LLMemoryStream mstr((U8*)look_at_str, strlen(look_at_str)); /* Flawfinder: ignore */ 1340#if !LL_WINDOWS && !LL_DARWIN
1402 LLSD sd = LLSDNotationParser::parse(mstr); 1341 size_t len = strnlen(look_at_str, MAX_STRING);
1342#else
1343 size_t len = strlen(look_at_str);
1344#endif
1345 LLMemoryStream mstr((U8*)look_at_str, len);
1346 LLSD sd = LLSDSerialize::fromNotation(mstr, len);
1403 agent_start_look_at = ll_vector3_from_sd(sd); 1347 agent_start_look_at = ll_vector3_from_sd(sd);
1404 } 1348 }
1405 1349
@@ -1420,8 +1364,13 @@ BOOL idle_startup()
1420 const char* home_location = gUserAuthp->getResponse("home"); 1364 const char* home_location = gUserAuthp->getResponse("home");
1421 if(home_location) 1365 if(home_location)
1422 { 1366 {
1423 LLMemoryStream mstr((U8*)home_location, strlen(home_location)); /* Flawfinder: ignore */ 1367#if !LL_WINDOWS && !LL_DARWIN
1424 LLSD sd = LLSDNotationParser::parse(mstr); 1368 size_t len = strnlen(home_location, MAX_STRING);
1369#else
1370 size_t len = strlen(home_location);
1371#endif
1372 LLMemoryStream mstr((U8*)home_location, len);
1373 LLSD sd = LLSDSerialize::fromNotation(mstr, len);
1425 S32 region_x = sd["region_handle"][0].asInteger(); 1374 S32 region_x = sd["region_handle"][0].asInteger();
1426 S32 region_y = sd["region_handle"][1].asInteger(); 1375 S32 region_y = sd["region_handle"][1].asInteger();
1427 U64 region_handle = to_region_handle(region_x, region_y); 1376 U64 region_handle = to_region_handle(region_x, region_y);
@@ -1594,6 +1543,11 @@ BOOL idle_startup()
1594 1543
1595 LLDrawable::initClass(); 1544 LLDrawable::initClass();
1596 1545
1546 // init the shader managers
1547 LLPostProcess::initClass();
1548 LLWLParamManager::initClass();
1549 LLWaterParamManager::initClass();
1550
1597 // RN: don't initialize VO classes in drone mode, they are too closely tied to rendering 1551 // RN: don't initialize VO classes in drone mode, they are too closely tied to rendering
1598 LLViewerObject::initVOClasses(); 1552 LLViewerObject::initVOClasses();
1599 1553
@@ -1785,7 +1739,7 @@ BOOL idle_startup()
1785 display_startup(); 1739 display_startup();
1786 gImageList.decodeAllImages(1.f); 1740 gImageList.decodeAllImages(1.f);
1787 } 1741 }
1788 LLStartUp::setStartupState( STATE_QUICKTIME_INIT ); 1742 LLStartUp::setStartupState( STATE_WORLD_WAIT );
1789 1743
1790 // JC - Do this as late as possible to increase likelihood Purify 1744 // JC - Do this as late as possible to increase likelihood Purify
1791 // will run. 1745 // will run.
@@ -1819,79 +1773,8 @@ BOOL idle_startup()
1819 } 1773 }
1820 1774
1821 //--------------------------------------------------------------------- 1775 //---------------------------------------------------------------------
1822 // LLMediaEngine Init
1823 //---------------------------------------------------------------------
1824 if (STATE_QUICKTIME_INIT == LLStartUp::getStartupState())
1825 {
1826 if (gViewerWindow)
1827 {
1828 audio_update_volume(true);
1829 }
1830
1831 #if LL_QUICKTIME_ENABLED // windows only right now but will be ported to mac
1832 if (gUseQuickTime)
1833 {
1834 if(!gQuickTimeInitialized)
1835 {
1836 // initialize quicktime libraries (fails gracefully if quicktime not installed ($QUICKTIME)
1837 llinfos << "Initializing QuickTime...." << llendl;
1838 set_startup_status(0.57f, "Initializing QuickTime...", gAgent.mMOTD.c_str());
1839 display_startup();
1840 #if LL_WINDOWS
1841 // Only necessary/available on Windows.
1842 if ( InitializeQTML ( 0L ) != noErr )
1843 {
1844 // quicktime init failed - turn off media engine support
1845 LLMediaEngine::getInstance ()->setAvailable ( FALSE );
1846 llinfos << "...not found - unable to initialize." << llendl;
1847 set_startup_status(0.57f, "QuickTime not found - unable to initialize.", gAgent.mMOTD.c_str());
1848 }
1849 else
1850 {
1851 llinfos << "QUICKTIME> QuickTime version (hex) is " << std::hex << LLMediaEngine::getInstance()->getQuickTimeVersion() << llendl;
1852 llinfos << "QUICKTIME> QuickTime version is " << std::dec << LLMediaEngine::getInstance()->getQuickTimeVersion() << llendl;
1853 if ( LLMediaEngine::getInstance()->getQuickTimeVersion() < LL_MIN_QUICKTIME_VERSION )
1854 {
1855 // turn off QuickTime if version is less than required
1856 LLMediaEngine::getInstance ()->setAvailable ( FALSE );
1857
1858 // display a message here explaining why we disabled QuickTime
1859 gViewerWindow->alertXml("QuickTimeOutOfDate");
1860 }
1861 else
1862 {
1863 llinfos << ".. initialized successfully." << llendl;
1864 set_startup_status(0.57f, "QuickTime initialized successfully.", gAgent.mMOTD.c_str());
1865 };
1866 };
1867 #elif LL_DARWIN
1868 llinfos << "QUICKTIME> QuickTime version (hex) is " << std::hex << LLMediaEngine::getInstance()->getQuickTimeVersion() << llendl;
1869 llinfos << "QUICKTIME> QuickTime version is " << std::dec << LLMediaEngine::getInstance()->getQuickTimeVersion() << llendl;
1870 if ( LLMediaEngine::getInstance()->getQuickTimeVersion() < LL_MIN_QUICKTIME_VERSION )
1871 {
1872 // turn off QuickTime if version is less than required
1873 LLMediaEngine::getInstance ()->setAvailable ( FALSE );
1874 1776
1875 // display a message here explaining why we disabled QuickTime
1876 gViewerWindow->alertXml("QuickTimeOutOfDate");
1877 }
1878 #endif
1879
1880 EnterMovies ();
1881 gQuickTimeInitialized = true;
1882 }
1883 }
1884 else
1885 {
1886 LLMediaEngine::getInstance()->setAvailable( FALSE );
1887 }
1888 #endif
1889 1777
1890 LLStartUp::setStartupState( STATE_WORLD_WAIT );
1891 return do_normal_idle;
1892 }
1893
1894 //---------------------------------------------------------------------
1895 // Agent Send 1778 // Agent Send
1896 //--------------------------------------------------------------------- 1779 //---------------------------------------------------------------------
1897 if(STATE_WORLD_WAIT == LLStartUp::getStartupState()) 1780 if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
@@ -2437,8 +2320,13 @@ BOOL idle_startup()
2437 2320
2438 LLStartUp::setStartupState( STATE_STARTED ); 2321 LLStartUp::setStartupState( STATE_STARTED );
2439 2322
2440 // Unmute audio if desired and setup volumes 2323 // Unmute audio if desired and setup volumes.
2324 // Unmute audio if desired and setup volumes.
2325 // This is a not-uncommon crash site, so surround it with
2326 // llinfos output to aid diagnosis.
2327 llinfos << "Doing first audio_update_volume..." << llendl;
2441 audio_update_volume(); 2328 audio_update_volume();
2329 llinfos << "Done first audio_update_volume." << llendl;
2442 2330
2443 // reset keyboard focus to sane state of pointing at world 2331 // reset keyboard focus to sane state of pointing at world
2444 gFocusMgr.setKeyboardFocus(NULL); 2332 gFocusMgr.setKeyboardFocus(NULL);
@@ -3132,18 +3020,6 @@ void register_viewer_callbacks(LLMessageSystem* msg)
3132 3020
3133 msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply); 3021 msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply);
3134 3022
3135 // Reponse to the "Refresh" button on land objects floater.
3136 if (gSavedSettings.getBOOL("AudioStreamingVideo"))
3137 {
3138 msg->setHandlerFunc("ParcelMediaCommandMessage", LLMediaEngine::process_parcel_media);
3139 msg->setHandlerFunc ( "ParcelMediaUpdate", LLMediaEngine::process_parcel_media_update );
3140 }
3141 else
3142 {
3143 msg->setHandlerFunc("ParcelMediaCommandMessage", null_message_callback);
3144 gMessageSystem->setHandlerFunc ( "ParcelMediaUpdate", null_message_callback );
3145 }
3146
3147 msg->setHandlerFunc("InitiateDownload", process_initiate_download); 3023 msg->setHandlerFunc("InitiateDownload", process_initiate_download);
3148 msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply); 3024 msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply);
3149 msg->setHandlerFunc("GenericMessage", process_generic_message); 3025 msg->setHandlerFunc("GenericMessage", process_generic_message);