Fix content pack support.

This commit is contained in:
Loudrob 2015-08-22 08:50:02 -04:00
parent fef0e0678e
commit a31c46f29a
2 changed files with 20 additions and 11 deletions

View file

@ -1,5 +1,5 @@
from panda3d.core import * from panda3d.core import *
import __builtin__, os, sys import __builtin__, os, sys, glob
import aes import aes
import niraidata import niraidata
@ -30,11 +30,19 @@ del dc
del iv del iv
del key del key
# The VirtualFileSystem, which has already initialized, doesn't see the mount
# directives in the config(s) yet. We have to force it to load those manually:
#from panda3d.core import VirtualFileSystem, ConfigVariableList, Filename
vfs = VirtualFileSystem.getGlobalPtr()
mounts = ConfigVariableList('vfs-mount')
for mount in mounts:
mountfile, mountpoint = (mount.split(' ', 2) + [None, None, None])[:2]
vfs.mount(Filename(mountfile), Filename(mountpoint), 0)
# Resources # Resources
# TO DO: Sign and verify the phases to prevent edition # TO DO: Sign and verify the phases to prevent edition
abort = False abort = False
# Packs # Packs
pack = os.environ.get('TT_STRIDE_CONTENT_PACK') pack = os.environ.get('TT_STRIDE_CONTENT_PACK')
if pack and pack != 'default': if pack and pack != 'default':
@ -50,7 +58,7 @@ if pack and pack != 'default':
mf.flush() mf.flush()
if not vfs.mount(mf, '../resources', 0): if not vfs.mount(mf, '/', 0):
print 'Unable to mount %s' % filename print 'Unable to mount %s' % filename
abort = True abort = True
break break

View file

@ -69,14 +69,15 @@ from direct.directnotify.DirectNotifyGlobal import directNotify
notify = directNotify.newCategory('ToontownStart') notify = directNotify.newCategory('ToontownStart')
notify.setInfo(True) notify.setInfo(True)
# The VirtualFileSystem, which has already initialized, doesn't see the mount if __debug__:
# directives in the config(s) yet. We have to force it to load those manually: # The VirtualFileSystem, which has already initialized, doesn't see the mount
from panda3d.core import VirtualFileSystem, ConfigVariableList, Filename # directives in the config(s) yet. We have to force it to load those manually:
vfs = VirtualFileSystem.getGlobalPtr() from panda3d.core import VirtualFileSystem, ConfigVariableList, Filename
mounts = ConfigVariableList('vfs-mount') vfs = VirtualFileSystem.getGlobalPtr()
for mount in mounts: mounts = ConfigVariableList('vfs-mount')
mountfile, mountpoint = (mount.split(' ', 2) + [None, None, None])[:2] for mount in mounts:
vfs.mount(Filename(mountfile), Filename(mountpoint), 0) mountfile, mountpoint = (mount.split(' ', 2) + [None, None, None])[:2]
vfs.mount(Filename(mountfile), Filename(mountpoint), 0)
from otp.settings.Settings import Settings from otp.settings.Settings import Settings
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals