aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/viewer.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:54 -0500
committerJacek Antonelli2008-08-15 23:44:54 -0500
commitb2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch)
tree3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/newview/viewer.cpp
parentSecond Life viewer sources 1.14.0.1 (diff)
downloadmeta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/newview/viewer.cpp')
-rw-r--r--linden/indra/newview/viewer.cpp283
1 files changed, 111 insertions, 172 deletions
diff --git a/linden/indra/newview/viewer.cpp b/linden/indra/newview/viewer.cpp
index 181e446..c42ac69 100644
--- a/linden/indra/newview/viewer.cpp
+++ b/linden/indra/newview/viewer.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 5 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -28,6 +29,7 @@
28#include "llviewerprecompiledheaders.h" 29#include "llviewerprecompiledheaders.h"
29#include "llparcel.h" 30#include "llparcel.h"
30#include "llviewerparcelmgr.h" 31#include "llviewerparcelmgr.h"
32#include "llviewerjoystick.h"
31 33
32// System library headers 34// System library headers
33#include <stdlib.h> 35#include <stdlib.h>
@@ -117,6 +119,7 @@
117#include "lldir.h" 119#include "lldir.h"
118#include "lleconomy.h" 120#include "lleconomy.h"
119#include "llerrorcontrol.h" 121#include "llerrorcontrol.h"
122#include "llhttpnode.h"
120#include "llflexibleobject.h" 123#include "llflexibleobject.h"
121#include "llfasttimer.h" 124#include "llfasttimer.h"
122#include "llfocusmgr.h" 125#include "llfocusmgr.h"
@@ -135,8 +138,8 @@
135#include "llvfsthread.h" 138#include "llvfsthread.h"
136#include "llxfermanager.h" 139#include "llxfermanager.h"
137#include "message.h" 140#include "message.h"
138#include "text_out.h"
139#include "llvoavatar.h" 141#include "llvoavatar.h"
142#include "llglslshader.h"
140 143
141// 144//
142// Viewer headers 145// Viewer headers
@@ -274,6 +277,7 @@ std::string gSerialNumber;
274 277
275S32 gStartupState = STATE_FIRST; 278S32 gStartupState = STATE_FIRST;
276 279
280BOOL gAgentMovementCompleted = FALSE;
277BOOL gHaveSavedSnapshot = FALSE; 281BOOL gHaveSavedSnapshot = FALSE;
278 282
279S32 gYieldMS = 0; 283S32 gYieldMS = 0;
@@ -332,8 +336,6 @@ static EUserServerDomain UserServerDefaultChoice = USERSERVER_DMZ;
332BOOL gHackGodmode = FALSE; 336BOOL gHackGodmode = FALSE;
333#endif 337#endif
334 338
335LLUUID gTemplateToken;
336
337// Only used if not empty. Otherwise uses value from table above. 339// Only used if not empty. Otherwise uses value from table above.
338static std::string gLoginURI; 340static std::string gLoginURI;
339static std::string gHelperURI; 341static std::string gHelperURI;
@@ -376,6 +378,7 @@ const char* LEGACY_DEFAULT_SETTINGS_FILE = "settings.ini";
376BOOL gUseWireframe = FALSE; 378BOOL gUseWireframe = FALSE;
377BOOL gRunLocal = FALSE; 379BOOL gRunLocal = FALSE;
378LLUUID gViewerDigest; // MD5 digest of the viewer's executable file. 380LLUUID gViewerDigest; // MD5 digest of the viewer's executable file.
381LLPumpIO* gServicePump = NULL;
379S32 gNumSessions = 0; 382S32 gNumSessions = 0;
380 383
381BOOL gAllowAFK = TRUE; 384BOOL gAllowAFK = TRUE;
@@ -422,6 +425,7 @@ LLTextureFetch* gTextureFetch = NULL;
422FILE *gDebugFile = NULL; // File pointer used by the function which writes debug data. 425FILE *gDebugFile = NULL; // File pointer used by the function which writes debug data.
423BOOL gRandomizeFramerate = FALSE; 426BOOL gRandomizeFramerate = FALSE;
424BOOL gPeriodicSlowFrame = FALSE; 427BOOL gPeriodicSlowFrame = FALSE;
428std::map<S32,LLFrameTimer> gDebugTimers;
425 429
426//LLVector3 gCameraVelocitySmoothed; 430//LLVector3 gCameraVelocitySmoothed;
427// 431//
@@ -527,6 +531,9 @@ BOOL gLogMessages = FALSE;
527BOOL gRequestInventoryLibrary = TRUE; 531BOOL gRequestInventoryLibrary = TRUE;
528BOOL gAcceptTOS = FALSE; 532BOOL gAcceptTOS = FALSE;
529BOOL gAcceptCriticalMessage = FALSE; 533BOOL gAcceptCriticalMessage = FALSE;
534// this is the channel the viewer uses to check for updates/login
535std::string gChannelName = "Second Life Release";
536
530LLUUID gInventoryLibraryOwner; 537LLUUID gInventoryLibraryOwner;
531LLUUID gInventoryLibraryRoot; 538LLUUID gInventoryLibraryRoot;
532 539
@@ -975,8 +982,8 @@ int main( int argc, char **argv )
975 982
976 llinfos << "Reading additional command line arguments from arguments.txt..." << llendl; 983 llinfos << "Reading additional command line arguments from arguments.txt..." << llendl;
977 984
978 typedef boost::tokenizer<boost::char_separator<char> > tokenizer; 985 typedef boost::tokenizer<boost::escaped_list_separator<char> > tokenizer;
979 boost::char_separator<char> sep("\r\n "); 986 boost::escaped_list_separator<char> sep("\\", "\r\n ", "\"'");
980 tokenizer tokens(args, sep); 987 tokenizer tokens(args, sep);
981 tokenizer::iterator token_iter; 988 tokenizer::iterator token_iter;
982 989
@@ -995,6 +1002,26 @@ int main( int argc, char **argv )
995 args_result = parse_args(arglist.size(), fakeargv); 1002 args_result = parse_args(arglist.size(), fakeargv);
996 delete[] fakeargv; 1003 delete[] fakeargv;
997 } 1004 }
1005
1006 // Get the user's preferred language string based on the Mac OS localization mechanism.
1007 // To add a new localization:
1008 // go to the "Resources" section of the project
1009 // get info on "language.txt"
1010 // in the "General" tab, click the "Add Localization" button
1011 // create a new localization for the language you're adding
1012 // set the contents of the new localization of the file to the string corresponding to our localization
1013 // (i.e. "en-us", "ja", etc. Use the existing ones as a guide.)
1014 CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL);
1015 char path[MAX_PATH];
1016 if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path)))
1017 {
1018 LLString lang;
1019 if(LLString::read(lang, path)) /* Flawfinder: ignore*/
1020 {
1021 gCommandLineForcedSettings["SystemLanguage"] = lang;
1022 }
1023 }
1024 CFRelease(url);
998 } 1025 }
999#endif 1026#endif
1000 1027
@@ -1292,7 +1319,7 @@ int main( int argc, char **argv )
1292 1319
1293 gLastRunVersion = gSavedSettings.getString("LastRunVersion"); 1320 gLastRunVersion = gSavedSettings.getString("LastRunVersion");
1294 1321
1295 settings_version_fixup(); 1322 fixup_settings();
1296 1323
1297 // Get the single value from the crash settings file, if it exists 1324 // Get the single value from the crash settings file, if it exists
1298 std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); 1325 std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
@@ -1403,6 +1430,8 @@ int main( int argc, char **argv )
1403 // 1430 //
1404 LLGroupMgr::parseRoleActions("role_actions.xml"); 1431 LLGroupMgr::parseRoleActions("role_actions.xml");
1405 1432
1433 LLAgent::parseTeleportMessages("teleport_strings.xml");
1434
1406 // Move certain saved settings into global variables for speed 1435 // Move certain saved settings into global variables for speed
1407 saved_settings_to_globals(); 1436 saved_settings_to_globals();
1408 1437
@@ -1661,10 +1690,6 @@ int main( int argc, char **argv )
1661 // Save the current version to the prefs file 1690 // Save the current version to the prefs file
1662 gSavedSettings.setString("LastRunVersion", gCurrentVersion); 1691 gSavedSettings.setString("LastRunVersion", gCurrentVersion);
1663 1692
1664 // generate an token for use during template checksum requests to
1665 // prevent DOS attacks from injected bad template checksum replies.
1666 gTemplateToken.generate();
1667
1668 gSimLastTime = gRenderStartTime.getElapsedTimeF32(); 1693 gSimLastTime = gRenderStartTime.getElapsedTimeF32();
1669 gSimFrames = (F32)gFrameCount; 1694 gSimFrames = (F32)gFrameCount;
1670 1695
@@ -1752,10 +1777,10 @@ extern MovieMaker gMovieMaker;
1752void main_loop() 1777void main_loop()
1753{ 1778{
1754 // Create IO Pump to use for HTTP Requests. 1779 // Create IO Pump to use for HTTP Requests.
1755 LLPumpIO* io_pump = new LLPumpIO(gAPRPoolp); 1780 gServicePump = new LLPumpIO(gAPRPoolp);
1756 LLHTTPClient::setPump(*io_pump); 1781 LLHTTPClient::setPump(*gServicePump);
1757 LLHTTPClient::setCABundle(gDirUtilp->getCAFile()); 1782 LLHTTPClient::setCABundle(gDirUtilp->getCAFile());
1758 1783
1759 LLMemType mt1(LLMemType::MTYPE_MAIN); 1784 LLMemType mt1(LLMemType::MTYPE_MAIN);
1760 LLTimer frameTimer,idleTimer; 1785 LLTimer frameTimer,idleTimer;
1761 LLTimer debugTime; 1786 LLTimer debugTime;
@@ -1789,6 +1814,7 @@ void main_loop()
1789 && !gFocusMgr.focusLocked()) 1814 && !gFocusMgr.focusLocked())
1790 { 1815 {
1791 gKeyboard->scanKeyboard(); 1816 gKeyboard->scanKeyboard();
1817 LLViewerJoystick::scanJoystick();
1792 } 1818 }
1793 1819
1794 // Update state based on messages, user input, object idle. 1820 // Update state based on messages, user input, object idle.
@@ -1796,8 +1822,9 @@ void main_loop()
1796 LLFastTimer t3(LLFastTimer::FTM_IDLE); 1822 LLFastTimer t3(LLFastTimer::FTM_IDLE);
1797 idle(); 1823 idle();
1798 LLCurl::process(); 1824 LLCurl::process();
1799 io_pump->pump(); 1825 // this pump is necessary to make the login screen show up
1800 io_pump->callback(); 1826 gServicePump->pump();
1827 gServicePump->callback();
1801 } 1828 }
1802 1829
1803 if (gDoDisconnect && (gStartupState == STATE_STARTED)) 1830 if (gDoDisconnect && (gStartupState == STATE_STARTED))
@@ -1900,7 +1927,7 @@ void main_loop()
1900 save_final_snapshot(NULL); 1927 save_final_snapshot(NULL);
1901 } 1928 }
1902 1929
1903 delete io_pump; 1930 delete gServicePump;
1904 1931
1905 llinfos << "Exiting main_loop" << llendflush; 1932 llinfos << "Exiting main_loop" << llendflush;
1906} 1933}
@@ -2096,7 +2123,7 @@ void write_system_info()
2096 LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); 2123 LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD);
2097 write_debug(tmp_str.c_str()); 2124 write_debug(tmp_str.c_str());
2098 write_debug("\n"); 2125 write_debug("\n");
2099 write_debug(gSysCPU.getCPUStringTerse()); 2126 write_debug(gSysCPU.getCPUString());
2100 write_debug("\n"); 2127 write_debug("\n");
2101 2128
2102 tmp_str = llformat("RAM: %u\n", gSysMemory.getPhysicalMemory()); 2129 tmp_str = llformat("RAM: %u\n", gSysMemory.getPhysicalMemory());
@@ -3129,6 +3156,12 @@ void idle_shutdown()
3129 { 3156 {
3130 return; 3157 return;
3131 } 3158 }
3159
3160 // close IM interface
3161 if(gIMView)
3162 {
3163 gIMView->disconnectAllSessions();
3164 }
3132 3165
3133 // Wait for all floaters to get resolved 3166 // Wait for all floaters to get resolved
3134 if (gFloaterView 3167 if (gFloaterView
@@ -3212,8 +3245,6 @@ extern U32 gVisTested;
3212 3245
3213void update_statistics(U32 frame_count) 3246void update_statistics(U32 frame_count)
3214{ 3247{
3215 const S32 MAX_TEXT_LENGTH = 255;
3216
3217 gTotalWorldBytes += gVLManager.getTotalBytes(); 3248 gTotalWorldBytes += gVLManager.getTotalBytes();
3218 gTotalObjectBytes += gObjectBits / 8; 3249 gTotalObjectBytes += gObjectBits / 8;
3219 gTotalTextureBytes += LLViewerImageList::sTextureBits / 8; 3250 gTotalTextureBytes += LLViewerImageList::sTextureBits / 8;
@@ -3273,6 +3304,18 @@ void update_statistics(U32 frame_count)
3273 gViewerStats->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); 3304 gViewerStats->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f);
3274 gTransferManager.resetTransferBitsIn(LLTCT_ASSET); 3305 gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
3275 3306
3307 static S32 tex_bits_idle_count = 0;
3308 if (LLViewerImageList::sTextureBits == 0)
3309 {
3310 if (++tex_bits_idle_count >= 30)
3311 gDebugTimers[0].pause();
3312 }
3313 else
3314 {
3315 tex_bits_idle_count = 0;
3316 gDebugTimers[0].unpause();
3317 }
3318
3276 gViewerStats->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets); 3319 gViewerStats->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets);
3277 3320
3278 cdp = gMessageSystem->mCircuitInfo.findCircuit(gUserServer); 3321 cdp = gMessageSystem->mCircuitInfo.findCircuit(gUserServer);
@@ -3288,7 +3331,7 @@ void update_statistics(U32 frame_count)
3288 // log when the LibXUL (aka Mozilla) widget is used and opened so we can monitor framerate changes 3331 // log when the LibXUL (aka Mozilla) widget is used and opened so we can monitor framerate changes
3289 #if LL_LIBXUL_ENABLED 3332 #if LL_LIBXUL_ENABLED
3290 { 3333 {
3291 BOOL result = LLHtmlHelp::getFloaterOpened(); 3334 BOOL result = gViewerHtmlHelp.getFloaterOpened();
3292 gViewerStats->setStat(LLViewerStats::ST_LIBXUL_WIDGET_USED, (F64)result); 3335 gViewerStats->setStat(LLViewerStats::ST_LIBXUL_WIDGET_USED, (F64)result);
3293 } 3336 }
3294 #endif 3337 #endif
@@ -3314,149 +3357,8 @@ void update_statistics(U32 frame_count)
3314 3357
3315 LLViewerImageList::sTextureBits = 0; 3358 LLViewerImageList::sTextureBits = 0;
3316 LLViewerImageList::sTexturePackets = 0; 3359 LLViewerImageList::sTexturePackets = 0;
3317
3318 // Argh! Shouldn't be doing the rendering here, it should be in a UI class!
3319
3320 static char wind_vel_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3321 static char wind_vector_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3322 static char rwind_vel_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3323 static char rwind_vector_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3324 static char audio_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3325
3326 // Now draw the text
3327 LLGLSUIDefault gls_ui;
3328
3329 // Draw the statistics in a light gray
3330 // and in a thin font
3331 set_text_color( LLColor4( 0.86f, 0.86f, 0.86f, 1.f ) );
3332
3333 // Draw stuff growing up from right lower corner of screen
3334 U32 xpos = gViewerWindow->getWindowWidth() - 350;
3335 U32 ypos = 64;
3336 const U32 y_inc = 20;
3337
3338 if (gDisplayCameraPos)
3339 {
3340 char camera_view_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3341 char camera_center_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3342 char agent_view_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3343 char agent_left_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3344 char agent_center_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3345 char agent_root_center_text[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3346
3347 LLVector3d tvector; // Temporary vector to hold data for printing.
3348
3349 // Update camera center, camera view, wind info every other frame
3350 tvector = gAgent.getPositionGlobal();
3351 snprintf(agent_center_text, MAX_TEXT_LENGTH, "AgentCenter %f %f %f", /* Flawfinder: ignore */
3352 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
3353
3354 if (gAgent.getAvatarObject())
3355 {
3356 tvector = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mRoot.getWorldPosition());
3357 snprintf(agent_root_center_text, MAX_TEXT_LENGTH, "AgentRootCenter %f %f %f", /* Flawfinder: ignore */
3358 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
3359 }
3360 else
3361 {
3362 snprintf(agent_root_center_text, MAX_TEXT_LENGTH, "---"); /* Flawfinder: ignore */
3363 }
3364
3365
3366 tvector = LLVector4(gAgent.getFrameAgent().getAtAxis());
3367 snprintf(agent_view_text, MAX_TEXT_LENGTH, "AgentAtAxis %f %f %f", /* Flawfinder: ignore */
3368 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
3369
3370 tvector = LLVector4(gAgent.getFrameAgent().getLeftAxis());
3371 snprintf(agent_left_text, MAX_TEXT_LENGTH, "AgentLeftAxis %f %f %f", /* Flawfinder: ignore */
3372 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
3373
3374 tvector = gAgent.getCameraPositionGlobal();
3375 snprintf(camera_center_text, MAX_TEXT_LENGTH, "CameraCenter %f %f %f", /* Flawfinder: ignore */
3376 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
3377
3378 tvector = LLVector4(gCamera->getAtAxis());
3379 snprintf(camera_view_text, MAX_TEXT_LENGTH, "CameraAtAxis %f %f %f", /* Flawfinder: ignore */
3380 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
3381
3382 add_text(xpos, ypos, agent_center_text); ypos += y_inc;
3383 add_text(xpos, ypos, agent_root_center_text); ypos += y_inc;
3384 add_text(xpos, ypos, agent_view_text); ypos += y_inc;
3385 add_text(xpos, ypos, agent_left_text); ypos += y_inc;
3386 add_text(xpos, ypos, camera_center_text); ypos += y_inc;
3387 add_text(xpos, ypos, camera_view_text); ypos += y_inc;
3388 }
3389
3390 if (gDisplayWindInfo)
3391 {
3392 snprintf(wind_vel_text, MAX_TEXT_LENGTH, "Wind velocity %.2f m/s", gWindVec.magVec()); /* Flawfinder: ignore */
3393 snprintf(wind_vector_text, MAX_TEXT_LENGTH, "Wind vector %.2f %.2f %.2f", gWindVec.mV[0], gWindVec.mV[1], gWindVec.mV[2]); /* Flawfinder: ignore */
3394 snprintf(rwind_vel_text, MAX_TEXT_LENGTH, "RWind vel %.2f m/s", gRelativeWindVec.magVec()); /* Flawfinder: ignore */
3395 snprintf(rwind_vector_text, MAX_TEXT_LENGTH, "RWind vec %.2f %.2f %.2f", gRelativeWindVec.mV[0], gRelativeWindVec.mV[1], gRelativeWindVec.mV[2]); /* Flawfinder: ignore */
3396
3397 add_text(xpos, ypos, wind_vel_text); ypos += y_inc;
3398 add_text(xpos, ypos, wind_vector_text); ypos += y_inc;
3399 add_text(xpos, ypos, rwind_vel_text); ypos += y_inc;
3400 add_text(xpos, ypos, rwind_vector_text); ypos += y_inc;
3401 }
3402 if (gDisplayWindInfo)
3403 {
3404 if (gAudiop)
3405 {
3406 snprintf(audio_text, MAX_TEXT_LENGTH, "Audio for wind: %d", gAudiop->isWindEnabled()); /* Flawfinder: ignore */
3407 }
3408 add_text(xpos, ypos, audio_text); ypos += y_inc;
3409 }
3410 if (gDisplayFOV)
3411 {
3412 char fov_string[MAX_TEXT_LENGTH]; /* Flawfinder: ignore */
3413 snprintf(fov_string, MAX_TEXT_LENGTH, "FOV: %2.1f deg", RAD_TO_DEG * gCamera->getView()); /* Flawfinder: ignore */
3414 add_text(xpos, ypos, fov_string);
3415 ypos += y_inc;
3416 }
3417#if !LL_RELEASE_FOR_DOWNLOAD
3418 if (gPipeline.getUseVertexShaders() == 0)
3419 {
3420 add_text(xpos, ypos, "Shaders Disabled");
3421 ypos += y_inc;
3422 }
3423 add_text(xpos, ypos, (char*) llformat("%d MB Vertex Data", LLVertexBuffer::sAllocatedBytes/(1024*1024)).c_str());
3424 ypos += y_inc;
3425
3426 add_text(xpos, ypos, (char*) llformat("%d Pending Lock", LLVertexBuffer::sLockedList.size()).c_str());
3427 ypos += y_inc;
3428
3429 add_text(xpos, ypos, (char*) llformat("%d Vertex Buffers", LLVertexBuffer::sGLCount).c_str());
3430 ypos += y_inc;
3431#endif
3432 if (LLPipeline::getRenderParticleBeacons(NULL))
3433 {
3434 add_text(xpos, ypos, "Viewing particle beacons (blue)");
3435 ypos += y_inc;
3436 }
3437 if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES))
3438 {
3439 add_text(xpos, ypos, "Hiding particles");
3440 ypos += y_inc;
3441 }
3442 if (LLPipeline::getRenderPhysicalBeacons(NULL))
3443 {
3444 add_text(xpos, ypos, "Viewing physical object beacons (green)");
3445 ypos += y_inc;
3446 }
3447 if (LLPipeline::getRenderScriptedBeacons(NULL))
3448 {
3449 add_text(xpos, ypos, "Viewing scripted object beacons (red)");
3450 ypos += y_inc;
3451 }
3452 if (LLPipeline::getRenderSoundBeacons(NULL))
3453 {
3454 add_text(xpos, ypos, "Viewing sound beacons (yellow)");
3455 ypos += y_inc;
3456 }
3457} 3360}
3458 3361
3459
3460// 3362//
3461// Handle messages, and all message related stuff 3363// Handle messages, and all message related stuff
3462// 3364//
@@ -3485,7 +3387,7 @@ void idle_network()
3485 stop_glerror(); 3387 stop_glerror();
3486 const S64 frame_count = gFrameCount; // U32->S64 3388 const S64 frame_count = gFrameCount; // U32->S64
3487 F32 total_time = 0.0f; 3389 F32 total_time = 0.0f;
3488 while (gMessageSystem->checkMessages(frame_count)) 3390 while (gMessageSystem->checkAllMessages(frame_count, gServicePump))
3489 { 3391 {
3490 if (gDoDisconnect) 3392 if (gDoDisconnect)
3491 { 3393 {
@@ -3757,6 +3659,8 @@ void idle()
3757 3659
3758 // Update statistics for this frame 3660 // Update statistics for this frame
3759 update_statistics(gFrameCount); 3661 update_statistics(gFrameCount);
3662
3663 gViewerWindow->updateDebugText();
3760 } 3664 }
3761 3665
3762 //////////////////////////////////////// 3666 ////////////////////////////////////////
@@ -3962,7 +3866,14 @@ void idle()
3962 } 3866 }
3963 stop_glerror(); 3867 stop_glerror();
3964 3868
3965 gAgent.updateCamera(); 3869 if (!LLViewerJoystick::sOverrideCamera)
3870 {
3871 gAgent.updateCamera();
3872 }
3873 else
3874 {
3875 LLViewerJoystick::updateCamera();
3876 }
3966 3877
3967 // objects and camera should be in sync, do LOD calculations now 3878 // objects and camera should be in sync, do LOD calculations now
3968 { 3879 {
@@ -4656,12 +4567,23 @@ class LLSetShaderListener: public LLSimpleListener
4656{ 4567{
4657 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 4568 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4658 { 4569 {
4659 gPipeline.setShaders(); 4570 LLShaderMgr::setShaders();
4660 return true; 4571 return true;
4661 } 4572 }
4662}; 4573};
4663static LLSetShaderListener set_shader_listener; 4574static LLSetShaderListener set_shader_listener;
4664 4575
4576class LLReleaseGLBufferListener: public LLSimpleListener
4577{
4578 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4579 {
4580 gPipeline.releaseGLBuffers();
4581 LLShaderMgr::setShaders();
4582 return true;
4583 }
4584};
4585static LLReleaseGLBufferListener release_gl_buffer_listener;
4586
4665class LLVolumeLODListener: public LLSimpleListener 4587class LLVolumeLODListener: public LLSimpleListener
4666{ 4588{
4667 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 4589 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -4841,6 +4763,15 @@ class LLMasterAudioListener: public LLSimpleListener
4841 } 4763 }
4842}; 4764};
4843 4765
4766class LLJoystickListener : public LLSimpleListener
4767{
4768 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4769 {
4770 LLViewerJoystick::updateCamera(TRUE);
4771 return true;
4772 }
4773};
4774static LLJoystickListener joystick_listener;
4844 4775
4845void stop_video(); 4776void stop_video();
4846void prepare_video(const LLParcel *parcel); 4777void prepare_video(const LLParcel *parcel);
@@ -5045,7 +4976,10 @@ void saved_settings_to_globals()
5045 gSavedSettings.getControl("RenderTerrainDetail")->addListener(&terrain_detail_listener); 4976 gSavedSettings.getControl("RenderTerrainDetail")->addListener(&terrain_detail_listener);
5046 gSavedSettings.getControl("RenderRippleWater")->addListener(&set_shader_listener); 4977 gSavedSettings.getControl("RenderRippleWater")->addListener(&set_shader_listener);
5047 gSavedSettings.getControl("RenderAvatarVP")->addListener(&set_shader_listener); 4978 gSavedSettings.getControl("RenderAvatarVP")->addListener(&set_shader_listener);
4979 gSavedSettings.getControl("VertexShaderEnable")->addListener(&set_shader_listener);
5048 gSavedSettings.getControl("RenderDynamicReflections")->addListener(&set_shader_listener); 4980 gSavedSettings.getControl("RenderDynamicReflections")->addListener(&set_shader_listener);
4981 gSavedSettings.getControl("RenderGlow")->addListener(&release_gl_buffer_listener);
4982 gSavedSettings.getControl("RenderGlowResolution")->addListener(&release_gl_buffer_listener);
5049 gSavedSettings.getControl("RenderAvatarMode")->addListener(&set_shader_listener); 4983 gSavedSettings.getControl("RenderAvatarMode")->addListener(&set_shader_listener);
5050 gSavedSettings.getControl("RenderVolumeLODFactor")->addListener(&volume_lod_listener); 4984 gSavedSettings.getControl("RenderVolumeLODFactor")->addListener(&volume_lod_listener);
5051 gSavedSettings.getControl("RenderAvatarLODFactor")->addListener(&avatar_lod_listener); 4985 gSavedSettings.getControl("RenderAvatarLODFactor")->addListener(&avatar_lod_listener);
@@ -5069,7 +5003,14 @@ void saved_settings_to_globals()
5069 gSavedSettings.getControl("RenderVBOEnable")->addListener(&render_use_vbo_listener); 5003 gSavedSettings.getControl("RenderVBOEnable")->addListener(&render_use_vbo_listener);
5070 gSavedSettings.getControl("RenderLightingDetail")->addListener(&render_lighting_detail_listener); 5004 gSavedSettings.getControl("RenderLightingDetail")->addListener(&render_lighting_detail_listener);
5071 gSavedSettings.getControl("NumpadControl")->addListener(&numpad_control_listener); 5005 gSavedSettings.getControl("NumpadControl")->addListener(&numpad_control_listener);
5072 5006 gSavedSettings.getControl("FlycamAxis0")->addListener(&joystick_listener);
5007 gSavedSettings.getControl("FlycamAxis1")->addListener(&joystick_listener);
5008 gSavedSettings.getControl("FlycamAxis2")->addListener(&joystick_listener);
5009 gSavedSettings.getControl("FlycamAxis3")->addListener(&joystick_listener);
5010 gSavedSettings.getControl("FlycamAxis4")->addListener(&joystick_listener);
5011 gSavedSettings.getControl("FlycamAxis5")->addListener(&joystick_listener);
5012 gSavedSettings.getControl("FlycamAxis6")->addListener(&joystick_listener);
5013
5073 // gAgent.init() also loads from saved settings. 5014 // gAgent.init() also loads from saved settings.
5074} 5015}
5075 5016
@@ -5436,7 +5377,7 @@ void send_stats()
5436 gMessageSystem->addS32Fast(_PREHASH_RegionsVisited, gAgent.getRegionsVisited()); 5377 gMessageSystem->addS32Fast(_PREHASH_RegionsVisited, gAgent.getRegionsVisited());
5437 gMessageSystem->addU32Fast(_PREHASH_SysRAM, gSysMemory.getPhysicalMemory()); 5378 gMessageSystem->addU32Fast(_PREHASH_SysRAM, gSysMemory.getPhysicalMemory());
5438 gMessageSystem->addStringFast(_PREHASH_SysOS, gSysOS.getOSString()); 5379 gMessageSystem->addStringFast(_PREHASH_SysOS, gSysOS.getOSString());
5439 gMessageSystem->addStringFast(_PREHASH_SysCPU, gSysCPU.getCPUStringTerse()); 5380 gMessageSystem->addStringFast(_PREHASH_SysCPU, gSysCPU.getCPUString());
5440 5381
5441 5382
5442 std::string gpu_desc = llformat("%-6s Class %d ", 5383 std::string gpu_desc = llformat("%-6s Class %d ",
@@ -5903,6 +5844,10 @@ int parse_args(int argc, char **argv)
5903 { 5844 {
5904 gVerifySSLCert = false; 5845 gVerifySSLCert = false;
5905 } 5846 }
5847 else if ( (!strcmp(argv[j], "--channel") || !strcmp(argv[j], "-channel")) && (++j < argc))
5848 {
5849 gChannelName = argv[j];
5850 }
5906#if LL_DARWIN 5851#if LL_DARWIN
5907 else if (!strncmp(argv[j], "-psn_", 5)) 5852 else if (!strncmp(argv[j], "-psn_", 5))
5908 { 5853 {
@@ -6162,12 +6107,6 @@ void disconnect_viewer(void *)
6162 6107
6163 save_name_cache(); 6108 save_name_cache();
6164 6109
6165 // close IM interface
6166 if(gIMView)
6167 {
6168 gIMView->disconnectAllSessions();
6169 }
6170
6171 // close inventory interface, close all windows 6110 // close inventory interface, close all windows
6172 LLInventoryView::cleanup(); 6111 LLInventoryView::cleanup();
6173 6112