From e2cae7d76e130427426d26fcef8af1f21d227bd7 Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 30 Jun 2021 14:42:52 -0400 Subject: [PATCH] launcher: More cleanup --- otp/launcher/LauncherBase.py | 13 +----- otp/launcher/procapi.py | 43 ------------------- .../distributed/ToontownClientRepository.py | 2 +- toontown/launcher/QuickLauncher.py | 2 - 4 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 otp/launcher/procapi.py diff --git a/otp/launcher/LauncherBase.py b/otp/launcher/LauncherBase.py index 7ef2ec6..17d19fb 100644 --- a/otp/launcher/LauncherBase.py +++ b/otp/launcher/LauncherBase.py @@ -31,7 +31,6 @@ class LogAndOutput: class LauncherBase(DirectObject): GameName = 'game' - ArgCount = 6 GameLogFilenameKey = 'GAMELOG_FILENAME' PandaWindowOpenKey = 'PANDA_WINDOW_OPEN' PandaErrorCodeKey = 'PANDA_ERROR_CODE' @@ -49,11 +48,6 @@ class LauncherBase(DirectObject): self.started = False self.taskMgrStarted = False 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() logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000, ltime[1], @@ -61,10 +55,8 @@ class LauncherBase(DirectObject): ltime[3], ltime[4], ltime[5]) - logPrefix = '' - if not self.WIN32: - logPrefix = os.environ.get('LOGFILE_PREFIX', '') - logfile = logPrefix + self.getLogFileName() + '-' + logSuffix + '.log' + logPrefix = self.getLogFileName() + '-' + logfile = logPrefix + logSuffix + '.log' self.errorfile = 'errorCode' log = open(logfile, 'a') logOut = LogAndOutput(sys.__stdout__, log) @@ -81,7 +73,6 @@ class LauncherBase(DirectObject): print('os.environ = ', os.environ) self.miniTaskMgr = MiniTaskManager() self.setServerVersion(launcherConfig.GetString('server-version', 'no_version_set')) - self.ServerVersionSuffix = launcherConfig.GetString('server-version-suffix', '') self.nout = MultiplexStream() Notify.ptr().setOstreamPtr(self.nout, 0) self.nout.addFile(Filename(logfile)) diff --git a/otp/launcher/procapi.py b/otp/launcher/procapi.py deleted file mode 100644 index 5c3eaf6..0000000 --- a/otp/launcher/procapi.py +++ /dev/null @@ -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 diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 32bd9d8..8a66a19 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -241,7 +241,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): def __handleAvatarChooserDone(self, avList, doneStatus): done = doneStatus['mode'] if done == 'exit': - if not launcher.isDummy() and launcher.VISTA: + if not launcher.isDummy(): if not self.isPaid(): self.loginFSM.request('shutdown', [OTPLauncherGlobals.ExitUpsell]) else: diff --git a/toontown/launcher/QuickLauncher.py b/toontown/launcher/QuickLauncher.py index 4914a65..f6d226e 100644 --- a/toontown/launcher/QuickLauncher.py +++ b/toontown/launcher/QuickLauncher.py @@ -16,7 +16,6 @@ from toontown.toonbase import TTLocalizer class QuickLauncher(LauncherBase): GameName = 'Toontown' - ArgCount = 3 Localizer = TTLocalizer def __init__(self): @@ -69,7 +68,6 @@ class QuickLauncher(LauncherBase): def getRegistry(self, name, missingValue = None): self.notify.info('getRegistry %s' % ((name, missingValue),)) - self.notify.info('self.VISTA = %s' % self.VISTA) self.notify.info('checking env' % os.environ) if missingValue == None: missingValue = ''