TRS: Difference between revisions

From wowdev
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
This file is used by World of Warcraft in order to convert texture filename hashcodes into the string that is calling the said texture. There is only one .trs file. it is found in "textures\Minimap\md5translate.trs". This file is used to convert the minimap texture files into the hashcode filenames (and vice-versa if needed).
To avoid having duplicates of all-water minimaps and thus wasting space, minimap textures have been stored using an md5 hash of their content as filename. To map from map tile to minimap file, <tt>textures/minimap/md5translate.trs</tt> exists. The file contains blocks of tile → filename mappings per map in text form.


==Structure==
block_header := "dir: " map_basename "\n"
 
  block_entry := map_basename "\map" x "_" y ".blp\t" actual_filename "\n"
dir: directory1
block := block_header block_entry+
hash1.blp      directory1\clearfilename1.blp
  file := block+
hash2.blp      directory1\clearfilename3.blp
hash3.blp      directory1\clearfilename2.blp
  hash4.blp      directory1\clearfilename4.blp
dir: directory2
hash5.blp      directory2\clearfilename1.blp
 
==Simple Translator (Java)==
 
A simple translator, I wrote. --[[User:Schlumpf|Schlumpf]] 14:10, 3 August 2007 (CEST)
 
import java.io.*;
public class trnslate
{
  public static String filename = "_bmd5translate.trs";  // .trs-file
  public static boolean back = true;                      // md5 -> clear (false) | clear -> md5 (true)
 
  public static void main(String[] args)  throws IOException
  {
  String dir  = "";
  String test[] = new String[5];
  File file1 = new File(" ");
  File file2 = new File(" ");
  boolean success = true;
  int counter = 0;
  int length = 1;
  File infile = new File(filename);
  FileReader instream = new FileReader(infile);
  BufferedReader in = new BufferedReader(instream);
 
  while ((in.readLine()) != null)
    length++;
 
  instream = new FileReader(infile);
  in = new BufferedReader(instream);
 
  String zeile[][] = new String[length][10];
  String filename[]  = new String[length];
 
  while ((filename[counter] = in.readLine()) != null)
  {
    if (filename[counter] != null)
    {
    test=filename[counter].split("dir: ");
    if(!(test[0].equals("")))
    {
      zeile[counter] = filename[counter].split("\t");
     
      file1 = new File(zeile[counter][1]);
      file2 = new File(zeile[counter][0]);
      if(back == true)
      {
      file2 = new File(zeile[counter][1]);
      file1 = new File(zeile[counter][0]);
      }
     
      success = file1.renameTo(file2);
    }
    else
    {
      File temp = new File(test[1]);
      success = temp.mkdirs();
    }
    }
    counter++;
  }
  }
}


* <code>map_basename</code> as found in [[DB/Map|MapRec]]
* <code>x</code> and <code>y</code> as in ADT tile coordinates. Note that x is '''not''' zero-padded but y is zero-padded to two digits. (<code>"map_%d_%02d.blp"</code>)
* <code>actual_filename</code> is given relative to <code>textures/minimap/</code>
* note: an earlier version of this page has <code>block_entry := actual_filename "\t" map_basename "\map" x "_" y ".blp\n"</code>


[[Category:Format]]
[[Category:Format]]

Latest revision as of 12:33, 6 July 2016

To avoid having duplicates of all-water minimaps and thus wasting space, minimap textures have been stored using an md5 hash of their content as filename. To map from map tile to minimap file, textures/minimap/md5translate.trs exists. The file contains blocks of tile → filename mappings per map in text form.

block_header := "dir: " map_basename "\n"
block_entry := map_basename "\map" x "_" y ".blp\t" actual_filename "\n"
block := block_header block_entry+
file := block+
  • map_basename as found in MapRec
  • x and y as in ADT tile coordinates. Note that x is not zero-padded but y is zero-padded to two digits. ("map_%d_%02d.blp")
  • actual_filename is given relative to textures/minimap/
  • note: an earlier version of this page has block_entry := actual_filename "\t" map_basename "\map" x "_" y ".blp\n"