diff options
author | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
commit | b235c59d60472f818a9142c0886b95a0ff4191d7 (patch) | |
tree | d323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/newview/llappviewer.h | |
parent | Second Life viewer sources 1.18.5.3 (diff) | |
download | meta-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.h | 294 |
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 | |||
35 | class LLTextureCache; | ||
36 | class LLWorkerThread; | ||
37 | class LLTextureFetch; | ||
38 | |||
39 | class LLAppViewer : public LLApp | ||
40 | { | ||
41 | public: | ||
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 | |||
122 | protected: | ||
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 | |||
130 | private: | ||
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 | ||
187 | const 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 | |||
194 | extern bool gVerifySSLCert; // parse_args setting used by llxmlrpctransaction.cpp | ||
195 | extern BOOL gHandleKeysAsync; // gSavedSettings used by llviewerdisplay.cpp & llviewermenu.cpp | ||
196 | extern BOOL gProbeHardware; | ||
197 | extern LLString gDisabledMessage; // llstartup | ||
198 | extern BOOL gHideLinks; // used by llpanellogin, lllfloaterbuycurrency, llstartup | ||
199 | extern BOOL gInProductionGrid; | ||
200 | extern LLSD gDebugInfo; | ||
201 | |||
202 | extern BOOL gAllowIdleAFK; | ||
203 | extern F32 gAFKTimeout; | ||
204 | extern BOOL gShowObjectUpdates; | ||
205 | |||
206 | extern BOOL gLogMessages; // llstartup | ||
207 | extern std::string gChannelName; | ||
208 | extern BOOL gUseAudio; // llstartup | ||
209 | |||
210 | extern LLString gCmdLineFirstName; // llstartup | ||
211 | extern LLString gCmdLineLastName; | ||
212 | extern LLString gCmdLinePassword; | ||
213 | |||
214 | extern BOOL gAutoLogin; // llstartup | ||
215 | extern const char* DEFAULT_SETTINGS_FILE; // llstartup | ||
216 | |||
217 | extern BOOL gRequestInventoryLibrary; // llstartup | ||
218 | extern BOOL gGodConnect; // llstartup | ||
219 | |||
220 | extern BOOL gAcceptTOS; | ||
221 | extern BOOL gAcceptCriticalMessage; | ||
222 | |||
223 | extern LLUUID gViewerDigest; // MD5 digest of the viewer's executable file. | ||
224 | extern BOOL gLastExecFroze; // llstartup | ||
225 | |||
226 | extern U32 gFrameCount; | ||
227 | extern U32 gForegroundFrameCount; | ||
228 | |||
229 | extern LLPumpIO* gServicePump; | ||
230 | |||
231 | // Is the Pacific time zone (aka server time zone) | ||
232 | // currently in daylight savings time? | ||
233 | extern BOOL gPacificDaylightTime; | ||
234 | |||
235 | extern U64 gFrameTime; // The timestamp of the most-recently-processed frame | ||
236 | extern F32 gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... | ||
237 | extern F32 gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds | ||
238 | extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame | ||
239 | extern F32 gFrameDTClamped; | ||
240 | extern U64 gStartTime; | ||
241 | |||
242 | extern LLTimer gRenderStartTime; | ||
243 | extern LLFrameTimer gForegroundTime; | ||
244 | |||
245 | extern F32 gLogoutMaxTime; | ||
246 | extern LLTimer gLogoutTimer; | ||
247 | |||
248 | extern F32 gSimLastTime; | ||
249 | extern F32 gSimFrames; | ||
250 | |||
251 | extern LLUUID gInventoryLibraryOwner; | ||
252 | extern LLUUID gInventoryLibraryRoot; | ||
253 | |||
254 | extern BOOL gDisconnected; | ||
255 | extern BOOL gDisableVoice; | ||
256 | |||
257 | // Map scale in pixels per region | ||
258 | extern F32 gMapScale; | ||
259 | extern F32 gMiniMapScale; | ||
260 | |||
261 | extern LLFrameTimer gRestoreGLTimer; | ||
262 | extern BOOL gRestoreGL; | ||
263 | extern BOOL gUseWireframe; | ||
264 | |||
265 | extern F32 gMouseSensitivity; | ||
266 | extern 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 | ||
271 | extern LLVFS *gStaticVFS; | ||
272 | |||
273 | extern LLMemoryInfo gSysMemory; | ||
274 | |||
275 | extern bool gPreloadImages; | ||
276 | extern bool gPreloadSounds; | ||
277 | |||
278 | extern LLString gLastVersionChannel; | ||
279 | |||
280 | extern LLVector3 gWindVec; | ||
281 | extern LLVector3 gRelativeWindVec; | ||
282 | extern U32 gPacketsIn; | ||
283 | extern BOOL gPrintMessagesThisFrame; | ||
284 | |||
285 | extern LLUUID gSunTextureID; | ||
286 | extern LLUUID gMoonTextureID; | ||
287 | |||
288 | extern BOOL gUseConsole; | ||
289 | |||
290 | extern BOOL gRandomizeFramerate; | ||
291 | extern BOOL gPeriodicSlowFrame; | ||
292 | |||
293 | extern BOOL gQAMode; | ||
294 | #endif // LL_LLAPPVIEWER_H | ||