Exemple #1
0
        public void Update(List <string> GivenFiles, List <int> GivenExpIDs, uint GivenHash, int GivenMips, List <ITexture2D> GivenTextures, string pathBIOGame)
        {
            if (Files == null)
            {
                Files = new List <string>();
            }

            /*if (GameVersion != 1)
             *  KFreonLib.PCCObjects.Misc.ReorderFiles(ref GivenFiles, ref GivenExpIDs, pathBIOGame, GameVersion);
             *
             * Files.Insert(0, GivenFiles[0]);
             * Files.AddRange(GivenFiles.GetRange(1, GivenFiles.Count - 1));
             * OriginalFiles = new List<string>(Files);
             *
             * if (ExpIDs == null)
             *  ExpIDs = new List<int>();
             *
             * ExpIDs.Insert(0, GivenExpIDs[0]);
             * ExpIDs.AddRange(GivenExpIDs.GetRange(1, GivenExpIDs.Count - 1));
             * OriginalExpIDs = new List<int>(ExpIDs);*/

            if (Files == null)
            {
                Files = new List <string>(GivenFiles);
            }
            else
            {
                Files.AddRange(GivenFiles);
            }
            OriginalFiles = new List <string>(Files);

            if (ExpIDs == null)
            {
                ExpIDs = new List <int>(GivenExpIDs);
            }
            else
            {
                ExpIDs.AddRange(GivenExpIDs);
            }
            OriginalExpIDs = new List <int>(ExpIDs);


            if (Textures == null)
            {
                Textures = new List <ITexture2D>();
            }
            Textures.AddRange(GivenTextures);

            NumMips = GivenMips;
            if (Hash == 0 && GivenHash != 0)
            {
                Hash = GivenHash;
            }
        }
Exemple #2
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;
 }
Exemple #3
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();
        }