/// <summary> /// Generates a list of StringIndexes contained in the map /// </summary> /// <returns>List of StringID_info</returns> List <StringID_info> Get_SID_list(string map_loc) { List <StringID_info> ret = new List <StringID_info>(); StreamReader map_stream = new StreamReader(map_loc); int string_table_count = DATA_READ.ReadINT_LE(0x170, map_stream); int string_index_table_offset = DATA_READ.ReadINT_LE(0x178, map_stream); int string_table_offset = DATA_READ.ReadINT_LE(0x17C, map_stream); for (int index = 0; index < string_table_count; index++) { int table_off = DATA_READ.ReadINT_LE(string_index_table_offset + index * 0x4, map_stream) & 0xFFFF; string STRING = DATA_READ.ReadSTRING(string_table_offset + table_off, map_stream); if (STRING.Length > 0) { int SID = DATA_READ.Generate_SID(index, 0x0, STRING);//set is 0x0 cuz i couldnt figure out any other value StringID_info SIDI = new StringID_info(); SIDI.string_index_table_index = string_index_table_offset + index * 0x4; SIDI.string_table_offset = table_off; SIDI.StringID = SID; SIDI.STRING = STRING; ret.Add(SIDI); } } map_stream.Close(); return(ret); }
/// <summary> /// Initialises tree view upon opening a map file /// </summary> void initialize_treeview() { treeView1.Nodes.Clear(); int tag_count = 0; int path_start = 0; for (int i = 0; ; i++) { int tag_table_REF = table_start + 0x10 * i; if (tag_table_REF > table_size + table_start) { break; } string type = DATA_READ.ReadTAG_TYPE(tag_table_REF, map_stream); int datum_index = DATA_READ.ReadINT_LE(tag_table_REF + 4, map_stream); string path = DATA_READ.ReadSTRING(file_table_offset + path_start, map_stream); if (datum_index != -1) { //lets check the mem addrs validity before adding it to the list int mem_addr = DATA_READ.ReadINT_LE(tag_table_REF + (datum_index & 0xffff) * 0x10 + 8, map_stream); if (mem_addr != 0x0) { AllTagList.Add(datum_index, path);//Adding only Map Specific tags with Internal Reference only to list } if (treeView1.Nodes.IndexOfKey(type) == -1) { treeView1.Nodes.Add(type, "- " + type); } int index = treeView1.Nodes.IndexOfKey(type); //HEX Values contains ABCDEF treeView1.Nodes[index].Nodes.Add(tag_table_REF.ToString(), "- " + path); //add this stuff to the SID list SID_list.Add(datum_index, path); //ugh! is basically the last tag if (type.CompareTo("ugh!") == 0) { break; } path_start += path.Length + 1; } tag_count = i; } treeView1.Sort(); textBox2.Text = tag_count.ToString() + " Total Tags"; }
/// <summary> /// Gets the list of tags contained in the map /// </summary> /// <param name="map_loc"></param> /// <returns></returns> List <tag_info> Get_Tag_list(string map_loc) { List <tag_info> ret = new List <tag_info>(); StreamReader map_stream = new StreamReader(map_loc); int table_off = DATA_READ.ReadINT_LE(0x10, map_stream); int table_size = DATA_READ.ReadINT_LE(0x14, map_stream); int file_table_offset = DATA_READ.ReadINT_LE(0x2D0, map_stream); int table_start = table_off + 0xC * DATA_READ.ReadINT_LE(table_off + 4, map_stream) + 0x20; int path_start = 0; for (int i = 0; ; i++) { int tag_table_REF = table_start + 0x10 * i; if (tag_table_REF > table_size + table_start) { break; } string type = DATA_READ.ReadTAG_TYPE(tag_table_REF, map_stream); int datum_index = DATA_READ.ReadINT_LE(tag_table_REF + 4, map_stream); string path = DATA_READ.ReadSTRING(file_table_offset + path_start, map_stream); if (datum_index != -1) { tag_info temp = new tag_info(); temp.datum_index = datum_index; temp.type = type; temp.file_loc = path; ret.Add(temp); //ugh! is basically the last tag if (type.CompareTo("ugh!") == 0) { break; } path_start += path.Length + 1; } } map_stream.Close(); return(ret); }
/// <summary> /// Initialises tree view upon opening a map file /// </summary> void initialize_treeview() { treeView1.Nodes.Clear(); int path_start = 0; for (int i = 0; ; i++) { int tag_table_REF = table_start + 0x10 * i; if (tag_table_REF > table_size + table_start) { break; } string type = DATA_READ.ReadTAG_TYPE(tag_table_REF, map_stream); int datum_index = DATA_READ.ReadINT_LE(tag_table_REF + 4, map_stream); string path = DATA_READ.ReadSTRING(file_table_offset + path_start, map_stream); if (datum_index != -1) { //lets check the mem addrs validity before adding it to the list int mem_addr = DATA_READ.ReadINT_LE(tag_table_REF + (datum_index & 0xffff) * 0x10 + 8, map_stream); if (mem_addr != 0x0) { datum_list.Add(datum_index);//lets add this to the list } if (treeView1.Nodes.IndexOfKey(type) == -1) { treeView1.Nodes.Add(type, type); } int index = treeView1.Nodes.IndexOfKey(type); //HEX Values contains ABCDEF treeView1.Nodes[index].Nodes.Add(tag_table_REF.ToString(), path); //add this stuff to the SID list SID_list.Add(datum_index, path); //ugh! is basically the last tag if (type.CompareTo("ugh!") == 0) { break; } path_start += path.Length + 1; } } }