aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfeaturemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfeaturemanager.cpp')
-rw-r--r--linden/indra/newview/llfeaturemanager.cpp56
1 files changed, 27 insertions, 29 deletions
diff --git a/linden/indra/newview/llfeaturemanager.cpp b/linden/indra/newview/llfeaturemanager.cpp
index 69e7bcc..a3da4f5 100644
--- a/linden/indra/newview/llfeaturemanager.cpp
+++ b/linden/indra/newview/llfeaturemanager.cpp
@@ -75,23 +75,21 @@ const char FEATURE_TABLE_FILENAME[] = "featuretable.txt";
75 75
76const char GPU_TABLE_FILENAME[] = "gpu_table.txt"; 76const char GPU_TABLE_FILENAME[] = "gpu_table.txt";
77 77
78LLFeatureInfo::LLFeatureInfo(const char *name, const BOOL available, const F32 level) : mValid(TRUE) 78LLFeatureInfo::LLFeatureInfo(const std::string& name, const BOOL available, const F32 level)
79 : mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level)
79{ 80{
80 mName = name;
81 mAvailable = available;
82 mRecommendedLevel = level;
83} 81}
84 82
85LLFeatureList::LLFeatureList(const char *name) 83LLFeatureList::LLFeatureList(const std::string& name)
84 : mName(name)
86{ 85{
87 mName = name;
88} 86}
89 87
90LLFeatureList::~LLFeatureList() 88LLFeatureList::~LLFeatureList()
91{ 89{
92} 90}
93 91
94void LLFeatureList::addFeature(const char *name, const BOOL available, const F32 level) 92void LLFeatureList::addFeature(const std::string& name, const BOOL available, const F32 level)
95{ 93{
96 if (mFeatures.count(name)) 94 if (mFeatures.count(name))
97 { 95 {
@@ -102,7 +100,7 @@ void LLFeatureList::addFeature(const char *name, const BOOL available, const F32
102 mFeatures[name] = fi; 100 mFeatures[name] = fi;
103} 101}
104 102
105BOOL LLFeatureList::isFeatureAvailable(const char *name) 103BOOL LLFeatureList::isFeatureAvailable(const std::string& name)
106{ 104{
107 if (mFeatures.count(name)) 105 if (mFeatures.count(name))
108 { 106 {
@@ -116,7 +114,7 @@ BOOL LLFeatureList::isFeatureAvailable(const char *name)
116 return TRUE; 114 return TRUE;
117} 115}
118 116
119F32 LLFeatureList::getRecommendedValue(const char *name) 117F32 LLFeatureList::getRecommendedValue(const std::string& name)
120{ 118{
121 if (mFeatures.count(name) && isFeatureAvailable(name)) 119 if (mFeatures.count(name) && isFeatureAvailable(name))
122 { 120 {
@@ -188,7 +186,7 @@ void LLFeatureList::dump()
188 LL_DEBUGS("RenderInit") << LL_ENDL; 186 LL_DEBUGS("RenderInit") << LL_ENDL;
189} 187}
190 188
191LLFeatureList *LLFeatureManager::findMask(const char *name) 189LLFeatureList *LLFeatureManager::findMask(const std::string& name)
192{ 190{
193 if (mMaskList.count(name)) 191 if (mMaskList.count(name))
194 { 192 {
@@ -198,7 +196,7 @@ LLFeatureList *LLFeatureManager::findMask(const char *name)
198 return NULL; 196 return NULL;
199} 197}
200 198
201BOOL LLFeatureManager::maskFeatures(const char *name) 199BOOL LLFeatureManager::maskFeatures(const std::string& name)
202{ 200{
203 LLFeatureList *maskp = findMask(name); 201 LLFeatureList *maskp = findMask(name);
204 if (!maskp) 202 if (!maskp)
@@ -225,14 +223,13 @@ BOOL LLFeatureManager::loadFeatureTables()
225 data_path += gDirUtilp->getDirDelimiter(); 223 data_path += gDirUtilp->getDirDelimiter();
226 224
227 data_path += FEATURE_TABLE_FILENAME; 225 data_path += FEATURE_TABLE_FILENAME;
228 226 lldebugs << "Looking for feature table in " << data_path << llendl;
229
230 char name[MAX_STRING+1]; /*Flawfinder: ignore*/
231 227
232 llifstream file; 228 llifstream file;
229 std::string name;
233 U32 version; 230 U32 version;
234 231
235 file.open(data_path.c_str()); /*Flawfinder: ignore*/ 232 file.open(data_path); /*Flawfinder: ignore*/
236 233
237 if (!file) 234 if (!file)
238 { 235 {
@@ -243,7 +240,7 @@ BOOL LLFeatureManager::loadFeatureTables()
243 // Check file version 240 // Check file version
244 file >> name; 241 file >> name;
245 file >> version; 242 file >> version;
246 if (strcmp(name, "version")) 243 if (name != "version")
247 { 244 {
248 LL_WARNS("RenderInit") << data_path << " does not appear to be a valid feature table!" << LL_ENDL; 245 LL_WARNS("RenderInit") << data_path << " does not appear to be a valid feature table!" << LL_ENDL;
249 return FALSE; 246 return FALSE;
@@ -252,30 +249,27 @@ BOOL LLFeatureManager::loadFeatureTables()
252 mTableVersion = version; 249 mTableVersion = version;
253 250
254 LLFeatureList *flp = NULL; 251 LLFeatureList *flp = NULL;
255 while (!file.eof()) 252 while (!file.eof() && file.good())
256 { 253 {
257 char buffer[MAX_STRING]; /*Flawfinder: ignore*/ 254 char buffer[MAX_STRING]; /*Flawfinder: ignore*/
258 name[0] = 0;
259 255
260 file >> name; 256 file >> name;
261 257
262 if (strlen(name) >= 2 && /*Flawfinder: ignore*/ 258 if (name.substr(0,2) == "//")
263 name[0] == '/' &&
264 name[1] == '/')
265 { 259 {
266 // This is a comment. 260 // This is a comment.
267 file.getline(buffer, MAX_STRING); 261 file.getline(buffer, MAX_STRING);
268 continue; 262 continue;
269 } 263 }
270 264
271 if (strlen(name) == 0) /*Flawfinder: ignore*/ 265 if (name.empty())
272 { 266 {
273 // This is a blank line 267 // This is a blank line
274 file.getline(buffer, MAX_STRING); 268 file.getline(buffer, MAX_STRING);
275 continue; 269 continue;
276 } 270 }
277 271
278 if (!strcmp(name, "list")) 272 if (name == "list")
279 { 273 {
280 if (flp) 274 if (flp)
281 { 275 {
@@ -323,7 +317,7 @@ void LLFeatureManager::loadGPUClass()
323 317
324 llifstream file; 318 llifstream file;
325 319
326 file.open(data_path.c_str()); /*Flawfinder: ignore*/ 320 file.open(data_path); /*Flawfinder: ignore*/
327 321
328 if (!file) 322 if (!file)
329 { 323 {
@@ -491,19 +485,19 @@ void LLFeatureManager::applyFeatures(bool skipFeatures)
491 // handle all the different types 485 // handle all the different types
492 if(ctrl->isType(TYPE_BOOLEAN)) 486 if(ctrl->isType(TYPE_BOOLEAN))
493 { 487 {
494 gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first.c_str())); 488 gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first));
495 } 489 }
496 else if (ctrl->isType(TYPE_S32)) 490 else if (ctrl->isType(TYPE_S32))
497 { 491 {
498 gSavedSettings.setS32(mIt->first, (S32)getRecommendedValue(mIt->first.c_str())); 492 gSavedSettings.setS32(mIt->first, (S32)getRecommendedValue(mIt->first));
499 } 493 }
500 else if (ctrl->isType(TYPE_U32)) 494 else if (ctrl->isType(TYPE_U32))
501 { 495 {
502 gSavedSettings.setU32(mIt->first, (U32)getRecommendedValue(mIt->first.c_str())); 496 gSavedSettings.setU32(mIt->first, (U32)getRecommendedValue(mIt->first));
503 } 497 }
504 else if (ctrl->isType(TYPE_F32)) 498 else if (ctrl->isType(TYPE_F32))
505 { 499 {
506 gSavedSettings.setF32(mIt->first, (F32)getRecommendedValue(mIt->first.c_str())); 500 gSavedSettings.setF32(mIt->first, (F32)getRecommendedValue(mIt->first));
507 } 501 }
508 else 502 else
509 { 503 {
@@ -593,6 +587,10 @@ void LLFeatureManager::applyBaseMasks()
593 { 587 {
594 maskFeatures("ATI"); 588 maskFeatures("ATI");
595 } 589 }
590 if (gGLManager.mATIOldDriver)
591 {
592 maskFeatures("ATIOldDriver");
593 }
596 if (gGLManager.mIsGFFX) 594 if (gGLManager.mIsGFFX)
597 { 595 {
598 maskFeatures("GeForceFX"); 596 maskFeatures("GeForceFX");
@@ -618,7 +616,7 @@ void LLFeatureManager::applyBaseMasks()
618 } 616 }
619 617
620 //llinfos << "Masking features from gpu table match: " << gpustr << llendl; 618 //llinfos << "Masking features from gpu table match: " << gpustr << llendl;
621 maskFeatures(gpustr.c_str()); 619 maskFeatures(gpustr);
622 620
623 // now mask cpu type ones 621 // now mask cpu type ones
624 if (gSysMemory.getPhysicalMemoryClamped() <= 256*1024*1024) 622 if (gSysMemory.getPhysicalMemoryClamped() <= 256*1024*1024)