def __call__(self): if self.__needReboot: return texQuality = BigWorld.getGraphicsSetting('TEXTURE_QUALITY') if texQuality < 2: texQuality += 1 if self.__originQuality == -1: self.__originQuality = texQuality - 1 LOG_NOTE( 'To save the memory the texture quality setting was force lowered to <%s>.' % self.QUALITY_MAP[texQuality]) else: message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) self.__event(message) LOG_NOTE( "The free memory is too low, We can't do anything. Please, reboot the game." ) self.__needReboot = True return message = (0, 'tex_was_lowered_to_' + self.QUALITY_MAP[texQuality]) self.__messages.append(message) self.__event(message) BigWorld.setGraphicsSetting('TEXTURE_QUALITY', texQuality) BigWorld.commitPendingGraphicsSettings()
def __call__(self): if self.__needReboot: return WWISE.WW_onMemoryCritical() self.__selfCheckInProgress = False self.__needReboot = True self.__loweredSettings = [ t for t in BigWorld.graphicsSettings() if t[0] == 'TEXTURE_QUALITY' ] texQuality = BigWorld.getGraphicsSetting('TEXTURE_QUALITY') pipelineType = BigWorld.getGraphicsSetting('RENDER_PIPELINE') textureSettings = [ t for t in self.__loweredSettings if t[0] == 'TEXTURE_QUALITY' ][0][2] textureMinQuality = len(textureSettings) - 1 if textureSettings[textureMinQuality][0] == 'OFF': textureMinQuality -= 1 while 1: (textureSettings[textureMinQuality][1] is False or pipelineType == 1 and textureSettings[textureMinQuality][2] is True) and textureMinQuality -= 1 if textureMinQuality < texQuality: textureMinQuality = texQuality if texQuality < textureMinQuality: if self.__originTexQuality == -1 and texQuality < textureMinQuality: self.__originTexQuality = texQuality else: message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) self.onMemCrit(message) LOG_NOTE("The free memory is too low, We can't do anything. Please, reboot the game.") return message = (0, 'tex_was_lowered_to_min') self.onMemCrit(message) message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) if texQuality < textureMinQuality: BigWorld.setGraphicsSetting('TEXTURE_QUALITY', textureMinQuality) LOG_NOTE('To save the memory the texture quality setting was force lowered to <%s>.' % textureSettings[textureMinQuality][0]) BigWorld.commitPendingGraphicsSettings()
def selectGraphicsOptions(self, option): currentOption = self.entries[self.entryNames[option]] for setting in currentOption.items(): try: BigWorld.setGraphicsSetting( setting[0], setting[1] ) except: print 'selectGraphicsOptions: unable to set option ', setting[0] self.selectedOption = option
def __setGraphicsSetting(label, index): isSet = True try: BigWorld.setGraphicsSetting(label, index) except ValueError: isSet = False LOG_CURRENT_EXCEPTION() return isSet
def restore(self): if self.__originQuality != -1: BigWorld.setGraphicsSetting('TEXTURE_QUALITY', self.__originQuality) BigWorld.commitPendingGraphicsSettings() LOG_NOTE( 'The texture quality setting was restored to the original value <%s>.' % self.QUALITY_MAP[self.__originQuality]) self.__originQuality = -1 self.__needReboot = False self.__messages = []
def applyGraphicsPresets(self, presetIndex, customSettings): newPresetKey = self.__presetsKeys[presetIndex] newPreset = {} if newPresetKey == self.CUSTOM_PRESET_KEY: newPreset = customSettings elif newPresetKey != self.selectedPresetKey: newPreset = self.__presets[newPresetKey] else: newPreset = self.__presets[self.selectedPresetKey] for key in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS_PRESETS_EXCLUDE: if customSettings.has_key(key): newPreset[key] = customSettings[key] notSetOptions = [] LOG_DEBUG('Setting preset: %s' % newPresetKey) for key in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS: value = newPreset.get(key, None) if value is None: LOG_ERROR('No value for setting: %s' % key) continue try: while not self.settingIsSupported(key, value) and value < 5: value = value + 1 LOG_DEBUG('set setting %s = %d' % (key, value)) BigWorld.setGraphicsSetting(key, value) if key == 'TEXTURE_QUALITY': if g_critMemHandler.originTexQuality != -1: g_critMemHandler.originTexQuality = value if key == 'FLORA_QUALITY': if g_critMemHandler.originFloraQuality != -1: g_critMemHandler.originFloraQuality = value if key == 'TERRAIN_QUALITY': if g_critMemHandler.originTerrainQuality != -1: g_critMemHandler.originTerrainQuality = value except: notSetOptions.append(i18n.makeString('#settings:%s' % key)) LOG_ERROR( "selectGraphicsOptions: unable to set value '%s' for option '%s'" % (value, key)) if notSetOptions: if newPresetKey == self.CUSTOM_PRESET_KEY: SystemMessages.pushI18nMessage( '#system_messages:graficsOptionsFail', ', '.join(notSetOptions), type=SystemMessages.SM_TYPE.Error) else: SystemMessages.pushI18nMessage( '#system_messages:graficsPresetFail', type=SystemMessages.SM_TYPE.Error) self.__currentSetings = None self.checkCurrentPreset() return
def applyGraphicsPresets(self, presetIndex, customSettings): newPresetKey = self.__presetsKeys[presetIndex] newPreset = {} if newPresetKey == self.CUSTOM_PRESET_KEY: newPreset = customSettings elif newPresetKey != self.selectedPresetKey: newPreset = self.__presets[newPresetKey] else: newPreset = self.__presets[self.selectedPresetKey] for key in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS_PRESETS_EXCLUDE: if customSettings.has_key(key): newPreset[key] = customSettings[key] notSetOptions = [] LOG_DEBUG("Setting preset: %s" % newPresetKey) for key in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS: value = newPreset.get(key, None) if value is None: LOG_ERROR("No value for setting: %s" % key) continue try: while not self.settingIsSupported(key, value) and value < 5: value = value + 1 LOG_DEBUG("set setting %s = %d" % (key, value)) BigWorld.setGraphicsSetting(key, value) if key == "TEXTURE_QUALITY": if g_critMemHandler.originTexQuality != -1: g_critMemHandler.originTexQuality = value if key == "FLORA_QUALITY": if g_critMemHandler.originFloraQuality != -1: g_critMemHandler.originFloraQuality = value if key == "TERRAIN_QUALITY": if g_critMemHandler.originTerrainQuality != -1: g_critMemHandler.originTerrainQuality = value except: notSetOptions.append(i18n.makeString("#settings:%s" % key)) LOG_ERROR("selectGraphicsOptions: unable to set value '%s' for option '%s'" % (value, key)) if notSetOptions: if newPresetKey == self.CUSTOM_PRESET_KEY: SystemMessages.pushI18nMessage( "#system_messages:graficsOptionsFail", ", ".join(notSetOptions), type=SystemMessages.SM_TYPE.Error ) else: SystemMessages.pushI18nMessage("#system_messages:graficsPresetFail", type=SystemMessages.SM_TYPE.Error) self.__currentSetings = None self.checkCurrentPreset()
def applyGraphicsPresets(self, newPresetKey): newPresetKey = newPresetKey.lower() newPreset = self.__presets[newPresetKey] for key, value in newPreset.items(): try: if not BigWorld.isHDContent() and key == 'TEXTURE_QUALITY': if value < 1: value = 1 BigWorld.setGraphicsSetting(key, value) if key == 'TEXTURE_QUALITY': if g_critMemHandler.originQuality != -1: g_critMemHandler.originQuality = value except Exception as inst: LOG_CURRENT_EXCEPTION() LOG_ERROR( "selectGraphicsOptions: unable to set value '%s' for option '%s'" % (value, key)) self.selectedPresetKey = newPresetKey
def __call__(self): if self.__needReboot: return self.__needReboot = True self.__loweredSettings = [ t for t in BigWorld.graphicsSettings() if t[0] == 'TEXTURE_QUALITY' or t[0] == 'FLORA_QUALITY' or t[0] == 'TERRAIN_QUALITY' ] texQuality = BigWorld.getGraphicsSetting('TEXTURE_QUALITY') floraQuality = BigWorld.getGraphicsSetting('FLORA_QUALITY') terrainQuality = BigWorld.getGraphicsSetting('TERRAIN_QUALITY') pipelineType = BigWorld.getGraphicsSetting('RENDER_PIPELINE') textureSettings = [ t for t in self.__loweredSettings if t[0] == 'TEXTURE_QUALITY' ][0][2] floraSettings = [ t for t in self.__loweredSettings if t[0] == 'FLORA_QUALITY' ][0][2] terrainSettings = [ t for t in self.__loweredSettings if t[0] == 'TERRAIN_QUALITY' ][0][2] textureMinQuality = len(textureSettings) - 1 floraMinQuality = len(floraSettings) - 1 terrainMinQuality = len(terrainSettings) - 1 if textureSettings[textureMinQuality][0] == 'OFF': textureMinQuality -= 1 while textureSettings[textureMinQuality][1] == False or pipelineType == 1 and textureSettings[textureMinQuality][2] == True: textureMinQuality -= 1 if textureMinQuality < texQuality: textureMinQuality = texQuality while floraSettings[floraMinQuality][1] == False or pipelineType == 1 and floraSettings[floraMinQuality][2] == True: floraMinQuality -= 1 if floraMinQuality < floraQuality: floraMinQuality = floraQuality while terrainSettings[terrainMinQuality][1] == False or pipelineType == 1 and terrainSettings[terrainMinQuality][2] == True: terrainMinQuality -= 1 if terrainMinQuality < terrainQuality: terrainMinQuality = terrainQuality if texQuality < textureMinQuality or floraQuality < floraMinQuality or terrainQuality < terrainMinQuality: if self.__originTexQuality == -1 and texQuality < textureMinQuality: self.__originTexQuality = texQuality if self.__originFloraQuality == -1 and floraQuality < floraMinQuality: self.__originFloraQuality = floraQuality if self.__originTerrainQuality == -1 and terrainQuality < terrainMinQuality: self.__originTerrainQuality = terrainQuality else: message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) self.__event(message) LOG_NOTE("The free memory is too low, We can't do anything. Please, reboot the game.") return message = (0, 'tex_was_lowered_to_min') self.__event(message) message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) if texQuality < textureMinQuality: BigWorld.setGraphicsSetting('TEXTURE_QUALITY', textureMinQuality) LOG_NOTE('To save the memory the texture quality setting was force lowered to <%s>.' % textureSettings[textureMinQuality][0]) if floraQuality < floraMinQuality: BigWorld.setGraphicsSetting('FLORA_QUALITY', floraMinQuality) LOG_NOTE('To save the memory the flora quality setting was force lowered to <%s>.' % floraSettings[floraMinQuality][0]) if terrainQuality < terrainMinQuality: BigWorld.setGraphicsSetting('TERRAIN_QUALITY', terrainMinQuality) LOG_NOTE('To save the memory the terrain quality setting was force lowered to <%s>.' % terrainSettings[terrainMinQuality][0]) BigWorld.commitPendingGraphicsSettings()
def restore(self): if self.__originTexQuality != -1 or self.__originFloraQuality != -1 or self.__originTerrainQuality != -1: if self.__originTexQuality != -1: BigWorld.setGraphicsSetting('TEXTURE_QUALITY', self.__originTexQuality) textureSettings = [ t for t in self.__loweredSettings if t[0] == 'TEXTURE_QUALITY' ][0][2] LOG_NOTE('The texture quality setting was restored to the original value <%s>.' % textureSettings[self.__originTexQuality][0]) if self.__originFloraQuality != -1: BigWorld.setGraphicsSetting('FLORA_QUALITY', self.__originFloraQuality) floraSettings = [ t for t in self.__loweredSettings if t[0] == 'FLORA_QUALITY' ][0][2] LOG_NOTE('The flora quality setting was restored to the original value <%s>.' % floraSettings[self.__originFloraQuality][0]) if self.__originTerrainQuality != -1: BigWorld.setGraphicsSetting('TERRAIN_QUALITY', self.__originTerrainQuality) terrainSettings = [ t for t in self.__loweredSettings if t[0] == 'TERRAIN_QUALITY' ][0][2] LOG_NOTE('The terrain quality setting was restored to the original value <%s>.' % terrainSettings[self.__originTerrainQuality][0]) BigWorld.commitPendingGraphicsSettings() self.__originTexQuality = -1 self.__originFloraQuality = -1 self.__originTerrainQuality = -1 self.__needReboot = False self.__messages = []
def restore(self): if self.__originTexQuality != -1 or self.__originFloraQuality != -1 or self.__originTerrainQuality != -1: if self.__originTexQuality != -1: BigWorld.setGraphicsSetting('TEXTURE_QUALITY', self.__originTexQuality) textureSettings = [ t for t in self.__loweredSettings if t[0] == 'TEXTURE_QUALITY' ][0][2] LOG_NOTE( 'The texture quality setting was restored to the original value <%s>.' % textureSettings[self.__originTexQuality][0]) if self.__originFloraQuality != -1: BigWorld.setGraphicsSetting('FLORA_QUALITY', self.__originFloraQuality) floraSettings = [ t for t in self.__loweredSettings if t[0] == 'FLORA_QUALITY' ][0][2] LOG_NOTE( 'The flora quality setting was restored to the original value <%s>.' % floraSettings[self.__originFloraQuality][0]) if self.__originTerrainQuality != -1: BigWorld.setGraphicsSetting('TERRAIN_QUALITY', self.__originTerrainQuality) terrainSettings = [ t for t in self.__loweredSettings if t[0] == 'TERRAIN_QUALITY' ][0][2] LOG_NOTE( 'The terrain quality setting was restored to the original value <%s>.' % terrainSettings[self.__originTerrainQuality][0]) BigWorld.commitPendingGraphicsSettings() self.__originTexQuality = -1 self.__originFloraQuality = -1 self.__originTerrainQuality = -1 self.__needReboot = False self.__messages = []
def __call__(self): if self.__needReboot: return self.__needReboot = True self.__loweredSettings = [ t for t in BigWorld.graphicsSettings() if t[0] == 'TEXTURE_QUALITY' or t[0] == 'FLORA_QUALITY' or t[0] == 'TERRAIN_QUALITY' ] texQuality = BigWorld.getGraphicsSetting('TEXTURE_QUALITY') floraQuality = BigWorld.getGraphicsSetting('FLORA_QUALITY') terrainQuality = BigWorld.getGraphicsSetting('TERRAIN_QUALITY') pipelineType = BigWorld.getGraphicsSetting('RENDER_PIPELINE') textureSettings = [ t for t in self.__loweredSettings if t[0] == 'TEXTURE_QUALITY' ][0][2] floraSettings = [ t for t in self.__loweredSettings if t[0] == 'FLORA_QUALITY' ][0][2] terrainSettings = [ t for t in self.__loweredSettings if t[0] == 'TERRAIN_QUALITY' ][0][2] textureMinQuality = len(textureSettings) - 1 floraMinQuality = len(floraSettings) - 1 terrainMinQuality = len(terrainSettings) - 1 if textureSettings[textureMinQuality][0] == 'OFF': textureMinQuality -= 1 while textureSettings[textureMinQuality][ 1] is False or pipelineType == 1 and textureSettings[ textureMinQuality][2] is True: textureMinQuality -= 1 if textureMinQuality < texQuality: textureMinQuality = texQuality while floraSettings[floraMinQuality][ 1] is False or pipelineType == 1 and floraSettings[ floraMinQuality][2] is True: floraMinQuality -= 1 if floraMinQuality < floraQuality: floraMinQuality = floraQuality while terrainSettings[terrainMinQuality][ 1] is False or pipelineType == 1 and terrainSettings[ terrainMinQuality][2] is True: terrainMinQuality -= 1 if terrainMinQuality < terrainQuality: terrainMinQuality = terrainQuality if texQuality < textureMinQuality or floraQuality < floraMinQuality or terrainQuality < terrainMinQuality: if self.__originTexQuality == -1 and texQuality < textureMinQuality: self.__originTexQuality = texQuality if self.__originFloraQuality == -1 and floraQuality < floraMinQuality: self.__originFloraQuality = floraQuality if self.__originTerrainQuality == -1 and terrainQuality < terrainMinQuality: self.__originTerrainQuality = terrainQuality else: message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) self.__event(message) LOG_NOTE( "The free memory is too low, We can't do anything. Please, reboot the game." ) return message = (0, 'tex_was_lowered_to_min') self.__event(message) message = (1, 'insufficient_memory_please_reboot') self.__messages.append(message) if texQuality < textureMinQuality: BigWorld.setGraphicsSetting('TEXTURE_QUALITY', textureMinQuality) LOG_NOTE( 'To save the memory the texture quality setting was force lowered to <%s>.' % textureSettings[textureMinQuality][0]) if floraQuality < floraMinQuality: BigWorld.setGraphicsSetting('FLORA_QUALITY', floraMinQuality) LOG_NOTE( 'To save the memory the flora quality setting was force lowered to <%s>.' % floraSettings[floraMinQuality][0]) if terrainQuality < terrainMinQuality: BigWorld.setGraphicsSetting('TERRAIN_QUALITY', terrainMinQuality) LOG_NOTE( 'To save the memory the terrain quality setting was force lowered to <%s>.' % terrainSettings[terrainMinQuality][0]) BigWorld.commitPendingGraphicsSettings()
def _set(self, value): try: BigWorld.setGraphicsSetting(self.name, value) except Exception: LOG_ERROR('Unable to set value `%s` for option `%s`' % (value, self.name))
def setSystemValue(self, value): try: BigWorld.setGraphicsSetting('PS_USE_PERFORMANCER', bool(value)) except Exception: LOG_CURRENT_EXCEPTION()