diff --git a/build/data/NiraiStart.py b/build/data/NiraiStart.py index b8d89099..d114aea4 100644 --- a/build/data/NiraiStart.py +++ b/build/data/NiraiStart.py @@ -14,9 +14,9 @@ for line in prc.split('\n'): line = line.strip() if line: loadPrcFileData('nirai config', line) - + del prc - + # DC __builtin__.dcStream = StringStream() @@ -39,18 +39,18 @@ abort = False for mf in mfs: filename = 'resources/default/phase_%s.mf' % mf if not os.path.isfile(filename): - print 'Phase %s not found' % filename + print 'Phase %s not found' % filename abort = True break - + mf = Multifile() mf.openRead(filename) - + if not vfs.mount(mf, '../resources', 0): print 'Unable to mount %s' % filename abort = True break - + # Packs pack = os.environ.get('TT_STRIDE_CONTENT_PACK') if pack and pack != 'default': @@ -63,14 +63,14 @@ if pack and pack != 'default': ext = os.path.splitext(name)[1] if ext not in ('.jpg', '.jpeg', '.ogg', '.rgb'): mf.removeSubfile(name) - + mf.flush() - + if not vfs.mount(mf, '../resources', 0): print 'Unable to mount %s' % filename abort = True break - + if not abort: # Run import toontown.toonbase.ClientStart diff --git a/build/make.py b/build/make.py index 92291b53..f233a375 100644 --- a/build/make.py +++ b/build/make.py @@ -11,75 +11,75 @@ parser.add_argument('--make-nri', '-n', action='store_true', help='Generate stride NRI.') args = parser.parse_args() -# BEGIN (STRIPPED AND MODIFIED) COPY FROM niraitools.py +# BEGIN (STRIPPED AND MODIFIED) COPY FROM niraitools.py class NiraiPackager: HEADER = 'NRI\n' - + def __init__(self, outfile): self.modules = {} self.outfile = outfile - + def __read_file(self, filename, mangler=None): with open(filename, 'rb') as f: data = f.read() - + base = filename.rsplit('.', 1)[0].replace('\\', '/').replace('/', '.') pkg = base.endswith('.__init__') moduleName = base.rsplit('.', 1)[0] if pkg else base - + name = moduleName if mangler is not None: name = mangler(name) - + if not name: return '', ('', 0) - + try: data = self.compile_module(name, data) - + except: print 'WARNING: Failed to compile', filename return '', ('', 0) - + size = len(data) * (-1 if pkg else 1) return name, (data, size) - + def compile_module(self, name, data): return marshal.dumps(compile(data, name, 'exec')) - + def add_module(self, moduleName, data, size=None, compile=False): if compile: data = self.compile_module(moduleName, data) - + if size is None: size = len(data) - + self.modules[moduleName] = (data, size) - + def add_file(self, filename, mangler=None): print 'Adding file', filename moduleName, (data, size) = self.__read_file(filename, mangler) if moduleName: moduleName = os.path.basename(filename).rsplit('.', 1)[0] self.add_module(moduleName, data, size) - + def add_directory(self, dir, mangler=None): print 'Adding directory', dir - + def _recurse_dir(dir): for f in os.listdir(dir): f = os.path.join(dir, f) - + if os.path.isdir(f): _recurse_dir(f) - + elif f.endswith('py'): moduleName, (data, size) = self.__read_file(f, mangler) if moduleName: self.add_module(moduleName, data, size) - + _recurse_dir(dir) - + def get_mangle_base(self, *path): return len(os.path.join(*path).rsplit('.', 1)[0].replace('\\', '/').replace('/', '.')) + 1 @@ -88,112 +88,112 @@ class NiraiPackager: f.write(self.HEADER) f.write(self.process_modules()) f.close() - + def generate_key(self, size=256): return os.urandom(size) - + def dump_key(self, key): for k in key: print ord(k), - + print - + def process_modules(self): # Pure virtual raise NotImplementedError('process_datagram') - + def get_file_contents(self, filename, keysize=0): with open(filename, 'rb') as f: data = f.read() - + if keysize: key = self.generate_key(keysize) rc4.rc4_setkey(key) data = key + rc4.rc4(data) - + return data -# END COPY FROM niraitools.py +# END COPY FROM niraitools.py class StridePackager(NiraiPackager): HEADER = 'STRIDETT' BASEDIR = '..' + os.sep - + def __init__(self, outfile): NiraiPackager.__init__(self, outfile) self.__manglebase = self.get_mangle_base(self.BASEDIR) - + def add_source_dir(self, dir): self.add_directory(self.BASEDIR + dir, mangler=self.__mangler) - + def add_data_file(self, file): mb = self.get_mangle_base('data/') self.add_file('data/%s.py' % file, mangler=lambda x: x[mb:]) - - def __mangler(self, name): + + def __mangler(self, name): if name.endswith('AI') or name.endswith('UD') or name in ('ToontownAIRepository', 'ToontownUberRepository', 'ToontownInternalRepository'): if not 'NonRepeatableRandomSource' in name: return '' return name[self.__manglebase:].strip('.') - + def generate_niraidata(self): print 'Generating niraidata' - + config = self.get_file_contents('../dependencies/config/release/en.prc') config += '\n\n' + self.get_file_contents('../dependencies/config/general.prc') key = self.generate_key(128) rc4.rc4_setkey(key) config = key + rc4.rc4(config) - + niraidata = 'CONFIG = %r' % config niraidata += '\nDC = %r' % self.get_file_contents('../dependencies/astron/dclass/stride.dc', 128) self.add_module('niraidata', niraidata, compile=True) - + def process_modules(self): with open('base.dg', 'rb') as f: basesize, = struct.unpack(' self.notAfter: self.notify.debug('Rejecting old token: %d, notAfter=%d' % (self.account.get('LAST_LOGIN_TS', 0), self.notAfter)) return self.__handleLookup({'success': False}) - + self.demand('SetAccount') def enterCreateAccount(self): @@ -1001,7 +1001,7 @@ class ClientServicesManagerUD(DistributedObjectGlobalUD): self.accountDB = RemoteAccountDB(self) else: self.notify.error('Invalid accountdb-type: ' + accountDBType) - + def killConnection(self, connId, reason): datagram = PyDatagram() datagram.addServerHeader( diff --git a/toontown/uberdog/ServiceStart.py b/toontown/uberdog/ServiceStart.py index 9498ecfb..4e935043 100755 --- a/toontown/uberdog/ServiceStart.py +++ b/toontown/uberdog/ServiceStart.py @@ -35,7 +35,7 @@ for prc in args.config: if os.path.isfile('dependencies/config/local.prc'): loadPrcFile('dependencies/config/local.prc') - + localconfig = '' if args.base_channel: localconfig += 'air-base-channel %s\n' % args.base_channel diff --git a/user/contentpacks/.gitignore b/user/contentpacks/.gitignore deleted file mode 100644 index 848e0447..00000000 --- a/user/contentpacks/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!sort.yaml \ No newline at end of file diff --git a/user/contentpacks/sort.yaml b/user/contentpacks/sort.yaml deleted file mode 100644 index e69de29b..00000000