summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--[-rwxr-xr-x]indra/newview/llappviewer.cpp91
1 files changed, 36 insertions, 55 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 70c5527b23..dac268ec92 100755..100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -42,6 +42,7 @@
#include "llagentcamera.h"
#include "llagentlanguage.h"
#include "llagentwearables.h"
+#include "llfloaterimcontainer.h"
#include "llwindow.h"
#include "llviewerstats.h"
#include "llviewerstatsrecorder.h"
@@ -59,6 +60,7 @@
#include "llares.h"
#include "llcurl.h"
#include "llcalc.h"
+#include "llconversationlog.h"
#include "lltexturestats.h"
#include "lltexturestats.h"
#include "llviewerwindow.h"
@@ -93,7 +95,6 @@
#include "llweb.h"
#include "llsecondlifeurls.h"
#include "llupdaterservice.h"
-#include "llcallfloater.h"
#include "llfloatertexturefetchdebugger.h"
#include "llspellcheck.h"
@@ -200,6 +201,7 @@
#include "llviewercontrol.h"
#include "lleventnotifier.h"
#include "llcallbacklist.h"
+#include "lldeferredsounds.h"
#include "pipeline.h"
#include "llgesturemgr.h"
#include "llsky.h"
@@ -219,7 +221,6 @@
#include "llmachineid.h"
#include "llmainlooprepeater.h"
-
// *FIX: These extern globals should be cleaned up.
// The globals either represent state/config/resource-storage of either
// this app, or another 'component' of the viewer. App globals should be
@@ -291,8 +292,10 @@ LLTimer gLogoutTimer;
static const F32 LOGOUT_REQUEST_TIME = 6.f; // this will be cut short by the LogoutReply msg.
F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME;
+
S32 gPendingMetricsUploads = 0;
+
BOOL gDisconnected = FALSE;
// used to restore texture state after a mode switch
@@ -461,7 +464,18 @@ static void ui_audio_callback(const LLUUID& uuid)
{
if (gAudiop)
{
- gAudiop->triggerSound(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ SoundData soundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ gAudiop->triggerSound(soundData);
+ }
+}
+
+// A callback set in LLAppViewer::init()
+static void deferred_ui_audio_callback(const LLUUID& uuid)
+{
+ if (gAudiop)
+ {
+ SoundData soundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ LLDeferredSounds::instance().deferSound(soundData);
}
}
@@ -639,6 +653,7 @@ LLAppViewer::LLAppViewer() :
mForceGraphicsDetail(false),
mQuitRequested(false),
mLogoutRequestSent(false),
+ mYieldTime(-1),
mMainloopTimeout(NULL),
mAgentRegionLastAlive(false),
mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", FALSE)),
@@ -787,6 +802,7 @@ bool LLAppViewer::init()
LLUI::initClass(settings_map,
LLUIImageList::getInstance(),
ui_audio_callback,
+ deferred_ui_audio_callback,
&LLUI::getScaleFactor());
LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
@@ -1231,8 +1247,8 @@ bool LLAppViewer::mainLoop()
LLVoiceChannel::initClass();
LLVoiceClient::getInstance()->init(gServicePump);
- LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLCallFloater::sOnCurrentChannelChanged, _1), true);
- LLTimer frameTimer,idleTimer,periodicRenderingTimer;
+ LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMContainer::onCurrentChannelChanged, _1), true);
+ LLTimer frameTimer,idleTimer;
LLTimer debugTime;
LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
joystick->setNeedsReset(true);
@@ -1244,8 +1260,6 @@ bool LLAppViewer::mainLoop()
// point of posting.
LLSD newFrame;
- BOOL restore_rendering_masks = FALSE;
-
//LLPrivateMemoryPoolTester::getInstance()->run(false) ;
//LLPrivateMemoryPoolTester::getInstance()->run(true) ;
//LLPrivateMemoryPoolTester::destroy() ;
@@ -1264,28 +1278,6 @@ bool LLAppViewer::mainLoop()
try
{
- // Check if we need to restore rendering masks.
- if (restore_rendering_masks)
- {
- gPipeline.popRenderDebugFeatureMask();
- gPipeline.popRenderTypeMask();
- }
- // Check if we need to temporarily enable rendering.
- F32 periodic_rendering = gSavedSettings.getF32("ForcePeriodicRenderingTime");
- if (periodic_rendering > F_APPROXIMATELY_ZERO && periodicRenderingTimer.getElapsedTimeF64() > periodic_rendering)
- {
- periodicRenderingTimer.reset();
- restore_rendering_masks = TRUE;
- gPipeline.pushRenderTypeMask();
- gPipeline.pushRenderDebugFeatureMask();
- gPipeline.setAllRenderTypes();
- gPipeline.setAllRenderDebugFeatures();
- }
- else
- {
- restore_rendering_masks = FALSE;
- }
-
pingMainloopTimeout("Main:MiscNativeWindowEvents");
if (gViewerWindow)
@@ -1333,11 +1325,11 @@ bool LLAppViewer::mainLoop()
// Scan keyboard for movement keys. Command keys and typing
// are handled by windows callbacks. Don't do this until we're
// done initializing. JC
- if (gViewerWindow->getWindow()->getVisible()
+ if ((gHeadlessClient || gViewerWindow->getWindow()->getVisible())
&& gViewerWindow->getActive()
&& !gViewerWindow->getWindow()->getMinimized()
&& LLStartUp::getStartupState() == STATE_STARTED
- && !gViewerWindow->getShowProgress()
+ && (gHeadlessClient || !gViewerWindow->getShowProgress())
&& !gFocusMgr.focusLocked())
{
joystick->scanJoystick();
@@ -1383,7 +1375,8 @@ bool LLAppViewer::mainLoop()
}
// Render scene.
- if (!LLApp::isExiting())
+ // *TODO: Should we run display() even during gHeadlessClient? DK 2011-02-18
+ if (!LLApp::isExiting() && !gHeadlessClient)
{
pingMainloopTimeout("Main:Display");
gGLActive = TRUE;
@@ -1404,11 +1397,10 @@ bool LLAppViewer::mainLoop()
LLFastTimer t2(FTM_SLEEP);
// yield some time to the os based on command line option
- S32 yield_time = gSavedSettings.getS32("YieldTime");
- if(yield_time >= 0)
+ if(mYieldTime >= 0)
{
LLFastTimer t(FTM_YIELD);
- ms_sleep(yield_time);
+ ms_sleep(mYieldTime);
}
// yield cooperatively when not running as foreground window
@@ -1520,26 +1512,6 @@ bool LLAppViewer::mainLoop()
{
gFrameStalls++;
}
-
- // Limit FPS
- F32 max_fps = gSavedSettings.getF32("MaxFPS");
- // Only limit FPS when we are actually rendering something. Otherwise
- // logins, logouts and teleports take much longer to complete.
- if (max_fps > F_APPROXIMATELY_ZERO &&
- LLStartUp::getStartupState() == STATE_STARTED &&
- !gTeleportDisplay &&
- !logoutRequestSent())
- {
- // Sleep a while to limit frame rate.
- F32 min_frame_time = 1.f / max_fps;
- S32 milliseconds_to_sleep = llclamp((S32)((min_frame_time - frameTimer.getElapsedTimeF64()) * 1000.f), 0, 1000);
- if (milliseconds_to_sleep > 0)
- {
- LLFastTimer t(FTM_YIELD);
- ms_sleep(milliseconds_to_sleep);
- }
- }
-
frameTimer.reset();
resumeMainloopTimeout();
@@ -1904,6 +1876,9 @@ bool LLAppViewer::cleanup()
// save mute list. gMuteList used to also be deleted here too.
LLMuteList::getInstance()->cache(gAgent.getID());
+ //save call log list
+ LLConversationLog::instance().cache();
+
if (mPurgeOnExit)
{
llinfos << "Purging all cache files on exit" << llendflush;
@@ -2661,6 +2636,8 @@ bool LLAppViewer::initConfiguration()
}
}
+ mYieldTime = gSavedSettings.getS32("YieldTime");
+
// Read skin/branding settings if specified.
//if (! gDirUtilp->getSkinDir().empty() )
//{
@@ -3051,6 +3028,9 @@ bool LLAppViewer::initWindow()
{
LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
+ // store setting in a global for easy access and modification
+ gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient");
+
// always start windowed
BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth");
@@ -4412,6 +4392,7 @@ void LLAppViewer::idle()
// The 5-second interval is nice for this purpose. If the object debug
// bit moves or is disabled, please give this a suitable home.
LLViewerAssetStatsFF::record_fps_main(gFPSClamped);
+ LLViewerAssetStatsFF::record_avatar_stats();
}
}