summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp161
1 files changed, 114 insertions, 47 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 92db908059..d67dd3adcb 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -62,6 +62,8 @@
#include "llviewerwindow.h"
#include "llviewerdisplay.h"
#include "llviewermedia.h"
+#include "llviewerparcelmedia.h"
+#include "llviewermediafocus.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
#include "llworldmap.h"
@@ -114,10 +116,12 @@
#include "llassetstorage.h"
#include "llpolymesh.h"
#include "llcachename.h"
-#include "audioengine.h"
+#include "llaudioengine.h"
+#include "llstreamingaudio.h"
#include "llviewermenu.h"
#include "llselectmgr.h"
#include "lltrans.h"
+#include "lltransutil.h"
#include "lltracker.h"
#include "llviewerparcelmgr.h"
#include "llworldmapview.h"
@@ -293,9 +297,9 @@ static std::set<std::string> default_trans_args;
void init_default_trans_args()
{
default_trans_args.insert("SECOND_LIFE"); // World
- default_trans_args.insert("SECOND_LIFE_VIEWER");
+ default_trans_args.insert("APP_NAME");
default_trans_args.insert("SECOND_LIFE_GRID");
- default_trans_args.insert("SECOND_LIFE_SUPPORT");
+ default_trans_args.insert("SUPPORT_SITE");
}
//----------------------------------------------------------------------------
@@ -681,8 +685,8 @@ bool LLAppViewer::init()
// Setup paths and LLTrans after LLUI::initClass has been called
LLUI::setupPaths();
- LLTrans::parseStrings("strings.xml", default_trans_args);
- LLTrans::parseLanguageStrings("language_settings.xml");
+ LLTransUtil::parseStrings("strings.xml", default_trans_args);
+ LLTransUtil::parseLanguageStrings("language_settings.xml");
LLWeb::initClass(); // do this after LLUI
LLTextEditor::setURLCallbacks(&LLWeb::loadURL,
@@ -871,6 +875,11 @@ bool LLAppViewer::init()
return true;
}
+static LLFastTimer::DeclareTimer FTM_MESSAGES("System Messages");
+static LLFastTimer::DeclareTimer FTM_SLEEP("Sleep");
+static LLFastTimer::DeclareTimer FTM_IDLE("Idle");
+static LLFastTimer::DeclareTimer FTM_PUMP("Pump");
+
bool LLAppViewer::mainLoop()
{
LLMemType mt1(LLMemType::MTYPE_MAIN);
@@ -913,7 +922,7 @@ bool LLAppViewer::mainLoop()
if (gViewerWindow)
{
- LLFastTimer t2(LLFastTimer::FTM_MESSAGES);
+ LLFastTimer t2(FTM_MESSAGES);
gViewerWindow->mWindow->processMiscNativeEvents();
}
@@ -921,7 +930,7 @@ bool LLAppViewer::mainLoop()
if (gViewerWindow)
{
- LLFastTimer t2(LLFastTimer::FTM_MESSAGES);
+ LLFastTimer t2(FTM_MESSAGES);
if (!restoreErrorTrap())
{
llwarns << " Someone took over my signal/exception handler (post messagehandling)!" << llendl;
@@ -971,14 +980,14 @@ bool LLAppViewer::mainLoop()
{
pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds!
- LLFastTimer t3(LLFastTimer::FTM_IDLE);
+ LLFastTimer t3(FTM_IDLE);
idle();
if (gAres != NULL && gAres->isInitialized())
{
LLMemType mt_ip(LLMemType::MTYPE_IDLE_PUMP);
pingMainloopTimeout("Main:ServicePump");
- LLFastTimer t4(LLFastTimer::FTM_PUMP);
+ LLFastTimer t4(FTM_PUMP);
gAres->process();
// this pump is necessary to make the login screen show up
gServicePump->pump();
@@ -1015,7 +1024,7 @@ bool LLAppViewer::mainLoop()
// Sleep and run background threads
{
LLMemType mt_sleep(LLMemType::MTYPE_SLEEP);
- LLFastTimer t2(LLFastTimer::FTM_SLEEP);
+ LLFastTimer t2(FTM_SLEEP);
bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads");
// yield some time to the os based on command line option
@@ -1234,6 +1243,14 @@ bool LLAppViewer::cleanup()
if (gAudiop)
{
+ // shut down the streaming audio sub-subsystem first, in case it relies on not outliving the general audio subsystem.
+
+ LLStreamingAudioInterface *sai = gAudiop->getStreamingAudioImpl();
+ delete sai;
+ gAudiop->setStreamingAudioImpl(NULL);
+
+ // shut down the audio subsystem
+
bool want_longname = false;
if (gAudiop->getDriverName(want_longname) == "FMOD")
{
@@ -1467,7 +1484,9 @@ bool LLAppViewer::cleanup()
//Note:
//LLViewerMedia::cleanupClass() has to be put before gTextureList.shutdown()
//because some new image might be generated during cleaning up media. --bao
+ LLViewerMediaFocus::cleanupClass();
LLViewerMedia::cleanupClass();
+ LLViewerParcelMedia::cleanupClass();
gTextureList.shutdown(); // shutdown again in case a callback added something
LLUIImageList::getInstance()->cleanUp();
@@ -1763,8 +1782,8 @@ bool LLAppViewer::initConfiguration()
}
LLUI::setupPaths(); // setup paths for LLTrans based on settings files only
- LLTrans::parseStrings("strings.xml", default_trans_args);
- LLTrans::parseLanguageStrings("language_settings.xml");
+ LLTransUtil::parseStrings("strings.xml", default_trans_args);
+ LLTransUtil::parseLanguageStrings("language_settings.xml");
// - set procedural settings
// Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet
gSavedSettings.setString("ClientSettingsFile",
@@ -2047,7 +2066,7 @@ bool LLAppViewer::initConfiguration()
#if LL_DARWIN
// Initialize apple menubar and various callbacks
- init_apple_menu(LLTrans::getString("SECOND_LIFE_VIEWER").c_str());
+ init_apple_menu(LLTrans::getString("APP_NAME").c_str());
#if __ppc__
// If the CPU doesn't have Altivec (i.e. it's not at least a G4), don't go any further.
@@ -2086,7 +2105,7 @@ bool LLAppViewer::initConfiguration()
//
// Set the name of the window
//
- gWindowTitle = LLTrans::getString("SECOND_LIFE_VIEWER");
+ gWindowTitle = LLTrans::getString("APP_NAME");
#if LL_DEBUG
gWindowTitle += std::string(" [DEBUG] ") + gArgs;
#else
@@ -2203,7 +2222,7 @@ void LLAppViewer::checkForCrash(void)
{
std::ostringstream msg;
msg << LLTrans::getString("MBFrozenCrashed");
- std::string alert = LLTrans::getString("SECOND_LIFE_VIEWER") + " " + LLTrans::getString("MBAlert");
+ std::string alert = LLTrans::getString("APP_NAME") + " " + LLTrans::getString("MBAlert");
choice = OSMessageBox(msg.str(),
alert,
OSMB_YESNO);
@@ -2413,7 +2432,7 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true;
// Dump some debugging info
- LL_INFOS("SystemInfo") << LLTrans::getString("SECOND_LIFE_VIEWER")
+ LL_INFOS("SystemInfo") << LLTrans::getString("APP_NAME")
<< " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH
<< LL_ENDL;
@@ -3091,7 +3110,7 @@ void LLAppViewer::purgeCache()
std::string LLAppViewer::getSecondLifeTitle() const
{
- return LLTrans::getString("SECOND_LIFE_VIEWER");
+ return LLTrans::getString("APP_NAME");
}
std::string LLAppViewer::getWindowTitle() const
@@ -3256,6 +3275,15 @@ public:
}
};
+static LLFastTimer::DeclareTimer FTM_AUDIO_UPDATE("Update Audio");
+static LLFastTimer::DeclareTimer FTM_CLEANUP("Cleanup");
+static LLFastTimer::DeclareTimer FTM_IDLE_CB("Idle Callbacks");
+static LLFastTimer::DeclareTimer FTM_LOD_UPDATE("Update LOD");
+static LLFastTimer::DeclareTimer FTM_OBJECTLIST_UPDATE("Update Objectlist");
+static LLFastTimer::DeclareTimer FTM_REGION_UPDATE("Update Region");
+static LLFastTimer::DeclareTimer FTM_WORLD_UPDATE("Update World");
+static LLFastTimer::DeclareTimer FTM_NETWORK("Network");
+
///////////////////////////////////////////////////////
// idle()
//
@@ -3322,7 +3350,7 @@ void LLAppViewer::idle()
if (!gDisconnected)
{
- LLFastTimer t(LLFastTimer::FTM_NETWORK);
+ LLFastTimer t(FTM_NETWORK);
// Update spaceserver timeinfo
LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC));
@@ -3403,7 +3431,7 @@ void LLAppViewer::idle()
if (!gDisconnected)
{
- LLFastTimer t(LLFastTimer::FTM_NETWORK);
+ LLFastTimer t(FTM_NETWORK);
////////////////////////////////////////////////
//
@@ -3432,7 +3460,7 @@ void LLAppViewer::idle()
//
{
-// LLFastTimer t(LLFastTimer::FTM_IDLE_CB);
+// LLFastTimer t(FTM_IDLE_CB);
// Do event notifications if necessary. Yes, we may want to move this elsewhere.
gEventNotifier.update();
@@ -3467,7 +3495,7 @@ void LLAppViewer::idle()
}
{
- LLFastTimer t(LLFastTimer::FTM_OBJECTLIST_UPDATE); // Actually "object update"
+ LLFastTimer t(FTM_OBJECTLIST_UPDATE); // Actually "object update"
if (!(logoutRequestSent() && hasSavedFinalSnapshot()))
{
@@ -3482,7 +3510,7 @@ void LLAppViewer::idle()
//
{
- LLFastTimer t(LLFastTimer::FTM_CLEANUP);
+ LLFastTimer t(FTM_CLEANUP);
gObjectList.cleanDeadObjects();
LLDrawable::cleanupDeadDrawables();
}
@@ -3514,7 +3542,7 @@ void LLAppViewer::idle()
//
{
- LLFastTimer t(LLFastTimer::FTM_NETWORK);
+ LLFastTimer t(FTM_NETWORK);
gVLManager.unpackData();
}
@@ -3526,7 +3554,7 @@ void LLAppViewer::idle()
LLWorld::getInstance()->updateVisibilities();
{
const F32 max_region_update_time = .001f; // 1ms
- LLFastTimer t(LLFastTimer::FTM_REGION_UPDATE);
+ LLFastTimer t(FTM_REGION_UPDATE);
LLWorld::getInstance()->updateRegions(max_region_update_time);
}
@@ -3573,7 +3601,7 @@ void LLAppViewer::idle()
if (!gNoRender)
{
- LLFastTimer t(LLFastTimer::FTM_WORLD_UPDATE);
+ LLFastTimer t(FTM_WORLD_UPDATE);
gPipeline.updateMove();
LLWorld::getInstance()->updateParticles();
@@ -3594,14 +3622,17 @@ void LLAppViewer::idle()
gAgent.updateCamera();
}
+ // update media focus
+ LLViewerMediaFocus::getInstance()->update();
+
// objects and camera should be in sync, do LOD calculations now
{
- LLFastTimer t(LLFastTimer::FTM_LOD_UPDATE);
+ LLFastTimer t(FTM_LOD_UPDATE);
gObjectList.updateApparentAngles(gAgent);
}
{
- LLFastTimer t(LLFastTimer::FTM_AUDIO_UPDATE);
+ LLFastTimer t(FTM_AUDIO_UPDATE);
if (gAudiop)
{
@@ -3752,6 +3783,8 @@ void LLAppViewer::sendLogoutRequest()
static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME;
#endif
+static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Network");
+
void LLAppViewer::idleNetwork()
{
LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK);
@@ -3764,7 +3797,7 @@ void LLAppViewer::idleNetwork()
if (!gSavedSettings.getBOOL("SpeedTest"))
{
- LLFastTimer t(LLFastTimer::FTM_IDLE_NETWORK); // decode
+ LLFastTimer t(FTM_IDLE_NETWORK); // decode
// deal with any queued name requests and replies.
gCacheName->processPending();
@@ -4153,7 +4186,14 @@ void LLAppViewer::launchUpdater()
delete LLAppViewer::sUpdaterInfo;
}
LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ;
-
+
+ // if a sim name was passed in via command line parameter (typically through a SLURL)
+ if ( LLURLSimString::sInstance.mSimString.length() )
+ {
+ // record the location to start at next time
+ gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString );
+ };
+
#if LL_WINDOWS
LLAppViewer::sUpdaterInfo->mUpdateExePath = gDirUtilp->getTempFilename();
if (LLAppViewer::sUpdaterInfo->mUpdateExePath.empty())
@@ -4187,13 +4227,6 @@ void LLAppViewer::launchUpdater()
return;
}
- // if a sim name was passed in via command line parameter (typically through a SLURL)
- if ( LLURLSimString::sInstance.mSimString.length() )
- {
- // record the location to start at next time
- gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString );
- };
-
LLAppViewer::sUpdaterInfo->mParams << "-url \"" << update_url.asString() << "\"";
LL_DEBUGS("AppInit") << "Calling updater: " << LLAppViewer::sUpdaterInfo->mUpdateExePath << " " << LLAppViewer::sUpdaterInfo->mParams.str() << LL_ENDL;
@@ -4205,13 +4238,6 @@ void LLAppViewer::launchUpdater()
// see LLAppViewerWin32.cpp
#elif LL_DARWIN
- // if a sim name was passed in via command line parameter (typically through a SLURL)
- if ( LLURLSimString::sInstance.mSimString.length() )
- {
- // record the location to start at next time
- gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString );
- };
-
LLAppViewer::sUpdaterInfo->mUpdateExePath = "'";
LLAppViewer::sUpdaterInfo->mUpdateExePath += gDirUtilp->getAppRODataDir();
LLAppViewer::sUpdaterInfo->mUpdateExePath += "/mac-updater.app/Contents/MacOS/mac-updater' -url \"";
@@ -4225,10 +4251,51 @@ void LLAppViewer::launchUpdater()
// Run the auto-updater.
system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */
-#elif LL_LINUX || LL_SOLARIS
- OSMessageBox("Automatic updating is not yet implemented for Linux.\n"
- "Please download the latest version from www.secondlife.com.",
- LLStringUtil::null, OSMB_OK);
+#elif (LL_LINUX || LL_SOLARIS) && LL_GTK
+ // we tell the updater where to find the xml containing string
+ // translations which it can use for its own UI
+ std::string xml_strings_file = "strings.xml";
+ std::vector<std::string> xui_path_vec = LLUI::getXUIPaths();
+ std::string xml_search_paths;
+ std::vector<std::string>::const_iterator iter;
+ // build comma-delimited list of xml paths to pass to updater
+ for (iter = xui_path_vec.begin(); iter != xui_path_vec.end(); )
+ {
+ std::string this_skin_dir = gDirUtilp->getDefaultSkinDir()
+ + gDirUtilp->getDirDelimiter()
+ + (*iter);
+ llinfos << "Got a XUI path: " << this_skin_dir << llendl;
+ xml_search_paths.append(this_skin_dir);
+ ++iter;
+ if (iter != xui_path_vec.end())
+ xml_search_paths.append(","); // comma-delimit
+ }
+ // build the overall command-line to run the updater correctly
+ update_exe_path =
+ gDirUtilp->getExecutableDir() + "/" + "linux-updater.bin" +
+ " --url \"" + update_url.asString() + "\"" +
+ " --name \"" + LLAppViewer::instance()->getSecondLifeTitle() + "\"" +
+ " --dest \"" + gDirUtilp->getAppRODataDir() + "\"" +
+ " --stringsdir \"" + xml_search_paths + "\"" +
+ " --stringsfile \"" + xml_strings_file + "\"";
+
+ LL_INFOS("AppInit") << "Calling updater: "
+ << update_exe_path << LL_ENDL;
+
+ // *TODO: we could use the gdk equivilant to ensure the updater
+ // gets started on the same screen.
+ GError *error = NULL;
+ if (!g_spawn_command_line_async(update_exe_path.c_str(), &error))
+ {
+ llerrs << "Failed to launch updater: "
+ << error->message
+ << llendl;
+ }
+ if (error) {
+ g_error_free(error);
+ }
+#else
+ OSMessageBox(LLTrans::getString("MBNoAutoUpdate"), LLStringUtil::null, OSMB_OK);
#endif
// *REMOVE:Mani - Saving for reference...