launcher: Remove more old cruft

This commit is contained in:
John Cote 2021-06-29 20:20:52 -04:00
parent 7f3c81b386
commit dbf1c70648
3 changed files with 1 additions and 118 deletions

View file

@ -163,14 +163,12 @@ class OTPClientRepository(ClientRepositoryBase):
else: else:
self.notify.error('The required-login was not recognized.') self.notify.error('The required-login was not recognized.')
self.computeValidateDownload()
self.wantMagicWords = base.config.GetString('want-magic-words', '') self.wantMagicWords = base.config.GetString('want-magic-words', '')
if self.launcher and hasattr(self.launcher, 'http'): if self.launcher and hasattr(self.launcher, 'http'):
self.http = self.launcher.http self.http = self.launcher.http
else: else:
self.http = HTTPClient() self.http = HTTPClient()
#self.allocateDcFile()
self.accountOldAuth = config.GetBool('account-old-auth', 0) self.accountOldAuth = config.GetBool('account-old-auth', 0)
self.accountOldAuth = config.GetBool('%s-account-old-auth' % game.name, self.accountOldAuth = config.GetBool('%s-account-old-auth' % game.name,
self.accountOldAuth) self.accountOldAuth)
@ -456,24 +454,6 @@ class OTPClientRepository(ClientRepositoryBase):
self.handler = None self.handler = None
return return
def computeValidateDownload(self):
if self.launcher:
hash = HashVal()
hash.mergeWith(launcher.launcherFileDbHash)
hash.mergeWith(launcher.serverDbFileHash)
self.validateDownload = hash.asHex()
else:
self.validateDownload = ''
basePath = os.path.expandvars('$TOONTOWN') or './toontown'
downloadParFilename = Filename.expandFrom(basePath + '/src/configfiles/download.par')
if downloadParFilename.exists():
downloadPar = open(downloadParFilename.toOsSpecific())
for line in downloadPar.readlines():
i = string.find(line, 'VALIDATE_DOWNLOAD=')
if i != -1:
self.validateDownload = string.strip(line[i + 18:])
break
def getServerVersion(self): def getServerVersion(self):
return self.serverVersion return self.serverVersion
@ -1886,12 +1866,6 @@ class OTPClientRepository(ClientRepositoryBase):
self.queryObjectFieldId(doId, fieldId, context) self.queryObjectFieldId(doId, fieldId, context)
return return
def allocateDcFile(self):
dcName = 'Shard %s cannot be found.'
hash = HashVal()
hash.hashString(dcName)
self.http.setClientCertificatePassphrase(hash.asHex())
def lostConnection(self): def lostConnection(self):
ClientRepositoryBase.lostConnection(self) ClientRepositoryBase.lostConnection(self)
self.loginFSM.request('noConnection') self.loginFSM.request('noConnection')

View file

@ -1,14 +1,13 @@
import sys import sys
import os import os
import time import time
import string
import builtins import builtins
from panda3d.core import * from panda3d.core import *
from direct.showbase import DConfig from direct.showbase import DConfig
from direct.showbase.MessengerGlobal import * from direct.showbase.MessengerGlobal import *
from direct.showbase.DirectObject import DirectObject from direct.showbase.DirectObject import DirectObject
from direct.showbase.EventManagerGlobal import * from direct.showbase.EventManagerGlobal import *
from direct.task.MiniTask import MiniTask, MiniTaskManager from direct.task.MiniTask import MiniTaskManager
from direct.directnotify.DirectNotifyGlobal import * from direct.directnotify.DirectNotifyGlobal import *
class LogAndOutput: class LogAndOutput:
@ -33,8 +32,6 @@ class LogAndOutput:
class LauncherBase(DirectObject): class LauncherBase(DirectObject):
GameName = 'game' GameName = 'game'
ArgCount = 6 ArgCount = 6
win32con_FILE_PERSISTENT_ACLS = 8
InstallDirKey = 'INSTALL_DIR'
GameLogFilenameKey = 'GAMELOG_FILENAME' GameLogFilenameKey = 'GAMELOG_FILENAME'
PandaWindowOpenKey = 'PANDA_WINDOW_OPEN' PandaWindowOpenKey = 'PANDA_WINDOW_OPEN'
PandaErrorCodeKey = 'PANDA_ERROR_CODE' PandaErrorCodeKey = 'PANDA_ERROR_CODE'
@ -47,10 +44,6 @@ class LauncherBase(DirectObject):
PeriodNameKey = 'PERIOD_NAME' PeriodNameKey = 'PERIOD_NAME'
SwidKey = 'SWID' SwidKey = 'SWID'
DISLTokenKey = 'DISLTOKEN' DISLTokenKey = 'DISLTOKEN'
ProxyServerKey = 'PROXY_SERVER'
ProxyDirectHostsKey = 'PROXY_DIRECT_HOSTS'
launcherFileDbFilename = 'launcherFileDb'
webLauncherFlag = False
def __init__(self): def __init__(self):
self.started = False self.started = False
@ -147,15 +140,6 @@ class LauncherBase(DirectObject):
def isDummy(self): def isDummy(self):
return 0 return 0
def getProductName(self):
config = getConfigExpress()
productName = config.GetString('product-name', '')
if productName and productName != 'DisneyOnline-US':
productName = '_%s' % productName
else:
productName = ''
return productName
def background(self): def background(self):
self.notify.info('background: Launcher now operating in background') self.notify.info('background: Launcher now operating in background')
self.backgrounded = 1 self.backgrounded = 1
@ -175,10 +159,6 @@ class LauncherBase(DirectObject):
if not self.backgrounded: if not self.backgrounded:
time.sleep(self.ForegroundSleepTime) time.sleep(self.ForegroundSleepTime)
def forceSleep(self):
if not self.backgrounded:
time.sleep(3.0)
def maybeStartGame(self): def maybeStartGame(self):
if not self.started and self.currentPhase >= self.showPhase: if not self.started and self.currentPhase >= self.showPhase:
self.started = True self.started = True

View file

@ -50,7 +50,6 @@ class QuickLauncher(LauncherBase):
ForegroundSleepTime = 0.001 ForegroundSleepTime = 0.001
Localizer = TTLocalizer Localizer = TTLocalizer
DecompressMultifiles = True DecompressMultifiles = True
launcherFileDbFilename = 'patcher.ver?%s' % random.randint(1, 1000000000)
CompressionExt = 'bz2' CompressionExt = 'bz2'
PatchExt = 'pch' PatchExt = 'pch'
@ -69,79 +68,12 @@ class QuickLauncher(LauncherBase):
self.toontownPlayTokenKey = 'PLAYTOKEN' self.toontownPlayTokenKey = 'PLAYTOKEN'
print('useTTSpecificLogin=%s' % self.useTTSpecificLogin) print('useTTSpecificLogin=%s' % self.useTTSpecificLogin)
self.contentDir = '/' self.contentDir = '/'
self.serverDbFileHash = HashVal()
self.launcherFileDbHash = HashVal()
self.DECREASE_BANDWIDTH = 0
self.webAcctParams = 'WEB_ACCT_PARAMS' self.webAcctParams = 'WEB_ACCT_PARAMS'
self.parseWebAcctParams() self.parseWebAcctParams()
self.showPhase = -1 self.showPhase = -1
self.maybeStartGame() self.maybeStartGame()
self.mainLoop() self.mainLoop()
def addDownloadVersion(self, serverFilePath):
url = URLSpec(self.downloadServer)
origPath = url.getPath()
if origPath[-1] == '/':
url.setPath('%s%s' % (origPath, serverFilePath))
else:
url.setPath('%s/%s' % (origPath, serverFilePath))
return url
def downloadLauncherFileDbDone(self):
settings = {}
for line in self.ramfile.readlines():
if line.find('=') >= 0:
key, value = line.strip().split('=')
settings[key] = value
self.requiredInstallFiles = []
if sys.platform == 'win32':
fileList = settings['REQUIRED_INSTALL_FILES']
elif sys.platform == 'darwin':
fileList = settings['REQUIRED_INSTALL_FILES_OSX']
else:
self.notify.warning('Unknown sys.platform: %s' % sys.platform)
fileList = settings['REQUIRED_INSTALL_FILES']
for fileDesc in fileList.split():
fileName, flag = fileDesc.split(':')
directions = BitMask32(flag)
extract = directions.getBit(0)
required = directions.getBit(1)
optionalDownload = directions.getBit(2)
self.notify.info('fileName: %s, flag:=%s directions=%s, extract=%s required=%s optDownload=%s' % (fileName,
flag,
directions,
extract,
required,
optionalDownload))
if required:
self.requiredInstallFiles.append(fileName)
self.notify.info('requiredInstallFiles: %s' % self.requiredInstallFiles)
self.mfDetails = {}
for mfName in self.requiredInstallFiles:
currentVer = settings['FILE_%s.current' % mfName]
details = settings['FILE_%s.%s' % (mfName, currentVer)]
size, hash = details.split()
self.mfDetails[mfName] = (currentVer, int(size), hash)
self.notify.info('mfDetails[%s] = %s' % (mfName, self.mfDetails[mfName]))
self.resumeInstall()
def resumeMultifileDownload(self):
curVer, expectedSize, expectedMd5 = self.mfDetails[self.currentMfname]
localFilename = Filename(self.topDir, Filename('_%s.%s.%s' % (self.currentMfname, curVer, self.CompressionExt)))
serverFilename = '%s%s.%s.%s' % (self.contentDir,
self.currentMfname,
curVer,
self.CompressionExt)
if localFilename.exists():
fileSize = localFilename.getFileSize()
self.notify.info('Previous partial download exists for: %s size=%s' % (localFilename.cStr(), fileSize))
self.downloadMultifile(serverFilename, localFilename, self.currentMfname, self.downloadMultifileDone, 0, fileSize, self.downloadMultifileWriteToDisk)
else:
self.downloadMultifile(serverFilename, localFilename, self.currentMfname, self.downloadMultifileDone, 0, 0, self.downloadMultifileWriteToDisk)
def resumeInstall(self): def resumeInstall(self):
for self.currentPhaseIndex in range(len(self.LauncherPhases)): for self.currentPhaseIndex in range(len(self.LauncherPhases)):
self.currentPhase = self.LauncherPhases[self.currentPhaseIndex] self.currentPhase = self.LauncherPhases[self.currentPhaseIndex]
@ -393,9 +325,6 @@ class QuickLauncher(LauncherBase):
else: else:
return self.chatEligibleKey return self.chatEligibleKey
def canLeaveFirstIsland(self):
return self.getPhaseComplete(4)
def startGame(self): def startGame(self):
self.newTaskManager() self.newTaskManager()
eventMgr.restart() eventMgr.restart()