Exemplo n.º 1
0
        //function display the tag structure
        private void getTagStructureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (map_loaded)
            {
                if (treeView1.SelectedNode != null)
                {
                    string type = DATA_READ.ReadTAG_TYPE(Int32.Parse(treeView1.SelectedNode.Name), map_stream);

                    plugins_field temp = DATA_READ.Get_Tag_stucture_from_plugin(type);
                    if (temp != null)
                    {
                        TreeNode tn = temp.Get_field_structure();

                        tn.Text = type;

                        treeView1.Nodes.Clear();
                        treeView1.Nodes.Add(tn);
                    }
                    else
                    {
                        MessageBox.Show("The plugin of type " + type + " doesn't exist", "ERROR");
                    }

                    map_loaded = false;
                }
                else
                {
                    MessageBox.Show("Select a TAG", "Hint");
                }
            }
            else
            {
                MessageBox.Show("Select a map First", "Hint");
            }
        }
Exemplo n.º 2
0
        Dictionary <int, extended_meta> list_extended; //<mem_off,extended_meta obj>,a dictionary containing the extended meta by their memory address to prevent redundancy.

        /// <summary>
        /// use to read meta data from a map file
        /// </summary>
        /// <param name="datum_index">the datum index of the tag</param>
        /// <param name="sr">the path of the tag.eg: characters/elite/elite_mp</param>
        /// <param name="sr">the stream object</param>
        public meta(int datum_index, string path, StreamReader sr)
        {
            //initialise some stuff
            this.datum_index = datum_index;
            this.path        = path;
            map_stream       = sr;

            //some meta reading prologue
            int table_off    = DATA_READ.ReadINT_LE(0x10, map_stream);
            int table_size   = DATA_READ.ReadINT_LE(0x14, map_stream);
            int table_start  = table_off + 0xC * DATA_READ.ReadINT_LE(table_off + 4, map_stream) + 0x20;
            int scnr_off     = table_off + table_size;
            int scnr_memaddr = DATA_READ.ReadINT_LE(table_start + 0x8, map_stream);//scnr tag index is 0x0(mostly)

            //steps concerned with the specified meta
            type    = DATA_READ.ReadTAG_TYPE(table_start + (0xFFFF & datum_index) * 0x10, map_stream);
            mem_off = DATA_READ.ReadINT_LE(table_start + ((0xFFFF & datum_index) * 0x10) + 0x8, map_stream);

            size = DATA_READ.ReadINT_LE(table_start + ((0xFFFF & datum_index) * 0x10) + 0xC, map_stream);

            //read the meta from the map
            data = new byte[size];

            if (!DATA_READ.Check_shared(sr))
            {
                //normal map
                map_stream.BaseStream.Position = scnr_off + (mem_off - scnr_memaddr);
            }
            else
            {
                //shared map
                map_stream.BaseStream.Position = scnr_off + (mem_off - 0x3c000);
                //0x3c000 is a hardcoded value in blam engine
            }

            map_stream.BaseStream.Read(data, 0, size);

            //read and store the plugin structure
            plugin = DATA_READ.Get_Tag_stucture_from_plugin(type);

            //lets initialise some lists and dictionaries
            ref_data      = new List <int>();
            ref_tags      = new List <int>();
            ref_reflexive = new List <int>();
            ref_stringID  = new List <int>();
            ref_extended  = new Dictionary <int, int>();
            list_extended = new Dictionary <int, extended_meta>();
            ref_WCtags    = new List <int>();


            //now lets search for all kinds of stuff
            List_deps(0x0, plugin);
        }
Exemplo n.º 3
0
        /// <summary>
        /// used to read meta data from a meta file along with ability to modify mem_off
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="type"></param>
        /// <param name="size"></param>
        /// <param name="path"></param>
        /// <param name="mem_off"></param>
        public meta(byte[] meta, string type, int size, string path, int mem_off)
        {
            data         = meta;
            this.type    = type;
            this.size    = size;
            this.path    = path;
            this.mem_off = mem_off;//this is for awkward cases when i rebase the meta to some other shit

            //lets initialise some lists and dictionaries
            ref_data      = new List <int>();
            ref_tags      = new List <int>();
            ref_reflexive = new List <int>();
            ref_stringID  = new List <int>();
            ref_WCtags    = new List <int>();
            //while extracting the meta ,i fix all the extended meta stuff so we dont need it now

            plugin = DATA_READ.Get_Tag_stucture_from_plugin(type);

            List_deps(0x0, plugin);
        }
Exemplo n.º 4
0
        /// <summary>
        /// used to read meta data from a meta file
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="type"></param>
        /// <param name="size"></param>
        /// <param name="path"></param>
        public meta(byte[] meta, string type, int size, string path)
        {
            data         = meta;
            this.type    = type;
            this.size    = size;
            this.path    = path;
            this.mem_off = 0x0;//i usually rebase meta to 0x0 when extracting

            //lets initialise some lists and dictionaries
            ref_data      = new List <int>();
            ref_tags      = new List <int>();
            ref_reflexive = new List <int>();
            ref_stringID  = new List <int>();
            ref_WCtags    = new List <int>();
            //while extracting the meta ,i fix all the extended meta stuff so we dont need it now

            //plugin
            plugin = DATA_READ.Get_Tag_stucture_from_plugin(type);

            List_deps(0x0, plugin);
        }