diff pytouhou/resource/loader.py @ 325:cddfd3cb4797

Add music support for >PCB.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 21 Jun 2012 15:01:01 +0200
parents 61adb5453e46
children 65453340ae95
line wrap: on
line diff
--- a/pytouhou/resource/loader.py
+++ b/pytouhou/resource/loader.py
@@ -25,6 +25,7 @@ from pytouhou.formats.msg import MSG
 from pytouhou.formats.sht import SHT
 from pytouhou.formats.exe import SHT as EoSDSHT, InvalidExeException
 from pytouhou.formats.music import Track
+from pytouhou.formats.fmt import FMT
 
 
 from pytouhou.resource.anmwrapper import AnmWrapper
@@ -108,6 +109,7 @@ class Loader(object):
         self.instanced_msgs = {}
         self.instanced_shts = {}
         self.instanced_tracks = {}
+        self.instanced_fmts = {}
 
 
     def scan_archives(self, paths_lists):
@@ -194,6 +196,13 @@ class Loader(object):
         return self.instanced_tracks[name]
 
 
+    def get_fmt(self, name):
+        if name not in self.instanced_fmts:
+            file = self.get_file(name)
+            self.instanced_fmts[name] = FMT.read(file) #TODO: modular
+        return self.instanced_fmts[name]
+
+
     def get_anm_wrapper(self, names, offsets=None):
         """Create an AnmWrapper for ANM files “names”.