diff pytouhou/resource/loader.py @ 133:2cad2e84a49e

Add reading support for the MSG format.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 11 Sep 2011 07:34:34 -0700
parents ac2e5e1c2c3c
children 0595315d3880
line wrap: on
line diff
--- a/pytouhou/resource/loader.py
+++ b/pytouhou/resource/loader.py
@@ -4,6 +4,7 @@ from pytouhou.formats.pbg3 import PBG3
 from pytouhou.formats.std import Stage
 from pytouhou.formats.ecl import ECL
 from pytouhou.formats.anm0 import Animations
+from pytouhou.formats.msg import MSG
 
 
 from pytouhou.resource.anmwrapper import AnmWrapper
@@ -42,6 +43,7 @@ class Loader(object):
         self.instanced_ecls = {}
         self.instanced_anms = {}
         self.instanced_stages = {}
+        self.instanced_msgs = {}
 
 
     def scan_archives(self, paths):
@@ -84,6 +86,13 @@ class Loader(object):
         return self.instanced_ecls[name]
 
 
+    def get_msg(self, name):
+        if name not in self.instanced_msgs:
+            file = self.get_file(name)
+            self.instanced_msgs[name] = MSG.read(file) #TODO: modular
+        return self.instanced_msgs[name]
+
+
     def get_anm_wrapper(self, names):
         return AnmWrapper(self.get_anm(name) for name in names)