Ejemplo n.º 1
0
 public void UndoAnalysis(int newGameVersion)
 {
     wasAnalysed = false;
     Files.Clear();
     OriginalFiles.Clear();
     ExpIDs.Clear();
     OriginalExpIDs.Clear();
     found          = false;
     ExpectedFormat = "";
     ExpectedMips   = 0;
     AutofixSuccess = true;
     FileDuplicates.Clear();
     TreeDuplicates.Clear();
     TexName     = null;
     GameVersion = newGameVersion;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates current texture object from tree.
        /// </summary>
        /// <param name="treeInd">Index of texture in tree.</param>
        /// <param name="treetex">Tree texture object to get info from.</param>
        public void UpdateTex(int treeInd, TreeTexInfo treetex)
        {
            found   = true;
            TreeInd = treeInd;
            TexName = treetex.TexName;

            // KFreon: Reorder files so DLC isn't first

            /*List<string> files = new List<string>(treetex.Files);
             * List<int> ids = new List<int>(treetex.ExpIDs);
             *
             * int count = files.Count;
             * int index = -1;
             *
             * if (files[0].Contains("DLC"))
             *  for (int i = 0; i < count; i++)
             *      if (!files[i].Contains("DLC"))
             *      {
             *          index = i;
             *          break;
             *      }
             *
             * if (index != -1)
             * {
             *  string thing = files[index];
             *  files.RemoveAt(index);
             *  files.Insert(0, thing);
             *
             *  int thing2 = ids[index];
             *  ids.RemoveAt(index);
             *  ids.Insert(0, thing2);
             * }
             *
             * Files.AddRange(files);
             * ExpIDs.AddRange(ids);*/
            Files.AddRange(treetex.Files);
            ExpIDs.AddRange(treetex.ExpIDs);



            List <PCCExpID> things = new List <PCCExpID>();

            for (int i = 0; i < Files.Count; i++)
            {
                things.Add(new PCCExpID(Files[i], ExpIDs[i]));
            }


            // KFreon: Reorder ME1 files
            if (GameVersion == 1)
            {
                things = things.OrderByDescending(t => t.file.Length).ToList();

                Files.Clear();
                ExpIDs.Clear();

                foreach (var item in things)
                {
                    Files.Add(item.file);
                    ExpIDs.Add(item.expid);
                }
            }

            //ExpIDs.AddRange(treetex.ExpIDs);

            OriginalFiles  = new List <string>(Files);
            OriginalExpIDs = new List <int>(ExpIDs);

            ExpectedMips   = treetex.NumMips;
            ExpectedFormat = treetex.Format.Replace("PF_", "");
            if (ExpectedFormat.ToUpperInvariant().Contains("NORMALMAP"))
            {
                ExpectedFormat = "ATI2_3Dc";
            }

            if (ExpectedFormat.ToUpperInvariant().Contains("A8R8G8B8"))
            {
                ExpectedFormat = "ARGB";
            }

            // KFreon: File Dups
            List <TPFTexInfo> dups = new List <TPFTexInfo>(FileDuplicates);

            FileDuplicates.Clear();
            foreach (TPFTexInfo tex in dups)
            {
                TPFTexInfo texn = tex;
                texn.found   = true;
                texn.TreeInd = TreeInd;
                texn.TexName = treetex.TexName;

                texn.Files.AddRange(treetex.Files);
                texn.ExpIDs.AddRange(treetex.ExpIDs);

                texn.ExpectedFormat = treetex.Format;
                texn.ExpectedMips   = treetex.NumMips;

                texn.OriginalExpIDs = new List <int>(ExpIDs);
                texn.OriginalFiles  = new List <string>(Files);

                FileDuplicates.Add(texn);
            }

            ValidDimensions = ValidateDimensions();
        }