示例#1
0
文件: Icons.cs 项目: airways/OpenVIII
 protected override void InitTextures(ArchiveWorker aw = null)
 {
     Textures = new List <TextureHandler>();
     for (int t = 0; t < Props.Count; t++)
     {
         TEX tex;
         tex = new TEX(ArchiveWorker.GetBinaryFile(ArchiveString,
                                                   aw.GetListOfFiles().First(x => x.IndexOf(Props[t].Filename, StringComparison.OrdinalIgnoreCase) >= 0)));
         if (Props[t].Colors == null || Props[t].Colors.Length == 0)
         {
             for (ushort i = 0; i < tex.GetClutCount; i++)
             {
                 if (FORCE_ORIGINAL == false && Props[t].Big != null && Props[t].Big.Count > 0)
                 {
                     Textures.Add(TextureHandler.Create(Props[t].Big[0].Filename, tex, 2, Props[t].Big[0].Split / 2, i));
                 }
                 else
                 {
                     Textures.Add(TextureHandler.Create(Props[t].Filename, tex, 1, 1, i));
                 }
             }
         }
         else
         {
             if (FORCE_ORIGINAL == false && Props[t].Big != null && Props[t].Big.Count > 0)
             {
                 Textures.Add(TextureHandler.Create(Props[t].Big[0].Filename, tex, 2, Props[t].Big[0].Split / 2, (ushort)Textures.Count, colors: Props[t].Big[0].Colors ?? Props[t].Colors));
             }
             else
             {
                 Textures.Add(TextureHandler.Create(Props[t].Filename, tex, 1, 1, (ushort)Textures.Count, colors: Props[t].Colors));
             }
         }
     }
 }
示例#2
0
        //Splash is 640x400 16BPP typical TIM with palette of ggg bbbbb a rrrrr gg
        private void ReadSplash()
        {
            if (string.IsNullOrWhiteSpace(filename))
            {
                return;
            }
            string fn = Path.GetFileNameWithoutExtension(filename);
            //Debug.Assert(!fn.Equals("ff8", StringComparison.OrdinalIgnoreCase));
            ArchiveBase aw = ArchiveWorker.Load(Memory.Archives.A_MAIN);

            byte[] buffer = aw.GetBinaryFile(filename);

            TIM_OVERTURE tim = new TIM_OVERTURE(buffer);

            if ((fn.Equals("ff8", StringComparison.OrdinalIgnoreCase)) || (fn.IndexOf("loop", StringComparison.OrdinalIgnoreCase) >= 0))
            {
                tim.IgnoreAlpha = true;
            }

            tex = TextureHandler.Create(fn, tim, 0);//TIM2.Overture(buffer);
            //using (FileStream fs = File.Create(Path.Combine("D:\\main", Path.GetFileNameWithoutExtension(filename) + ".png")))
            //    splashTex.SaveAsPng(fs, splashTex.Width, splashTex.Height);

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
示例#3
0
        private void ReadTIM(int id, BinaryReader br, out TextureHandler[] tex)
        {
            var temp = new TIM2(br, EXE_Offsets.TIM[id]);

            tex = new TextureHandler[temp.GetClutCount];
            for (ushort i = 0; i < temp.GetClutCount; i++)
            {
                tex[i] = TextureHandler.Create($"ff8exe{id.ToString("D2")}", temp, i);
            }
        }
示例#4
0
 protected override void Init()
 {
     Size = new Vector2 {
         X = 840, Y = 630
     };
     //Data0 is scaled from 1280x720
     Data0 = new Dictionary <Enum, Menu_Base> {
         { SectionName.BG, new IGMDataItem.Texture_Handler(TextureHandler.Create("start{0:00}", 2), new Rectangle(0, -25, 1280, 0)) } //new Rectangle(-45,-25, 1280+100, 0)
     };
     //Data is scaled from Size
     Data.TryAdd(SectionName.Selections, IGMData_Selections.Create());
     base.Init();
 }
示例#5
0
        public void LoadFonts()
        {
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);
            string        sysfntTdwFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tdw"));
            string        sysfntFilepath    = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tex"));
            TEX           tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath));

            sysfnt    = tex.GetTexture((int)ColorID.White);
            sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

            TDW tim = new TDW(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath), 0);

            charWidths = tim.CharWidths;
            menuFont   = tim.GetTexture((ushort)ColorID.White);
        }
示例#6
0
文件: texl.cs 项目: stantoxt/OpenVIII
 public texl(byte[] texlBuffer)
 {
     textures = new TextureHandler[20][];
     using (var br = new BinaryReader(new MemoryStream(texlBuffer)))
         for (var i = 0; i < TEX_COUNT; i++)
         {
             var timOffset = i * TEX_SIZE;
             var tim       = new TIM2(texlBuffer, (uint)timOffset);
             textures[i] = new TextureHandler[tim.GetClutCount];
             for (ushort k = 0; k < textures[i].Length; k++)
             {
                 textures[i][k] = TextureHandler.Create($"texl_tim{(i + 1).ToString("D2")}.tim", tim, k, null);
             }
             //todo detect if mods aren't using palettes.
         }
 }
示例#7
0
        public void LoadFonts()
        {
            Memory.Log.WriteLine($"{nameof(Font)} :: {nameof(LoadFonts)} ");
            var aw        = ArchiveWorker.Load(Memory.Archives.A_MENU);
            var bufferTex = aw.GetBinaryFile("sysfnt.tex");
            var tex       = new TEX(bufferTex);

            sysfnt    = tex.GetTexture((int)ColorID.White);
            sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

            var bufferTDW = aw.GetBinaryFile("sysfnt.tdw");
            var tim       = new TDW(bufferTDW);

            charWidths = tim.CharWidths;
            menuFont   = tim.GetTexture((ushort)ColorID.White);
        }
示例#8
0
文件: SP2.cs 项目: stantoxt/OpenVIII
        protected virtual void InitTextures <T>(ArchiveBase aw = null) where T : Texture_Base, new()
        {
            var count = (int)Props.Sum(x => x.Count);

            if (Textures == null)
            {
                Textures = new List <TextureHandler>(count);
            }
            if (Textures.Count <= 0)
            {
                if (aw == null)
                {
                    aw = ArchiveWorker.Load(ArchiveString);
                }
                T tex;
                Scale = new Dictionary <uint, Vector2>(count);
                var b = 0;
                for (var j = 0; j < Props.Count; j++)
                {
                    for (uint i = 0; i < Props[j].Count; i++)
                    {
                        tex = new T();
                        var buffer = aw.GetBinaryFile(string.Format(Props[j].Filename, i + TextureStartOffset));
                        if (buffer != null)
                        {
                            tex.Load(buffer);

                            if (Props[j].Big != null && ForceOriginal == false && b < Props[j].Big.Count)
                            {
                                var th = TextureHandler.Create(Props[j].Big[b].Filename, tex, 2, Props[j].Big[b++].Split / 2);

                                Textures.Add(th);
                                Scale[i] = Vector2.One;
                            }
                            else
                            {
                                var th = TextureHandler.Create(Props[j].Filename, tex);
                                Textures.Add(th);
                                Scale[i] = th.GetScale(); //scale might not be used outside of texturehandler.
                            }
                        }
                    }
                }
            }
        }
示例#9
0
        public void LoadFonts()
        {
            Memory.Log.WriteLine($"{nameof(Font)} :: {nameof(LoadFonts)} ");
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);

            string[] filelist = aw.GetListOfFiles();
            if (filelist != null)
            {
                string sysfntTdwFilepath = filelist.First(x => x.ToLower().Contains("sysfnt.tdw"));
                string sysfntFilepath    = filelist.First(x => x.ToLower().Contains("sysfnt.tex"));
                TEX    tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath));
                sysfnt    = tex.GetTexture((int)ColorID.White);
                sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

                TDW tim = new TDW(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath), 0);
                charWidths = tim.CharWidths;
                menuFont   = tim.GetTexture((ushort)ColorID.White);
            }
        }
示例#10
0
        protected virtual void InitTextures(ArchiveWorker aw = null)
        {
            int count = (int)Props.Sum(x => x.Count);

            if (Textures == null)
            {
                Textures = new List <TextureHandler>(count);
            }
            if (Textures.Count <= 0)
            {
                if (aw == null)
                {
                    aw = new ArchiveWorker(ArchiveString);
                }
                TEX tex;
                Scale = new Dictionary <uint, Vector2>(count);
                int b = 0;
                for (int j = 0; j < Props.Count; j++)
                {
                    for (uint i = 0; i < Props[j].Count; i++)
                    {
                        string path = aw.GetListOfFiles().First(x => x.ToLower().Contains(string.Format(Props[j].Filename, i + TextureStartOffset)));
                        tex = new TEX(aw.GetBinaryFile(path));
                        if (Props[j].Big != null && FORCE_ORIGINAL == false && b < Props[j].Big.Count)
                        {
                            TextureHandler th = TextureHandler.Create(Props[j].Big[b].Filename, tex, 2, Props[j].Big[b++].Split / 2);

                            Textures.Add(th);
                            Scale[i] = Vector2.One;
                        }
                        else
                        {
                            TextureHandler th = TextureHandler.Create(path, tex);
                            Textures.Add(th);
                            Scale[i] = th.GetScale(); //scale might not be used outside of texturehandler.
                        }
                    }
                }
            }
        }
        //Splash is 640x400 16BPP typical TIM with palette of ggg bbbbb a rrrrr gg
        private void ReadSplash()
        {
            byte[] buffer     = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MAIN, filename);
            string fn         = Path.GetFileNameWithoutExtension(filename);
            uint   uncompSize = BitConverter.ToUInt32(buffer, 0);

            buffer = buffer.Skip(4).ToArray(); //hotfix for new LZSS
            buffer = LZSS.DecompressAllNew(buffer);
            TIM_OVERTURE tim = new TIM_OVERTURE(buffer);

            if ((fn.Equals("ff8", StringComparison.OrdinalIgnoreCase)) || (fn.IndexOf("loop", StringComparison.OrdinalIgnoreCase) >= 0))
            {
                tim.IgnoreAlpha = true;
            }

            tex = (Texture2D)TextureHandler.Create(fn, tim, 0);//TIM2.Overture(buffer);
            //using (FileStream fs = File.Create(Path.Combine("D:\\main", Path.GetFileNameWithoutExtension(filename) + ".png")))
            //    splashTex.SaveAsPng(fs, splashTex.Width, splashTex.Height);

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }