home *** CD-ROM | disk | FTP | other *** search
-
- # *************************************************************************
- #
- # autoexec.py
- #
- # Author: Matthias Gudmundsson
- # Created: Nov. 2001
- # Project: Framework
- #
- # Description:
- #
- # Executes startup scripts according to command line arguments. Optionally
- # Executes script:/my_autoexec.py if present, see comment below
- #
- # Dependencies:
- #
- # Blue
- #
- # (c) CCP 2000, 2001
- #
- # *************************************************************************
-
-
- # --------------------------------------------------------------------
- # Startup
- # --------------------------------------------------------------------
- def CheckDXVersion():
-
- musthave = 0x00090002 # 9.0b
- ver = blue.os.GetDXVersion()
-
- if ver < musthave:
- major, minor, letter = DecodeVersion(ver)
- major2, minor2, letter2 = DecodeVersion(musthave)
-
- msg = "DirectX %s.%s%s detected but this application needs %s.%s%s.\r\n"
- msg += "Click Yes to continue, but the application may not run.\r\n"
- msg += "Click No to go to support web page where you can download the "
- msg += "latest DirectX runtime files."
- msg = msg % (major, minor, letter, major2, minor2, letter2)
-
- ret = blue.os.MessageBox(msg, "Try continue with old DirectX version?", 0x1000|0x20|0x4)
- if ret == 6:
- return 1
-
- url = "http://www.eve-online.com/directx"
- url += "?dxversion=%s.%s%s"%(major, minor, letter)
- url += "&"+GetVersionArg()
- blue.os.ShellExecute(url)
-
- blue.pyos.Quit("DirectX version check failed.")
- return 0
-
- return 1
-
-
- def DecodeVersion(version):
- major, minor, lettercode = version >> 16, (version & 0xff00)>>8, version & 0xff
- if (lettercode):
- letter = chr(ord("a") + lettercode - 1)
- else:
- letter = ""
- return major, minor, letter
-
-
- def GetVersionArg():
- try:
- buildno = "%s.%s" % (boot.keyval["version"].split("=", 1)[1], boot.build)
- except:
- try:
- buildno = str(boot.build)
- except:
- buildno = "501" # internal error
-
- return "buildno=" + buildno
-
-
-
- if CheckDXVersion():
-
-
- import blue
- blue.pyos.ExecFile("script:/sys/nasty.py")
-
- ## here we list out all the paths under the cache directory that have to exist
- ## because they are created every time EVE starts up, users can delete the cache folder
- ## with out suffering any consiquences (apart from having to get everything again)
- paths = [
- blue.os.cachepath,
- blue.os.cachepath + "Browser",
- blue.os.cachepath + "Browser/Img",
- blue.os.cachepath + "Map",
- blue.os.cachepath + "Pictures",
- blue.os.cachepath + "Pictures/Gids",
- blue.os.cachepath + "Pictures/Planets",
- blue.os.cachepath + "Pictures/Portraits",
- blue.os.cachepath + "Pictures/Types",
- blue.os.cachepath + "Temp",
- blue.os.cachepath + "Temp/Mapbrowser",
- blue.os.cachepath + "Texture",
- blue.os.cachepath + "Texture/Planets",
- blue.os.cachepath + "Texture/Planets/Visited",
- blue.os.cachepath + "Shader",
- blue.os.cachepath + "Settings",
-
- blue.os.rootpath + "capture",
- blue.os.rootpath + "capture/Screenshots",
- blue.os.rootpath + "capture/Chatlogs",
- blue.os.rootpath + "capture/Gamelogs",
- blue.os.rootpath + "capture/Portraits",
-
- ]
-
- import os
- for path in paths:
- try:
- os.listdir(path)
- except OSError:
- os.mkdir(path)
-
-
- import eve
- evetmp = eve.eve
- import __builtin__
- del eve
- __builtin__.eve = evetmp
-
-
- def Startup():
-
- import log
- startedat = "EVE Client version %s build %s started %s %s"%( boot.version, boot.build, blue.os.FormatUTC()[0], blue.os.FormatUTC()[2] )
- print startedat
- log.general.Log(startedat, 1)
- log.general.Log(startedat, 2)
- log.general.Log(startedat, 4)
- log.general.Log(startedat, 8)
- log.general.Log(startedat, 32)
- log.general.Log(startedat, 64)
- log.general.Log(startedat, 128)
-
-
-
- # this is a placeholder for whatever local crap you want to do on
- # startup. I haven't checked in a blank script:/my_autoexec.py to
- # avoid annoying ss messages, so it just ignores it if the file is
- # not found.
- import service
-
- srvMng = service.ServiceManager()
- # Can┤t hurt to load some things early.
- run = [
- "dataconfig",
- "textmetr",
- "godma",
- "caption",
- "photo",
- "TransitionMgr",
- "machoNet",
- "objectCaching",
- "ComTool",
- "patch",
- "inv",
- "selection",
- "billboard",
- "xitems"
- ]
- if hasattr(prefs,"http") and prefs.http:
- print "http"
- run.append("http")
- if hasattr(prefs,"telnet") and prefs.telnet:
- print "telnet"
- run.append("telnet")
- srvMng.Run(run)
-
-
- # Execute all files referred on the command line
- for i in blue.pyos.GetArg()[1:]:
- if i[0] != '-' and i[0] != '/':
- print "Executing", i
- scriptfile = blue.os.scriptpath + i[8:]
- blue.pyos.ExecFile(i)
-
-
- # Try run private script
- file = blue.os.CreateInstance("blue.ResFile")
-
- if file.Open("script:/my_autoexec.py",1):
- file.Close()
- blue.pyos.ExecFile("script:/my_autoexec.py")
-
-
- # Try run deployment script
- if "/skiprun" not in blue.pyos.GetArg()[1:] and file.Open("script:/run.py",1):
- file.Close()
- blue.pyos.ExecFile("script:/run.py")
-
-
- import uthread
- uthread.new(Startup)
-
-