comparison 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
comparison
equal deleted inserted replaced
132:fba45c37ec99 133:2cad2e84a49e
2 2
3 from pytouhou.formats.pbg3 import PBG3 3 from pytouhou.formats.pbg3 import PBG3
4 from pytouhou.formats.std import Stage 4 from pytouhou.formats.std import Stage
5 from pytouhou.formats.ecl import ECL 5 from pytouhou.formats.ecl import ECL
6 from pytouhou.formats.anm0 import Animations 6 from pytouhou.formats.anm0 import Animations
7 from pytouhou.formats.msg import MSG
7 8
8 9
9 from pytouhou.resource.anmwrapper import AnmWrapper 10 from pytouhou.resource.anmwrapper import AnmWrapper
10 11
11 12
40 def __init__(self): 41 def __init__(self):
41 self.known_files = {} 42 self.known_files = {}
42 self.instanced_ecls = {} 43 self.instanced_ecls = {}
43 self.instanced_anms = {} 44 self.instanced_anms = {}
44 self.instanced_stages = {} 45 self.instanced_stages = {}
46 self.instanced_msgs = {}
45 47
46 48
47 def scan_archives(self, paths): 49 def scan_archives(self, paths):
48 for path in paths: 50 for path in paths:
49 archive_description = ArchiveDescription.get_from_path(path) 51 archive_description = ArchiveDescription.get_from_path(path)
82 file = self.get_file(name) 84 file = self.get_file(name)
83 self.instanced_ecls[name] = ECL.read(file) #TODO: modular 85 self.instanced_ecls[name] = ECL.read(file) #TODO: modular
84 return self.instanced_ecls[name] 86 return self.instanced_ecls[name]
85 87
86 88
89 def get_msg(self, name):
90 if name not in self.instanced_msgs:
91 file = self.get_file(name)
92 self.instanced_msgs[name] = MSG.read(file) #TODO: modular
93 return self.instanced_msgs[name]
94
95
87 def get_anm_wrapper(self, names): 96 def get_anm_wrapper(self, names):
88 return AnmWrapper(self.get_anm(name) for name in names) 97 return AnmWrapper(self.get_anm(name) for name in names)
89 98
90 99
91 def get_anm_wrapper2(self, names): 100 def get_anm_wrapper2(self, names):