예제 #1
0
파일: device.py 프로젝트: connoryang/1v1dec
    def CreateDevice(self):
        self.LogInfo('CreateDevice')
        if '/safemode' in blue.pyos.GetArg():
            self.SetToSafeMode()
        triapp = trinity.app
        triapp.title = uicore.triappargs['title']
        triapp.minimumWidth = self.minimumSize['width']
        triapp.minimumHeight = self.minimumSize['height']
        triapp.width = triapp.minimumWidth
        triapp.height = triapp.minimumHeight
        triapp.hideTitle = 1
        triapp.fullscreen = 0
        triapp.Create()
        dev = trinity.device
        while not dev.DoesD3DDeviceExist():
            try:
                self.Initialize()
                triapp = trinity.app
                trinity.device.disableAsyncLoad = not bool(
                    settings.public.generic.Get('asyncLoad', 1))
                self.SetResourceCacheSize()
                dev.mipLevelSkipCount = gfxsettings.Get(
                    gfxsettings.GFX_TEXTURE_QUALITY)
                trinity.SetShaderModel(self.GetAppShaderModel())
                if not self.PrepareMain(True):
                    blue.os.Pump()
                    time.sleep(0.5)
                    continue
                if trinity.adapters.SupportsDepthStencilFormat(
                        trinity.adapters.DEFAULT_ADAPTER,
                        trinity.adapters.GetCurrentDisplayMode(
                            trinity.adapters.DEFAULT_ADAPTER).format,
                        trinity.DEPTH_STENCIL_FORMAT.READABLE):
                    trinity.AddGlobalSituationFlags(['OPT_INTZ'])
                else:
                    trinity.RemoveGlobalSituationFlags(['OPT_INTZ'])
                try:
                    trinity.RebindAllShaderMaterials()
                except:
                    pass

            except trinity.D3DERR_NOTAVAILABLE as e:
                sys.exc_clear()
                trinity.adapters.Refresh()
            except trinity.ALDeviceNotAvailable as e:
                sys.exc_clear()
                trinity.adapters.Refresh()

        if not blue.sysinfo.isTransgaming:
            resizeEventHandler = blue.BlueEventToPython()
            resizeEventHandler.handler = self.HandleResizeEvent
            triapp.resizeEventListener = resizeEventHandler
        for k, v in self.GetAppSettings().iteritems():
            trinity.settings.SetValue(k, v)

        for dir in self.GetAppMipLevelSkipExclusionDirectories():
            trinity.AddMipLevelSkipExclusionDirectory(dir)
예제 #2
0
 def AppRun(self):
     if not settings.public.generic.Get('resourceUnloading', 1):
         trinity.SetEveSpaceObjectResourceUnloadingEnabled(0)
     self.defaultPresentationInterval = trinity.PRESENT_INTERVAL.ONE
     self.deviceCategories = ReadYamlFile('res:/videoCardCategories.yaml')
     if settings.public.device.Get('depthEffectsEnabled',
                                   self.GetDefaultDepthEffectsEnabled()
                                   ) and not self.SupportsDepthEffects():
         settings.public.device.Set('depthEffectsEnabled', False)
     if prefs.HasKey('shadowsEnabled'):
         shadowsEnabled = prefs.GetValue('shadowsEnabled')
         if not settings.public.HasKey('device', 'shadowQuality'):
             if not shadowsEnabled:
                 settings.public.device.Set('shadowQuality', 0)
             else:
                 settings.public.device.Set('shadowQuality',
                                            self.GetDefaultShadowQuality())
         prefs.DeleteValue('shadowsEnabled')
     if prefs.HasKey('bloomType'):
         bloomType = prefs.GetValue('bloomType')
         if not settings.public.HasKey('device', 'postProcessingQuality'):
             if bloomType == 0 or bloomType == 1:
                 settings.public.device.Set('postProcessingQuality',
                                            bloomType)
             else:
                 settings.public.device.Set('postProcessingQuality', 2)
             settings.public.device.Set('bloomType', bloomType)
         prefs.DeleteValue('bloomType')
     if not settings.public.HasKey('device', 'antiAliasing'):
         set = settings.public.device.Get('DeviceSettings', {}).copy()
         msType = set.get('MultiSampleType', 0)
         set['MultiSampleType'] = 0
         set['MultiSampleQuality'] = 0
         settings.public.device.Set('DeviceSettings', set)
         self.settings.SaveSettings()
         antiAliasing = 0
         if msType >= 8:
             antiAliasing = 3
         elif msType >= 4:
             antiAliasing = 2
         elif msType >= 2:
             antiAliasing = 1
         settings.public.device.Set('antiAliasing', antiAliasing)
     if not settings.public.HasKey('device', 'interiorShaderQuality'):
         settings.public.device.Set('interiorShaderQuality',
                                    self.GetDefaultInteriorShaderQuality())
     if settings.public.device.Get(
             'interiorShaderQuality',
             self.GetDefaultInteriorShaderQuality()) != 0:
         trinity.AddGlobalSituationFlags(['OPT_INTERIOR_SM_HIGH'])
     else:
         trinity.RemoveGlobalSituationFlags(['OPT_INTERIOR_SM_HIGH'])
     self.deviceCreated = False
     if blue.win32.IsTransgaming():
         self.cider = sm.GetService('cider')
         self.ciderFullscreenLast = False
         self.ciderFullscreenBackup = False
예제 #3
0
    def CreateDevice(self):
        self.LogInfo('CreateDevice')
        if '/safemode' in blue.pyos.GetArg():
            self.SetToSafeMode()
        triapp = trinity.app
        triapp.title = uicore.triappargs['title']
        triapp.hideTitle = 1
        triapp.fullscreen = 0
        triapp.Create()
        triapp.minimumWidth = self.minimumSize['width']
        triapp.minimumHeight = self.minimumSize['height']
        dev = trinity.device
        while not dev.DoesD3DDeviceExist():
            try:
                self.Initialize()
                triapp = trinity.app
                trinity.device.disableAsyncLoad = not bool(
                    settings.public.generic.Get('asyncLoad', 1))
                if self.IsHDRSupported() and settings.public.device.Get(
                        'hdrEnabled', self.GetDefaultHDRState()):
                    dev.hdrEnable = True
                else:
                    dev.hdrEnable = False
                self.SetResourceCacheSize()
                blue.os.sleeptime = 0
                dev.mipLevelSkipCount = settings.public.device.Get(
                    'textureQuality', self.GetDefaultTextureQuality())
                trinity.SetShaderModel(self.GetAppShaderModel())
                self.PrepareMain(True)
                if trinity.adapters.SupportsDepthStencilFormat(
                        trinity.adapters.DEFAULT_ADAPTER,
                        trinity.adapters.GetCurrentDisplayMode(
                            trinity.adapters.DEFAULT_ADAPTER).format,
                        trinity.DEPTH_STENCIL_FORMAT.READABLE):
                    trinity.AddGlobalSituationFlags(['OPT_INTZ'])
                else:
                    trinity.RemoveGlobalSituationFlags(['OPT_INTZ'])
                try:
                    trinity.RebindAllShaderMaterials()
                except:
                    pass

            except trinity.D3DERR_NOTAVAILABLE as e:
                sys.exc_clear()
                trinity.adapters.Refresh()

        if not blue.win32.IsTransgaming():
            resizeEventHandler = blue.BlueEventToPython()
            resizeEventHandler.handler = self.HandleResizeEvent
            triapp.resizeEventListener = resizeEventHandler
        for k, v in self.GetAppSettings().iteritems():
            trinity.settings.SetValue(k, v)

        for dir in self.GetAppMipLevelSkipExclusionDirectories():
            trinity.AddMipLevelSkipExclusionDirectory(dir)
예제 #4
0
 def AppRun(self):
     if not settings.public.generic.Get('resourceUnloading', 1):
         trinity.SetEveSpaceObjectResourceUnloadingEnabled(0)
     self.defaultPresentationInterval = trinity.PRESENT_INTERVAL.ONE
     gfx = gfxsettings.GraphicsSettings.GetGlobal()
     gfx.InitializeSettingsGroup(gfxsettings.SETTINGS_GROUP_DEVICE,
                                 settings.public.device)
     if gfxsettings.Get(gfxsettings.GFX_INTERIOR_SHADER_QUALITY) != 0:
         trinity.AddGlobalSituationFlags(['OPT_INTERIOR_SM_HIGH'])
     else:
         trinity.RemoveGlobalSituationFlags(['OPT_INTERIOR_SM_HIGH'])
     blue.classes.maxPendingDeletes = 20000
     blue.classes.maxTimeForPendingDeletes = 4.0
     blue.classes.pendingDeletesEnabled = True
     self.deviceCreated = False
     if blue.sysinfo.isTransgaming:
         self.cider = sm.GetService('cider')
         self.ciderFullscreenLast = False
         self.ciderFullscreenBackup = False
예제 #5
0
 def RemoveVisualization(self, rj):
     trinity.RemoveGlobalSituationFlags(['OPT_VISUALIZE_TEXTURES'])
     trinity.RebindAllShaderMaterials()