From a31c46f29a4a229a8f689427ae08c17e65370597 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sat, 22 Aug 2015 08:50:02 -0400 Subject: [PATCH] Fix content pack support. --- build/data/NiraiStart.py | 14 +++++++++++--- toontown/toonbase/ToontownStart.py | 17 +++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/build/data/NiraiStart.py b/build/data/NiraiStart.py index 52372c5f..f2311e39 100644 --- a/build/data/NiraiStart.py +++ b/build/data/NiraiStart.py @@ -1,5 +1,5 @@ from panda3d.core import * -import __builtin__, os, sys +import __builtin__, os, sys, glob import aes import niraidata @@ -30,11 +30,19 @@ del dc del iv 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 # TO DO: Sign and verify the phases to prevent edition abort = False - # Packs pack = os.environ.get('TT_STRIDE_CONTENT_PACK') if pack and pack != 'default': @@ -50,7 +58,7 @@ if pack and pack != 'default': mf.flush() - if not vfs.mount(mf, '../resources', 0): + if not vfs.mount(mf, '/', 0): print 'Unable to mount %s' % filename abort = True break diff --git a/toontown/toonbase/ToontownStart.py b/toontown/toonbase/ToontownStart.py index 7662412a..c4a9249e 100644 --- a/toontown/toonbase/ToontownStart.py +++ b/toontown/toonbase/ToontownStart.py @@ -69,14 +69,15 @@ from direct.directnotify.DirectNotifyGlobal import directNotify notify = directNotify.newCategory('ToontownStart') notify.setInfo(True) -# 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) +if __debug__: + # 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) from otp.settings.Settings import Settings from otp.otpbase import OTPGlobals