示例#1
0
    def load_map(self, map_path, **kwargs):
        HaloMap.load_map(self, map_path, **kwargs)
        self.tag_index = h3_to_h1_tag_index(self.map_header, self.tag_index)
        self.basic_deprotection()

        tag_index_array = self.tag_index.tag_index
        self.tag_index_manager = TagIndexManager(tag_index_array)
        self.string_id_manager = StringIdManager(
            self.map_header.strings.string_id_table,
            self.string_id_set_offsets,
        )
        for sect in self.map_header.sections:
            self.map_pointer_converter.add_page_info(sect.virtual_address,
                                                     sect.file_offset,
                                                     sect.size)

        for part in self.map_header.partitions:
            self.map_pointer_converter.add_page_info(part.load_address,
                                                     part.file_offset,
                                                     part.size)

        self.load_root_tags()

        play_meta = self.root_tags.get("cache_file_resource_layout_table")
        if play_meta:
            self.shared_map_names = list(
                b.map_path.lower().replace('\\', '/').split("/")[-1].split(
                    ".")[0]
                for b in play_meta.external_cache_references.STEPTREE)

        self.rawdata_manager = RawdataManager(self)

        map_type = self.map_header.map_type.data
        if map_type >= 2 and map_type < 5:
            self.is_resource = True
            ext_cache_name = HALO3_SHARED_MAP_TYPES[map_type - 2]

            for map_name, halo_map in self.maps.items():
                # update each map's rawdata_manager so each one
                # knows what name the shared caches are named.
                halo_map.rawdata_manager.add_shared_map_name(
                    ext_cache_name, self.map_header.map_name)

        self.clear_map_cache()
示例#2
0
    def load_map(self, map_path, **kwargs):
        HaloMap.load_map(self, map_path, **kwargs)
        tag_index = self.tag_index
        if self.engine == "halo2alpha":
            self.tag_index = h2_alpha_to_h1_tag_index(self.map_header,
                                                      tag_index)
        else:
            self.tag_index = h2_to_h1_tag_index(self.map_header, tag_index)

        # add the tag data section
        self.map_pointer_converter.add_page_info(
            self.index_magic, self.map_header.tag_index_header_offset,
            self.map_header.tag_index_data_size +
            self.map_header.tag_data_size)

        self.string_id_manager = StringIdManager(
            self.map_header.strings.string_id_table,
            (),
        )
        self.tag_index_manager = TagIndexManager(self.tag_index.tag_index)
        map_type = self.map_header.map_type.data - 1
        if map_type > 0 and map_type < 4:
            self.is_resource = True
            self.maps[HALO2_MAP_TYPES[map_type]] = self

        # get the sound_cache_file_gestalt meta
        try:
            if self.engine == "halo2vista":
                ugh__id = None
                for b in self.tag_index.tag_index:
                    if int_to_fourcc(b.class_1.data) == "ugh!":
                        ugh__id = b.id & 0xFFff
                        break

                self.ugh__meta = self.get_meta(ugh__id)
                if self.ugh__meta is None:
                    print("Could not read sound_cache_file_gestalt tag")
        except Exception:
            print(format_exc())
            print("Could not read sound_cache_file_gestalt tag")

        self.clear_map_cache()