diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llappviewer.cpp | 1603 |
1 files changed, 642 insertions, 961 deletions
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index cb94e51..7c71e46 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp | |||
@@ -32,10 +32,11 @@ | |||
32 | 32 | ||
33 | #include "llviewerprecompiledheaders.h" | 33 | #include "llviewerprecompiledheaders.h" |
34 | #include "llappviewer.h" | 34 | #include "llappviewer.h" |
35 | #include "llprimitive.h" | ||
35 | 36 | ||
36 | #include "llversionviewer.h" | 37 | #include "llversionviewer.h" |
37 | #include "llfeaturemanager.h" | 38 | #include "llfeaturemanager.h" |
38 | #include "llvieweruictrlfactory.h" | 39 | #include "lluictrlfactory.h" |
39 | #include "llalertdialog.h" | 40 | #include "llalertdialog.h" |
40 | #include "llerrorcontrol.h" | 41 | #include "llerrorcontrol.h" |
41 | #include "llviewerimagelist.h" | 42 | #include "llviewerimagelist.h" |
@@ -45,12 +46,12 @@ | |||
45 | #include "llviewerstats.h" | 46 | #include "llviewerstats.h" |
46 | #include "llmd5.h" | 47 | #include "llmd5.h" |
47 | #include "llpumpio.h" | 48 | #include "llpumpio.h" |
48 | #include "llfloateractivespeakers.h" | ||
49 | #include "llimpanel.h" | 49 | #include "llimpanel.h" |
50 | #include "llmimetypes.h" | 50 | #include "llmimetypes.h" |
51 | #include "llstartup.h" | 51 | #include "llstartup.h" |
52 | #include "llfocusmgr.h" | 52 | #include "llfocusmgr.h" |
53 | #include "llviewerjoystick.h" | 53 | #include "llviewerjoystick.h" |
54 | #include "llfloaterjoystick.h" | ||
54 | #include "llares.h" | 55 | #include "llares.h" |
55 | #include "llcurl.h" | 56 | #include "llcurl.h" |
56 | #include "llfloatersnapshot.h" | 57 | #include "llfloatersnapshot.h" |
@@ -62,10 +63,13 @@ | |||
62 | #include "llmutelist.h" | 63 | #include "llmutelist.h" |
63 | #include "llurldispatcher.h" | 64 | #include "llurldispatcher.h" |
64 | #include "llurlhistory.h" | 65 | #include "llurlhistory.h" |
66 | #include "llfirstuse.h" | ||
65 | 67 | ||
66 | #include "llweb.h" | 68 | #include "llweb.h" |
67 | #include "llsecondlifeurls.h" | 69 | #include "llsecondlifeurls.h" |
68 | 70 | ||
71 | #include <boost/bind.hpp> | ||
72 | |||
69 | #if LL_WINDOWS | 73 | #if LL_WINDOWS |
70 | #include "llwindebug.h" | 74 | #include "llwindebug.h" |
71 | #endif | 75 | #endif |
@@ -93,7 +97,6 @@ | |||
93 | #include "lltoolmgr.h" | 97 | #include "lltoolmgr.h" |
94 | #include "llassetstorage.h" | 98 | #include "llassetstorage.h" |
95 | #include "llpolymesh.h" | 99 | #include "llpolymesh.h" |
96 | #include "lleconomy.h" | ||
97 | #include "llcachename.h" | 100 | #include "llcachename.h" |
98 | #include "audioengine.h" | 101 | #include "audioengine.h" |
99 | #include "llviewermenu.h" | 102 | #include "llviewermenu.h" |
@@ -108,6 +111,7 @@ | |||
108 | #include "lldebugview.h" | 111 | #include "lldebugview.h" |
109 | #include "llconsole.h" | 112 | #include "llconsole.h" |
110 | #include "llcontainerview.h" | 113 | #include "llcontainerview.h" |
114 | #include "llfloaterstats.h" | ||
111 | #include "llhoverview.h" | 115 | #include "llhoverview.h" |
112 | 116 | ||
113 | #include "llsdserialize.h" | 117 | #include "llsdserialize.h" |
@@ -148,14 +152,12 @@ | |||
148 | #include "llvieweraudio.h" | 152 | #include "llvieweraudio.h" |
149 | #include "llimview.h" | 153 | #include "llimview.h" |
150 | #include "llviewerthrottle.h" | 154 | #include "llviewerthrottle.h" |
155 | #include "llparcel.h" | ||
151 | // | 156 | // |
152 | 157 | ||
153 | #include "llinventoryview.h" | 158 | #include "llinventoryview.h" |
154 | 159 | ||
155 | // *FIX: Remove these once the command line params thing is figured out. | 160 | #include "llcommandlineparser.h" |
156 | // Yuck! | ||
157 | static int gTempArgC = 0; | ||
158 | static char** gTempArgV; | ||
159 | 161 | ||
160 | // *FIX: These extern globals should be cleaned up. | 162 | // *FIX: These extern globals should be cleaned up. |
161 | // The globals either represent state/config/resource-storage of either | 163 | // The globals either represent state/config/resource-storage of either |
@@ -168,7 +170,6 @@ static char** gTempArgV; | |||
168 | //---------------------------------------------------------------------------- | 170 | //---------------------------------------------------------------------------- |
169 | // llviewernetwork.h | 171 | // llviewernetwork.h |
170 | #include "llviewernetwork.h" | 172 | #include "llviewernetwork.h" |
171 | // extern EGridInfo gGridChoice; | ||
172 | 173 | ||
173 | 174 | ||
174 | ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor | 175 | ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor |
@@ -210,26 +211,13 @@ extern OSStatus DisplayReleaseNotes(void); | |||
210 | #endif // LL_DARWIN | 211 | #endif // LL_DARWIN |
211 | 212 | ||
212 | 213 | ||
213 | #include "moviemaker.h" | ||
214 | extern BOOL gbCapturing; | ||
215 | |||
216 | #if !LL_SOLARIS | ||
217 | extern MovieMaker gMovieMaker; | ||
218 | #endif | ||
219 | |||
220 | extern BOOL gRandomizeFramerate; | 214 | extern BOOL gRandomizeFramerate; |
221 | extern BOOL gPeriodicSlowFrame; | 215 | extern BOOL gPeriodicSlowFrame; |
222 | 216 | ||
223 | //////////////////////////////////////////////////////////// | 217 | //////////////////////////////////////////////////////////// |
224 | // All from the last globals push... | 218 | // All from the last globals push... |
225 | bool gVerifySSLCert = true; | ||
226 | BOOL gHandleKeysAsync = FALSE; | 219 | BOOL gHandleKeysAsync = FALSE; |
227 | 220 | ||
228 | BOOL gProbeHardware = TRUE; // Use DirectX 9 to probe for hardware | ||
229 | |||
230 | S32 gYieldMS = 0; // set in parse_args, used in mainLoop | ||
231 | BOOL gYieldTime = FALSE; | ||
232 | |||
233 | const F32 DEFAULT_AFK_TIMEOUT = 5.f * 60.f; // time with no input before user flagged as Away From Keyboard | 221 | const F32 DEFAULT_AFK_TIMEOUT = 5.f * 60.f; // time with no input before user flagged as Away From Keyboard |
234 | 222 | ||
235 | F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() | 223 | F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() |
@@ -240,25 +228,13 @@ LLString gDisabledMessage; // Set in LLAppViewer::initConfiguration used in idle | |||
240 | BOOL gHideLinks = FALSE; // Set in LLAppViewer::initConfiguration, used externally | 228 | BOOL gHideLinks = FALSE; // Set in LLAppViewer::initConfiguration, used externally |
241 | 229 | ||
242 | BOOL gAllowIdleAFK = TRUE; | 230 | BOOL gAllowIdleAFK = TRUE; |
243 | F32 gAFKTimeout = DEFAULT_AFK_TIMEOUT; | 231 | BOOL gAllowTapTapHoldRun = TRUE; |
244 | BOOL gShowObjectUpdates = FALSE; | 232 | BOOL gShowObjectUpdates = FALSE; |
245 | BOOL gLogMessages = FALSE; | ||
246 | std::string gChannelName = LL_CHANNEL; | ||
247 | BOOL gUseAudio = TRUE; | ||
248 | BOOL gUseQuickTime = TRUE; | 233 | BOOL gUseQuickTime = TRUE; |
249 | LLString gCmdLineFirstName; | ||
250 | LLString gCmdLineLastName; | ||
251 | LLString gCmdLinePassword; | ||
252 | |||
253 | BOOL gAutoLogin = FALSE; | ||
254 | 234 | ||
255 | const char* DEFAULT_SETTINGS_FILE = "settings.xml"; | ||
256 | BOOL gRequestInventoryLibrary = TRUE; | ||
257 | BOOL gGodConnect = FALSE; | ||
258 | BOOL gAcceptTOS = FALSE; | 235 | BOOL gAcceptTOS = FALSE; |
259 | BOOL gAcceptCriticalMessage = FALSE; | 236 | BOOL gAcceptCriticalMessage = FALSE; |
260 | 237 | ||
261 | LLUUID gViewerDigest; // MD5 digest of the viewer's executable file. | ||
262 | eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; | 238 | eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; |
263 | 239 | ||
264 | LLSD gDebugInfo; | 240 | LLSD gDebugInfo; |
@@ -285,7 +261,6 @@ F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME; | |||
285 | LLUUID gInventoryLibraryOwner; | 261 | LLUUID gInventoryLibraryOwner; |
286 | LLUUID gInventoryLibraryRoot; | 262 | LLUUID gInventoryLibraryRoot; |
287 | 263 | ||
288 | BOOL gDisableVoice = FALSE; | ||
289 | BOOL gDisconnected = FALSE; | 264 | BOOL gDisconnected = FALSE; |
290 | 265 | ||
291 | // Map scale in pixels per region | 266 | // Map scale in pixels per region |
@@ -297,17 +272,11 @@ LLFrameTimer gRestoreGLTimer; | |||
297 | BOOL gRestoreGL = FALSE; | 272 | BOOL gRestoreGL = FALSE; |
298 | BOOL gUseWireframe = FALSE; | 273 | BOOL gUseWireframe = FALSE; |
299 | 274 | ||
300 | F32 gMouseSensitivity = 3.f; | ||
301 | BOOL gInvertMouse = FALSE; | ||
302 | |||
303 | // VFS globals - see llappviewer.h | 275 | // VFS globals - see llappviewer.h |
304 | LLVFS* gStaticVFS = NULL; | 276 | LLVFS* gStaticVFS = NULL; |
305 | 277 | ||
306 | LLMemoryInfo gSysMemory; | 278 | LLMemoryInfo gSysMemory; |
307 | 279 | ||
308 | bool gPreloadImages = true; | ||
309 | bool gPreloadSounds = true; | ||
310 | |||
311 | LLString gLastVersionChannel; | 280 | LLString gLastVersionChannel; |
312 | 281 | ||
313 | LLVector3 gWindVec(3.0, 3.0, 0.0); | 282 | LLVector3 gWindVec(3.0, 3.0, 0.0); |
@@ -317,34 +286,16 @@ U32 gPacketsIn = 0; | |||
317 | 286 | ||
318 | BOOL gPrintMessagesThisFrame = FALSE; | 287 | BOOL gPrintMessagesThisFrame = FALSE; |
319 | 288 | ||
320 | BOOL gUseConsole = TRUE; | ||
321 | |||
322 | BOOL gRandomizeFramerate = FALSE; | 289 | BOOL gRandomizeFramerate = FALSE; |
323 | BOOL gPeriodicSlowFrame = FALSE; | 290 | BOOL gPeriodicSlowFrame = FALSE; |
324 | 291 | ||
325 | BOOL gQAMode = FALSE; | 292 | BOOL gCrashOnStartup = FALSE; |
326 | BOOL gLLErrorActivated = FALSE; | 293 | BOOL gLLErrorActivated = FALSE; |
327 | BOOL gLogoutInProgress = FALSE; | 294 | BOOL gLogoutInProgress = FALSE; |
328 | //////////////////////////////////////////////////////////// | 295 | //////////////////////////////////////////////////////////// |
329 | // Internal globals... that should be removed. | 296 | // Internal globals... that should be removed. |
330 | static F32 gQuitAfterSeconds = 0.f; | ||
331 | static BOOL gRotateRight = FALSE; | ||
332 | static BOOL gIgnorePixelDepth = FALSE; | ||
333 | |||
334 | // Allow multiple viewers in ReleaseForDownload | ||
335 | #if LL_RELEASE_FOR_DOWNLOAD | ||
336 | static BOOL gMultipleViewersOK = FALSE; | ||
337 | #else | ||
338 | static BOOL gMultipleViewersOK = TRUE; | ||
339 | #endif | ||
340 | |||
341 | static std::map<std::string, std::string> gCommandLineSettings; | ||
342 | static std::map<std::string, std::string> gCommandLineForcedSettings; | ||
343 | |||
344 | static LLString gArgs; | 297 | static LLString gArgs; |
345 | 298 | ||
346 | static LLString gOldSettingsFileName; | ||
347 | static const char* LEGACY_DEFAULT_SETTINGS_FILE = "settings.ini"; | ||
348 | const char* MARKER_FILE_NAME = "SecondLife.exec_marker"; | 299 | const char* MARKER_FILE_NAME = "SecondLife.exec_marker"; |
349 | const char* ERROR_MARKER_FILE_NAME = "SecondLife.error_marker"; | 300 | const char* ERROR_MARKER_FILE_NAME = "SecondLife.error_marker"; |
350 | const char* LLERROR_MARKER_FILE_NAME = "SecondLife.llerror_marker"; | 301 | const char* LLERROR_MARKER_FILE_NAME = "SecondLife.llerror_marker"; |
@@ -367,52 +318,10 @@ std::string gLoginPage; | |||
367 | std::vector<std::string> gLoginURIs; | 318 | std::vector<std::string> gLoginURIs; |
368 | static std::string gHelperURI; | 319 | static std::string gHelperURI; |
369 | 320 | ||
370 | static const char USAGE[] = "\n" | ||
371 | "usage:\tviewer [options]\n" | ||
372 | "options:\n" | ||
373 | " -login <first> <last> <password> log in as a user\n" | ||
374 | " -autologin log in as last saved user\n" | ||
375 | " -loginpage <URL> login authentication page to use\n" | ||
376 | " -loginuri <URI> login server and CGI script to use\n" | ||
377 | " -helperuri <URI> helper web CGI prefix to use\n" | ||
378 | " -settings <filename> specify the filename of a\n" | ||
379 | " configuration file\n" | ||
380 | " default is settings.xml\n" | ||
381 | " -setdefault <variable> <value> specify the value of a particular\n" | ||
382 | " configuration variable which can be\n" | ||
383 | " overridden by settings.xml\n" | ||
384 | " -set <variable> <value> specify the value of a particular\n" | ||
385 | " configuration variable that\n" | ||
386 | " overrides all other settings\n" | ||
387 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
388 | " -sim <simulator_ip> specify the simulator ip address\n" | ||
389 | #endif | ||
390 | " -god log in as god if you have god access\n" | ||
391 | " -purge delete files in cache\n" | ||
392 | " -safe reset preferences, run in safe mode\n" | ||
393 | " -noutc logs in local time, not UTC\n" | ||
394 | " -nothread run vfs in single thread\n" | ||
395 | " -noinvlib Do not request inventory library\n" | ||
396 | " -multiple allow multiple viewers\n" | ||
397 | " -nomultiple block multiple viewers\n" | ||
398 | " -novoice disable voice\n" | ||
399 | " -ignorepixeldepth ignore pixel depth settings\n" | ||
400 | " -cooperative [ms] yield some idle time to local host\n" | ||
401 | " -skin ui/branding skin folder to use\n" | ||
402 | #if LL_WINDOWS | ||
403 | " -noprobe disable hardware probe\n" | ||
404 | #endif | ||
405 | " -noquicktime disable QuickTime movies, speeds startup\n" | ||
406 | " -nopreload don't preload UI images or sounds, speeds startup\n" | ||
407 | // these seem to be unused | ||
408 | //" -noenv turn off environmental effects\n" | ||
409 | //" -proxy <proxy_ip> specify the proxy ip address\n" | ||
410 | "\n"; | ||
411 | |||
412 | void idle_afk_check() | 321 | void idle_afk_check() |
413 | { | 322 | { |
414 | // check idle timers | 323 | // check idle timers |
415 | if (gAllowIdleAFK && (gAwayTriggerTimer.getElapsedTimeF32() > gAFKTimeout)) | 324 | if (gAllowIdleAFK && (gAwayTriggerTimer.getElapsedTimeF32() > gSavedSettings.getF32("AFKTimeout"))) |
416 | { | 325 | { |
417 | gAgent.setAFK(); | 326 | gAgent.setAFK(); |
418 | } | 327 | } |
@@ -432,8 +341,8 @@ void request_initial_instant_messages() | |||
432 | { | 341 | { |
433 | static BOOL requested = FALSE; | 342 | static BOOL requested = FALSE; |
434 | if (!requested | 343 | if (!requested |
435 | && gMuteListp | 344 | && gMessageSystem |
436 | && gMuteListp->isLoaded() | 345 | && LLMuteList::getInstance()->isLoaded() |
437 | && gAgent.getAvatarObject()) | 346 | && gAgent.getAvatarObject()) |
438 | { | 347 | { |
439 | // Auto-accepted inventory items may require the avatar object | 348 | // Auto-accepted inventory items may require the avatar object |
@@ -451,7 +360,7 @@ void request_initial_instant_messages() | |||
451 | 360 | ||
452 | // Use these strictly for things that are constructed at startup, | 361 | // Use these strictly for things that are constructed at startup, |
453 | // or for things that are performance critical. JC | 362 | // or for things that are performance critical. JC |
454 | static void saved_settings_to_globals() | 363 | static void settings_to_globals() |
455 | { | 364 | { |
456 | LLBUTTON_H_PAD = gSavedSettings.getS32("ButtonHPad"); | 365 | LLBUTTON_H_PAD = gSavedSettings.getS32("ButtonHPad"); |
457 | LLBUTTON_V_PAD = gSavedSettings.getS32("ButtonVPad"); | 366 | LLBUTTON_V_PAD = gSavedSettings.getS32("ButtonVPad"); |
@@ -489,17 +398,18 @@ static void saved_settings_to_globals() | |||
489 | 398 | ||
490 | gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); | 399 | gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); |
491 | gAllowIdleAFK = gSavedSettings.getBOOL("AllowIdleAFK"); | 400 | gAllowIdleAFK = gSavedSettings.getBOOL("AllowIdleAFK"); |
492 | gAFKTimeout = gSavedSettings.getF32("AFKTimeout"); | 401 | gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun"); |
493 | gMouseSensitivity = gSavedSettings.getF32("MouseSensitivity"); | ||
494 | gInvertMouse = gSavedSettings.getBOOL("InvertMouse"); | ||
495 | gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); | 402 | gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); |
496 | gMapScale = gSavedSettings.getF32("MapScale"); | 403 | gMapScale = gSavedSettings.getF32("MapScale"); |
497 | gMiniMapScale = gSavedSettings.getF32("MiniMapScale"); | 404 | gMiniMapScale = gSavedSettings.getF32("MiniMapScale"); |
498 | gHandleKeysAsync = gSavedSettings.getBOOL("AsyncKeyboard"); | 405 | gHandleKeysAsync = gSavedSettings.getBOOL("AsyncKeyboard"); |
499 | LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips"); | 406 | LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips"); |
407 | } | ||
500 | 408 | ||
409 | static void settings_modify() | ||
410 | { | ||
501 | LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); | 411 | LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); |
502 | LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); | 412 | LLVOAvatar::sUseImpostors = FALSE; //gSavedSettings.getBOOL("RenderUseImpostors"); |
503 | LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); | 413 | LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); |
504 | LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //sqaure lod factor to get exponential range of [1,4] | 414 | LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //sqaure lod factor to get exponential range of [1,4] |
505 | 415 | ||
@@ -539,374 +449,75 @@ static void saved_settings_to_globals() | |||
539 | 449 | ||
540 | // propagate push to talk preference to current status | 450 | // propagate push to talk preference to current status |
541 | gSavedSettings.setBOOL("PTTCurrentlyEnabled", TRUE); //gSavedSettings.getBOOL("EnablePushToTalk")); | 451 | gSavedSettings.setBOOL("PTTCurrentlyEnabled", TRUE); //gSavedSettings.getBOOL("EnablePushToTalk")); |
542 | |||
543 | settings_setup_listeners(); | ||
544 | |||
545 | // gAgent.init() also loads from saved settings. | ||
546 | } | 452 | } |
547 | 453 | ||
548 | int parse_args(int argc, char **argv) | 454 | void initGridChoice() |
549 | { | 455 | { |
550 | // Sometimes IP addresses passed in on the command line have leading | 456 | LLString gridChoice = gSavedSettings.getString("GridChoice"); |
551 | // or trailing white space. Use LLString to clean that up. | 457 | if(!gridChoice.empty()) |
552 | LLString ip_string; | ||
553 | S32 j; | ||
554 | |||
555 | for (j = 1; j < argc; j++) | ||
556 | { | ||
557 | // Used to show first chunk of each argument passed in the | 458 | // Used to show first chunk of each argument passed in the |
558 | // window title. | 459 | // window title. |
559 | gArgs += argv[j]; | 460 | { |
560 | gArgs += " "; | 461 | // find the grid choice from the user setting. |
561 | 462 | int gridIndex = GRID_INFO_NONE; | |
562 | LLString argument = argv[j]; | 463 | for(;gridIndex < GRID_INFO_OTHER; ++gridIndex ) |
563 | if ((!strcmp(argv[j], "-port")) && (++j < argc)) | 464 | { |
564 | { | 465 | if(0 == LLString::compareInsensitive(gGridInfo[gridIndex].mLabel, gridChoice.c_str())) |
565 | sscanf(argv[j], "%u", &(gAgent.mViewerPort)); | 466 | { |
566 | } | 467 | gGridChoice = (EGridInfo)gridIndex; |
567 | else if ((!strcmp(argv[j], "-drop")) && (++j < argc)) | 468 | |
568 | { | 469 | if(GRID_INFO_LOCAL == gGridChoice) |
569 | sscanf(argv[j], "%f", &gPacketDropPercentage); | 470 | { |
570 | } | 471 | gGridName = LOOPBACK_ADDRESS_STRING; |
571 | else if ((!strcmp(argv[j], "-inbw")) && (++j < argc)) | 472 | break; |
572 | { | 473 | } |
573 | sscanf(argv[j], "%f", &gInBandwidth); | 474 | else |
574 | } | 475 | { |
575 | else if ((!strcmp(argv[j], "-outbw")) && (++j < argc)) | 476 | gGridName = gGridInfo[gGridChoice].mName; |
576 | { | 477 | break; |
577 | sscanf(argv[j], "%f", &gOutBandwidth); | 478 | } |
578 | } | 479 | } |
579 | else if (!strcmp(argv[j], "--aditi")) | 480 | } |
580 | { | 481 | |
581 | gGridChoice = GRID_INFO_ADITI; | 482 | if(GRID_INFO_OTHER == gridIndex) |
582 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore | 483 | { |
583 | } | 484 | // *FIX:MEP Can and should we validate that this is an IP address? |
584 | else if (!strcmp(argv[j], "--agni")) | 485 | gGridChoice = (EGridInfo)gridIndex; |
585 | { | 486 | gGridName = llformat("%s", gSavedSettings.getString("GridChoice").c_str()); |
586 | gGridChoice = GRID_INFO_AGNI; | 487 | |
587 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore | 488 | } |
588 | } | 489 | } |
589 | else if (!strcmp(argv[j], "--aruna")) | ||
590 | { | ||
591 | gGridChoice = GRID_INFO_ARUNA; | ||
592 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
593 | } | ||
594 | else if (!strcmp(argv[j], "--durga")) | ||
595 | { | ||
596 | gGridChoice = GRID_INFO_DURGA; | ||
597 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore | ||
598 | } | ||
599 | else if (!strcmp(argv[j], "--ganga")) | ||
600 | { | ||
601 | gGridChoice = GRID_INFO_GANGA; | ||
602 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
603 | } | ||
604 | else if (!strcmp(argv[j], "--mitra")) | ||
605 | { | ||
606 | gGridChoice = GRID_INFO_MITRA; | ||
607 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
608 | } | ||
609 | else if (!strcmp(argv[j], "--mohini")) | ||
610 | { | ||
611 | gGridChoice = GRID_INFO_MOHINI; | ||
612 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
613 | } | ||
614 | else if (!strcmp(argv[j], "--nandi")) | ||
615 | { | ||
616 | gGridChoice = GRID_INFO_NANDI; | ||
617 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
618 | } | ||
619 | else if (!strcmp(argv[j], "--radha")) | ||
620 | { | ||
621 | gGridChoice = GRID_INFO_RADHA; | ||
622 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
623 | } | ||
624 | else if (!strcmp(argv[j], "--ravi")) | ||
625 | { | ||
626 | gGridChoice = GRID_INFO_RAVI; | ||
627 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
628 | } | ||
629 | else if (!strcmp(argv[j], "--siva")) | ||
630 | { | ||
631 | gGridChoice = GRID_INFO_SIVA; | ||
632 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore | ||
633 | } | ||
634 | else if (!strcmp(argv[j], "--shakti")) | ||
635 | { | ||
636 | gGridChoice = GRID_INFO_SHAKTI; | ||
637 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore | ||
638 | } | ||
639 | else if (!strcmp(argv[j], "--soma")) | ||
640 | { | ||
641 | gGridChoice = GRID_INFO_SOMA; | ||
642 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore | ||
643 | } | ||
644 | else if (!strcmp(argv[j], "--uma")) | ||
645 | { | ||
646 | gGridChoice = GRID_INFO_UMA; | ||
647 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
648 | } | ||
649 | else if (!strcmp(argv[j], "--vaak")) | ||
650 | { | ||
651 | gGridChoice = GRID_INFO_VAAK; | ||
652 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
653 | } | ||
654 | else if (!strcmp(argv[j], "--yami")) | ||
655 | { | ||
656 | gGridChoice = GRID_INFO_YAMI; | ||
657 | sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName); | ||
658 | } | ||
659 | else if (!strcmp(argv[j], "-loginpage") && (++j < argc)) | ||
660 | { | ||
661 | LLAppViewer::instance()->setLoginPage(utf8str_trim(argv[j])); | ||
662 | } | ||
663 | else if (!strcmp(argv[j], "-loginuri") && (++j < argc)) | ||
664 | { | ||
665 | LLAppViewer::instance()->addLoginURI(utf8str_trim(argv[j])); | ||
666 | } | ||
667 | else if (!strcmp(argv[j], "-helperuri") && (++j < argc)) | ||
668 | { | ||
669 | LLAppViewer::instance()->setHelperURI(utf8str_trim(argv[j])); | ||
670 | } | ||
671 | else if (!strcmp(argv[j], "-debugviews")) | ||
672 | { | ||
673 | LLView::sDebugRects = TRUE; | ||
674 | } | ||
675 | else if (!strcmp(argv[j], "-skin") && (++j < argc)) | ||
676 | { | ||
677 | std::string folder(argv[j]); | ||
678 | gDirUtilp->setSkinFolder(folder); | ||
679 | } | ||
680 | else if (!strcmp(argv[j], "-autologin") || !strcmp(argv[j], "--autologin")) // keep --autologin for compatibility | ||
681 | { | ||
682 | gAutoLogin = TRUE; | ||
683 | } | ||
684 | else if (!strcmp(argv[j], "-quitafter") && (++j < argc)) | ||
685 | { | ||
686 | gQuitAfterSeconds = (F32)atof(argv[j]); | ||
687 | } | ||
688 | else if (!strcmp(argv[j], "-rotate")) | ||
689 | { | ||
690 | gRotateRight = TRUE; | ||
691 | } | ||
692 | // else if (!strcmp(argv[j], "-noenv")) | ||
693 | // { | ||
694 | //turn OFF environmental effects for slow machines/video cards | ||
695 | // gRequestParaboloidMap = FALSE; | ||
696 | // } | ||
697 | else if (!strcmp(argv[j], "-noaudio")) | ||
698 | { | ||
699 | gUseAudio = FALSE; | ||
700 | } | ||
701 | else if (!strcmp(argv[j], "-nosound")) // tends to be popular cmdline on Linux. | ||
702 | { | ||
703 | gUseAudio = FALSE; | ||
704 | } | ||
705 | else if (!strcmp(argv[j], "-noprobe")) | ||
706 | { | ||
707 | gProbeHardware = FALSE; | ||
708 | } | ||
709 | else if (!strcmp(argv[j], "-noquicktime")) | ||
710 | { | ||
711 | // Developers can log in faster if they don't load all the | ||
712 | // quicktime dlls. | ||
713 | gUseQuickTime = false; | ||
714 | } | ||
715 | else if (!strcmp(argv[j], "-nopreload")) | ||
716 | { | ||
717 | // Developers can log in faster if they don't decode sounds | ||
718 | // or images on startup, ~5 seconds faster. | ||
719 | gPreloadSounds = false; | ||
720 | gPreloadImages = false; | ||
721 | } | ||
722 | else if (!strcmp(argv[j], "-purge")) | ||
723 | { | ||
724 | LLAppViewer::instance()->purgeCache(); | ||
725 | } | ||
726 | else if(!strcmp(argv[j], "-noinvlib")) | ||
727 | { | ||
728 | gRequestInventoryLibrary = FALSE; | ||
729 | } | ||
730 | else if (!strcmp(argv[j], "-log")) | ||
731 | { | ||
732 | gLogMessages = TRUE; | ||
733 | continue; | ||
734 | } | ||
735 | else if (!strcmp(argv[j], "-logfile") && (++j < argc)) | ||
736 | { | ||
737 | // *NOTE: This buffer size is hard coded into scanf() below. | ||
738 | char logfile[256]; // Flawfinder: ignore | ||
739 | sscanf(argv[j], "%255s", logfile); // Flawfinder: ignore | ||
740 | llinfos << "Setting log file to " << logfile << llendl; | ||
741 | LLFile::remove(logfile); | ||
742 | LLError::logToFile(logfile); | ||
743 | } | ||
744 | else if (!strcmp(argv[j], "-settings") && (++j < argc)) | ||
745 | { | ||
746 | gSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, argv[j]); | ||
747 | } | ||
748 | else if (!strcmp(argv[j], "-setdefault") && (j + 2 < argc)) | ||
749 | { | ||
750 | std::string control_name; | ||
751 | std::string control_value; | ||
752 | |||
753 | j++; | ||
754 | if (argv[j]) control_name = std::string(argv[j]); | ||
755 | 490 | ||
756 | j++; | ||
757 | if (argv[j]) control_value = std::string(argv[j]); | ||
758 | |||
759 | // grab control name and value | ||
760 | if (!control_name.empty()) | ||
761 | { | ||
762 | gCommandLineSettings[control_name] = control_value; | ||
763 | } | ||
764 | } | ||
765 | else if (!strcmp(argv[j], "-set") && (j + 2 < argc)) | ||
766 | { | ||
767 | std::string control_name; | ||
768 | std::string control_value; | ||
769 | |||
770 | j++; | ||
771 | if (argv[j]) control_name = std::string(argv[j]); | ||
772 | 491 | ||
773 | j++; | 492 | #if !LL_RELEASE_FOR_DOWNLOAD |
774 | if (argv[j]) control_value = std::string(argv[j]); | 493 | if (gGridChoice == GRID_INFO_NONE) |
775 | 494 | { | |
776 | // grab control name and value | 495 | // Development version: load last server choice by default (overridden by cmd line args) |
777 | if (!control_name.empty()) | 496 | S32 server = gSavedSettings.getS32("ServerChoice"); |
778 | { | 497 | if (server != 0) |
779 | gCommandLineForcedSettings[control_name] = control_value; | 498 | gGridChoice = (EGridInfo)llclamp(server, 0, (S32)GRID_INFO_COUNT - 1); |
780 | } | 499 | if (server == GRID_INFO_OTHER) |
781 | } | ||
782 | else if (!strcmp(argv[j], "-login")) | ||
783 | { | ||
784 | if (j + 3 < argc) | ||
785 | { | ||
786 | j++; | ||
787 | gCmdLineFirstName = argv[j]; | ||
788 | j++; | ||
789 | gCmdLineLastName = argv[j]; | ||
790 | j++; | ||
791 | gCmdLinePassword = argv[j]; | ||
792 | } | ||
793 | else | ||
794 | { | ||
795 | // only works if -login is last parameter on command line | ||
796 | llerrs << "Not enough parameters to -login. Did you mean -loginuri?" << llendl; | ||
797 | } | ||
798 | } | ||
799 | else if (!strcmp(argv[j], "-god")) | ||
800 | { | ||
801 | gGodConnect = TRUE; | ||
802 | } | ||
803 | else if (!strcmp(argv[j], "-noconsole")) | ||
804 | { | ||
805 | gUseConsole = FALSE; | ||
806 | } | ||
807 | else if (!strcmp(argv[j], "-safe")) | ||
808 | { | ||
809 | llinfos << "Setting viewer feature table to run in safe mode, resetting prefs" << llendl; | ||
810 | gFeatureManagerp->setSafe(TRUE); | ||
811 | } | ||
812 | else if (!strcmp(argv[j], "-multiple")) | ||
813 | { | ||
814 | gMultipleViewersOK = TRUE; | ||
815 | } | ||
816 | else if (!strcmp(argv[j], "-nomultiple")) | ||
817 | { | ||
818 | gMultipleViewersOK = FALSE; | ||
819 | } | ||
820 | else if (!strcmp(argv[j], "-novoice")) | ||
821 | { | ||
822 | gDisableVoice = TRUE; | ||
823 | } | ||
824 | else if (!strcmp(argv[j], "-nothread")) | ||
825 | { | ||
826 | LLVFile::ALLOW_ASYNC = FALSE; | ||
827 | llinfos << "Running VFS in nothread mode" << llendl; | ||
828 | } | ||
829 | // some programs don't respect the command line options in protocol handlers (I'm looking at you, Opera) | ||
830 | // so this allows us to parse the URL straight off the command line without a "-url" paramater | ||
831 | else if (LLURLDispatcher::isSLURL(argv[j]) | ||
832 | || !strcmp(argv[j], "-url") && (++j < argc)) | ||
833 | { | ||
834 | std::string slurl = argv[j]; | ||
835 | if (LLURLDispatcher::isSLURLCommand(slurl)) | ||
836 | { | ||
837 | LLStartUp::sSLURLCommand = slurl; | ||
838 | } | ||
839 | else | ||
840 | { | ||
841 | LLURLSimString::setString(slurl); | ||
842 | } | ||
843 | // *NOTE: After setting the url, bail. What can happen is | ||
844 | // that someone can use IE (or potentially other browsers) | ||
845 | // and do the rough equivalent of command injection and | ||
846 | // steal passwords. Phoenix. SL-55321 | ||
847 | return 0; | ||
848 | } | ||
849 | else if (!strcmp(argv[j], "-ignorepixeldepth")) | ||
850 | { | ||
851 | gIgnorePixelDepth = TRUE; | ||
852 | } | ||
853 | else if (!strcmp(argv[j], "-cooperative")) | ||
854 | { | 500 | { |
855 | S32 ms_to_yield = 0; | 501 | LLString custom_server = gSavedSettings.getString("CustomServer"); |
856 | if(++j < argc) | 502 | if (custom_server.empty()) |
857 | { | 503 | { |
858 | S32 rv = sscanf(argv[j], "%d", &ms_to_yield); | 504 | gGridName = "none"; |
859 | if(0 == rv) | ||
860 | { | ||
861 | --j; | ||
862 | } | ||
863 | } | 505 | } |
864 | else | 506 | else |
865 | { | 507 | { |
866 | --j; | 508 | gGridName = custom_server.c_str(); |
867 | } | 509 | } |
868 | gYieldMS = ms_to_yield; | ||
869 | gYieldTime = TRUE; | ||
870 | } | ||
871 | else if (!strcmp(argv[j], "-no-verify-ssl-cert")) | ||
872 | { | ||
873 | gVerifySSLCert = false; | ||
874 | } | 510 | } |
875 | else if ( (!strcmp(argv[j], "--channel") || !strcmp(argv[j], "-channel")) && (++j < argc)) | ||
876 | { | ||
877 | gChannelName = argv[j]; | ||
878 | } | ||
879 | #if LL_DARWIN | ||
880 | else if (!strncmp(argv[j], "-psn_", 5)) | ||
881 | { | ||
882 | // this is the Finder passing the process session number | ||
883 | // we ignore this | ||
884 | } | ||
885 | #endif | ||
886 | else if(!strncmp(argv[j], "-qa", 3)) | ||
887 | { | ||
888 | // This whole case should disappear with settings clean-up work in QAR-369 | ||
889 | // or at least be replaced by setting a boolean in the settings repository. -MG | ||
890 | gQAMode = TRUE; | ||
891 | LLUI::setQAMode(gQAMode); | ||
892 | } | ||
893 | else if(argument == "-crash") | ||
894 | { | ||
895 | LLAppViewer::instance()->forceErrorBadMemoryAccess(); | ||
896 | } | ||
897 | else | ||
898 | { | ||
899 | 511 | ||
900 | // DBC - Mac OS X passes some stuff by default on the command line (e.g. psn). | 512 | gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel); |
901 | // Second Life URLs are passed this way as well? | 513 | } |
902 | llwarns << "Possible unknown keyword " << argv[j] << llendl; | 514 | #endif |
903 | 515 | ||
904 | // print usage information | 516 | if (gGridChoice == GRID_INFO_NONE) |
905 | llinfos << USAGE << llendl; | 517 | { |
906 | // return 1; | 518 | gGridChoice = GridDefaultChoice; |
907 | } | 519 | gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel); |
908 | } | 520 | } |
909 | return 0; | ||
910 | } | 521 | } |
911 | 522 | ||
912 | bool send_url_to_other_instance(const std::string& url) | 523 | bool send_url_to_other_instance(const std::string& url) |
@@ -917,6 +528,7 @@ bool send_url_to_other_instance(const std::string& url) | |||
917 | window_class[255] = 0; | 528 | window_class[255] = 0; |
918 | // Use the class instead of the window name. | 529 | // Use the class instead of the window name. |
919 | HWND other_window = FindWindow(window_class, NULL); | 530 | HWND other_window = FindWindow(window_class, NULL); |
531 | |||
920 | if (other_window != NULL) | 532 | if (other_window != NULL) |
921 | { | 533 | { |
922 | lldebugs << "Found other window with the name '" << gWindowTitle << "'" << llendl; | 534 | lldebugs << "Found other window with the name '" << gWindowTitle << "'" << llendl; |
@@ -942,6 +554,10 @@ bool send_url_to_other_instance(const std::string& url) | |||
942 | // The single viewer app. | 554 | // The single viewer app. |
943 | LLAppViewer* LLAppViewer::sInstance = NULL; | 555 | LLAppViewer* LLAppViewer::sInstance = NULL; |
944 | 556 | ||
557 | const std::string LLAppViewer::sGlobalSettingsName = "Global"; | ||
558 | const std::string LLAppViewer::sPerAccountSettingsName = "PerAccount"; | ||
559 | const std::string LLAppViewer::sCrashSettingsName = "CrashSettings"; | ||
560 | |||
945 | LLTextureCache* LLAppViewer::sTextureCache = NULL; | 561 | LLTextureCache* LLAppViewer::sTextureCache = NULL; |
946 | LLWorkerThread* LLAppViewer::sImageDecodeThread = NULL; | 562 | LLWorkerThread* LLAppViewer::sImageDecodeThread = NULL; |
947 | LLTextureFetch* LLAppViewer::sTextureFetch = NULL; | 563 | LLTextureFetch* LLAppViewer::sTextureFetch = NULL; |
@@ -952,11 +568,12 @@ LLAppViewer::LLAppViewer() : | |||
952 | mReportedCrash(false), | 568 | mReportedCrash(false), |
953 | mNumSessions(0), | 569 | mNumSessions(0), |
954 | mPurgeCache(false), | 570 | mPurgeCache(false), |
955 | mPurgeOnExit(false), | 571 | mPurgeOnExit(false), |
956 | mSecondInstance(false), | 572 | mSecondInstance(false), |
957 | mSavedFinalSnapshot(false), | 573 | mSavedFinalSnapshot(false), |
958 | mQuitRequested(false), | 574 | mQuitRequested(false), |
959 | mLogoutRequestSent(false) | 575 | mLogoutRequestSent(false), |
576 | mYieldTime(-1) | ||
960 | { | 577 | { |
961 | if(NULL != sInstance) | 578 | if(NULL != sInstance) |
962 | { | 579 | { |
@@ -972,13 +589,6 @@ LLAppViewer::~LLAppViewer() | |||
972 | removeMarkerFile(); | 589 | removeMarkerFile(); |
973 | } | 590 | } |
974 | 591 | ||
975 | bool LLAppViewer::tempStoreCommandOptions(int argc, char** argv) | ||
976 | { | ||
977 | gTempArgC = argc; | ||
978 | gTempArgV = argv; | ||
979 | return true; | ||
980 | } | ||
981 | |||
982 | bool LLAppViewer::init() | 592 | bool LLAppViewer::init() |
983 | { | 593 | { |
984 | // *NOTE:Mani - LLCurl::initClass is not thread safe. | 594 | // *NOTE:Mani - LLCurl::initClass is not thread safe. |
@@ -987,7 +597,6 @@ bool LLAppViewer::init() | |||
987 | 597 | ||
988 | initThreads(); | 598 | initThreads(); |
989 | 599 | ||
990 | initEarlyConfiguration(); | ||
991 | 600 | ||
992 | // | 601 | // |
993 | // Start of the application | 602 | // Start of the application |
@@ -1007,14 +616,19 @@ bool LLAppViewer::init() | |||
1007 | // | 616 | // |
1008 | // OK to write stuff to logs now, we've now crash reported if necessary | 617 | // OK to write stuff to logs now, we've now crash reported if necessary |
1009 | // | 618 | // |
1010 | |||
1011 | // Set up some defaults... | ||
1012 | gSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, DEFAULT_SETTINGS_FILE); | ||
1013 | gOldSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, LEGACY_DEFAULT_SETTINGS_FILE); | ||
1014 | |||
1015 | if (!initConfiguration()) | 619 | if (!initConfiguration()) |
1016 | return false; | 620 | return false; |
1017 | 621 | ||
622 | writeSystemInfo(); | ||
623 | |||
624 | // Build a string representing the current version number. | ||
625 | gCurrentVersion = llformat("%s %d.%d.%d.%d", | ||
626 | gSavedSettings.getString("VersionChannelName").c_str(), | ||
627 | LL_VERSION_MAJOR, | ||
628 | LL_VERSION_MINOR, | ||
629 | LL_VERSION_PATCH, | ||
630 | LL_VERSION_BUILD ); | ||
631 | |||
1018 | ////////////////////////////////////////////////////////////////////////////// | 632 | ////////////////////////////////////////////////////////////////////////////// |
1019 | ////////////////////////////////////////////////////////////////////////////// | 633 | ////////////////////////////////////////////////////////////////////////////// |
1020 | ////////////////////////////////////////////////////////////////////////////// | 634 | ////////////////////////////////////////////////////////////////////////////// |
@@ -1022,47 +636,10 @@ bool LLAppViewer::init() | |||
1022 | // *FIX: The following code isn't grouped into functions yet. | 636 | // *FIX: The following code isn't grouped into functions yet. |
1023 | 637 | ||
1024 | // | 638 | // |
1025 | // Write system information into the debug log (CPU, OS, etc.) | 639 | // Various introspection concerning the libs we're using. |
1026 | // | 640 | // |
1027 | writeSystemInfo(); | 641 | llinfos << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << llendl; |
1028 | 642 | ||
1029 | // Build a string representing the current version number. | ||
1030 | gCurrentVersion = llformat("%s %d.%d.%d.%d", gChannelName.c_str(), LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VERSION_BUILD ); | ||
1031 | |||
1032 | // | ||
1033 | // Merge with the command line overrides | ||
1034 | gSavedSettings.applyOverrides(gCommandLineSettings); | ||
1035 | |||
1036 | // Need to do this before calling parseAlerts | ||
1037 | gUICtrlFactory = new LLViewerUICtrlFactory(); | ||
1038 | |||
1039 | // Pre-load alerts.xml to define the warnings settings (always loads from skins/xui/en-us/) | ||
1040 | // Do this *before* loading the settings file | ||
1041 | LLAlertDialog::parseAlerts("alerts.xml", &gSavedSettings, TRUE); | ||
1042 | |||
1043 | // Overwrite default settings with user settings | ||
1044 | llinfos << "Loading configuration file " << gSettingsFileName << llendl; | ||
1045 | if (0 == gSavedSettings.loadFromFile(gSettingsFileName)) | ||
1046 | { | ||
1047 | llinfos << "Failed to load settings from " << gSettingsFileName << llendl; | ||
1048 | llinfos << "Loading legacy settings from " << gOldSettingsFileName << llendl; | ||
1049 | gSavedSettings.loadFromFileLegacy(gOldSettingsFileName); | ||
1050 | } | ||
1051 | |||
1052 | // need to do this here - need to have initialized global settings first | ||
1053 | LLString nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); | ||
1054 | if ( nextLoginLocation.length() ) | ||
1055 | { | ||
1056 | LLURLSimString::setString( nextLoginLocation.c_str() ); | ||
1057 | }; | ||
1058 | |||
1059 | // Merge with the command line overrides | ||
1060 | gSavedSettings.applyOverrides(gCommandLineForcedSettings); | ||
1061 | |||
1062 | gLastRunVersion = gSavedSettings.getString("LastRunVersion"); | ||
1063 | |||
1064 | fixup_settings(); | ||
1065 | |||
1066 | // Get the single value from the crash settings file, if it exists | 643 | // Get the single value from the crash settings file, if it exists |
1067 | std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); | 644 | std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); |
1068 | gCrashSettings.loadFromFile(crash_settings_filename.c_str()); | 645 | gCrashSettings.loadFromFile(crash_settings_filename.c_str()); |
@@ -1101,68 +678,29 @@ bool LLAppViewer::init() | |||
1101 | { | 678 | { |
1102 | LLError::setPrintLocation(true); | 679 | LLError::setPrintLocation(true); |
1103 | } | 680 | } |
1104 | |||
1105 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
1106 | if (gGridChoice == GRID_INFO_NONE) | ||
1107 | { | ||
1108 | // Development version: load last server choice by default (overridden by cmd line args) | ||
1109 | |||
1110 | S32 server = gSavedSettings.getS32("ServerChoice"); | ||
1111 | if (server != 0) | ||
1112 | gGridChoice = (EGridInfo)llclamp(server, 0, (S32)GRID_INFO_COUNT - 1); | ||
1113 | if (server == GRID_INFO_OTHER) | ||
1114 | { | ||
1115 | LLString custom_server = gSavedSettings.getString("CustomServer"); | ||
1116 | if (custom_server.empty()) | ||
1117 | { | ||
1118 | snprintf(gGridName, MAX_STRING, "none"); /* Flawfinder: ignore */ | ||
1119 | } | ||
1120 | else | ||
1121 | { | ||
1122 | snprintf(gGridName, MAX_STRING, "%s", custom_server.c_str()); /* Flawfinder: ignore */ | ||
1123 | } | ||
1124 | } | ||
1125 | } | ||
1126 | #endif | ||
1127 | |||
1128 | if (gGridChoice == GRID_INFO_NONE) | ||
1129 | { | ||
1130 | gGridChoice = GridDefaultChoice; | ||
1131 | } | ||
1132 | 681 | ||
1133 | // Load art UUID information, don't require these strings to be declared in code. | 682 | // Load art UUID information, don't require these strings to be declared in code. |
1134 | LLString viewer_art_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"viewerart.xml"); | ||
1135 | llinfos << "Loading art table from " << viewer_art_filename << llendl; | ||
1136 | gViewerArt.loadFromFile(viewer_art_filename.c_str(), FALSE); | ||
1137 | LLString textures_filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "textures", "textures.xml"); | ||
1138 | llinfos << "Loading art table from " << textures_filename << llendl; | ||
1139 | gViewerArt.loadFromFile(textures_filename.c_str(), FALSE); | ||
1140 | |||
1141 | LLString colors_base_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors_base.xml"); | 683 | LLString colors_base_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors_base.xml"); |
1142 | llinfos << "Loading base colors from " << colors_base_filename << llendl; | 684 | llinfos << "Loading base colors from " << colors_base_filename << llendl; |
1143 | gColors.loadFromFile(colors_base_filename.c_str(), FALSE, TYPE_COL4U); | 685 | gColors.loadFromFileLegacy(colors_base_filename.c_str(), FALSE, TYPE_COL4U); |
1144 | 686 | ||
1145 | // Load overrides from user colors file | 687 | // Load overrides from user colors file |
1146 | LLString user_colors_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors.xml"); | 688 | LLString user_colors_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors.xml"); |
1147 | llinfos << "Loading user colors from " << user_colors_filename << llendl; | 689 | llinfos << "Loading user colors from " << user_colors_filename << llendl; |
1148 | if (gColors.loadFromFile(user_colors_filename.c_str(), FALSE, TYPE_COL4U) == 0) | 690 | if (gColors.loadFromFileLegacy(user_colors_filename.c_str(), FALSE, TYPE_COL4U) == 0) |
1149 | { | 691 | { |
1150 | llinfos << "Failed to load user colors from " << user_colors_filename << llendl; | 692 | llinfos << "Cannot load user colors from " << user_colors_filename << llendl; |
1151 | LLString user_legacy_colors_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors.ini"); | ||
1152 | llinfos << "Loading legacy colors from " << user_legacy_colors_filename << llendl; | ||
1153 | gColors.loadFromFileLegacy(user_legacy_colors_filename.c_str(), FALSE, TYPE_COL4U); | ||
1154 | } | 693 | } |
1155 | 694 | ||
1156 | // Widget construction depends on LLUI being initialized | 695 | // Widget construction depends on LLUI being initialized |
1157 | LLUI::initClass(&gSavedSettings, | 696 | LLUI::initClass(&gSavedSettings, |
1158 | &gColors, | 697 | &gColors, |
1159 | &gViewerArt, | 698 | LLUIImageList::getInstance(), |
1160 | &gImageList, | ||
1161 | ui_audio_callback, | 699 | ui_audio_callback, |
1162 | &LLUI::sGLScaleFactor); | 700 | &LLUI::sGLScaleFactor); |
1163 | 701 | ||
1164 | LLWeb::initClass(); // do this after LLUI | 702 | LLWeb::initClass(); // do this after LLUI |
1165 | gUICtrlFactory->setupPaths(); // update paths with correct language set | 703 | LLUICtrlFactory::getInstance()->setupPaths(); // update paths with correct language set |
1166 | 704 | ||
1167 | ///////////////////////////////////////////////// | 705 | ///////////////////////////////////////////////// |
1168 | // | 706 | // |
@@ -1173,16 +711,18 @@ bool LLAppViewer::init() | |||
1173 | 711 | ||
1174 | LLAgent::parseTeleportMessages("teleport_strings.xml"); | 712 | LLAgent::parseTeleportMessages("teleport_strings.xml"); |
1175 | 713 | ||
714 | LLViewerJointMesh::updateVectorize(); | ||
715 | |||
1176 | // load MIME type -> media impl mappings | 716 | // load MIME type -> media impl mappings |
1177 | LLMIMETypes::parseMIMETypes( "mime_types.xml" ); | 717 | LLMIMETypes::parseMIMETypes( "mime_types.xml" ); |
1178 | 718 | ||
1179 | mCrashBehavior = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); | ||
1180 | |||
1181 | LLVectorPerformanceOptions::initClass(); | ||
1182 | |||
1183 | // Move certain saved settings into global variables for speed | ||
1184 | saved_settings_to_globals(); | ||
1185 | 719 | ||
720 | // Copy settings to globals. *TODO: Remove or move to appropriage class initializers | ||
721 | settings_to_globals(); | ||
722 | // Setup settings listeners | ||
723 | settings_setup_listeners(); | ||
724 | // Modify settings based on system configuration and compile options | ||
725 | settings_modify(); | ||
1186 | 726 | ||
1187 | // Find partition serial number (Windows) or hardware serial (Mac) | 727 | // Find partition serial number (Windows) or hardware serial (Mac) |
1188 | mSerialNumber = generateSerialNumber(); | 728 | mSerialNumber = generateSerialNumber(); |
@@ -1203,7 +743,7 @@ bool LLAppViewer::init() | |||
1203 | MemSetErrorHandler(first_mem_error_handler); | 743 | MemSetErrorHandler(first_mem_error_handler); |
1204 | #endif // LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP | 744 | #endif // LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP |
1205 | 745 | ||
1206 | gViewerStats = new LLViewerStats(); | 746 | // *Note: this is where gViewerStats used to be created. |
1207 | 747 | ||
1208 | // | 748 | // |
1209 | // Initialize the VFS, and gracefully handle initialization errors | 749 | // Initialize the VFS, and gracefully handle initialization errors |
@@ -1262,17 +802,6 @@ bool LLAppViewer::init() | |||
1262 | // Load Custom bindings (override defaults) | 802 | // Load Custom bindings (override defaults) |
1263 | gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"custom_keys.ini").c_str()); | 803 | gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"custom_keys.ini").c_str()); |
1264 | 804 | ||
1265 | // Calculate the digest for the executable (takes < 90ms on a fast machine). | ||
1266 | FILE* app_file = LLFile::fopen( gDirUtilp->getExecutablePathAndName().c_str(), "rb" ); /* Flawfinder: ignore */ | ||
1267 | if( app_file ) | ||
1268 | { | ||
1269 | LLMD5 app_md5; | ||
1270 | app_md5.update( app_file ); // Automatically closes the file | ||
1271 | app_md5.finalize(); | ||
1272 | app_md5.raw_digest( gViewerDigest.mData ); | ||
1273 | } | ||
1274 | llinfos << "Viewer Digest: " << gViewerDigest << llendl; | ||
1275 | |||
1276 | // If we don't have the right GL requirements, exit. | 805 | // If we don't have the right GL requirements, exit. |
1277 | if (!gGLManager.mHasRequirements && !gNoRender) | 806 | if (!gGLManager.mHasRequirements && !gNoRender) |
1278 | { | 807 | { |
@@ -1303,7 +832,7 @@ bool LLAppViewer::init() | |||
1303 | minRAMString >> minRAM; | 832 | minRAMString >> minRAM; |
1304 | minRAM = minRAM * 1024 * 1024; | 833 | minRAM = minRAM * 1024 * 1024; |
1305 | 834 | ||
1306 | if(!gFeatureManagerp->isGPUSupported()) | 835 | if(!LLFeatureManager::getInstance()->isGPUSupported()) |
1307 | { | 836 | { |
1308 | minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedGPU"); | 837 | minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedGPU"); |
1309 | minSpecs += "\n"; | 838 | minSpecs += "\n"; |
@@ -1338,6 +867,16 @@ bool LLAppViewer::init() | |||
1338 | gSimLastTime = gRenderStartTime.getElapsedTimeF32(); | 867 | gSimLastTime = gRenderStartTime.getElapsedTimeF32(); |
1339 | gSimFrames = (F32)gFrameCount; | 868 | gSimFrames = (F32)gFrameCount; |
1340 | 869 | ||
870 | LLViewerJoystick::getInstance()->init(false); | ||
871 | if (LLViewerJoystick::getInstance()->isLikeSpaceNavigator()) | ||
872 | { | ||
873 | if (gSavedSettings.getString("JoystickInitialized") != "SpaceNavigator") | ||
874 | { | ||
875 | LLFloaterJoystick::setSNDefaults(); | ||
876 | gSavedSettings.setString("JoystickInitialized", "SpaceNavigator"); | ||
877 | } | ||
878 | } | ||
879 | |||
1341 | return true; | 880 | return true; |
1342 | } | 881 | } |
1343 | 882 | ||
@@ -1352,9 +891,7 @@ bool LLAppViewer::mainLoop() | |||
1352 | LLHTTPClient::setPump(*gServicePump); | 891 | LLHTTPClient::setPump(*gServicePump); |
1353 | LLCurl::setCAFile(gDirUtilp->getCAFile()); | 892 | LLCurl::setCAFile(gDirUtilp->getCAFile()); |
1354 | 893 | ||
1355 | // initialize voice stuff here | 894 | // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated. |
1356 | gLocalSpeakerMgr = new LLLocalSpeakerMgr(); | ||
1357 | gActiveChannelSpeakerMgr = new LLActiveSpeakerMgr(); | ||
1358 | 895 | ||
1359 | LLVoiceChannel::initClass(); | 896 | LLVoiceChannel::initClass(); |
1360 | LLVoiceClient::init(gServicePump); | 897 | LLVoiceClient::init(gServicePump); |
@@ -1362,7 +899,9 @@ bool LLAppViewer::mainLoop() | |||
1362 | LLMemType mt1(LLMemType::MTYPE_MAIN); | 899 | LLMemType mt1(LLMemType::MTYPE_MAIN); |
1363 | LLTimer frameTimer,idleTimer; | 900 | LLTimer frameTimer,idleTimer; |
1364 | LLTimer debugTime; | 901 | LLTimer debugTime; |
1365 | 902 | LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); | |
903 | joystick->setNeedsReset(true); | ||
904 | |||
1366 | // Handle messages | 905 | // Handle messages |
1367 | while (!LLApp::isExiting()) | 906 | while (!LLApp::isExiting()) |
1368 | { | 907 | { |
@@ -1383,7 +922,7 @@ bool LLAppViewer::mainLoop() | |||
1383 | gViewerWindow->mWindow->gatherInput(); | 922 | gViewerWindow->mWindow->gatherInput(); |
1384 | } | 923 | } |
1385 | 924 | ||
1386 | #if 1 && !RELEASE_FOR_DOWNLOAD | 925 | #if 1 && !LL_RELEASE_FOR_DOWNLOAD |
1387 | // once per second debug info | 926 | // once per second debug info |
1388 | if (debugTime.getElapsedTimeF32() > 1.f) | 927 | if (debugTime.getElapsedTimeF32() > 1.f) |
1389 | { | 928 | { |
@@ -1403,8 +942,8 @@ bool LLAppViewer::mainLoop() | |||
1403 | && !gViewerWindow->getShowProgress() | 942 | && !gViewerWindow->getShowProgress() |
1404 | && !gFocusMgr.focusLocked()) | 943 | && !gFocusMgr.focusLocked()) |
1405 | { | 944 | { |
945 | joystick->scanJoystick(); | ||
1406 | gKeyboard->scanKeyboard(); | 946 | gKeyboard->scanKeyboard(); |
1407 | LLViewerJoystick::scanJoystick(); | ||
1408 | } | 947 | } |
1409 | 948 | ||
1410 | // Update state based on messages, user input, object idle. | 949 | // Update state based on messages, user input, object idle. |
@@ -1434,12 +973,6 @@ bool LLAppViewer::mainLoop() | |||
1434 | 973 | ||
1435 | LLFloaterSnapshot::update(); // take snapshots | 974 | LLFloaterSnapshot::update(); // take snapshots |
1436 | 975 | ||
1437 | #if !LL_SOLARIS | ||
1438 | if (gbCapturing) | ||
1439 | { | ||
1440 | gMovieMaker.Snap(); | ||
1441 | } | ||
1442 | #endif | ||
1443 | #if LL_WINDOWS && LL_LCD_COMPILE | 976 | #if LL_WINDOWS && LL_LCD_COMPILE |
1444 | // update LCD Screen | 977 | // update LCD Screen |
1445 | gLcdScreen->UpdateDisplay(); | 978 | gLcdScreen->UpdateDisplay(); |
@@ -1454,9 +987,9 @@ bool LLAppViewer::mainLoop() | |||
1454 | bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads"); | 987 | bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads"); |
1455 | 988 | ||
1456 | // yield some time to the os based on command line option | 989 | // yield some time to the os based on command line option |
1457 | if(gYieldTime) | 990 | if(mYieldTime >= 0) |
1458 | { | 991 | { |
1459 | ms_sleep(gYieldMS); | 992 | ms_sleep(mYieldTime); |
1460 | } | 993 | } |
1461 | 994 | ||
1462 | // yield cooperatively when not running as foreground window | 995 | // yield cooperatively when not running as foreground window |
@@ -1589,15 +1122,11 @@ bool LLAppViewer::cleanup() | |||
1589 | gTransferManager.cleanup(); | 1122 | gTransferManager.cleanup(); |
1590 | #endif | 1123 | #endif |
1591 | 1124 | ||
1592 | // Clean up map data storage | 1125 | // Note: this is where gWorldMap used to be deleted. |
1593 | delete gWorldMap; | ||
1594 | gWorldMap = NULL; | ||
1595 | 1126 | ||
1596 | delete gHUDManager; | 1127 | // Note: this is where gHUDManager used to be deleted. |
1597 | gHUDManager = NULL; | 1128 | LLHUDManager::getInstance()->shutdownClass(); |
1598 | 1129 | ||
1599 | delete gToolMgr; | ||
1600 | gToolMgr = NULL; | ||
1601 | 1130 | ||
1602 | delete gAssetStorage; | 1131 | delete gAssetStorage; |
1603 | gAssetStorage = NULL; | 1132 | gAssetStorage = NULL; |
@@ -1607,17 +1136,12 @@ bool LLAppViewer::cleanup() | |||
1607 | delete gCacheName; | 1136 | delete gCacheName; |
1608 | gCacheName = NULL; | 1137 | gCacheName = NULL; |
1609 | 1138 | ||
1610 | delete gGlobalEconomy; | 1139 | // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be deleted. |
1611 | gGlobalEconomy = NULL; | ||
1612 | |||
1613 | delete gActiveChannelSpeakerMgr; | ||
1614 | gActiveChannelSpeakerMgr = NULL; | ||
1615 | |||
1616 | delete gLocalSpeakerMgr; | ||
1617 | gLocalSpeakerMgr = NULL; | ||
1618 | 1140 | ||
1619 | LLNotifyBox::cleanup(); | 1141 | LLNotifyBox::cleanup(); |
1620 | 1142 | ||
1143 | LLWorldMap::getInstance()->reset(); // release any images | ||
1144 | |||
1621 | llinfos << "Global stuff deleted" << llendflush; | 1145 | llinfos << "Global stuff deleted" << llendflush; |
1622 | 1146 | ||
1623 | #if !LL_RELEASE_FOR_DOWNLOAD | 1147 | #if !LL_RELEASE_FOR_DOWNLOAD |
@@ -1631,9 +1155,7 @@ bool LLAppViewer::cleanup() | |||
1631 | llwarns << "Hack, skipping audio engine cleanup" << llendflush; | 1155 | llwarns << "Hack, skipping audio engine cleanup" << llendflush; |
1632 | #endif | 1156 | #endif |
1633 | 1157 | ||
1634 | llinfos << "Cleaning up feature manager" << llendflush; | 1158 | // Note: this is where LLFeatureManager::getInstance()-> used to be deleted. |
1635 | delete gFeatureManagerp; | ||
1636 | gFeatureManagerp = NULL; | ||
1637 | 1159 | ||
1638 | // Patch up settings for next time | 1160 | // Patch up settings for next time |
1639 | // Must do this before we delete the viewer window, | 1161 | // Must do this before we delete the viewer window, |
@@ -1709,20 +1231,22 @@ bool LLAppViewer::cleanup() | |||
1709 | gLcdScreen = NULL; | 1231 | gLcdScreen = NULL; |
1710 | #endif | 1232 | #endif |
1711 | 1233 | ||
1712 | if (!gVolumeMgr->cleanup()) | 1234 | LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager(); |
1235 | if (!volume_manager->cleanup()) | ||
1713 | { | 1236 | { |
1714 | llwarns << "Remaining references in the volume manager!" << llendflush; | 1237 | llwarns << "Remaining references in the volume manager!" << llendflush; |
1715 | } | 1238 | } |
1239 | LLPrimitive::cleanupVolumeManager(); | ||
1716 | 1240 | ||
1717 | LLViewerParcelMgr::cleanupGlobals(); | 1241 | LLViewerParcelMgr::cleanupGlobals(); |
1718 | 1242 | ||
1719 | delete gViewerStats; | 1243 | // *Note: this is where gViewerStats used to be deleted. |
1720 | gViewerStats = NULL; | ||
1721 | 1244 | ||
1722 | //end_messaging_system(); | 1245 | //end_messaging_system(); |
1723 | 1246 | ||
1724 | LLFollowCamMgr::cleanupClass(); | 1247 | LLFollowCamMgr::cleanupClass(); |
1725 | LLVolumeMgr::cleanupClass(); | 1248 | //LLVolumeMgr::cleanupClass(); |
1249 | LLPrimitive::cleanupVolumeManager(); | ||
1726 | LLWorldMapView::cleanupClass(); | 1250 | LLWorldMapView::cleanupClass(); |
1727 | LLUI::cleanupClass(); | 1251 | LLUI::cleanupClass(); |
1728 | 1252 | ||
@@ -1739,36 +1263,26 @@ bool LLAppViewer::cleanup() | |||
1739 | 1263 | ||
1740 | // Must do this after all panels have been deleted because panels that have persistent rects | 1264 | // Must do this after all panels have been deleted because panels that have persistent rects |
1741 | // save their rects on delete. | 1265 | // save their rects on delete. |
1742 | gSavedSettings.saveToFile(gSettingsFileName, TRUE); | 1266 | gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); |
1743 | if (!gPerAccountSettingsFileName.empty()) | 1267 | |
1744 | { | 1268 | // PerAccountSettingsFile should be empty if no use has been logged on. |
1745 | gSavedPerAccountSettings.saveToFile(gPerAccountSettingsFileName, TRUE); | 1269 | // *FIX:Mani This should get really saved in a "logoff" mode. |
1746 | } | 1270 | gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); |
1747 | llinfos << "Saved settings" << llendflush; | 1271 | llinfos << "Saved settings" << llendflush; |
1748 | 1272 | ||
1749 | std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); | 1273 | std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); |
1750 | // save all settings, even if equals defaults | 1274 | // save all settings, even if equals defaults |
1751 | gCrashSettings.saveToFile(crash_settings_filename.c_str(), FALSE); | 1275 | gCrashSettings.saveToFile(crash_settings_filename.c_str(), FALSE); |
1752 | 1276 | ||
1753 | delete gUICtrlFactory; | ||
1754 | gUICtrlFactory = NULL; | ||
1755 | |||
1756 | gSavedSettings.cleanup(); | 1277 | gSavedSettings.cleanup(); |
1757 | gViewerArt.cleanup(); | ||
1758 | gColors.cleanup(); | 1278 | gColors.cleanup(); |
1759 | gCrashSettings.cleanup(); | 1279 | gCrashSettings.cleanup(); |
1760 | 1280 | ||
1761 | // Save URL history file | 1281 | // Save URL history file |
1762 | LLURLHistory::saveFile("url_history.xml"); | 1282 | LLURLHistory::saveFile("url_history.xml"); |
1763 | 1283 | ||
1764 | if (gMuteListp) | 1284 | // save mute list. gMuteList used to also be deleted here too. |
1765 | { | 1285 | LLMuteList::getInstance()->cache(gAgent.getID()); |
1766 | // save mute list | ||
1767 | gMuteListp->cache(gAgent.getID()); | ||
1768 | |||
1769 | delete gMuteListp; | ||
1770 | gMuteListp = NULL; | ||
1771 | } | ||
1772 | 1286 | ||
1773 | if (mPurgeOnExit) | 1287 | if (mPurgeOnExit) |
1774 | { | 1288 | { |
@@ -1838,10 +1352,10 @@ bool LLAppViewer::cleanup() | |||
1838 | 1352 | ||
1839 | end_messaging_system(); | 1353 | end_messaging_system(); |
1840 | 1354 | ||
1841 | // *NOTE:Mani - The following call is not thread safe. | 1355 | // *NOTE:Mani - The following call is not thread safe. |
1842 | LLCurl::cleanupClass(); | 1356 | LLCurl::cleanupClass(); |
1843 | 1357 | ||
1844 | // If we're exiting to launch an URL, do that here so the screen | 1358 | // If we're exiting to launch an URL, do that here so the screen |
1845 | // is at the right resolution before we launch IE. | 1359 | // is at the right resolution before we launch IE. |
1846 | if (!gLaunchFileOnQuit.empty()) | 1360 | if (!gLaunchFileOnQuit.empty()) |
1847 | { | 1361 | { |
@@ -1862,106 +1376,6 @@ bool LLAppViewer::cleanup() | |||
1862 | return true; | 1376 | return true; |
1863 | } | 1377 | } |
1864 | 1378 | ||
1865 | bool LLAppViewer::initEarlyConfiguration() | ||
1866 | { | ||
1867 | // *FIX: globals - This method sets a bunch of globals early in the init process. | ||
1868 | int argc = gTempArgC; | ||
1869 | char** argv = gTempArgV; | ||
1870 | |||
1871 | // HACK! We REALLY want to know what grid they were trying to connect to if they | ||
1872 | // crashed hard. | ||
1873 | // So we walk through the command line args ONLY looking for the | ||
1874 | // userserver arguments first. And we don't do ANYTHING but set | ||
1875 | // the gGridName (which gets passed to the crash reporter). | ||
1876 | // We're assuming that they're trying to log into the same grid as last | ||
1877 | // time, which seems fairly reasonable. | ||
1878 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GridDefaultChoice].mName); // Flawfinder: ignore | ||
1879 | S32 j; | ||
1880 | for (j = 1; j < argc; j++) | ||
1881 | { | ||
1882 | if (!strcmp(argv[j], "--aditi")) | ||
1883 | { | ||
1884 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_ADITI].mName); // Flawfinder: ignore | ||
1885 | } | ||
1886 | else if (!strcmp(argv[j], "--agni")) | ||
1887 | { | ||
1888 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_AGNI].mName); // Flawfinder: ignore | ||
1889 | } | ||
1890 | else if (!strcmp(argv[j], "--siva")) | ||
1891 | { | ||
1892 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_SIVA].mName); // Flawfinder: ignore | ||
1893 | } | ||
1894 | else if (!strcmp(argv[j], "--shakti")) | ||
1895 | { | ||
1896 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_SHAKTI].mName); | ||
1897 | } | ||
1898 | else if (!strcmp(argv[j], "--durga")) | ||
1899 | { | ||
1900 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_DURGA].mName); // Flawfinder: ignore | ||
1901 | } | ||
1902 | else if (!strcmp(argv[j], "--soma")) | ||
1903 | { | ||
1904 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_SOMA].mName); // Flawfinder: ignore | ||
1905 | } | ||
1906 | else if (!strcmp(argv[j], "--ganga")) | ||
1907 | { | ||
1908 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_GANGA].mName); // Flawfinder: ignore | ||
1909 | } | ||
1910 | else if (!strcmp(argv[j], "--vaak")) | ||
1911 | { | ||
1912 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_VAAK].mName); | ||
1913 | } | ||
1914 | else if (!strcmp(argv[j], "--uma")) | ||
1915 | { | ||
1916 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_UMA].mName); | ||
1917 | } | ||
1918 | else if (!strcmp(argv[j], "--mohini")) | ||
1919 | { | ||
1920 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_MOHINI].mName); | ||
1921 | } | ||
1922 | else if (!strcmp(argv[j], "--yami")) | ||
1923 | { | ||
1924 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_YAMI].mName); | ||
1925 | } | ||
1926 | else if (!strcmp(argv[j], "--nandi")) | ||
1927 | { | ||
1928 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_NANDI].mName); | ||
1929 | } | ||
1930 | else if (!strcmp(argv[j], "--mitra")) | ||
1931 | { | ||
1932 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_MITRA].mName); | ||
1933 | } | ||
1934 | else if (!strcmp(argv[j], "--radha")) | ||
1935 | { | ||
1936 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_RADHA].mName); | ||
1937 | } | ||
1938 | else if (!strcmp(argv[j], "--ravi")) | ||
1939 | { | ||
1940 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_RAVI].mName); | ||
1941 | } | ||
1942 | else if (!strcmp(argv[j], "--aruna")) | ||
1943 | { | ||
1944 | sprintf(gGridName,"%s", gGridInfo[GRID_INFO_ARUNA].mName); | ||
1945 | } | ||
1946 | else if (!strcmp(argv[j], "-multiple")) | ||
1947 | { | ||
1948 | // Hack to detect -multiple so we can disable the marker file check (which will always fail) | ||
1949 | gMultipleViewersOK = TRUE; | ||
1950 | } | ||
1951 | else if (!strcmp(argv[j], "-novoice")) | ||
1952 | { | ||
1953 | // May need to know this early also | ||
1954 | gDisableVoice = TRUE; | ||
1955 | } | ||
1956 | else if (!strcmp(argv[j], "-url") && (++j < argc)) | ||
1957 | { | ||
1958 | LLURLSimString::setString(argv[j]); | ||
1959 | } | ||
1960 | } | ||
1961 | |||
1962 | return true; | ||
1963 | } | ||
1964 | |||
1965 | bool LLAppViewer::initThreads() | 1379 | bool LLAppViewer::initThreads() |
1966 | { | 1380 | { |
1967 | #if MEM_TRACK_MEM | 1381 | #if MEM_TRACK_MEM |
@@ -2022,14 +1436,359 @@ bool LLAppViewer::initLogging() | |||
2022 | return true; | 1436 | return true; |
2023 | } | 1437 | } |
2024 | 1438 | ||
1439 | void LLAppViewer::loadSettingsFromDirectory(ELLPath path_index) | ||
1440 | { | ||
1441 | for(LLSD::map_iterator itr = mSettingsFileList.beginMap(); itr != mSettingsFileList.endMap(); ++itr) | ||
1442 | { | ||
1443 | LLString settings_name = (*itr).first; | ||
1444 | LLString settings_file = mSettingsFileList[settings_name].asString(); | ||
1445 | |||
1446 | LLString full_settings_path = gDirUtilp->getExpandedFilename(path_index, settings_file); | ||
1447 | |||
1448 | if(settings_name == sGlobalSettingsName) | ||
1449 | { | ||
1450 | // The non-persistent setting, ClientSettingsFile, specifies a | ||
1451 | // custom name to use for the global settings file. | ||
1452 | std::string custom_path; | ||
1453 | if(gSettings[sGlobalSettingsName]->controlExists("ClientSettingsFile")) | ||
1454 | { | ||
1455 | custom_path = | ||
1456 | gSettings[sGlobalSettingsName]->getString("ClientSettingsFile"); | ||
1457 | } | ||
1458 | if(!custom_path.empty()) | ||
1459 | { | ||
1460 | full_settings_path = custom_path; | ||
1461 | } | ||
1462 | } | ||
1463 | |||
1464 | if(gSettings.find(settings_name) == gSettings.end()) | ||
1465 | { | ||
1466 | llwarns << "Cannot load " << settings_file << " - No matching settings group for name " << settings_name << llendl; | ||
1467 | continue; | ||
1468 | } | ||
1469 | if(!gSettings[settings_name]->loadFromFile(full_settings_path)) | ||
1470 | { | ||
1471 | llwarns << "Cannot load " << full_settings_path << " - No settings found." << llendl; | ||
1472 | } | ||
1473 | else | ||
1474 | { | ||
1475 | llinfos << "Loaded settings file " << full_settings_path << llendl; | ||
1476 | } | ||
1477 | } | ||
1478 | } | ||
1479 | |||
1480 | std::string LLAppViewer::getSettingsFileName(const std::string& file) | ||
1481 | { | ||
1482 | if(mSettingsFileList.has(file)) | ||
1483 | { | ||
1484 | return mSettingsFileList[file].asString(); | ||
1485 | } | ||
1486 | return std::string(); | ||
1487 | } | ||
1488 | |||
2025 | bool LLAppViewer::initConfiguration() | 1489 | bool LLAppViewer::initConfiguration() |
2026 | { | 1490 | { |
2027 | // Ye olde parse_args()... | 1491 | //Set up internal pointers |
2028 | if(!doConfigFromCommandLine()) | 1492 | gSettings[sGlobalSettingsName] = &gSavedSettings; |
1493 | gSettings[sPerAccountSettingsName] = &gSavedPerAccountSettings; | ||
1494 | gSettings[sCrashSettingsName] = &gCrashSettings; | ||
1495 | |||
1496 | //Load settings files list | ||
1497 | std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); | ||
1498 | LLControlGroup settings_control; | ||
1499 | llinfos << "Loading settings file list" << settings_file_list << llendl; | ||
1500 | if (0 == settings_control.loadFromFile(settings_file_list)) | ||
1501 | { | ||
1502 | llerrs << "Cannot load default configuration file " << settings_file_list << llendl; | ||
1503 | } | ||
1504 | |||
1505 | mSettingsFileList = settings_control.getLLSD("Files"); | ||
1506 | |||
1507 | // The settings and command line parsing have a fragile | ||
1508 | // order-of-operation: | ||
1509 | // - load defaults from app_settings | ||
1510 | // - set procedural settings values | ||
1511 | // - read command line settings | ||
1512 | // - selectively apply settings needed to load user settings. | ||
1513 | // - load overrides from user_settings | ||
1514 | // - apply command line settings (to override the overrides) | ||
1515 | // - load per account settings (happens in llstartup | ||
1516 | |||
1517 | // - load defaults | ||
1518 | loadSettingsFromDirectory(LL_PATH_APP_SETTINGS); | ||
1519 | |||
1520 | // - set procedural settings | ||
1521 | gSavedSettings.setString("ClientSettingsFile", | ||
1522 | gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFileName("Global"))); | ||
1523 | |||
1524 | gSavedSettings.setString("VersionChannelName", LL_CHANNEL); | ||
1525 | |||
1526 | #ifndef LL_RELEASE_FOR_DOWNLOAD | ||
1527 | gSavedSettings.setBOOL("ShowConsoleWindow", TRUE); | ||
1528 | gSavedSettings.setBOOL("AllowMultipleViewers", TRUE); | ||
1529 | #endif | ||
1530 | |||
1531 | #if LL_WINDOWS | ||
1532 | // Lists Japanese, Korean, and Chinese sanserif fonts available in | ||
1533 | // Windows XP and Vista, as well as "Arial Unicode MS". | ||
1534 | gSavedSettings.setString("FontSansSerifFallback", | ||
1535 | "MSGOTHIC.TTC;gulim.ttc;simhei.ttf;ArialUni.ttf"); | ||
1536 | #elif LL_DARWIN | ||
1537 | // This is a fairly complete Japanese font that ships with Mac OS X. | ||
1538 | // The first filename is in UTF8, but it shows up in the font menu as "Hiragino Kaku Gothic Pro W3". | ||
1539 | // The third filename is in UTF8, but it shows up in the font menu as "STHeiti Light" | ||
1540 | gSavedSettings.setString("FontSansSerifFallback", | ||
1541 | "\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 Pro W3.otf;\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 ProN W3.otf;AppleGothic.dfont;AppleGothic.ttf;\xe5\x8d\x8e\xe6\x96\x87\xe7\xbb\x86\xe9\xbb\x91.ttf"); | ||
1542 | #else | ||
1543 | // 'unicode.ttf' doesn't exist, but hopefully an international | ||
1544 | // user can take the hint and drop in their favourite local font. | ||
1545 | gSavedSettings.setString("FontSansSerifFallback", | ||
1546 | "unicode.ttf"); | ||
1547 | #endif | ||
1548 | |||
1549 | |||
1550 | // These are warnings that appear on the first experience of that condition. | ||
1551 | // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse | ||
1552 | // for disable/reset ability | ||
1553 | LLFirstUse::addConfigVariable("FirstBalanceIncrease"); | ||
1554 | LLFirstUse::addConfigVariable("FirstBalanceDecrease"); | ||
1555 | LLFirstUse::addConfigVariable("FirstSit"); | ||
1556 | LLFirstUse::addConfigVariable("FirstMap"); | ||
1557 | LLFirstUse::addConfigVariable("FirstGoTo"); | ||
1558 | LLFirstUse::addConfigVariable("FirstBuild"); | ||
1559 | LLFirstUse::addConfigVariable("FirstLeftClickNoHit"); | ||
1560 | LLFirstUse::addConfigVariable("FirstTeleport"); | ||
1561 | LLFirstUse::addConfigVariable("FirstOverrideKeys"); | ||
1562 | LLFirstUse::addConfigVariable("FirstAttach"); | ||
1563 | LLFirstUse::addConfigVariable("FirstAppearance"); | ||
1564 | LLFirstUse::addConfigVariable("FirstInventory"); | ||
1565 | LLFirstUse::addConfigVariable("FirstSandbox"); | ||
1566 | LLFirstUse::addConfigVariable("FirstFlexible"); | ||
1567 | LLFirstUse::addConfigVariable("FirstDebugMenus"); | ||
1568 | LLFirstUse::addConfigVariable("FirstStreamingMusic"); | ||
1569 | LLFirstUse::addConfigVariable("FirstStreamingVideo"); | ||
1570 | LLFirstUse::addConfigVariable("FirstSculptedPrim"); | ||
1571 | LLFirstUse::addConfigVariable("FirstVoice"); | ||
1572 | LLFirstUse::addConfigVariable("FirstMedia"); | ||
1573 | |||
1574 | ////// | ||
1575 | // *FIX:Mani - Find a way to remove the gUICtrlFactory and | ||
1576 | // LLAlertDialog::parseAlerts dependecies on the being loaded | ||
1577 | // *before* the user settings. Having to do this init here | ||
1578 | // seems odd. | ||
1579 | |||
1580 | // This is where gUICtrlFactory used to be instantiated with a new LLUICtrlFactory | ||
1581 | // which needed to happen before calling parseAlerts below. | ||
1582 | // TODO: That method is still dependant upon the base LLUICtrlFactory constructor being called | ||
1583 | // which registers some callbacks so I'm leaving in a call to getInstance here to cause that to | ||
1584 | // still happen. This needs to be cleaned up later when the base and derived classes | ||
1585 | // are planned to be combined. -MG | ||
1586 | LLUICtrlFactory::getInstance(); | ||
1587 | |||
1588 | |||
1589 | // Pre-load alerts.xml to define the warnings settings (always loads from skins/xui/en-us/) | ||
1590 | // Do this *before* loading the settings file | ||
1591 | LLAlertDialog::parseAlerts("alerts.xml", &gSavedSettings, TRUE); | ||
1592 | |||
1593 | // - read command line settings | ||
1594 | LLControlGroupCLP clp; | ||
1595 | std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, | ||
1596 | "cmd_line.xml"); | ||
1597 | clp.configure(cmd_line_config, &gSavedSettings); | ||
1598 | |||
1599 | if(!initParseCommandLine(clp)) | ||
2029 | { | 1600 | { |
1601 | llwarns | ||
1602 | << "Error parsing command line options. Command Line options ignored." | ||
1603 | << llendl; | ||
1604 | |||
1605 | llinfos << "Command line usage:\n" << clp << llendl; | ||
1606 | |||
1607 | std::ostringstream msg; | ||
1608 | msg << "Second Life found an error parsing the command line. \n" | ||
1609 | << "Please see: http://wiki.secondlife.com/wiki/Client_parameters \n" | ||
1610 | << "Error: " << clp.getErrorMessage(); | ||
1611 | |||
1612 | OSMessageBox( | ||
1613 | msg.str().c_str(), | ||
1614 | NULL, | ||
1615 | OSMB_OK); | ||
1616 | |||
2030 | return false; | 1617 | return false; |
2031 | } | 1618 | } |
2032 | 1619 | ||
1620 | // - selectively apply settings | ||
1621 | |||
1622 | // If the user has specified a alternate settings file name. | ||
1623 | // Load it now before loading the user_settings/settings.xml | ||
1624 | if(clp.hasOption("settings")) | ||
1625 | { | ||
1626 | std::string user_settings_filename = | ||
1627 | gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, | ||
1628 | clp.getOption("settings")[0]); | ||
1629 | gSavedSettings.setString("ClientSettingsFile", user_settings_filename); | ||
1630 | llinfos << "Using command line specified settings filename: " | ||
1631 | << user_settings_filename << llendl; | ||
1632 | } | ||
1633 | |||
1634 | // - load overrides from user_settings | ||
1635 | loadSettingsFromDirectory(LL_PATH_USER_SETTINGS); | ||
1636 | |||
1637 | // - apply command line settings | ||
1638 | clp.notify(); | ||
1639 | |||
1640 | // Handle initialization from settings. | ||
1641 | // Start up the debugging console before handling other options. | ||
1642 | if (gSavedSettings.getBOOL("ShowConsoleWindow")) | ||
1643 | { | ||
1644 | initConsole(); | ||
1645 | } | ||
1646 | |||
1647 | if(clp.hasOption("help")) | ||
1648 | { | ||
1649 | std::ostringstream msg; | ||
1650 | msg << "Command line usage:\n" << clp; | ||
1651 | llinfos << msg.str() << llendl; | ||
1652 | |||
1653 | OSMessageBox( | ||
1654 | msg.str().c_str(), | ||
1655 | NULL, | ||
1656 | OSMB_OK); | ||
1657 | |||
1658 | return false; | ||
1659 | } | ||
1660 | |||
1661 | ////////////////////////// | ||
1662 | // Apply settings... | ||
1663 | if(clp.hasOption("setdefault")) | ||
1664 | { | ||
1665 | //const LLCommandLineParser::token_vector_t& setdefault = clp.getOption("setdefault"); | ||
1666 | //if(0x1 & setdefault.size()) | ||
1667 | //{ | ||
1668 | // llwarns << "Invalid '--setdefault' parameter count." << llendl; | ||
1669 | //} | ||
1670 | //else | ||
1671 | //{ | ||
1672 | // LLCommandLineParser::token_vector_t::const_iterator itr = setdefault.begin(); | ||
1673 | // for(; itr != setdefault.end(); ++itr) | ||
1674 | // { | ||
1675 | // const std::string& name = *itr; | ||
1676 | // const std::string& value = *(++itr); | ||
1677 | // LLControlVariable* c = gSettings[sGlobalSettingsName]->getControl(name); | ||
1678 | // if(c) | ||
1679 | // { | ||
1680 | // c->setDefault(value); | ||
1681 | // } | ||
1682 | // else | ||
1683 | // { | ||
1684 | // llwarns << "'--setdefault' specified with unknown setting: '" | ||
1685 | // << name << "'." << llendl; | ||
1686 | // } | ||
1687 | // } | ||
1688 | //} | ||
1689 | } | ||
1690 | |||
1691 | if(clp.hasOption("set")) | ||
1692 | { | ||
1693 | const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); | ||
1694 | if(0x1 & set_values.size()) | ||
1695 | { | ||
1696 | llwarns << "Invalid '--set' parameter count." << llendl; | ||
1697 | } | ||
1698 | else | ||
1699 | { | ||
1700 | LLCommandLineParser::token_vector_t::const_iterator itr = set_values.begin(); | ||
1701 | for(; itr != set_values.end(); ++itr) | ||
1702 | { | ||
1703 | const std::string& name = *itr; | ||
1704 | const std::string& value = *(++itr); | ||
1705 | LLControlVariable* c = gSettings[sGlobalSettingsName]->getControl(name); | ||
1706 | if(c) | ||
1707 | { | ||
1708 | c->setValue(value, false); | ||
1709 | } | ||
1710 | else | ||
1711 | { | ||
1712 | llwarns << "'--set' specified with unknown setting: '" | ||
1713 | << name << "'." << llendl; | ||
1714 | } | ||
1715 | } | ||
1716 | } | ||
1717 | } | ||
1718 | |||
1719 | initGridChoice(); | ||
1720 | |||
1721 | // If we have specified crash on startup, set the global so we'll trigger the crash at the right time | ||
1722 | if(clp.hasOption("crashonstartup")) | ||
1723 | { | ||
1724 | gCrashOnStartup = TRUE; | ||
1725 | } | ||
1726 | |||
1727 | // Handle slurl use. NOTE: Don't let SL-55321 reappear. | ||
1728 | |||
1729 | // *FIX: This init code should be made more robust to prevent | ||
1730 | // the issue SL-55321 from returning. One thought is to allow | ||
1731 | // only select options to be set from command line when a slurl | ||
1732 | // is specified. More work on the settings system is needed to | ||
1733 | // achieve this. For now... | ||
1734 | |||
1735 | // *NOTE:Mani The command line parser parses tokens and is | ||
1736 | // setup to bail after parsing the '--url' option or the | ||
1737 | // first option specified without a '--option' flag (or | ||
1738 | // any other option that uses the 'last_option' setting - | ||
1739 | // see LLControlGroupCLP::configure()) | ||
1740 | |||
1741 | // What can happen is that someone can use IE (or potentially | ||
1742 | // other browsers) and do the rough equivalent of command | ||
1743 | // injection and steal passwords. Phoenix. SL-55321 | ||
1744 | if(clp.hasOption("url")) | ||
1745 | { | ||
1746 | std::string slurl = clp.getOption("url")[0]; | ||
1747 | if (LLURLDispatcher::isSLURLCommand(slurl)) | ||
1748 | { | ||
1749 | LLStartUp::sSLURLCommand = slurl; | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | LLURLSimString::setString(slurl); | ||
1754 | } | ||
1755 | } | ||
1756 | else if(clp.hasOption("slurl")) | ||
1757 | { | ||
1758 | std::string slurl = clp.getOption("slurl")[0]; | ||
1759 | if(LLURLDispatcher::isSLURL(slurl)) | ||
1760 | { | ||
1761 | if (LLURLDispatcher::isSLURLCommand(slurl)) | ||
1762 | { | ||
1763 | LLStartUp::sSLURLCommand = slurl; | ||
1764 | } | ||
1765 | else | ||
1766 | { | ||
1767 | LLURLSimString::setString(slurl); | ||
1768 | } | ||
1769 | } | ||
1770 | } | ||
1771 | |||
1772 | const LLControlVariable* loginuri = gSavedSettings.getControl("LoginURI"); | ||
1773 | if(loginuri && LLString::null != loginuri->getValue().asString()) | ||
1774 | { | ||
1775 | addLoginURI(loginuri->getValue().asString()); | ||
1776 | } | ||
1777 | |||
1778 | const LLControlVariable* helperuri = gSavedSettings.getControl("HelperURI"); | ||
1779 | if(helperuri && LLString::null != helperuri->getValue().asString()) | ||
1780 | { | ||
1781 | setHelperURI(helperuri->getValue().asString()); | ||
1782 | } | ||
1783 | |||
1784 | const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinFolder"); | ||
1785 | if(skinfolder && LLString::null != skinfolder->getValue().asString()) | ||
1786 | { | ||
1787 | gDirUtilp->setSkinFolder(skinfolder->getValue().asString()); | ||
1788 | } | ||
1789 | |||
1790 | mYieldTime = gSavedSettings.getS32("YieldTime"); | ||
1791 | |||
2033 | // XUI:translate | 1792 | // XUI:translate |
2034 | gSecondLife = "Second Life"; | 1793 | gSecondLife = "Second Life"; |
2035 | 1794 | ||
@@ -2091,28 +1850,15 @@ bool LLAppViewer::initConfiguration() | |||
2091 | LLSplashScreen::show(); | 1850 | LLSplashScreen::show(); |
2092 | LLSplashScreen::update(splash_msg.str().c_str()); | 1851 | LLSplashScreen::update(splash_msg.str().c_str()); |
2093 | 1852 | ||
2094 | LLVolumeMgr::initClass(); | 1853 | //LLVolumeMgr::initClass(); |
1854 | LLVolumeMgr* volume_manager = new LLVolumeMgr(); | ||
1855 | volume_manager->useMutex(); // LLApp and LLMutex magic must be manually enabled | ||
1856 | LLPrimitive::setVolumeManager(volume_manager); | ||
2095 | 1857 | ||
2096 | // Initialize the feature manager | 1858 | // Note: this is where we used to initialize LLFeatureManager::getInstance()->. |
2097 | // The feature manager is responsible for determining what features | ||
2098 | // are turned on/off in the app. | ||
2099 | gFeatureManagerp = new LLFeatureManager; | ||
2100 | 1859 | ||
2101 | gStartTime = totalTime(); | 1860 | gStartTime = totalTime(); |
2102 | 1861 | ||
2103 | //////////////////////////////////////// | ||
2104 | // | ||
2105 | // Process ini files | ||
2106 | // | ||
2107 | |||
2108 | // declare all possible setting variables | ||
2109 | declare_settings(); | ||
2110 | |||
2111 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
2112 | // only write the defaults for non-release builds! | ||
2113 | gSavedSettings.saveToFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings_default.xml").c_str(), FALSE); | ||
2114 | #endif | ||
2115 | |||
2116 | // | 1862 | // |
2117 | // Set the name of the window | 1863 | // Set the name of the window |
2118 | // | 1864 | // |
@@ -2125,33 +1871,34 @@ bool LLAppViewer::initConfiguration() | |||
2125 | #endif | 1871 | #endif |
2126 | LLString::truncate(gWindowTitle, 255); | 1872 | LLString::truncate(gWindowTitle, 255); |
2127 | 1873 | ||
2128 | if (!gMultipleViewersOK) | 1874 | //RN: if we received a URL, hand it off to the existing instance |
1875 | // don't call anotherInstanceRunning() when doing URL handoff, as | ||
1876 | // it relies on checking a marker file which will not work when running | ||
1877 | // out of different directories | ||
1878 | std::string slurl; | ||
1879 | if (!LLStartUp::sSLURLCommand.empty()) | ||
1880 | { | ||
1881 | slurl = LLStartUp::sSLURLCommand; | ||
1882 | } | ||
1883 | else if (LLURLSimString::parse()) | ||
1884 | { | ||
1885 | slurl = LLURLSimString::getURL(); | ||
1886 | } | ||
1887 | if (!slurl.empty()) | ||
1888 | { | ||
1889 | if (send_url_to_other_instance(slurl)) | ||
1890 | { | ||
1891 | // successfully handed off URL to existing instance, exit | ||
1892 | return false; | ||
1893 | } | ||
1894 | } | ||
1895 | |||
1896 | if (!gSavedSettings.getBOOL("AllowMultipleViewers")) | ||
2129 | { | 1897 | { |
2130 | // | 1898 | // |
2131 | // Check for another instance of the app running | 1899 | // Check for another instance of the app running |
2132 | // | 1900 | // |
2133 | //RN: if we received a URL, hand it off to the existing instance | 1901 | |
2134 | // don't call anotherInstanceRunning() when doing URL handoff, as | ||
2135 | // it relies on checking a marker file which will not work when running | ||
2136 | // out of different directories | ||
2137 | std::string slurl; | ||
2138 | if (!LLStartUp::sSLURLCommand.empty()) | ||
2139 | { | ||
2140 | slurl = LLStartUp::sSLURLCommand; | ||
2141 | } | ||
2142 | else if (LLURLSimString::parse()) | ||
2143 | { | ||
2144 | slurl = LLURLSimString::getURL(); | ||
2145 | } | ||
2146 | if (!slurl.empty()) | ||
2147 | { | ||
2148 | if (send_url_to_other_instance(slurl)) | ||
2149 | { | ||
2150 | // successfully handed off URL to existing instance, exit | ||
2151 | return false; | ||
2152 | } | ||
2153 | } | ||
2154 | |||
2155 | mSecondInstance = anotherInstanceRunning(); | 1902 | mSecondInstance = anotherInstanceRunning(); |
2156 | 1903 | ||
2157 | if (mSecondInstance) | 1904 | if (mSecondInstance) |
@@ -2251,111 +1998,29 @@ bool LLAppViewer::initConfiguration() | |||
2251 | 1998 | ||
2252 | if (mSecondInstance) | 1999 | if (mSecondInstance) |
2253 | { | 2000 | { |
2254 | gDisableVoice = TRUE; | 2001 | // This is the second instance of SL. Turn off voice support, |
2255 | /* Don't start another instance if using -multiple | 2002 | // but make sure the setting is *not* persisted. |
2256 | //RN: if we received a URL, hand it off to the existing instance | 2003 | LLControlVariable* disable_voice = gSavedSettings.getControl("CmdLineDisableVoice"); |
2257 | if (LLURLSimString::parse()) | 2004 | if(disable_voice) |
2258 | { | 2005 | { |
2259 | LLURLSimString::send_to_other_instance(); | 2006 | const BOOL DO_NOT_PERSIST = FALSE; |
2260 | return 1; | 2007 | disable_voice->setValue(LLSD(TRUE), DO_NOT_PERSIST); |
2261 | } | 2008 | } |
2262 | */ | ||
2263 | } | 2009 | } |
2264 | 2010 | ||
2265 | initMarkerFile(); | 2011 | initMarkerFile(); |
2266 | } | 2012 | } |
2267 | 2013 | ||
2268 | return true; // Config was successful. | 2014 | // need to do this here - need to have initialized global settings first |
2269 | } | 2015 | LLString nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); |
2270 | 2016 | if ( nextLoginLocation.length() ) | |
2271 | bool LLAppViewer::doConfigFromCommandLine() | ||
2272 | { | ||
2273 | // *FIX: This is what parse args used to do, minus the arg reading part. | ||
2274 | // Now the arg parsing is handled by LLApp::parseCommandOptions() and this | ||
2275 | // method need only interpret settings. Perhaps some day interested parties | ||
2276 | // can ask an app about a setting rather than have the app set | ||
2277 | // a gazzillion globals. | ||
2278 | |||
2279 | ///////////////////////////////////////// | ||
2280 | // | ||
2281 | // Process command line arguments | ||
2282 | // | ||
2283 | S32 args_result = 0; | ||
2284 | |||
2285 | #if LL_DARWIN | ||
2286 | { | 2017 | { |
2287 | // On the Mac, read in arguments.txt (if it exists) and process it for additional arguments. | 2018 | LLURLSimString::setString( nextLoginLocation.c_str() ); |
2288 | LLString args; | 2019 | }; |
2289 | if(_read_file_into_string(args, "arguments.txt")) /* Flawfinder: ignore*/ | ||
2290 | { | ||
2291 | // The arguments file exists. | ||
2292 | // It should consist of command line arguments separated by newlines. | ||
2293 | // Split it into individual arguments and build a fake argv[] to pass to parse_args. | ||
2294 | std::vector<std::string> arglist; | ||
2295 | |||
2296 | arglist.push_back("newview"); | ||
2297 | |||
2298 | llinfos << "Reading additional command line arguments from arguments.txt..." << llendl; | ||
2299 | |||
2300 | typedef boost::tokenizer<boost::escaped_list_separator<char> > tokenizer; | ||
2301 | boost::escaped_list_separator<char> sep("\\", "\r\n ", "\"'"); | ||
2302 | tokenizer tokens(args, sep); | ||
2303 | tokenizer::iterator token_iter; | ||
2304 | |||
2305 | for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) | ||
2306 | { | ||
2307 | // people can put their password in the file. :( | ||
2308 | // http://jira.secondlife.com/browse/SEC-42 | ||
2309 | //llinfos << "argument: '" << (token_iter->c_str()) << "'" << llendl; | ||
2310 | |||
2311 | arglist.push_back(*token_iter); | ||
2312 | } | ||
2313 | |||
2314 | char **fakeargv = new char*[arglist.size()]; | ||
2315 | int i; | ||
2316 | for(i=0; i < arglist.size(); i++) | ||
2317 | fakeargv[i] = const_cast<char*>(arglist[i].c_str()); | ||
2318 | |||
2319 | args_result = parse_args(arglist.size(), fakeargv); | ||
2320 | delete[] fakeargv; | ||
2321 | } | ||
2322 | |||
2323 | // Get the user's preferred language string based on the Mac OS localization mechanism. | ||
2324 | // To add a new localization: | ||
2325 | // go to the "Resources" section of the project | ||
2326 | // get info on "language.txt" | ||
2327 | // in the "General" tab, click the "Add Localization" button | ||
2328 | // create a new localization for the language you're adding | ||
2329 | // set the contents of the new localization of the file to the string corresponding to our localization | ||
2330 | // (i.e. "en-us", "ja", etc. Use the existing ones as a guide.) | ||
2331 | CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL); | ||
2332 | char path[MAX_PATH]; | ||
2333 | if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path))) | ||
2334 | { | ||
2335 | LLString lang; | ||
2336 | if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/ | ||
2337 | { | ||
2338 | gCommandLineForcedSettings["SystemLanguage"] = lang; | ||
2339 | } | ||
2340 | } | ||
2341 | CFRelease(url); | ||
2342 | } | ||
2343 | #endif | ||
2344 | |||
2345 | int argc = gTempArgC; | ||
2346 | char** argv = gTempArgV; | ||
2347 | 2020 | ||
2348 | // | 2021 | gLastRunVersion = gSavedSettings.getString("LastRunVersion"); |
2349 | // Parse the command line arguments | ||
2350 | // | ||
2351 | args_result |= parse_args(argc, argv); | ||
2352 | if (args_result) | ||
2353 | { | ||
2354 | removeMarkerFile(); | ||
2355 | return false; | ||
2356 | } | ||
2357 | 2022 | ||
2358 | return true; | 2023 | return true; // Config was successful. |
2359 | } | 2024 | } |
2360 | 2025 | ||
2361 | bool LLAppViewer::initWindow() | 2026 | bool LLAppViewer::initWindow() |
@@ -2374,10 +2039,11 @@ bool LLAppViewer::initWindow() | |||
2374 | window_title_str[sizeof(window_title_str) - 1] = '\0'; | 2039 | window_title_str[sizeof(window_title_str) - 1] = '\0'; |
2375 | 2040 | ||
2376 | // always start windowed | 2041 | // always start windowed |
2042 | BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); | ||
2377 | gViewerWindow = new LLViewerWindow(window_title_str, "Second Life", | 2043 | gViewerWindow = new LLViewerWindow(window_title_str, "Second Life", |
2378 | gSavedSettings.getS32("WindowX"), gSavedSettings.getS32("WindowY"), | 2044 | gSavedSettings.getS32("WindowX"), gSavedSettings.getS32("WindowY"), |
2379 | gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), | 2045 | gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), |
2380 | FALSE, gIgnorePixelDepth); | 2046 | FALSE, ignorePixelDepth); |
2381 | 2047 | ||
2382 | if (gSavedSettings.getBOOL("FullScreen")) | 2048 | if (gSavedSettings.getBOOL("FullScreen")) |
2383 | { | 2049 | { |
@@ -2399,14 +2065,20 @@ bool LLAppViewer::initWindow() | |||
2399 | 2065 | ||
2400 | // Set this flag in case we crash while initializing GL | 2066 | // Set this flag in case we crash while initializing GL |
2401 | gSavedSettings.setBOOL("RenderInitError", TRUE); | 2067 | gSavedSettings.setBOOL("RenderInitError", TRUE); |
2402 | gSavedSettings.saveToFile( gSettingsFileName, TRUE ); | 2068 | gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); |
2403 | 2069 | ||
2404 | gPipeline.init(); | 2070 | gPipeline.init(); |
2405 | stop_glerror(); | 2071 | stop_glerror(); |
2406 | gViewerWindow->initGLDefaults(); | 2072 | gViewerWindow->initGLDefaults(); |
2407 | 2073 | ||
2408 | gSavedSettings.setBOOL("RenderInitError", FALSE); | 2074 | gSavedSettings.setBOOL("RenderInitError", FALSE); |
2409 | gSavedSettings.saveToFile( gSettingsFileName, TRUE ); | 2075 | gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); |
2076 | } | ||
2077 | |||
2078 | //If we have a startup crash, it's usually near GL initialization, so simulate that. | ||
2079 | if(gCrashOnStartup) | ||
2080 | { | ||
2081 | LLAppViewer::instance()->forceErrorLLError(); | ||
2410 | } | 2082 | } |
2411 | 2083 | ||
2412 | LLUI::sWindow = gViewerWindow->getWindow(); | 2084 | LLUI::sWindow = gViewerWindow->getWindow(); |
@@ -2414,11 +2086,6 @@ bool LLAppViewer::initWindow() | |||
2414 | LLAlertDialog::parseAlerts("alerts.xml"); | 2086 | LLAlertDialog::parseAlerts("alerts.xml"); |
2415 | LLNotifyBox::parseNotify("notify.xml"); | 2087 | LLNotifyBox::parseNotify("notify.xml"); |
2416 | 2088 | ||
2417 | // *TODO - remove this when merging into release | ||
2418 | // DON'T Clean up the feature manager lookup table - settings are needed | ||
2419 | // for setting the graphics level. | ||
2420 | //gFeatureManagerp->cleanupFeatureTables(); | ||
2421 | |||
2422 | // Show watch cursor | 2089 | // Show watch cursor |
2423 | gViewerWindow->setCursor(UI_CURSOR_WAIT); | 2090 | gViewerWindow->setCursor(UI_CURSOR_WAIT); |
2424 | 2091 | ||
@@ -2427,6 +2094,7 @@ bool LLAppViewer::initWindow() | |||
2427 | 2094 | ||
2428 | // show viewer window | 2095 | // show viewer window |
2429 | gViewerWindow->mWindow->show(); | 2096 | gViewerWindow->mWindow->show(); |
2097 | |||
2430 | 2098 | ||
2431 | return true; | 2099 | return true; |
2432 | } | 2100 | } |
@@ -2455,6 +2123,7 @@ void LLAppViewer::cleanupSavedSettings() | |||
2455 | gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc); | 2123 | gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc); |
2456 | 2124 | ||
2457 | gSavedSettings.setBOOL("AllowIdleAFK", gAllowIdleAFK); | 2125 | gSavedSettings.setBOOL("AllowIdleAFK", gAllowIdleAFK); |
2126 | gSavedSettings.setBOOL("AllowTapTapHoldRun", gAllowTapTapHoldRun); | ||
2458 | gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates); | 2127 | gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates); |
2459 | 2128 | ||
2460 | if (!gNoRender) | 2129 | if (!gNoRender) |
@@ -2462,7 +2131,7 @@ void LLAppViewer::cleanupSavedSettings() | |||
2462 | if (gDebugView) | 2131 | if (gDebugView) |
2463 | { | 2132 | { |
2464 | gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible()); | 2133 | gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible()); |
2465 | gSavedSettings.setBOOL("ShowDebugStats", gDebugView->mStatViewp->getVisible()); | 2134 | gSavedSettings.setBOOL("ShowDebugStats", gDebugView->mFloaterStatsp->getVisible()); |
2466 | } | 2135 | } |
2467 | } | 2136 | } |
2468 | 2137 | ||
@@ -2508,7 +2177,7 @@ void LLAppViewer::writeSystemInfo() | |||
2508 | { | 2177 | { |
2509 | gDebugInfo["SLLog"] = LLError::logFileName(); | 2178 | gDebugInfo["SLLog"] = LLError::logFileName(); |
2510 | 2179 | ||
2511 | gDebugInfo["ClientInfo"]["Name"] = gChannelName; | 2180 | gDebugInfo["ClientInfo"]["Name"] = gSavedSettings.getString("VersionChannelName"); |
2512 | gDebugInfo["ClientInfo"]["MajorVersion"] = LL_VERSION_MAJOR; | 2181 | gDebugInfo["ClientInfo"]["MajorVersion"] = LL_VERSION_MAJOR; |
2513 | gDebugInfo["ClientInfo"]["MinorVersion"] = LL_VERSION_MINOR; | 2182 | gDebugInfo["ClientInfo"]["MinorVersion"] = LL_VERSION_MINOR; |
2514 | gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; | 2183 | gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; |
@@ -2543,6 +2212,13 @@ void LLAppViewer::writeSystemInfo() | |||
2543 | llinfos << "OS info: " << getOSInfo() << llendl; | 2212 | llinfos << "OS info: " << getOSInfo() << llendl; |
2544 | } | 2213 | } |
2545 | 2214 | ||
2215 | void LLAppViewer::handleSyncViewerCrash() | ||
2216 | { | ||
2217 | LLAppViewer* pApp = LLAppViewer::instance(); | ||
2218 | // Call to pure virtual, handled by platform specific llappviewer instance. | ||
2219 | pApp->handleSyncCrashTrace(); | ||
2220 | } | ||
2221 | |||
2546 | void LLAppViewer::handleViewerCrash() | 2222 | void LLAppViewer::handleViewerCrash() |
2547 | { | 2223 | { |
2548 | LLAppViewer* pApp = LLAppViewer::instance(); | 2224 | LLAppViewer* pApp = LLAppViewer::instance(); |
@@ -2562,13 +2238,25 @@ void LLAppViewer::handleViewerCrash() | |||
2562 | 2238 | ||
2563 | //We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version | 2239 | //We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version |
2564 | //to check against no matter what | 2240 | //to check against no matter what |
2565 | gDebugInfo["ClientInfo"]["Name"] = gChannelName; | 2241 | gDebugInfo["ClientInfo"]["Name"] = gSavedSettings.getString("VersionChannelName"); |
2242 | |||
2566 | gDebugInfo["ClientInfo"]["MajorVersion"] = LL_VERSION_MAJOR; | 2243 | gDebugInfo["ClientInfo"]["MajorVersion"] = LL_VERSION_MAJOR; |
2567 | gDebugInfo["ClientInfo"]["MinorVersion"] = LL_VERSION_MINOR; | 2244 | gDebugInfo["ClientInfo"]["MinorVersion"] = LL_VERSION_MINOR; |
2568 | gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; | 2245 | gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; |
2569 | gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD; | 2246 | gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD; |
2247 | |||
2248 | LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); | ||
2249 | if ( parcel && parcel->getMusicURL()[0]) | ||
2250 | { | ||
2251 | gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL(); | ||
2252 | } | ||
2253 | if ( parcel && parcel->getMediaURL()[0]) | ||
2254 | { | ||
2255 | gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL(); | ||
2256 | } | ||
2257 | |||
2570 | 2258 | ||
2571 | gDebugInfo["SettingsFilename"] = gSettingsFileName; | 2259 | gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile"); |
2572 | gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); | 2260 | gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); |
2573 | gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName().c_str(); | 2261 | gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName().c_str(); |
2574 | gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath().c_str(); | 2262 | gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath().c_str(); |
@@ -2625,10 +2313,8 @@ void LLAppViewer::handleViewerCrash() | |||
2625 | gMessageSystem->getCircuitInfo(gDebugInfo["CircuitInfo"]); | 2313 | gMessageSystem->getCircuitInfo(gDebugInfo["CircuitInfo"]); |
2626 | gMessageSystem->stopLogging(); | 2314 | gMessageSystem->stopLogging(); |
2627 | } | 2315 | } |
2628 | if (gWorldp) | 2316 | |
2629 | { | 2317 | LLWorld::getInstance()->getInfo(gDebugInfo); |
2630 | gWorldp->getInfo(gDebugInfo); | ||
2631 | } | ||
2632 | 2318 | ||
2633 | // Close the debug file | 2319 | // Close the debug file |
2634 | pApp->closeDebug(); | 2320 | pApp->closeDebug(); |
@@ -2644,7 +2330,7 @@ void LLAppViewer::handleViewerCrash() | |||
2644 | pApp->removeMarkerFile(false); | 2330 | pApp->removeMarkerFile(false); |
2645 | } | 2331 | } |
2646 | 2332 | ||
2647 | // Call to pure virtual, handled by platform specifc llappviewer instance. | 2333 | // Call to pure virtual, handled by platform specific llappviewer instance. |
2648 | pApp->handleCrashReporting(); | 2334 | pApp->handleCrashReporting(); |
2649 | 2335 | ||
2650 | return; | 2336 | return; |
@@ -2740,7 +2426,11 @@ void LLAppViewer::initMarkerFile() | |||
2740 | ll_apr_file_remove(error_marker_file); | 2426 | ll_apr_file_remove(error_marker_file); |
2741 | 2427 | ||
2742 | //Freeze case checks | 2428 | //Freeze case checks |
2743 | if(anotherInstanceRunning()) return; | 2429 | if(anotherInstanceRunning()) |
2430 | { | ||
2431 | return; | ||
2432 | } | ||
2433 | |||
2744 | fMarker = ll_apr_file_open(mMarkerFileName, LL_APR_RB); | 2434 | fMarker = ll_apr_file_open(mMarkerFileName, LL_APR_RB); |
2745 | if (fMarker != NULL) | 2435 | if (fMarker != NULL) |
2746 | { | 2436 | { |
@@ -2804,13 +2494,10 @@ void LLAppViewer::requestQuit() | |||
2804 | return; | 2494 | return; |
2805 | } | 2495 | } |
2806 | 2496 | ||
2807 | if (gHUDManager) | 2497 | LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); |
2808 | { | 2498 | effectp->setPositionGlobal(gAgent.getPositionGlobal()); |
2809 | LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); | 2499 | effectp->setColor(LLColor4U(gAgent.getEffectColor())); |
2810 | effectp->setPositionGlobal(gAgent.getPositionGlobal()); | 2500 | LLHUDManager::getInstance()->sendEffects(); |
2811 | effectp->setColor(LLColor4U(gAgent.getEffectColor())); | ||
2812 | gHUDManager->sendEffects(); | ||
2813 | } | ||
2814 | 2501 | ||
2815 | // Attempt to close all floaters that might be | 2502 | // Attempt to close all floaters that might be |
2816 | // editing things. | 2503 | // editing things. |
@@ -2952,7 +2639,7 @@ bool LLAppViewer::initCache() | |||
2952 | char static_vfs_index_file[LL_MAX_PATH]; // Flawfinder: ignore | 2639 | char static_vfs_index_file[LL_MAX_PATH]; // Flawfinder: ignore |
2953 | char static_vfs_data_file[LL_MAX_PATH]; // Flawfinder: ignore | 2640 | char static_vfs_data_file[LL_MAX_PATH]; // Flawfinder: ignore |
2954 | 2641 | ||
2955 | if (gMultipleViewersOK) | 2642 | if (gSavedSettings.getBOOL("AllowMultipleViewers")) |
2956 | { | 2643 | { |
2957 | // don't mess with renaming the VFS in this case | 2644 | // don't mess with renaming the VFS in this case |
2958 | new_salt = old_salt; | 2645 | new_salt = old_salt; |
@@ -3143,7 +2830,25 @@ const std::string& LLAppViewer::getHelperURI() const | |||
3143 | 2830 | ||
3144 | void LLAppViewer::addLoginURI(const std::string& uri) | 2831 | void LLAppViewer::addLoginURI(const std::string& uri) |
3145 | { | 2832 | { |
2833 | // *NOTE:Mani - login uri trumps the --grid (gGridChoice) setting. | ||
2834 | // Update gGridChoice to reflect the loginURI setting. | ||
3146 | gLoginURIs.push_back(uri); | 2835 | gLoginURIs.push_back(uri); |
2836 | |||
2837 | const std::string& top_uri = getLoginURIs()[0]; | ||
2838 | int i = 0; | ||
2839 | for(; i < GRID_INFO_COUNT; ++i) | ||
2840 | { | ||
2841 | if(top_uri == gGridInfo[i].mLoginURI) | ||
2842 | { | ||
2843 | gGridChoice = (EGridInfo)i; | ||
2844 | break; | ||
2845 | } | ||
2846 | } | ||
2847 | |||
2848 | if(GRID_INFO_COUNT == i) | ||
2849 | { | ||
2850 | gGridChoice = GRID_INFO_OTHER; | ||
2851 | } | ||
3147 | } | 2852 | } |
3148 | 2853 | ||
3149 | void LLAppViewer::setHelperURI(const std::string& uri) | 2854 | void LLAppViewer::setHelperURI(const std::string& uri) |
@@ -3151,17 +2856,6 @@ void LLAppViewer::setHelperURI(const std::string& uri) | |||
3151 | gHelperURI = uri; | 2856 | gHelperURI = uri; |
3152 | } | 2857 | } |
3153 | 2858 | ||
3154 | void LLAppViewer::setLoginPage(const std::string& login_page) | ||
3155 | { | ||
3156 | gLoginPage = login_page; | ||
3157 | } | ||
3158 | |||
3159 | const std::string& LLAppViewer::getLoginPage() | ||
3160 | { | ||
3161 | return gLoginPage; | ||
3162 | } | ||
3163 | |||
3164 | |||
3165 | // Callback from a dialog indicating user was logged out. | 2859 | // Callback from a dialog indicating user was logged out. |
3166 | void finish_disconnect(S32 option, void* userdata) | 2860 | void finish_disconnect(S32 option, void* userdata) |
3167 | { | 2861 | { |
@@ -3224,6 +2918,7 @@ void LLAppViewer::badNetworkHandler() | |||
3224 | // Generates the minidump. | 2918 | // Generates the minidump. |
3225 | LLWinDebug::handleException(NULL); | 2919 | LLWinDebug::handleException(NULL); |
3226 | #endif | 2920 | #endif |
2921 | LLAppViewer::handleSyncViewerCrash(); | ||
3227 | LLAppViewer::handleViewerCrash(); | 2922 | LLAppViewer::handleViewerCrash(); |
3228 | 2923 | ||
3229 | std::ostringstream message; | 2924 | std::ostringstream message; |
@@ -3257,7 +2952,8 @@ void LLAppViewer::saveFinalSnapshot() | |||
3257 | LLString snap_filename = gDirUtilp->getLindenUserDir(); | 2952 | LLString snap_filename = gDirUtilp->getLindenUserDir(); |
3258 | snap_filename += gDirUtilp->getDirDelimiter(); | 2953 | snap_filename += gDirUtilp->getDirDelimiter(); |
3259 | snap_filename += SCREEN_LAST_FILENAME; | 2954 | snap_filename += SCREEN_LAST_FILENAME; |
3260 | gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidth(), gViewerWindow->getWindowHeight(), FALSE, TRUE); | 2955 | // use full pixel dimensions of viewer window (not post-scale dimensions) |
2956 | gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, TRUE); | ||
3261 | mSavedFinalSnapshot = TRUE; | 2957 | mSavedFinalSnapshot = TRUE; |
3262 | } | 2958 | } |
3263 | } | 2959 | } |
@@ -3299,7 +2995,10 @@ void LLAppViewer::saveNameCache() | |||
3299 | 2995 | ||
3300 | bool LLAppViewer::isInProductionGrid() | 2996 | bool LLAppViewer::isInProductionGrid() |
3301 | { | 2997 | { |
3302 | return (GRID_INFO_AGNI == gGridChoice); | 2998 | // *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice, |
2999 | // but it seems that loginURI trumps that. | ||
3000 | const std::string& loginURI = getLoginURIs()[0]; | ||
3001 | return (loginURI == gGridInfo[GRID_INFO_AGNI].mLoginURI); | ||
3303 | } | 3002 | } |
3304 | 3003 | ||
3305 | 3004 | ||
@@ -3330,8 +3029,6 @@ void LLAppViewer::idle() | |||
3330 | // Update frame timers | 3029 | // Update frame timers |
3331 | static LLTimer idle_timer; | 3030 | static LLTimer idle_timer; |
3332 | 3031 | ||
3333 | LLControlBase::updateAllListeners(); | ||
3334 | |||
3335 | LLFrameTimer::updateFrameTime(); | 3032 | LLFrameTimer::updateFrameTime(); |
3336 | LLEventTimer::updateClass(); | 3033 | LLEventTimer::updateClass(); |
3337 | LLCriticalDamp::updateInterpolants(); | 3034 | LLCriticalDamp::updateInterpolants(); |
@@ -3352,9 +3049,10 @@ void LLAppViewer::idle() | |||
3352 | // Smoothly weight toward current frame | 3049 | // Smoothly weight toward current frame |
3353 | gFPSClamped = (frame_rate_clamped + (4.f * gFPSClamped)) / 5.f; | 3050 | gFPSClamped = (frame_rate_clamped + (4.f * gFPSClamped)) / 5.f; |
3354 | 3051 | ||
3355 | if (gQuitAfterSeconds > 0.f) | 3052 | F32 qas = gSavedSettings.getF32("QuitAfterSeconds"); |
3053 | if (qas > 0.f) | ||
3356 | { | 3054 | { |
3357 | if (gRenderStartTime.getElapsedTimeF32() > gQuitAfterSeconds) | 3055 | if (gRenderStartTime.getElapsedTimeF32() > qas) |
3358 | { | 3056 | { |
3359 | LLAppViewer::instance()->forceQuit(); | 3057 | LLAppViewer::instance()->forceQuit(); |
3360 | } | 3058 | } |
@@ -3385,7 +3083,7 @@ void LLAppViewer::idle() | |||
3385 | { | 3083 | { |
3386 | LLFastTimer t(LLFastTimer::FTM_NETWORK); | 3084 | LLFastTimer t(LLFastTimer::FTM_NETWORK); |
3387 | // Update spaceserver timeinfo | 3085 | // Update spaceserver timeinfo |
3388 | gWorldp->setSpaceTimeUSec(gWorldp->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC)); | 3086 | LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC)); |
3389 | 3087 | ||
3390 | 3088 | ||
3391 | ////////////////////////////////////// | 3089 | ////////////////////////////////////// |
@@ -3393,7 +3091,7 @@ void LLAppViewer::idle() | |||
3393 | // Update simulator agent state | 3091 | // Update simulator agent state |
3394 | // | 3092 | // |
3395 | 3093 | ||
3396 | if (gRotateRight) | 3094 | if (gSavedSettings.getBOOL("RotateRight")) |
3397 | { | 3095 | { |
3398 | gAgent.moveYaw(-1.f); | 3096 | gAgent.moveYaw(-1.f); |
3399 | } | 3097 | } |
@@ -3519,7 +3217,7 @@ void LLAppViewer::idle() | |||
3519 | { | 3217 | { |
3520 | // After agent and camera moved, figure out if we need to | 3218 | // After agent and camera moved, figure out if we need to |
3521 | // deselect objects. | 3219 | // deselect objects. |
3522 | gSelectMgr->deselectAllIfTooFar(); | 3220 | LLSelectMgr::getInstance()->deselectAllIfTooFar(); |
3523 | 3221 | ||
3524 | } | 3222 | } |
3525 | 3223 | ||
@@ -3536,7 +3234,7 @@ void LLAppViewer::idle() | |||
3536 | 3234 | ||
3537 | if (!(logoutRequestSent() && hasSavedFinalSnapshot())) | 3235 | if (!(logoutRequestSent() && hasSavedFinalSnapshot())) |
3538 | { | 3236 | { |
3539 | gObjectList.update(gAgent, *gWorldp); | 3237 | gObjectList.update(gAgent, *LLWorld::getInstance()); |
3540 | } | 3238 | } |
3541 | } | 3239 | } |
3542 | 3240 | ||
@@ -3568,9 +3266,9 @@ void LLAppViewer::idle() | |||
3568 | 3266 | ||
3569 | { | 3267 | { |
3570 | gFrameStats.start(LLFrameStats::UPDATE_EFFECTS); | 3268 | gFrameStats.start(LLFrameStats::UPDATE_EFFECTS); |
3571 | gSelectMgr->updateEffects(); | 3269 | LLSelectMgr::getInstance()->updateEffects(); |
3572 | gHUDManager->cleanupEffects(); | 3270 | LLHUDManager::getInstance()->cleanupEffects(); |
3573 | gHUDManager->sendEffects(); | 3271 | LLHUDManager::getInstance()->sendEffects(); |
3574 | } | 3272 | } |
3575 | 3273 | ||
3576 | stop_glerror(); | 3274 | stop_glerror(); |
@@ -3590,21 +3288,20 @@ void LLAppViewer::idle() | |||
3590 | // Update surfaces, and surface textures as well. | 3288 | // Update surfaces, and surface textures as well. |
3591 | // | 3289 | // |
3592 | 3290 | ||
3593 | gWorldp->updateVisibilities(); | 3291 | LLWorld::getInstance()->updateVisibilities(); |
3594 | { | 3292 | { |
3595 | const F32 max_region_update_time = .001f; // 1ms | 3293 | const F32 max_region_update_time = .001f; // 1ms |
3596 | LLFastTimer t(LLFastTimer::FTM_REGION_UPDATE); | 3294 | LLFastTimer t(LLFastTimer::FTM_REGION_UPDATE); |
3597 | gWorldp->updateRegions(max_region_update_time); | 3295 | LLWorld::getInstance()->updateRegions(max_region_update_time); |
3598 | } | 3296 | } |
3599 | 3297 | ||
3600 | ///////////////////////// | 3298 | ///////////////////////// |
3601 | // | 3299 | // |
3602 | // Update weather effects | 3300 | // Update weather effects |
3603 | // | 3301 | // |
3604 | |||
3605 | if (!gNoRender) | 3302 | if (!gNoRender) |
3606 | { | 3303 | { |
3607 | gWorldp->updateClouds(gFrameDTClamped); | 3304 | LLWorld::getInstance()->updateClouds(gFrameDTClamped); |
3608 | gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets | 3305 | gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets |
3609 | 3306 | ||
3610 | // Update wind vector | 3307 | // Update wind vector |
@@ -3612,7 +3309,7 @@ void LLAppViewer::idle() | |||
3612 | static LLVector3 average_wind; | 3309 | static LLVector3 average_wind; |
3613 | 3310 | ||
3614 | LLViewerRegion *regionp; | 3311 | LLViewerRegion *regionp; |
3615 | regionp = gWorldp->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position | 3312 | regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position |
3616 | if (regionp) | 3313 | if (regionp) |
3617 | { | 3314 | { |
3618 | gWindVec = regionp->mWind.getVelocity(wind_position_region); | 3315 | gWindVec = regionp->mWind.getVelocity(wind_position_region); |
@@ -3635,27 +3332,6 @@ void LLAppViewer::idle() | |||
3635 | 3332 | ||
3636 | ////////////////////////////////////// | 3333 | ////////////////////////////////////// |
3637 | // | 3334 | // |
3638 | // Update images, using the image stats generated during object update/culling | ||
3639 | // | ||
3640 | // Can put objects onto the retextured list. | ||
3641 | // | ||
3642 | gFrameStats.start(LLFrameStats::IMAGE_UPDATE); | ||
3643 | |||
3644 | { | ||
3645 | LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); | ||
3646 | |||
3647 | LLViewerImage::updateClass(gCamera->getVelocityStat()->getMean(), | ||
3648 | gCamera->getAngularVelocityStat()->getMean()); | ||
3649 | |||
3650 | gBumpImageList.updateImages(); // must be called before gImageList version so that it's textures are thrown out first. | ||
3651 | |||
3652 | const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame) | ||
3653 | gImageList.updateImages(max_image_decode_time); | ||
3654 | stop_glerror(); | ||
3655 | } | ||
3656 | |||
3657 | ////////////////////////////////////// | ||
3658 | // | ||
3659 | // Sort and cull in the new renderer are moved to pipeline.cpp | 3335 | // Sort and cull in the new renderer are moved to pipeline.cpp |
3660 | // Here, particles are updated and drawables are moved. | 3336 | // Here, particles are updated and drawables are moved. |
3661 | // | 3337 | // |
@@ -3667,17 +3343,22 @@ void LLAppViewer::idle() | |||
3667 | gPipeline.updateMove(); | 3343 | gPipeline.updateMove(); |
3668 | 3344 | ||
3669 | gFrameStats.start(LLFrameStats::UPDATE_PARTICLES); | 3345 | gFrameStats.start(LLFrameStats::UPDATE_PARTICLES); |
3670 | gWorldp->updateParticles(); | 3346 | LLWorld::getInstance()->updateParticles(); |
3671 | } | 3347 | } |
3672 | stop_glerror(); | 3348 | stop_glerror(); |
3673 | 3349 | ||
3674 | if (!LLViewerJoystick::sOverrideCamera) | 3350 | if (LLViewerJoystick::getInstance()->getOverrideCamera()) |
3675 | { | 3351 | { |
3676 | gAgent.updateCamera(); | 3352 | LLViewerJoystick::getInstance()->moveFlycam(); |
3677 | } | 3353 | } |
3678 | else | 3354 | else |
3679 | { | 3355 | { |
3680 | LLViewerJoystick::updateCamera(); | 3356 | if (LLToolMgr::getInstance()->inBuildMode()) |
3357 | { | ||
3358 | LLViewerJoystick::getInstance()->moveObjects(); | ||
3359 | } | ||
3360 | |||
3361 | gAgent.updateCamera(); | ||
3681 | } | 3362 | } |
3682 | 3363 | ||
3683 | // objects and camera should be in sync, do LOD calculations now | 3364 | // objects and camera should be in sync, do LOD calculations now |
@@ -3948,9 +3629,9 @@ void LLAppViewer::disconnectViewer() | |||
3948 | } | 3629 | } |
3949 | } | 3630 | } |
3950 | 3631 | ||
3951 | if (gSelectMgr) | 3632 | if (LLSelectMgr::getInstance()) |
3952 | { | 3633 | { |
3953 | gSelectMgr->deselectAll(); | 3634 | LLSelectMgr::getInstance()->deselectAll(); |
3954 | } | 3635 | } |
3955 | 3636 | ||
3956 | if (!gNoRender) | 3637 | if (!gNoRender) |
@@ -3971,9 +3652,9 @@ void LLAppViewer::disconnectViewer() | |||
3971 | // Also writes cached agent settings to gSavedSettings | 3652 | // Also writes cached agent settings to gSavedSettings |
3972 | gAgent.cleanup(); | 3653 | gAgent.cleanup(); |
3973 | 3654 | ||
3974 | gObjectList.destroy(); | 3655 | // This is where we used to call gObjectList.destroy() and then delete gWorldp. |
3975 | delete gWorldp; | 3656 | // Now we just ask the LLWorld singleton to cleanly shut down. |
3976 | gWorldp = NULL; | 3657 | LLWorld::getInstance()->destroyClass(); |
3977 | 3658 | ||
3978 | cleanup_xfer_manager(); | 3659 | cleanup_xfer_manager(); |
3979 | gDisconnected = TRUE; | 3660 | gDisconnected = TRUE; |