Beispiel #1
0
def Reboot(reason=''):
    if not CanReboot():
        lg.Info('appUtils.Reboot', 'suppressing reboot due to single sign-on')
        lg.Info('appUtils.Reboot', 'rebooting due to ' + reason)
        bluepy.Terminate(reason)
    lg.Info('appUtils.Reboot', 'About to reboot the client because:' + reason)
    prefs.SetValue('rebootReason', reason)
    prefs.SetValue('rebootTime', blue.os.GetWallclockTime())
    allargs = blue.pyos.GetArg()
    cmd = allargs[0]
    args = []
    for arg in allargs[1:]:
        arg = arg.strip()
        if arg.find(' ') >= 0 or arg.find('\t') >= 0:
            arg = '"""' + arg + '"""'
        args.append(arg)

    args = ' '.join(args)
    lg.Info('appUtils.Reboot', 'About to reboot the client with:' + str(
        (0, None, cmd, args)))
    try:
        blue.win32.ShellExecute(0, None, cmd, args)
    except Exception as e:
        lg.Error('appUtils.Reboot', 'Failed with: ' + str(e))
        raise

    bluepy.Terminate(reason)
def KickPlayer():
    """
    Display a farewell message and exit the game.
    """
    Schedule(Seconds(20), bluepy.Terminate)
    eve.Message('AntiAddictionTimeExceeded', {'waitTime': WaitLeft().displayStr()})
    bluepy.Terminate()
Beispiel #3
0
 def ShowDisconnectNotice(self, notice=None):
     notice = notice or localization.GetByLabel(
         'UI/Shared/GenericConnectionLost')
     msgbox = form.MessageBox.Open(windowID='DisconnectNotice',
                                   parent=uicore.desktop,
                                   idx=0)
     msgbox.MakeUnResizeable()
     msgbox.MakeUnpinable()
     msgbox.MakeUnKillable()
     msgbox.Execute(
         notice,
         localization.GetByLabel('UI/Shared/ConnectionLost'),
         uiconst.OKCANCEL,
         uiconst.INFO,
         None,
         okLabel=localization.GetByLabel('UI/Commands/CmdRestart'),
         cancelLabel=localization.GetByLabel('UI/Commands/CmdQuit'))
     uicore.layer.hint.display = False
     blackOut = uicls.Fill(parent=uicore.layer.modal,
                           color=(0, 0, 0, 0),
                           idx=1)
     uicore.animations.MorphScalar(blackOut,
                                   'opacity',
                                   startVal=0,
                                   endVal=0.75,
                                   duration=1.0)
     modalResult = msgbox.ShowModal()
     if modalResult == uiconst.ID_OK:
         appUtils.Reboot('connection lost')
     else:
         bluepy.Terminate('User requesting close after client disconnect')
Beispiel #4
0
 def NewDoQuitGame(self):
     try:
         sm.GetService('tutorial').OnCloseApp()
         self.settings.SaveSettings()
         sm.GetService('clientStatsSvc').OnProcessExit()
     except:
         self.LogException()
     finally:
         bluepy.Terminate('User requesting close')
Beispiel #5
0
def ScriptWrapper(methodName):
    Log('Starting Script')
    try:
        getattr(Script(), methodName)()
    except Quitter as e:
        CloseXML()
        Log('Quitting: %s' % e)
        bluepy.Terminate(str(e))
        sys.exc_clear()
    except:
        CloseXML()
        LogException()
        sys.exc_clear()
        Log('Quitting!')
        if methodName != 'Test':
            bluepy.Terminate('Yikes!')

    CloseXML()
    Log('Finished Script')
Beispiel #6
0
def Quit(reason='(no reason stated)'):
    try:
        StackTraceAll(reason)
    except:
        try:
            LogTraceback('Exception in stack-trace-all, shutdown bombing')
        except:
            pass

    try:
        import bluepy
        bluepy.Terminate(reason)
    except ImportError:
        sys.exit(1)
Beispiel #7
0
 def _AppQuitGame(self):
     bluepy.Terminate('User requesting close')
Beispiel #8
0
 def DoManualPatch(self, msg, param):
     if uicore.Message(msg, {'text': param}, uiconst.YESNO, suppress=uiconst.ID_YES) == uiconst.ID_YES:
         msg = '%spatches.asp%s&e=%s' % (self.patchInfoUrl, self.queryString, param)
         blue.os.ShellExecute(msg)
         bluepy.Terminate('Manual patch close')
Beispiel #9
0
def KickPlayer():
    Schedule(Seconds(20), bluepy.Terminate)
    eve.Message('AntiAddictionTimeExceeded',
                {'waitTime': WaitLeft().displayStr()})
    bluepy.Terminate()
Beispiel #10
0
        private = blue.crypto.CryptExportKey(key, None,
                                             blue.crypto.PRIVATEKEYBLOB, 0)
        privateKey = 'if boot.GetValue("cryptoPack","Placebo") == "CryptoAPI":\n\n    # CryptoAPI Encryption\n   \n    import binascii\n    import blue\n    import blue.crypto\n    import macho\n\n    private  = blue.marshal.Load(binascii.a2b_hex("%(private)s") )\n    key      = blue.crypto.CryptImportKey(macho.GetCryptoContext(), private, None, 0)\n    version  = macho.CryptoHash(private)\n\n    exports = {\n       "macho.privateKey"        : key,\n       "macho.privateKeyVersion" : version,\n    }\n' % {
            'private': binascii.b2a_hex(blue.marshal.Save(private))
        }
        publicKey = 'if boot.GetValue("cryptoPack","Placebo") == "CryptoAPI":\n\n    # CryptoAPI Encryption\n\n    import binascii\n    import blue\n    import blue.crypto\n    import macho\n\n    public   = blue.marshal.Load(binascii.a2b_hex("%(public)s") )\n    key      = blue.crypto.CryptImportKey(macho.GetCryptoContext(), public, None, 0)\n    version  = macho.CryptoHash(public)\n\n    exports = {\n       "macho.publicKey"        : key,\n       "macho.publicKeyVersion" : version\n    }\n' % {
            'public': binascii.b2a_hex(blue.marshal.Save(public))
        }
        blue.win32.AtomicFileWrite(serverFileName,
                                   privateKey.replace('\n', '\r\n'))
        blue.win32.AtomicFileWrite(commonFileName,
                                   publicKey.replace('\n', '\r\n'))
    except Exception:
        log.LogException()

    bluepy.Terminate('Key Generation complete')
if cryptoPack == 'CryptoAPI':
    exports = {
        'macho.GetCryptoContext': CryptoAPI_GetCryptoContext,
        'macho.CryptoHash': CryptoAPI_CryptoHash,
        'macho.CryptoCreateContext': CryptoAPI_CreateContext,
        'macho.GetRandomBytes': CryptoAPI_GetRandomBytes,
        'macho.Sign': CryptoAPI_Sign,
        'macho.Verify': CryptoAPI_Verify
    }
else:
    exports = {
        'macho.CryptoHash': Placebo_CryptoHash,
        'macho.CryptoCreateContext': Placebo_CreateContext,
        'macho.GetRandomBytes': Placebo_GetRandomBytes,
        'macho.Sign': Placebo_Sign,
def _LogAndTerm(errstr, tool):
    silent = '/silent' in blue.pyos.GetArg()
    if not silent:
        blue.win32.MessageBox(errstr, 'Failed to initialize %s' % tool, 272)
        bluepy.Terminate(errstr)
Beispiel #12
0
def Startup(appCacheDirs,
            userCacheDirs,
            builtinSetupHook,
            servicesToRun,
            preUIStartArgProcessHook,
            StartupUIServiceName,
            startInline=[],
            serviceManagerClass='ServiceManager'):
    global Done
    args = blue.pyos.GetArg()[1:]
    autoexec_common.LogStarting('Client')
    bootWatchdog.SetPercentage(10)
    additionalScriptDirs = []
    fullDevToolsPath = os.path.join(
        blue.paths.ResolvePath(u'root:/devtools/script'))
    if not blue.pyos.packaged and '/compile' not in args and '/nodevtools' not in args and os.path.exists(
            fullDevToolsPath):
        additionalScriptDirs.extend(['script:/../../devtools/script/'])
        log.general.Log('Loading devtools locally from %s' % fullDevToolsPath,
                        log.LGINFO)
    else:
        log.general.Log('Additional tools will be loaded from the server',
                        log.LGINFO)
        servicesToRun += ('devToolsClient', )
    if '/black' in args:
        blue.resMan.substituteBlackForRed = True
    if '/jessica' in args and '/localizationMonitor' in args:
        servicesToRun += ('localizationMonitor', )
    if not blue.pyos.packaged and '/jessica' in args:
        if '/carbon' in blue.paths.ResolvePath(u'bin:/'):
            jessicaToolPath = '../tools/'
        else:
            jessicaToolPath = '../../carbon/tools/'
        additionalScriptDirs.extend([
            'script:/../' + jessicaToolPath + '/jessica/script/',
            'script:/../../../carbon/backend/script/',
            'script:/../../backend/script/'
        ])
        useExtensions = '/noJessicaExtensions' not in args
        if useExtensions:
            additionalScriptDirs.extend([
                'script:/../' + jessicaToolPath + 'jessicaExtensions/script/',
                'script:/../../tools/jessicaExtensions/script/'
            ])
    bootWatchdog.SetPercentage(20)
    import nasty
    nasty.Startup(additionalScriptDirs)
    localization.LoadLanguageData()
    errorMsg = {
        'resetsettings': [
            localization.GetByLabel('ErrorDialog/CantClearSettings'),
            localization.GetByLabel('ErrorDialog/CantClearSettingsHeader'),
            localization.GetByLabel('ErrorDialog/CantClearSettings')
        ],
        'clearcache': [
            localization.GetByLabel('ErrorDialog/CantClearCache'),
            localization.GetByLabel('ErrorDialog/CantClearCacheHeader'),
            localization.GetByLabel('ErrorDialog/CantClearCache')
        ]
    }
    if not getattr(prefs, 'disableLogInMemory', 0):
        blue.logInMemory.capacity = 1024
        blue.logInMemory.Start()
    bootWatchdog.SetPercentage(30)
    for clearType, clearPath in [
        ('resetsettings', blue.paths.ResolvePath(u'settings:/')),
        ('clearcache', blue.paths.ResolvePath(u'cache:/'))
    ]:
        if getattr(prefs, clearType, 0):
            if clearType == 'resetsettings':
                prefs.DeleteValue(clearType)
            if os.path.exists(clearPath):
                i = 0
                while 1:
                    newDir = clearPath[:-1] + '_backup%s' % i
                    if not os.path.isdir(newDir):
                        try:
                            os.makedirs(newDir)
                        except:
                            blue.win32.MessageBox(errorMsg[clearType][0],
                                                  errorMsg[clearType][1], 272)
                            bluepy.Terminate(errorMsg[clearType][2])
                            return False

                        break
                    i += 1

                for filename in os.listdir(clearPath):
                    if filename != 'Settings':
                        try:
                            os.rename(
                                clearPath + filename, '%s_backup%s/%s' %
                                (clearPath[:-1], i, filename))
                        except:
                            blue.win32.MessageBox(errorMsg[clearType][0],
                                                  errorMsg[clearType][1], 272)
                            bluepy.Terminate(errorMsg[clearType][2])
                            return False

                prefs.DeleteValue(clearType)

    mydocs = blue.win32.SHGetFolderPath(blue.win32.CSIDL_PERSONAL)
    paths = [blue.paths.ResolvePath(u'cache:/')]
    for dir in appCacheDirs:
        paths.append(blue.paths.ResolvePath(u'cache:/') + dir)

    for dir in userCacheDirs:
        paths.append(mydocs + dir)

    for path in paths:
        try:
            os.makedirs(path)
        except OSError as e:
            sys.exc_clear()

    import __builtin__
    import base
    session = base.CreateSession(None, const.session.SESSION_TYPE_GAME)
    __builtin__.session = session
    __builtin__.charsession = session
    base.EnableCallTimers(2)
    builtinSetupHook()
    autoexec_common.LogStarted('Client')
    bootWatchdog.SetPercentage(40)
    import numerical
    bluepy.frameClock = numerical.FrameClock()
    blue.os.frameClock = bluepy.frameClock
    import service
    smClass = getattr(service, serviceManagerClass)
    srvMng = smClass(startInline=['DB2', 'machoNet'] + startInline)
    bootWatchdog.SetPercentage(50)
    if hasattr(prefs, 'http') and prefs.http:
        log.general.Log('Running http', log.LGINFO)
        srvMng.Run(('http', ))
    srvMng.Run(servicesToRun)
    title = '[%s] %s %s %s.%s pid=%s' % (boot.region.upper(), boot.codename,
                                         boot.role, boot.version, boot.build,
                                         blue.os.pid)
    blue.os.SetAppTitle(title)
    Done = True
    try:
        blue.EnableBreakpad(prefs.GetValue('breakpadUpload', 1) == 1)
    except RuntimeError:
        pass

    bmRuns = prefs.GetValue('bmnextrun', 0)
    if '/benchmark' in args or bmRuns >= 1:
        import benchmark1
        prefs.SetValue('bmnextrun', bmRuns - 1)
        benchmark1.Run()
    if preUIStartArgProcessHook is not None:
        preUIStartArgProcessHook(args)
    if '/skiprun' not in args:
        if '/webtools' in args:
            ix = args.index('/webtools') + 1
            pr = args[ix]
            pr = pr.split(',')
            srvMng.StartService('webtools').SetVars(pr)
        srvMng.GetService(StartupUIServiceName).StartupUI(0)
Beispiel #13
0
def _LogAndTerm(errstr, tool):
    silent = '/silent' in blue.pyos.GetArg()
    if not silent:
        blue.os.ShowErrorMessageBox('Failed to initialize %s' % tool, errstr)
        bluepy.Terminate(errstr)
def Startup(appCacheDirs, userCacheDirs, servicesToRun):
    blue.os.sleeptime = 0
    _InitializeRemoteFileCacheIfNeeded()
    _PrepareRenderer()
    args = blue.pyos.GetArg()[1:]
    if '/thinclient' in args:
        import thinclients, thinclients.clientsetup
        if thinclients.HEADLESS in args:
            thinclients.clientsetup.patch_all()
        elif thinclients.HEADED in args:
            thinclients.clientsetup.enable_live_updates()
            thinclients.clientsetup.install_commands()
        else:
            raise RuntimeError('Bad params.')
    autoexec_common.LogStarting('Client')
    bootWatchdog.SetPercentage(10)
    if '/black' in args:
        blue.resMan.substituteBlackForRed = True
    if '/jessica' in args and '/localizationMonitor' in args:
        servicesToRun += ('localizationMonitor',)
    bootWatchdog.SetPercentage(20)
    builtinmangler.SmashNastyspaceBuiltinConflicts()
    whitelist.InitWhitelist()
    import localization
    localization.LoadLanguageData()
    errorMsg = {'resetsettings': [localization.GetByLabel('UI/ErrorDialog/CantClearSettings'), localization.GetByLabel('UI/ErrorDialog/CantClearSettingsHeader'), localization.GetByLabel('UI/ErrorDialog/CantClearSettings')],
     'clearcache': [localization.GetByLabel('UI/ErrorDialog/CantClearCache'), localization.GetByLabel('UI/ErrorDialog/CantClearCacheHeader'), localization.GetByLabel('UI/ErrorDialog/CantClearCache')]}
    if not getattr(prefs, 'disableLogInMemory', 0):
        blue.logInMemory.capacity = 1024
        blue.logInMemory.Start()
    bootWatchdog.SetPercentage(30)
    for clearType, clearPath in [('resetsettings', blue.paths.ResolvePath(u'settings:/')), ('clearcache', blue.paths.ResolvePath(u'cache:/'))]:
        if getattr(prefs, clearType, 0):
            if clearType == 'resetsettings':
                prefs.DeleteValue(clearType)
            if os.path.exists(clearPath):
                i = 0
                while 1:
                    newDir = clearPath[:-1] + '_backup%s' % i
                    if not os.path.isdir(newDir):
                        try:
                            os.makedirs(newDir)
                        except:
                            blue.win32.MessageBox(errorMsg[clearType][0], errorMsg[clearType][1], 272)
                            bluepy.Terminate(errorMsg[clearType][2])
                            return False

                        break
                    i += 1

                for filename in os.listdir(clearPath):
                    if filename != 'Settings':
                        try:
                            os.rename(clearPath + filename, '%s_backup%s/%s' % (clearPath[:-1], i, filename))
                        except:
                            blue.win32.MessageBox(errorMsg[clearType][0], errorMsg[clearType][1], 272)
                            bluepy.Terminate(errorMsg[clearType][2])
                            return False

                prefs.DeleteValue(clearType)

    mydocs = blue.win32.SHGetFolderPath(blue.win32.CSIDL_PERSONAL)
    paths = [blue.paths.ResolvePath(u'cache:/')]
    for dir in appCacheDirs:
        paths.append(blue.paths.ResolvePath(u'cache:/') + dir)

    for dir in userCacheDirs:
        paths.append(mydocs + dir)

    for path in paths:
        try:
            os.makedirs(path)
        except OSError as e:
            sys.exc_clear()

    import base
    import const
    session = base.CreateSession(None, const.session.SESSION_TYPE_GAME)
    __builtin__.session = session
    __builtin__.charsession = session
    base.EnableCallTimers(2)
    _InitializeEveBuiltin()
    autoexec_common.LogStarted('Client')
    bootWatchdog.SetPercentage(40)
    bluepy.frameClock = numerical.FrameClock()
    blue.os.frameClock = bluepy.frameClock
    import service
    srvMng = service.ServiceManager(startInline=INLINE_SERVICES)
    bootWatchdog.SetPercentage(50)
    if hasattr(prefs, 'http') and prefs.http:
        logmodule.general.Log('Running http', logmodule.LGINFO)
        srvMng.Run(('http',))
    srvMng.Run(servicesToRun)
    title = '[%s] %s %s %s.%s pid=%s' % (boot.region.upper(),
     boot.codename,
     boot.role,
     boot.version,
     boot.build,
     blue.os.pid)
    blue.os.SetAppTitle(title)
    try:
        blue.EnableBreakpad(prefs.GetValue('breakpadUpload', 1) == 1)
    except RuntimeError:
        pass

    blue.os.frameTimeTimeout = prefs.GetValue('frameTimeTimeout', 30000)
    if '/skiprun' not in args:
        if '/webtools' in args:
            ix = args.index('/webtools') + 1
            pr = args[ix]
            pr = pr.split(',')
            srvMng.StartService('webtools').SetVars(pr)
        srvMng.GetService('gameui').StartupUI(0)
 def GenericQuit(self):
     self.settings.SaveSettings()
     bluepy.Terminate('User requesting close')
Beispiel #16
0
    def SetDevice(self,
                  device,
                  tryAgain=1,
                  fallback=0,
                  keepSettings=1,
                  hideTitle=None,
                  userModified=False,
                  muteExceptions=False,
                  updateWindowPosition=True):
        if hideTitle is None:
            hideTitle = not device.Windowed
        self.LogInfo('SetDevice: tryAgain', tryAgain, 'fallback', fallback,
                     'keepSettings', keepSettings, 'hideTitle', hideTitle,
                     'deviceDict', device.__dict__)
        if not fallback:
            device = self.EnforceDeviceSettings(device)
        self.SanitizeDeviceTypes(device)
        change = self.CheckDeviceDifference(device, getChange=1)
        dev = trinity.device
        if not change and tryAgain and dev.DoesD3DDeviceExist():
            return True
        sm.ChainEvent('ProcessDeviceChange')
        pr = []
        for k, v in device.__dict__.items():
            pr.append((k, v))

        pr.sort()
        msg = 'SetDevice: Found a difference\n'
        for k, v in pr:
            extra = ''
            if k in change:
                extra = '   >> this one changed, it was ' + str(change[k][0])
            msg += '        ' + str(k) + ':    ' + str(v) + extra + '\n'

        self.LogInfo(msg)
        triapp = trinity.app
        if tryAgain:
            self.BackupSettings()
        try:
            triapp.hideTitle = hideTitle
            triapp.AdjustWindowForChange(
                device.Windowed,
                settings.public.device.Get('FixedWindow', False))
            msg = 'SetDevice - trying again\n'
            msg += 'Before:\n'
            msg += repr(device.__dict__) + '\n'
            if device.Adapter not in self.adapters:
                device.Adapter = self.adapters[0]
            device.__dict__.update(
                self.FixupPresentation(device.Adapter, device.__dict__))
            msg += 'After:\n'
            msg += repr(device.__dict__) + '\n'
            self.LogInfo(msg)
            dev = trinity.device
            dev.viewport.width = device.BackBufferWidth
            dev.viewport.height = device.BackBufferHeight
            while True:
                try:
                    triapp.ChangeDevice(device.Adapter, 0, 0, device.__dict__)
                    break
                except trinity.D3DERR_DEVICELOST:
                    blue.pyos.synchro.SleepWallclock(1000)

        except Exception as e:
            import traceback
            self.LogInfo(traceback.format_exc())
            self.LogInfo(repr(device.__dict__))
            if trinity.device.GetRenderingPlatformID() == 2:
                if prefs.HasKey('trinityPreferredPlatform') and prefs.GetValue(
                        'trinityPreferredPlatform') == 'dx11':
                    prefs.SetValue('trinityPreferredPlatform', 'dx9')
                    log.Quit(
                        'Failed to create device under DX11 - setting preferred platform to DX9'
                    )
                else:
                    log.Quit('Failed to create device under DX11')
            if tryAgain and self.settingsBackup:
                sys.exc_clear()
                self.LogInfo(
                    'SetDevice failed, trying again with backup settings')
                return self.SetDevice(self.settingsBackup,
                                      0,
                                      keepSettings=keepSettings)
            if not fallback:
                sys.exc_clear()
                self.LogInfo(
                    'SetDevice with backup settings failed, falling back to savemode'
                )
                set = self.GetSaveMode()
                return self.SetDevice(set,
                                      fallback=1,
                                      tryAgain=0,
                                      hideTitle=not set.Windowed,
                                      keepSettings=False)
            if muteExceptions:
                log.LogException()
                sys.exc_clear()
            self.LogInfo('SetDevice failed completely')
            return False

        if updateWindowPosition:
            self.UpdateWindowPosition(device)
        else:
            wr = triapp.GetWindowRect()
            triapp.SetWindowPos(wr.left, wr.top)
        sm.ScatterEvent('OnSetDevice')
        if uicore.desktop:
            uicore.desktop.UpdateSize()
        if keepSettings:
            set = self.GetSettings()
            keep = set.__dict__
            del keep['hDeviceWindow']
            gfxsettings.Set(gfxsettings.GFX_DEVICE_SETTINGS,
                            keep,
                            pending=False)
            self.settings.SaveSettings()
            self.LogInfo('Keeping device settings:', repr(keep))
            if self.IsWindowed(set):
                val = (set.BackBufferWidth, set.BackBufferHeight)
                gfxsettings.Set(gfxsettings.GFX_RESOLUTION_WINDOWED,
                                val,
                                pending=False)
            else:
                val = (set.BackBufferWidth, set.BackBufferHeight)
                gfxsettings.Set(gfxsettings.GFX_RESOLUTION_FULLSCREEN,
                                val,
                                pending=False)
                if userModified and self.resolutionBackup and self.resolutionBackup != val:
                    self.AskForConfirmation()
        sm.ScatterEvent('OnEndChangeDevice', change)
        unsupportedModels = ['SM_1_1', 'SM_2_0_LO', 'SM_2_0_HI']
        maxCardModel = trinity.GetMaxShaderModelSupported()
        if maxCardModel in unsupportedModels:
            message = localization.GetByLabel(
                '/Carbon/UI/Service/Device/ShaderModelNotSupportedMessage')
            title = localization.GetByLabel(
                '/Carbon/UI/Service/Device/ShaderModelNotSupportedTitle')
            blue.os.ShowErrorMessageBox(title, message)
            bluepy.Terminate('Shader Model version check failed')
        return True
Beispiel #17
0
def Startup(servicesToRun,
            builtinSetupHook,
            startInline=[],
            serviceManagerClass='ServiceManager'):
    global Done
    args = blue.pyos.GetArg()[1:]
    autoexec_common.LogStarting('ThinClient')
    additionalScriptDirs = [
        'script:/../../../client/script/',
        'script:/../../../../carbon/client/script/',
        'script:/../../../../carbon/tools/thinClient/script/',
        'script:/../../../devtools/script/'
    ]
    for argument in args:
        if argument.startswith('/cache='):
            cachepath = argument[len('/cache='):]
            blue.paths.SetSearchPath('cache:', cachepath + os.sep)
            log.general.Log(
                'Cache directory set to: ' +
                blue.paths.ResolvePath(u'cache:/'), log.LGNOTICE)
        elif argument.startswith('/randomcache'):
            import tempfile
            cachepath = tempfile.mkdtemp()
            blue.paths.SetSearchPath('cache:', u'%s' % cachepath + os.sep)
            log.general.Log(
                'Cache directory set to: ' +
                blue.paths.ResolvePath(u'cache:/'), log.LGNOTICE)

    if '/automaton' in args:
        additionalScriptDirs.extend([
            'script:/../../../../carbon/backend/script/',
            'script:/../../../backend/script/'
        ])
    if not blue.pyos.packaged and '/jessica' in args:
        additionalScriptDirs.extend([
            'script:/../../../../carbon/tools/jessica/script/',
            'script:/../../../../carbon/backend/script/',
            'script:/../../../backend/script/'
        ])
        useExtensions = '/noJessicaExtensions' not in args
        if useExtensions:
            additionalScriptDirs.extend([
                'script:/../../../../carbon/tools/jessicaExtensions/script/',
                'script:/../../../tools/jessicaExtensions/script/',
                'script:/../tools/jessicaExtensions/script/'
            ])
    import nasty
    nasty.Startup(additionalScriptDirs)
    errorMsg = {
        'resetsettings': [
            'The application is unable to clear the settings. If you are running other instances of Eve Online, please exit them. If the problem persists you should restart your system.',
            'Cannot clear settings!', 'Cannot clear settings'
        ],
        'clearcache': [
            'The application is unable to clear the cache. If you are running other instances of Eve Online, please exit them. If the problem persists you should restart your system.',
            'Cannot clear cache!', 'Cannot clear cache'
        ]
    }
    for clearType, clearPath in [
        ('resetsettings', blue.paths.ResolvePath(u'settings:/')),
        ('clearcache', blue.paths.ResolvePath(u'cache:/'))
    ]:
        if getattr(prefs, clearType, 0):
            if clearType == 'resetsettings':
                prefs.DeleteValue(clearType)
            if os.path.exists(clearPath):
                i = 0
                while 1:
                    newDir = clearPath[:-1] + '_backup%s' % i
                    if not os.path.isdir(newDir):
                        try:
                            os.makedirs(newDir)
                        except:
                            blue.win32.MessageBox(errorMsg[clearType][0],
                                                  errorMsg[clearType][1], 272)
                            bluepy.Terminate(errorMsg[clearType][2])
                            return False

                        break
                    i += 1

                for filename in os.listdir(clearPath):
                    if filename != 'Settings':
                        try:
                            os.rename(
                                clearPath + filename, '%s_backup%s/%s' %
                                (clearPath[:-1], i, filename))
                        except:
                            blue.win32.MessageBox(errorMsg[clearType][0],
                                                  errorMsg[clearType][1], 272)
                            bluepy.Terminate(errorMsg[clearType][2])
                            return False

                prefs.DeleteValue(clearType)

    mydocs = blue.win32.SHGetFolderPath(blue.win32.CSIDL_PERSONAL)
    paths = [blue.paths.ResolvePath(u'cache:/')]
    for path in paths:
        try:
            os.makedirs(path)
        except OSError as e:
            sys.exc_clear()

    import __builtin__, base
    session = base.CreateSession(None, const.session.SESSION_TYPE_GAME)
    __builtin__.session = session
    __builtin__.charsession = session
    builtinSetupHook()
    autoexec_common.LogStarted('ThinClient')
    import numerical
    bluepy.frameClock = numerical.FrameClock()
    blue.os.frameClock = bluepy.frameClock
    import service
    smClass = getattr(service, serviceManagerClass)
    srvMng = smClass(startInline=['DB2', 'machoNet'] + startInline)
    if hasattr(prefs, 'http') and prefs.http:
        print 'http'
        srvMng.Run(('http', ))
    srvMng.Run(servicesToRun)
    title = '[%s] %s %s %s.%s pid=%s' % (boot.region.upper(), boot.codename,
                                         boot.role, boot.version, boot.build,
                                         blue.os.pid)
    blue.os.SetAppTitle(title)
    Done = True
    if bluepy.IsRunningStartupTest():
        bluepy.TerminateStartupTest()

    def f(*args, **kwargs):
        return 'Malkovich'

    localization.GetByMessageID = f
    localization.GetByLabel = f
    localization.GetImportantByMessageID = f
    localization.GetImportantByLabel = f
    localization._GetRawByMessageID = f
    localization.FormatImportantString = f