launcher: More cleanup
This commit is contained in:
parent
33918d1ec0
commit
e2cae7d76e
4 changed files with 3 additions and 57 deletions
|
@ -31,7 +31,6 @@ class LogAndOutput:
|
||||||
|
|
||||||
class LauncherBase(DirectObject):
|
class LauncherBase(DirectObject):
|
||||||
GameName = 'game'
|
GameName = 'game'
|
||||||
ArgCount = 6
|
|
||||||
GameLogFilenameKey = 'GAMELOG_FILENAME'
|
GameLogFilenameKey = 'GAMELOG_FILENAME'
|
||||||
PandaWindowOpenKey = 'PANDA_WINDOW_OPEN'
|
PandaWindowOpenKey = 'PANDA_WINDOW_OPEN'
|
||||||
PandaErrorCodeKey = 'PANDA_ERROR_CODE'
|
PandaErrorCodeKey = 'PANDA_ERROR_CODE'
|
||||||
|
@ -49,11 +48,6 @@ class LauncherBase(DirectObject):
|
||||||
self.started = False
|
self.started = False
|
||||||
self.taskMgrStarted = False
|
self.taskMgrStarted = False
|
||||||
self.pandaErrorCode = 0
|
self.pandaErrorCode = 0
|
||||||
self.WIN32 = os.name == 'nt'
|
|
||||||
if self.WIN32:
|
|
||||||
self.VISTA = sys.getwindowsversion()[3] == 2 and sys.getwindowsversion()[0] == 6
|
|
||||||
else:
|
|
||||||
self.VISTA = 0
|
|
||||||
ltime = time.localtime()
|
ltime = time.localtime()
|
||||||
logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000,
|
logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000,
|
||||||
ltime[1],
|
ltime[1],
|
||||||
|
@ -61,10 +55,8 @@ class LauncherBase(DirectObject):
|
||||||
ltime[3],
|
ltime[3],
|
||||||
ltime[4],
|
ltime[4],
|
||||||
ltime[5])
|
ltime[5])
|
||||||
logPrefix = ''
|
logPrefix = self.getLogFileName() + '-'
|
||||||
if not self.WIN32:
|
logfile = logPrefix + logSuffix + '.log'
|
||||||
logPrefix = os.environ.get('LOGFILE_PREFIX', '')
|
|
||||||
logfile = logPrefix + self.getLogFileName() + '-' + logSuffix + '.log'
|
|
||||||
self.errorfile = 'errorCode'
|
self.errorfile = 'errorCode'
|
||||||
log = open(logfile, 'a')
|
log = open(logfile, 'a')
|
||||||
logOut = LogAndOutput(sys.__stdout__, log)
|
logOut = LogAndOutput(sys.__stdout__, log)
|
||||||
|
@ -81,7 +73,6 @@ class LauncherBase(DirectObject):
|
||||||
print('os.environ = ', os.environ)
|
print('os.environ = ', os.environ)
|
||||||
self.miniTaskMgr = MiniTaskManager()
|
self.miniTaskMgr = MiniTaskManager()
|
||||||
self.setServerVersion(launcherConfig.GetString('server-version', 'no_version_set'))
|
self.setServerVersion(launcherConfig.GetString('server-version', 'no_version_set'))
|
||||||
self.ServerVersionSuffix = launcherConfig.GetString('server-version-suffix', '')
|
|
||||||
self.nout = MultiplexStream()
|
self.nout = MultiplexStream()
|
||||||
Notify.ptr().setOstreamPtr(self.nout, 0)
|
Notify.ptr().setOstreamPtr(self.nout, 0)
|
||||||
self.nout.addFile(Filename(logfile))
|
self.nout.addFile(Filename(logfile))
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
import ctypes
|
|
||||||
from ctypes.wintypes import *
|
|
||||||
TH32CS_SNAPPROCESS = 2
|
|
||||||
INVALID_HANDLE_VALUE = -1
|
|
||||||
cwk = ctypes.windll.kernel32
|
|
||||||
|
|
||||||
class PROCESSENTRY32(ctypes.Structure):
|
|
||||||
_fields_ = [('dwSize', DWORD),
|
|
||||||
('cntUsage', DWORD),
|
|
||||||
('th32ProcessID', DWORD),
|
|
||||||
('th32DefaultHeapId', HANDLE),
|
|
||||||
('th32ModuleID', DWORD),
|
|
||||||
('cntThreads', DWORD),
|
|
||||||
('th32ParentProcessID', DWORD),
|
|
||||||
('pcPriClassBase', LONG),
|
|
||||||
('dwFlags', DWORD),
|
|
||||||
('szExeFile', c_char * MAX_PATH)]
|
|
||||||
|
|
||||||
|
|
||||||
class ProcessEntryPY:
|
|
||||||
|
|
||||||
def __init__(self, name, pid):
|
|
||||||
self.name = name
|
|
||||||
self.pid = pid
|
|
||||||
|
|
||||||
|
|
||||||
def getProcessList():
|
|
||||||
hProcessSnap = cwk.CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
|
|
||||||
|
|
||||||
processList = []
|
|
||||||
if hProcessSnap != INVALID_HANDLE_VALUE:
|
|
||||||
pe32 = PROCESSENTRY32()
|
|
||||||
pe32.dwSize = sizeof(pe32)
|
|
||||||
|
|
||||||
if cwk.Process32First(hProcessSnap, ctypes.byref(pe32)):
|
|
||||||
while 1:
|
|
||||||
processList.append(ProcessEntryPY(pe32.szExeFile.lower(), int(pe32.th32ProcessID)))
|
|
||||||
if not cwk.Process32Next(hProcessSnap, ctypes.byref(pe32)):
|
|
||||||
break
|
|
||||||
|
|
||||||
cwk.CloseHandle(hProcessSnap)
|
|
||||||
|
|
||||||
return processList
|
|
|
@ -241,7 +241,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
||||||
def __handleAvatarChooserDone(self, avList, doneStatus):
|
def __handleAvatarChooserDone(self, avList, doneStatus):
|
||||||
done = doneStatus['mode']
|
done = doneStatus['mode']
|
||||||
if done == 'exit':
|
if done == 'exit':
|
||||||
if not launcher.isDummy() and launcher.VISTA:
|
if not launcher.isDummy():
|
||||||
if not self.isPaid():
|
if not self.isPaid():
|
||||||
self.loginFSM.request('shutdown', [OTPLauncherGlobals.ExitUpsell])
|
self.loginFSM.request('shutdown', [OTPLauncherGlobals.ExitUpsell])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -16,7 +16,6 @@ from toontown.toonbase import TTLocalizer
|
||||||
|
|
||||||
class QuickLauncher(LauncherBase):
|
class QuickLauncher(LauncherBase):
|
||||||
GameName = 'Toontown'
|
GameName = 'Toontown'
|
||||||
ArgCount = 3
|
|
||||||
Localizer = TTLocalizer
|
Localizer = TTLocalizer
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -69,7 +68,6 @@ class QuickLauncher(LauncherBase):
|
||||||
|
|
||||||
def getRegistry(self, name, missingValue = None):
|
def getRegistry(self, name, missingValue = None):
|
||||||
self.notify.info('getRegistry %s' % ((name, missingValue),))
|
self.notify.info('getRegistry %s' % ((name, missingValue),))
|
||||||
self.notify.info('self.VISTA = %s' % self.VISTA)
|
|
||||||
self.notify.info('checking env' % os.environ)
|
self.notify.info('checking env' % os.environ)
|
||||||
if missingValue == None:
|
if missingValue == None:
|
||||||
missingValue = ''
|
missingValue = ''
|
||||||
|
|
Loading…
Reference in a new issue