mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-25 20:52:26 -06:00
Cleanup the repo a bit and remove unneeded files.
This commit is contained in:
parent
267310adc7
commit
188405a7db
13 changed files with 4 additions and 370 deletions
|
@ -1,11 +1,9 @@
|
||||||
Building
|
Building
|
||||||
========
|
========
|
||||||
These documents outline everything you need to know for building a Toontown Infinite client.
|
These documents outline everything you need to know for building a Toontown United client.
|
||||||
|
|
||||||
- - -
|
- - -
|
||||||
|
|
||||||
## Steps ##
|
## Steps ##
|
||||||
|
|
||||||
1. [Prepare for building](prepare-client.md)
|
TODO
|
||||||
2. [Build the frozen Python module](build-client.md)
|
|
||||||
3. [Encrypt the frozen Python module](encrypt-client.md)
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
Building the Client
|
|
||||||
===================
|
|
||||||
The first step in building a distributable Toontown Infinite client is building ```GameData.bin```. ```GameData.bin``` is an encrypted blob of frozen Python code. It contains all of the code necessary to run the game. There are three steps to building this file:
|
|
||||||
|
|
||||||
* [Prepare for building](prepare-client.md)
|
|
||||||
* **Build the frozen Python module**
|
|
||||||
* [Encrypt the frozen Python module](encrypt-client.md)
|
|
||||||
|
|
||||||
This document outlines how to accomplish the second task.
|
|
||||||
|
|
||||||
- - -
|
|
||||||
|
|
||||||
After preparing the client using the ```prepare_client.py``` utility, you're all set to build! Simply use the ```build_client.py``` utility through the _Visual Studio 2008 Command Prompt_. This will create a frozen Python module named ```GameData.pyd```.
|
|
||||||
|
|
||||||
## Usage ##
|
|
||||||
|
|
||||||
usage: build_client.py [-h] [--panda3d-dir PANDA3D_DIR]
|
|
||||||
[--build-dir BUILD_DIR] [--main-module MAIN_MODULE]
|
|
||||||
[modules [modules ...]]
|
|
||||||
|
|
||||||
positional arguments:
|
|
||||||
modules The Toontown Infinite modules to be included in the
|
|
||||||
build.
|
|
||||||
|
|
||||||
optional arguments:
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
--panda3d-dir PANDA3D_DIR
|
|
||||||
The path to the Panda3D build to use for this
|
|
||||||
distribution.
|
|
||||||
--build-dir BUILD_DIR
|
|
||||||
The directory of which the build was prepared.
|
|
||||||
--main-module MAIN_MODULE
|
|
||||||
The path to the instantiation module.
|
|
||||||
|
|
||||||
## Example ##
|
|
||||||
|
|
||||||
ppython -m build_client --panda3d-dir C:/Panda3D-1.9.0 --build-dir build
|
|
||||||
--main-module toontown.toonbase.ToontownStartDist
|
|
||||||
otp toontown
|
|
|
@ -1,28 +0,0 @@
|
||||||
Encrypting the Client
|
|
||||||
=====================
|
|
||||||
The first step in building a distributable Toontown Infinite client is building ```GameData.bin```. ```GameData.bin``` is an encrypted blob of frozen Python code. It contains all of the code necessary to run the game. There are three steps to building this file:
|
|
||||||
|
|
||||||
* [Prepare for building](prepare-client.md)
|
|
||||||
* [Build the frozen Python module](build-client.md)
|
|
||||||
* **Encrypt the frozen Python module**
|
|
||||||
|
|
||||||
This document outlines how to accomplish the third and final task.
|
|
||||||
|
|
||||||
- - -
|
|
||||||
|
|
||||||
By now, you should have a file named ```GameData.pyd``` in your build directory. The last step is to encrypt this file, and rename it to ```GameData.bin```! To do this, we use a utility called ```infinitecipher```. To get this utility, ask one of the lead developers.
|
|
||||||
|
|
||||||
## Usage ##
|
|
||||||
|
|
||||||
Usage: infinitecipher [-h] [-o OUTPUT] [INPUT]
|
|
||||||
|
|
||||||
Positional arguments:
|
|
||||||
INPUT The file that needs to be encrypted.
|
|
||||||
|
|
||||||
Optional arguments:
|
|
||||||
-h, --help Print this dialog and exit.
|
|
||||||
-o, --output The encrypted outputile.
|
|
||||||
|
|
||||||
## Example ##
|
|
||||||
|
|
||||||
infinitecipher -o GameData.bin GameData.pyd
|
|
|
@ -1,54 +0,0 @@
|
||||||
Client Build Preparation
|
|
||||||
========================
|
|
||||||
The first step in building a distributable Toontown Infinite client is building ```GameData.bin```. ```GameData.bin``` is an encrypted blob of frozen Python code. It contains all of the code necessary to run the game. There are three steps to building this file:
|
|
||||||
|
|
||||||
* **Prepare for building**
|
|
||||||
* [Build the frozen Python module](build-client.md)
|
|
||||||
* [Encrypt the frozen Python module](encrypt-client.md)
|
|
||||||
|
|
||||||
This document outlines how to accomplish the first task.
|
|
||||||
|
|
||||||
- - -
|
|
||||||
|
|
||||||
Preparing the client for building is quite simple when using the ```prepare_client.py``` utility. What it does is it creates a build directory with all of the necessary files for running a client. All server-specific files get removed. Next, it removes all ```__debug__``` blocks from the code, as they may pose a security risk, or be highly developer specific. After that, a file called ```game_data.py``` is generated. This file contains the PRC file data, (stripped) DC file, and time zone info. If a ```REVISION``` token was provided in the ```--server-ver``` option, it gets replaced in the PRC file data with the first 7 characters of the GitHub revision. Finally, if ```--build-mfs``` is provided, any phase files that were modified get compiled.
|
|
||||||
|
|
||||||
## Usage ##
|
|
||||||
|
|
||||||
usage: prepare_client.py [-h] [--distribution DISTRIBUTION]
|
|
||||||
[--build-dir BUILD_DIR] [--src-dir SRC_DIR]
|
|
||||||
[--server-ver SERVER_VER] [--build-mfs]
|
|
||||||
[--resources-dir RESOURCES_DIR] [--include INCLUDE]
|
|
||||||
[--exclude EXCLUDE]
|
|
||||||
[modules [modules ...]]
|
|
||||||
|
|
||||||
positional arguments:
|
|
||||||
modules The Toontown Infinite modules to be included in the
|
|
||||||
build.
|
|
||||||
|
|
||||||
optional arguments:
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
--distribution DISTRIBUTION
|
|
||||||
The distribution token.
|
|
||||||
--build-dir BUILD_DIR
|
|
||||||
The directory in which to store the build files.
|
|
||||||
--src-dir SRC_DIR The directory of the Toontown Infinite source code.
|
|
||||||
--server-ver SERVER_VER
|
|
||||||
The server version of this build. REVISION tokens will
|
|
||||||
be replaced with the current Git revision string.
|
|
||||||
--build-mfs When present, multifiles will be built.
|
|
||||||
--resources-dir RESOURCES_DIR
|
|
||||||
The directory of the Toontown Infinite resources.
|
|
||||||
--include INCLUDE, -i INCLUDE
|
|
||||||
Explicitly include this file in the build.
|
|
||||||
--exclude EXCLUDE, -x EXCLUDE
|
|
||||||
Explicitly exclude this file from the build.
|
|
||||||
|
|
||||||
## Example ##
|
|
||||||
|
|
||||||
ppython -m prepare_client --distribution devdist --build-dir build --src-dir ..
|
|
||||||
--server-ver infinite-REVISION --build-mfs
|
|
||||||
--resources-dir ../resources
|
|
||||||
--include NonRepeatableRandomSourceUD.py
|
|
||||||
--include NonRepeatableRandomSourceAI.py
|
|
||||||
--exclude ServiceStart.py
|
|
||||||
otp toontown
|
|
|
@ -1,6 +1,6 @@
|
||||||
Toontown Infinite Style Guidelines
|
Toontown United Style Guidelines
|
||||||
==================================
|
==================================
|
||||||
Code and documentation in the master and release branches of the Toontown Infinite repositories must conform to these guidelines. Any code submitted that is not properly formated will be rejected, as it is best to keep a readable, and consistent style for future contributors to read, and understand the code. Don't, however, blindly follow these guidelines into writing unreadable code. Sometimes it is best to use your own judgement.
|
Code and documentation in the master and release branches of the Toontown United repositories must conform to these guidelines. Any code submitted that is not properly formated will be rejected, as it is best to keep a readable, and consistent style for future contributors to read, and understand the code. Don't, however, blindly follow these guidelines into writing unreadable code. Sometimes it is best to use your own judgement.
|
||||||
|
|
||||||
- - -
|
- - -
|
||||||
|
|
||||||
|
|
19
findterm.py
19
findterm.py
|
@ -1,19 +0,0 @@
|
||||||
import glob
|
|
||||||
|
|
||||||
def processFile(f,t):
|
|
||||||
data = open(f,'rb').read()
|
|
||||||
lines = data.replace('\r\n','\n').split('\n')
|
|
||||||
lines_found = []
|
|
||||||
for i,x in enumerate(lines):
|
|
||||||
if t in x:
|
|
||||||
lines_found.append(i+1)
|
|
||||||
|
|
||||||
return lines_found
|
|
||||||
|
|
||||||
term = raw_input('>')
|
|
||||||
for x in glob.glob('toontown/*/*.py'):
|
|
||||||
r = processFile(x,term)
|
|
||||||
if r:
|
|
||||||
print x,r
|
|
||||||
|
|
||||||
raw_input('*****')
|
|
|
@ -1,19 +0,0 @@
|
||||||
import glob
|
|
||||||
|
|
||||||
def processFile(f,t):
|
|
||||||
data = open(f,'rb').read()
|
|
||||||
lines = data.replace('\r\n','\n').split('\n')
|
|
||||||
lines_found = []
|
|
||||||
for i,x in enumerate(lines):
|
|
||||||
if t in x:
|
|
||||||
lines_found.append(i+1)
|
|
||||||
|
|
||||||
return lines_found
|
|
||||||
|
|
||||||
term = raw_input('>')
|
|
||||||
for x in glob.glob('otp/*/*.py'):
|
|
||||||
r = processFile(x,term)
|
|
||||||
if r:
|
|
||||||
print x,r
|
|
||||||
|
|
||||||
raw_input('*****')
|
|
|
@ -1,34 +0,0 @@
|
||||||
#!/usr/bin/env python2
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('--build-dir', default='build',
|
|
||||||
help='The directory of which the build was prepared.')
|
|
||||||
parser.add_argument('--output', default='GameData.pyd',
|
|
||||||
help='The built file.')
|
|
||||||
parser.add_argument('--main-module', default='toontown.toonbase.ClientStartDist',
|
|
||||||
help='The module to load at the start of the game.')
|
|
||||||
parser.add_argument('modules', nargs='*', default=['otp', 'toontown'],
|
|
||||||
help='The Toontown United modules to be included in the build.')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
print 'Building the client...'
|
|
||||||
|
|
||||||
os.chdir(args.build_dir)
|
|
||||||
|
|
||||||
cmd = sys.executable + ' -m direct.showutil.pfreeze'
|
|
||||||
args.modules.extend(['direct', 'pandac'])
|
|
||||||
for module in args.modules:
|
|
||||||
cmd += ' -i %s.*.*' % module
|
|
||||||
cmd += ' -i encodings.*'
|
|
||||||
cmd += ' -i base64'
|
|
||||||
cmd += ' -i site'
|
|
||||||
cmd += ' -o ' + args.output
|
|
||||||
cmd += ' ' + args.main_module
|
|
||||||
os.system(cmd)
|
|
||||||
|
|
||||||
print 'Done building the client.'
|
|
|
@ -1,171 +0,0 @@
|
||||||
#!/usr/bin/env python2
|
|
||||||
import argparse
|
|
||||||
import hashlib
|
|
||||||
import os
|
|
||||||
from pandac.PandaModules import *
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('--distribution', default='en',
|
|
||||||
help='The distribution string.')
|
|
||||||
parser.add_argument('--build-dir', default='build',
|
|
||||||
help='The directory in which to store the build files.')
|
|
||||||
parser.add_argument('--src-dir', default='..',
|
|
||||||
help='The directory of the Toontown United source code.')
|
|
||||||
parser.add_argument('--server-ver', default='united-dev',
|
|
||||||
help='The server version of this build.')
|
|
||||||
parser.add_argument('--build-mfs', action='store_true',
|
|
||||||
help='When present, the resource multifiles will be built.')
|
|
||||||
parser.add_argument('--resources-dir', default='../resources',
|
|
||||||
help='The directory of the Toontown United resources.')
|
|
||||||
parser.add_argument('--config-dir', default='../config/release',
|
|
||||||
help='The directory of the Toontown United configuration files.')
|
|
||||||
parser.add_argument('--include', '-i', action='append',
|
|
||||||
help='Explicitly include this file in the build.')
|
|
||||||
parser.add_argument('--exclude', '-x', action='append',
|
|
||||||
help='Explicitly exclude this file from the build.')
|
|
||||||
parser.add_argument('--vfs', action='append',
|
|
||||||
help='Add this file to the virtual file system at runtime.')
|
|
||||||
parser.add_argument('modules', nargs='*', default=['otp', 'toontown'],
|
|
||||||
help='The Toontown United modules to be included in the build.')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
print 'Preparing the client...'
|
|
||||||
|
|
||||||
# Create a clean directory to store the build files in:
|
|
||||||
if os.path.exists(args.build_dir):
|
|
||||||
shutil.rmtree(args.build_dir)
|
|
||||||
os.mkdir(args.build_dir)
|
|
||||||
print 'Build directory = ' + args.build_dir
|
|
||||||
|
|
||||||
# Copy the provided Toontown United modules:
|
|
||||||
|
|
||||||
|
|
||||||
def minify(f):
|
|
||||||
"""
|
|
||||||
Returns the "minified" file data with removed __debug__ code blocks.
|
|
||||||
"""
|
|
||||||
|
|
||||||
data = ''
|
|
||||||
|
|
||||||
debugBlock = False # Marks when we're in a __debug__ code block.
|
|
||||||
elseBlock = False # Marks when we're in an else code block.
|
|
||||||
|
|
||||||
# The number of spaces in which the __debug__ condition is indented:
|
|
||||||
indentLevel = 0
|
|
||||||
|
|
||||||
for line in f:
|
|
||||||
thisIndentLevel = len(line) - len(line.lstrip())
|
|
||||||
if ('if __debug__:' not in line) and (not debugBlock):
|
|
||||||
data += line
|
|
||||||
continue
|
|
||||||
elif 'if __debug__:' in line:
|
|
||||||
debugBlock = True
|
|
||||||
indentLevel = thisIndentLevel
|
|
||||||
continue
|
|
||||||
if thisIndentLevel <= indentLevel:
|
|
||||||
if 'else' in line:
|
|
||||||
elseBlock = True
|
|
||||||
continue
|
|
||||||
if 'elif' in line:
|
|
||||||
line = line[:thisIndentLevel] + line[thisIndentLevel+2:]
|
|
||||||
data += line
|
|
||||||
debugBlock = False
|
|
||||||
elseBlock = False
|
|
||||||
indentLevel = 0
|
|
||||||
continue
|
|
||||||
if elseBlock:
|
|
||||||
data += line[4:]
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
for module in args.modules:
|
|
||||||
print 'Writing module...', module
|
|
||||||
for root, folders, files in os.walk(os.path.join(args.src_dir, module)):
|
|
||||||
outputDir = root.replace(args.src_dir, args.build_dir)
|
|
||||||
if not os.path.exists(outputDir):
|
|
||||||
os.mkdir(outputDir)
|
|
||||||
for filename in files:
|
|
||||||
if filename not in args.include:
|
|
||||||
if not filename.endswith('.py'):
|
|
||||||
continue
|
|
||||||
if filename.endswith('UD.py'):
|
|
||||||
continue
|
|
||||||
if filename.endswith('AI.py'):
|
|
||||||
continue
|
|
||||||
if filename in args.exclude:
|
|
||||||
continue
|
|
||||||
with open(os.path.join(root, filename), 'r') as f:
|
|
||||||
data = minify(f)
|
|
||||||
with open(os.path.join(outputDir, filename), 'w') as f:
|
|
||||||
f.write(data)
|
|
||||||
|
|
||||||
# Let's write game_data.py now. game_data.py is a compile-time generated
|
|
||||||
# collection of data that will be used by the game at runtime. It contains the
|
|
||||||
# PRC file data, and (stripped) DC file:
|
|
||||||
|
|
||||||
# First, we need to add the configuration pages:
|
|
||||||
configData = []
|
|
||||||
with open('../config/general.prc') as f:
|
|
||||||
configData.append(f.read())
|
|
||||||
|
|
||||||
configFileName = args.distribution + '.prc'
|
|
||||||
configFilePath = os.path.join(args.config_dir, configFileName)
|
|
||||||
print 'Using configuration file: ' + configFilePath
|
|
||||||
|
|
||||||
with open(configFilePath) as f:
|
|
||||||
data = f.readlines()
|
|
||||||
|
|
||||||
# Replace server-version definitions with the desired server version:
|
|
||||||
for i, line in enumerate(data):
|
|
||||||
if 'server-version' in line:
|
|
||||||
data[i] = 'server-version ' + args.server_ver
|
|
||||||
|
|
||||||
# Add our virtual file system data:
|
|
||||||
data.append('\n# Virtual file system...\nmodel-path /\n')
|
|
||||||
for filepath in args.vfs:
|
|
||||||
data.append('vfs-mount %s /\n' % filepath)
|
|
||||||
|
|
||||||
configData.append('\n'.join(data))
|
|
||||||
|
|
||||||
# Next, we need the DC file:
|
|
||||||
dcData = ''
|
|
||||||
filepath = os.path.join(args.src_dir, 'astron/dclass')
|
|
||||||
for filename in os.listdir(filepath):
|
|
||||||
if filename.endswith('.dc'):
|
|
||||||
fullpath = str(Filename.fromOsSpecific(os.path.join(filepath, filename)))
|
|
||||||
print 'Reading %s...' % fullpath
|
|
||||||
with open(fullpath, 'r') as f:
|
|
||||||
data = f.read()
|
|
||||||
for line in data.split('\n'):
|
|
||||||
if 'import' in line:
|
|
||||||
data = data.replace(line + '\n', '')
|
|
||||||
dcData += data
|
|
||||||
|
|
||||||
# Finally, write our data to game_data.py:
|
|
||||||
print 'Writing game_data.py...'
|
|
||||||
gameData = 'CONFIG = %r\nDC = %r\n'
|
|
||||||
with open(os.path.join(args.build_dir, 'game_data.py'), 'wb') as f:
|
|
||||||
f.write(gameData % (configData, dcData.strip()))
|
|
||||||
|
|
||||||
# We have all of the code gathered together. Let's create the multifiles now:
|
|
||||||
if args.build_mfs:
|
|
||||||
print 'Building multifiles...'
|
|
||||||
dest = os.path.join(args.build_dir, 'resources')
|
|
||||||
if not os.path.exists(dest):
|
|
||||||
os.mkdir(dest)
|
|
||||||
dest = os.path.realpath(dest)
|
|
||||||
os.chdir(args.resources_dir)
|
|
||||||
for phase in os.listdir('.'):
|
|
||||||
if not phase.startswith('phase_'):
|
|
||||||
continue
|
|
||||||
if not os.path.isdir(phase):
|
|
||||||
continue
|
|
||||||
filename = phase + '.mf'
|
|
||||||
print 'Writing...', filename
|
|
||||||
filepath = os.path.join(dest, filename)
|
|
||||||
os.system('multify -c -f "%s" "%s"' % (filepath, phase))
|
|
||||||
|
|
||||||
print 'Done preparing the client.'
|
|
Loading…
Reference in a new issue