Example #1
0
def getGraphicsSetting(settingName):
    __initGraphicsSettingsData()
    index = _g_graphSettingsIndices.get(settingName)
    if index is None:
        LOG_WARNING('Unknown graphics setting', settingName)
        return
    return GraphicSetting(*BigWorld.graphicsSettings()[index])
    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()
Example #3
0
def __initGraphicsSettingsData():
    global _g_graphSettingsIndices
    if _g_graphSettingsIndices is None:
        _g_graphSettingsIndices = dict(
            ((data[0], idx)
             for idx, data in enumerate(BigWorld.graphicsSettings())))
    return
    def getCurrentSettingsMap(self):
        graphQualitySettings = BigWorld.graphicsSettings()
        qualitySettings = {}
        for label, index, values, description in graphQualitySettings:
            qualitySettings[label] = index

        return qualitySettings
Example #5
0
def getGraphicsSetting(settingName):
    __initGraphicsSettingsData()
    index = _g_graphSettingsIndices.get(settingName)
    if index is None:
        LOG_WARNING('Unknown graphics setting', settingName)
        return
    return GraphicSetting(*BigWorld.graphicsSettings()[index])
Example #6
0
    def getGraphicsPresetsData(self):
        graphQualitySettings = BigWorld.graphicsSettings()
        qualitySettings = {'quality': {},
         'presets': None,
         'qualityOrder': GraphicsPresets.GRAPHICS_QUALITY_SETTINGS}
        for label, index, values, _, advanced, _, _ in graphQualitySettings:
            if label in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                options = []
                for i, val in enumerate(values):
                    valueLabel, supportFlag, advanced, _ = val
                    if supportFlag:
                        options.append({'label': '#settings:graphicsQuality/' + valueLabel,
                         'data': i,
                         'advanced': advanced})

                qualitySettings['quality'][label] = {'value': index,
                 'options': options}

        presets = {'current': self.__presetsKeys.index(self.selectedPresetKey),
         'values': []}
        for index, presetKey in enumerate(self.__presetsKeys):
            preset = {'index': index,
             'key': presetKey,
             'settings': {}}
            settings = self.__presets.get(presetKey, {})
            for label, value in settings.items():
                if label in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                    preset['settings'][label] = value

            presets['values'].append(preset)

        qualitySettings['presets'] = presets
        return qualitySettings
    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()
Example #8
0
    def settingIsSupported(self, label, value):
        graphQualitySettings = BigWorld.graphicsSettings()
        for name, _, optionsList, _, _, _, _ in graphQualitySettings:
            if name == label and len(optionsList) > value:
                _, supportFlag, _, _ = optionsList[value]
                return supportFlag

        return False
    def getSettingValues(self):
        result = []
        graphQualitySettings = BigWorld.graphicsSettings()
        for setting in showGraphicsSetting:
            elem = self.getSettingElem(graphQualitySettings, setting)
            if elem != None:
                result.append(GraphicsPresetsTuple([setting, elem]))

        return result
Example #10
0
    def getGraphicsPresetsData(self):
        graphQualitySettings = BigWorld.graphicsSettings()
        qualitySettings = {
            'quality': {},
            'presets': None,
            'qualityOrder': GraphicsPresets.GRAPHICS_QUALITY_SETTINGS
        }
        for settingName, index, values, _, advanced, _, _ in graphQualitySettings:
            if settingName in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                options = []
                for i, val in enumerate(values):
                    valueLabel, supportFlag, advanced, _ = val
                    options.append({
                        'label':
                        '#settings:graphicsSettingsOptions/' + valueLabel,
                        'data':
                        i,
                        'advanced':
                        advanced,
                        'supported':
                        supportFlag
                    })

                options = sorted(options, key=itemgetter('data'), reverse=True)
                qualitySettings['quality'][settingName] = {
                    'value': index,
                    'options': options
                }

        presets = {
            'current': self.__presetsKeys.index(self.selectedPresetKey),
            'values': []
        }
        for index, presetKey in enumerate(self.__presetsKeys):
            preset = {'index': index, 'key': presetKey, 'settings': {}}
            settings = self.__presets.get(presetKey, {})
            isSupported = True
            for settingName, value in settings.items():
                if not self.settingIsSupported(settingName, value):
                    allowedPresetSettings = GUI_SETTINGS.allowedNotSupportedGraphicSettings.get(
                        preset['key'], [])
                    if settingName not in allowedPresetSettings:
                        isSupported = False
                        break
                if settingName in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                    preset['settings'][settingName] = value

            if isSupported:
                presets['values'].append(preset)

        presets['values'] = sorted(presets['values'],
                                   key=itemgetter('index'),
                                   reverse=True)
        qualitySettings['presets'] = presets
        return qualitySettings
Example #11
0
    def settingIsMaxOfSupported(self, label, value):
        graphQualitySettings = BigWorld.graphicsSettings()
        for name, _, optionsList, _, _, _, _ in graphQualitySettings:
            if name == label and len(optionsList) > value:
                _, supportFlag, _, _ = optionsList[value]
                if supportFlag:
                    if value > 0:
                        _, supportFlag_1, _, _ = optionsList[value - 1]
                        return not supportFlag_1
                    else:
                        return True
                return False

        return False
Example #12
0
    def __currentSettingsMap(self):
        if self.__currentSetings is None:
            graphQualitySettings = BigWorld.graphicsSettings()
            self.__currentSetings = {}
            sNeedRestart = []
            sDelayed = []
            for label, index, _, _, _, needsRestart, delayed in graphQualitySettings:
                self.__currentSetings[label] = index
                if needsRestart:
                    sNeedRestart.append(label)
                if delayed:
                    sDelayed.append(label)

            self.__settingsNeedRestart = set(sNeedRestart)
            self.__settingsDelayed = set(sDelayed)
        return self.__currentSetings
    def setSelectedOption(self):
        self.selectedOption = -1
        currentOptionMap = {}
        for currentOption in BigWorld.graphicsSettings():
            currentOptionMap[currentOption[0]] = currentOption[1]

        for i in range(0, len(self.entryNames)):
            foundOption = True
            for setting in self.entries[self.entryNames[i]].items():
                if currentOptionMap.get(setting[0]) != setting[1]:
                    foundOption = False
                    break

            if foundOption == True:
                self.selectedOption = i
                break
Example #14
0
    def setSelectedOption(self):
        self.selectedOption = -1
        currentOptionMap = {}
        for currentOption in BigWorld.graphicsSettings():
            currentOptionMap[currentOption[0]] = currentOption[1]

        for i in range(0, len(self.entryNames)):
            foundOption = True
            for setting in self.entries[self.entryNames[i]].items():
                if currentOptionMap.get(setting[0]) != setting[1]:
                    foundOption = False
                    break

            if foundOption == True:
                self.selectedOption = i
                break
Example #15
0
    def getGraphicsPresetsData(self):
        graphQualitySettings = BigWorld.graphicsSettings()
        qualitySettings = {'quality': {},
         'presets': None,
         'qualityOrder': GraphicsPresets.GRAPHICS_QUALITY_SETTINGS}
        for settingName, index, values, _, advanced, _, _ in graphQualitySettings:
            if settingName in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                options = []
                for i, val in enumerate(values):
                    valueLabel, supportFlag, advanced, _ = val
                    options.append({'label': '#settings:graphicsSettingsOptions/' + valueLabel,
                     'data': i,
                     'advanced': advanced,
                     'supported': supportFlag})

                options = sorted(options, key=itemgetter('data'), reverse=True)
                qualitySettings['quality'][settingName] = {'value': index,
                 'options': options}

        presets = {'current': self.__presetsKeys.index(self.selectedPresetKey),
         'values': []}
        for index, presetKey in enumerate(self.__presetsKeys):
            preset = {'index': index,
             'key': presetKey,
             'settings': {}}
            settings = self.__presets.get(presetKey, {})
            isSupported = True
            for settingName, value in settings.items():
                if not self.settingIsSupported(settingName, value):
                    allowedPresetSettings = GUI_SETTINGS.allowedNotSupportedGraphicSettings.get(preset['key'], [])
                    if settingName not in allowedPresetSettings:
                        isSupported = False
                        break
                if settingName in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                    preset['settings'][settingName] = value

            if isSupported:
                presets['values'].append(preset)

        presets['values'] = sorted(presets['values'], key=itemgetter('index'), reverse=True)
        qualitySettings['presets'] = presets
        return qualitySettings
Example #16
0
	def setSelectedOption(self):
		# init to -1 as that means no preset selected
		self.selectedOption = -1
		# create a dictionary from the currently set graphics options		
		currentOptionMap = {}		
		for currentOption in BigWorld.graphicsSettings():
			currentOptionMap[currentOption[0]] = currentOption[1]

		# iterate over the dictionary presets and compare them to the currently set
		# graphics options, if all the options match our preset, we have found a
		# preset option
		for i in range(0, len(self.entryNames)):
			foundOption = True
			for setting in self.entries[self.entryNames[i]].items():
				if currentOptionMap.get(setting[0]) != setting[1]:
					foundOption = False
					break
			if foundOption == True:
				self.selectedOption = i
				break
Example #17
0
    def getGraphicsPresetsData(self):
        graphQualitySettings = BigWorld.graphicsSettings()
        qualitySettings = {"quality": {}, "presets": None, "qualityOrder": GraphicsPresets.GRAPHICS_QUALITY_SETTINGS}
        for settingName, index, values, _, advanced, _, _ in graphQualitySettings:
            if settingName in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                options = []
                for i, val in enumerate(values):
                    valueLabel, supportFlag, advanced, _ = val
                    options.append(
                        {
                            "label": "#settings:graphicsSettingsOptions/" + valueLabel,
                            "data": i,
                            "advanced": advanced,
                            "supported": supportFlag,
                        }
                    )

                options = sorted(options, key=itemgetter("data"), reverse=True)
                qualitySettings["quality"][settingName] = {"value": index, "options": options}

        presets = {"current": self.__presetsKeys.index(self.selectedPresetKey), "values": []}
        for index, presetKey in enumerate(self.__presetsKeys):
            preset = {"index": index, "key": presetKey, "settings": {}}
            settings = self.__presets.get(presetKey, {})
            isSupported = True
            for settingName, value in settings.items():
                if not self.settingIsSupported(settingName, value):
                    allowedPresetSettings = GUI_SETTINGS.allowedNotSupportedGraphicSettings.get(preset["key"], [])
                    if settingName not in allowedPresetSettings:
                        isSupported = False
                        break
                if settingName in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS:
                    preset["settings"][settingName] = value

            if isSupported:
                presets["values"].append(preset)

        presets["values"] = sorted(presets["values"], key=itemgetter("index"), reverse=True)
        qualitySettings["presets"] = presets
        return qualitySettings
Example #18
0
    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()
Example #19
0
def __initGraphicsSettingsData():
    global _g_graphSettingsIndices
    if _g_graphSettingsIndices is None:
        _g_graphSettingsIndices = dict(((data[0], idx) for idx, data in enumerate(BigWorld.graphicsSettings())))
    return