aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llappviewer.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:19 -0500
committerJacek Antonelli2008-08-15 23:45:19 -0500
commitb235c59d60472f818a9142c0886b95a0ff4191d7 (patch)
treed323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/newview/llappviewer.h
parentSecond Life viewer sources 1.18.5.3 (diff)
downloadmeta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.zip
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.gz
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.bz2
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.xz
Second Life viewer sources 1.18.6.0-RC
Diffstat (limited to 'linden/indra/newview/llappviewer.h')
-rw-r--r--linden/indra/newview/llappviewer.h294
1 files changed, 294 insertions, 0 deletions
diff --git a/linden/indra/newview/llappviewer.h b/linden/indra/newview/llappviewer.h
new file mode 100644
index 0000000..e97aead
--- /dev/null
+++ b/linden/indra/newview/llappviewer.h
@@ -0,0 +1,294 @@
1/**
2 * @file llappviewer.h
3 * @brief The LLAppViewer class declaration
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#ifndef LL_LLAPPVIEWER_H
33#define LL_LLAPPVIEWER_H
34
35class LLTextureCache;
36class LLWorkerThread;
37class LLTextureFetch;
38
39class LLAppViewer : public LLApp
40{
41public:
42 LLAppViewer();
43 virtual ~LLAppViewer();
44
45 // *NOTE:Mani - Don't use this!
46 // Having
47 static LLAppViewer* instance() {return sInstance; }
48
49 //
50 // Main application logic
51 //
52 virtual bool init(); // Override to do application initialization
53 virtual bool cleanup(); // Override to do application cleanup
54 virtual bool mainLoop(); // Override for the application main loop. Needs to at least gracefully notice the QUITTING state and exit.
55
56 // Application control
57 void forceQuit(); // Puts the viewer into 'shutting down without error' mode.
58 void requestQuit(); // Request a quit. A kinder, gentler quit.
59 void userQuit(); // The users asks to quit. Confirm, then requestQuit()
60 void earlyExit(const LLString& msg); // Display an error dialog and forcibly quit.
61 void forceExit(S32 arg); // exit() immediately (after some cleanup).
62 void abortQuit(); // Called to abort a quit request.
63
64 bool quitRequested() { return mQuitRequested; }
65 bool logoutRequestSent() { return mLogoutRequestSent; }
66
67 // *FIX: This is meant to stay only until the command line issues are hashed out with repect to LLApp::parseCommandLine
68 // This version stores the argc and argv for later usage, make sure the params passed in last as long as this class.
69 bool tempStoreCommandOptions(int argc, char** argv);
70
71 void closeDebug();
72
73 const LLOSInfo& getOSInfo() const { return mSysOSInfo; }
74
75 // Report true if under the control of a debugger. A null-op default.
76 virtual bool beingDebugged() { return false; }
77
78 S32 getCrashBehavior() const { return mCrashBehavior; }
79 void setCrashBehavior(S32 cb);
80 virtual void handleCrashReporting() = 0; // What to do with crash report?
81 static void handleViewerCrash(); // Hey! The viewer crashed. Do this.
82
83 // Thread accessors
84 static LLTextureCache* getTextureCache() { return sTextureCache; }
85 static LLWorkerThread* getImageDecodeThread() { return sImageDecodeThread; }
86 static LLTextureFetch* getTextureFetch() { return sTextureFetch; }
87
88 const std::string& getSerialNumber() { return mSerialNumber; }
89
90 // *FIX:Mani purgeCache was made public for parse_args().
91 // If that beast is gone, make it private.
92 void purgeCache(); // Clear the local cache.
93 bool getPurgeCache() const { return mPurgeCache; }
94
95 const LLString& getSecondLifeTitle() const; // The Second Life title.
96 const LLString& getWindowTitle() const; // The window display name.
97
98 // Helpers for URIs
99 void addLoginURI(const std::string& uri);
100 void setHelperURI(const std::string& uri);
101 const std::vector<std::string>& getLoginURIs() const;
102 const std::string& getHelperURI() const;
103 void resetURIs() const;
104
105 void forceDisconnect(const LLString& msg); // Force disconnection, with a message to the user.
106 void badNetworkHandler(); // Cause a crash state due to bad network packet.
107
108 bool hasSavedFinalSnapshot() { return mSavedFinalSnapshot; }
109 void saveFinalSnapshot();
110
111 void loadNameCache();
112 void saveNameCache();
113
114 // LLAppViewer testing helpers.
115 // *NOTE: These will potentially crash the viewer. Only for debugging.
116 virtual void forceErrorLLError();
117 virtual void forceErrorBreakpoint();
118 virtual void forceErrorBadMemoryAccess();
119 virtual void forceErrorInifiniteLoop();
120 virtual void forceErrorSoftwareException();
121
122protected:
123 virtual bool initWindow(); // Initialize the viewer's window.
124 virtual bool initLogging(); // Initialize log files, logging system, return false on failure.
125 virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit.
126
127 virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this.
128
129
130private:
131
132 bool initEarlyConfiguration(); // Initialize setting needed by crash reporting.
133 bool initThreads(); // Initialize viewer threads, return false on failure.
134 bool initConfiguration(); // Initialize settings from the command line/config file.
135
136 bool initCache(); // Initialize local client cache.
137
138 bool doConfigFromCommandLine(); // calls parse args.
139
140 void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup.
141 void removeCacheFiles(const char *filemask); // Deletes cached files the match the given wildcard.
142
143 void writeSystemInfo(); // Write system info to "debug_info.log"
144
145 bool anotherInstanceRunning();
146 void initMarkerFile();
147 void removeMarkerFile();
148
149 void idle();
150 void idleShutdown();
151 void idleNetwork();
152
153 void sendLogoutRequest();
154 void disconnectViewer();
155
156 // *FIX: the app viewer class should be some sort of singleton, no?
157 // Perhaps its child class is the singleton and this should be an abstract base.
158 static LLAppViewer* sInstance;
159
160 bool mSecondInstance; // Is this a second instance of the app?
161
162 FILE *mMarkerFile; // A file created to indicate the app is running.
163 bool mLastExecFroze; // Set on init if the marker file was found.
164
165 LLOSInfo mSysOSInfo;
166 S32 mCrashBehavior;
167 bool mReportedCrash;
168
169 // Thread objects.
170 static LLTextureCache* sTextureCache;
171 static LLWorkerThread* sImageDecodeThread;
172 static LLTextureFetch* sTextureFetch;
173
174 S32 mNumSessions;
175
176 std::string mSerialNumber;
177 bool mPurgeCache;
178 bool mPurgeOnExit;
179
180 bool mSavedFinalSnapshot;
181
182 bool mQuitRequested; // User wants to quit, may have modified documents open.
183 bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
184};
185
186// consts from viewer.h
187const S32 AGENT_UPDATES_PER_SECOND = 10;
188
189// Globals with external linkage. From viewer.h
190// *NOTE:Mani - These will be removed as the Viewer App Cleanup project continues.
191//
192// "// llstartup" indicates that llstartup is the only client for this global.
193
194extern bool gVerifySSLCert; // parse_args setting used by llxmlrpctransaction.cpp
195extern BOOL gHandleKeysAsync; // gSavedSettings used by llviewerdisplay.cpp & llviewermenu.cpp
196extern BOOL gProbeHardware;
197extern LLString gDisabledMessage; // llstartup
198extern BOOL gHideLinks; // used by llpanellogin, lllfloaterbuycurrency, llstartup
199extern BOOL gInProductionGrid;
200extern LLSD gDebugInfo;
201
202extern BOOL gAllowIdleAFK;
203extern F32 gAFKTimeout;
204extern BOOL gShowObjectUpdates;
205
206extern BOOL gLogMessages; // llstartup
207extern std::string gChannelName;
208extern BOOL gUseAudio; // llstartup
209
210extern LLString gCmdLineFirstName; // llstartup
211extern LLString gCmdLineLastName;
212extern LLString gCmdLinePassword;
213
214extern BOOL gAutoLogin; // llstartup
215extern const char* DEFAULT_SETTINGS_FILE; // llstartup
216
217extern BOOL gRequestInventoryLibrary; // llstartup
218extern BOOL gGodConnect; // llstartup
219
220extern BOOL gAcceptTOS;
221extern BOOL gAcceptCriticalMessage;
222
223extern LLUUID gViewerDigest; // MD5 digest of the viewer's executable file.
224extern BOOL gLastExecFroze; // llstartup
225
226extern U32 gFrameCount;
227extern U32 gForegroundFrameCount;
228
229extern LLPumpIO* gServicePump;
230
231// Is the Pacific time zone (aka server time zone)
232// currently in daylight savings time?
233extern BOOL gPacificDaylightTime;
234
235extern U64 gFrameTime; // The timestamp of the most-recently-processed frame
236extern F32 gFrameTimeSeconds; // Loses msec precision after ~4.5 hours...
237extern F32 gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds
238extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame
239extern F32 gFrameDTClamped;
240extern U64 gStartTime;
241
242extern LLTimer gRenderStartTime;
243extern LLFrameTimer gForegroundTime;
244
245extern F32 gLogoutMaxTime;
246extern LLTimer gLogoutTimer;
247
248extern F32 gSimLastTime;
249extern F32 gSimFrames;
250
251extern LLUUID gInventoryLibraryOwner;
252extern LLUUID gInventoryLibraryRoot;
253
254extern BOOL gDisconnected;
255extern BOOL gDisableVoice;
256
257// Map scale in pixels per region
258extern F32 gMapScale;
259extern F32 gMiniMapScale;
260
261extern LLFrameTimer gRestoreGLTimer;
262extern BOOL gRestoreGL;
263extern BOOL gUseWireframe;
264
265extern F32 gMouseSensitivity;
266extern BOOL gInvertMouse;
267
268// VFS globals - gVFS is for general use
269// gStaticVFS is read-only and is shipped w/ the viewer
270// it has pre-cache data like the UI .TGAs
271extern LLVFS *gStaticVFS;
272
273extern LLMemoryInfo gSysMemory;
274
275extern bool gPreloadImages;
276extern bool gPreloadSounds;
277
278extern LLString gLastVersionChannel;
279
280extern LLVector3 gWindVec;
281extern LLVector3 gRelativeWindVec;
282extern U32 gPacketsIn;
283extern BOOL gPrintMessagesThisFrame;
284
285extern LLUUID gSunTextureID;
286extern LLUUID gMoonTextureID;
287
288extern BOOL gUseConsole;
289
290extern BOOL gRandomizeFramerate;
291extern BOOL gPeriodicSlowFrame;
292
293extern BOOL gQAMode;
294#endif // LL_LLAPPVIEWER_H