def unpack_all(root): for f in util.iter_path(root): if not (f.endswith(".dat") or f.endswith(".dtt")): continue print "handling %s" % f fp = open(f, "rb") data = fp.read() fp.close() base, ext = os.path.splitext(f) unpack(data, out_dir=base + ext.replace(".", "_") + "_unpacked")
def collect_version(path): version_dict = {} for version in (0x20160116, 0x20151123, 0x20151001, 0x10000): version_dict[version] = [] for fpath in util.iter_path(path): if fpath.endswith(".wmb"): print "processing:", fpath fp = open(fpath, "rb") wmb = util.get_getter(fp, "<") version_dict[wmb.get("I", offset=0x4)].append(os.path.split(fpath)[1]) fp.close() return version_dict
def test_common(): import gen_all import parse for wmb_path in iter_path(wmb_files): print "parsing %s" % wmb_path f = open(wmb_path, "rb") try: parse.parse(f, dump_obj) except Exception: beep_error() import g_wmb_parser_xb g_wmb_parser_xb.print_value_statistic() # test me if the work is finished beep_finish()
import os import sys import splitdds import wta_parser import util if __name__ == "__main__": in_root_dir = sys.argv[1] out_dir = sys.argv[2] for path in util.iter_path(sys.argv[1]): if path.endswith(".wta"): print "processing %s" % os.path.basename(path) print path wtp_path = path.replace("_dat_unpacked", "_dtt_unpacked").replace(".wta", ".wtp") fp = open(path, "rb") wta_reader = util.get_getter(fp, "<") wta = wta_parser.parse(wta_reader) fp.close() try: splitdds.split(wtp_path, wta.texture_hashes, out_dir) except IOError: print >> sys.stderr, "IOError on %s" % wtp_path
def test_rand(root): fpath = random.choice(list(util.iter_path(root))) do_test(fpath)
def test(path): for fpath in util.iter_path(path): if fpath.endswith(".wmb"): do_test(fpath)
def test(path): for fpath in util.iter_path(path): if fpath.endswith(".bxm"): print "processing:", fpath convert(fpath)
def test(path): for fpath in util.iter_path(path): if fpath.endswith(".wtp"): print "processing:", fpath split(fpath)