예제 #1
0
        protected override void Initialize()
        {
            FFmpeg.AutoGen.Example.FFmpegBinariesHelper.RegisterFFmpegBinaries();
            Memory.graphics    = graphics;
            Memory.spriteBatch = spriteBatch;
            Memory.content     = Content;

            init_debugger_Audio.DEBUG();            //this initializes the DirectAudio, it's true that it gets loaded AFTER logo, but we will do the opposite
            init_debugger_Audio.DEBUG_SoundAudio(); //this initalizes the WAVE format audio.dat
            Init_debugger_fields.DEBUG();           //this initializes the field module, it's worth to have this at the beginning
            Init_debugger_battle.DEBUG();           //this initializes the encounters
            Memory.font = new Font();               //this initializes the fonts and drawing system- holds fonts in-memory
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);

            TEX tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU,
                                                          aw.GetListOfFiles().First(x => x.ToLower().Contains("icon.tex"))));

            Memory.iconsTex = new Texture2D[tex.TextureData.NumOfPalettes];
            for (int i = 0; i < Memory.iconsTex.Length; i++)
            {
                Memory.iconsTex[i] = tex.GetTexture(i);
            }
            Memory.FieldHolder.FieldMemory = new int[1024];

            base.Initialize();
        }
예제 #2
0
파일: Font.cs 프로젝트: Albeoris/OpenVIII
        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 = new TextureHandler("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

            ReadTdw(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath));
        }
예제 #3
0
        internal 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"));
            string        sysfnt00Filepath  = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt00.tex"));
            TEX           tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath));

            sysfnt   = tex.GetTexture();
            tex      = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfnt00Filepath));
            sysfnt00 = tex.GetTexture();

            ReadTdw(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath));
        }
예제 #4
0
 public Faces()
 {
     if (entries == null)
     {
         ArchiveWorker aw   = new ArchiveWorker(Memory.Archives.A_MENU);
         byte[]        test = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU,
                                                          aw.GetListOfFiles().First(x => x.ToLower().Contains("face.sp2")));
         using (MemoryStream ms = new MemoryStream(test))
         {
             ushort[] locs;
             using (BinaryReader br = new BinaryReader(ms))
             {
                 ms.Seek(4, SeekOrigin.Begin);
                 locs    = new UInt16[32];//br.ReadUInt32(); 32 valid values in face.sp2 rest is invalid
                 entries = new Entry[locs.Length];
                 for (int i = 0; i < locs.Length; i++)
                 {
                     locs[i] = br.ReadUInt16();
                     ms.Seek(2, SeekOrigin.Current);
                 }
                 byte fid = 0;
                 for (int i = 0; i < locs.Length; i++)
                 {
                     entries[i] = new Entry();
                     fid        = entries[i].LoadfromStreamSP2(br, locs[i], (byte)(i - 1 < 0 ?  0: entries[i - 1].Y), fid);
                 }
             }
         }
         //using (FileStream fs = File.OpenWrite(Path.Combine("d:\\", "face.sp2")))
         //{
         //    fs.Write(test, 0, test.Length);
         //}
         TEX tex;
         tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU,
                                                   aw.GetListOfFiles().First(x => x.ToLower().Contains("face1.tex"))));
         faces[0] = tex.GetTexture();
         tex      = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU,
                                                        aw.GetListOfFiles().First(x => x.ToLower().Contains("face2.tex"))));
         faces[1] = tex.GetTexture();
     }
 }
예제 #5
0
        public Icons()
        {
            if (entries == null)
            {
                ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);
                TEX           tex;
                byte[]        test = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU,
                                                                 aw.GetListOfFiles().First(x => x.ToLower().Contains("icon.tex")));

                tex         = new TEX(test);
                PalletCount = tex.TextureData.NumOfPalettes;
                icons       = new Texture2D[PalletCount];
                for (int i = 0; i < PalletCount; i++)
                {
                    icons[i] = tex.GetTexture(i);
                    //using (FileStream fs = File.OpenWrite($"d:\\icons.{i}.png"))
                    //{
                    //    //fs.Write(test, 0, test.Length);

                    //    icons[i].SaveAsPng(fs, 256, 256);
                    //}
                }
                test = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU,
                                                   aw.GetListOfFiles().First(x => x.ToLower().Contains("icon.sp1")));
                //using (FileStream fs = File.OpenWrite(Path.Combine("d:\\", "icons.sp1")))
                //{
                //    fs.Write(test, 0, test.Length);
                //}
                //read from icon.sp1
                using (MemoryStream ms = new MemoryStream(test))
                {
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        Count = br.ReadUInt32();
                        Loc[] locs = new Loc[Count];
                        for (int i = 0; i < Count; i++)
                        {
                            locs[i].pos   = br.ReadUInt16();
                            locs[i].count = br.ReadUInt16();
                            //if (locs[i].count > 1) Count += (uint)(locs[i].count - 1);
                        }
                        entries = new Dictionary <ID, EntryGroup>((int)Count + 10);
                        for (int i = 0; i < Count; i++)
                        {
                            ms.Seek(locs[i].pos, SeekOrigin.Begin);
                            byte c = (byte)locs[i].count;
                            entries[(ID)i] = new EntryGroup(c);
                            for (int e = 0; e < c; e++)
                            {
                                Entry tmp = new Entry();
                                tmp.LoadfromStreamSP1(br);
                                tmp.Part = (byte)e;
                                tmp.SetLoc(locs[i]);
                                entries[(ID)i].Add(tmp);
                            }
                        }
                    }
                    //custom stuff not in sp1
                    Entry BG = new Entry
                    {
                        X            = 0,
                        Y            = 48,
                        Width        = 256,
                        Height       = 16,
                        CustomPallet = 1,
                        Tile         = Vector2.UnitY,
                    };
                    Entry Border_TopLeft = new Entry
                    {
                        X            = 16,
                        Y            = 0,
                        Width        = 8,
                        Height       = 8,
                        CustomPallet = 0,
                    };
                    Entry Border_Top = new Entry
                    {
                        X            = 24,
                        Y            = 0,
                        Width        = 8,
                        Height       = 8,
                        Tile         = Vector2.UnitX,
                        Offset_X     = 8,
                        Offset_X2    = -8,
                        CustomPallet = 0
                    };
                    Entry Border_Bottom = new Entry
                    {
                        X            = 24,
                        Y            = 16,
                        Width        = 8,
                        Height       = 8,
                        Tile         = Vector2.UnitX,
                        Snap_Bottom  = true,
                        Offset_Y     = -8,
                        Offset_X     = 8,
                        Offset_X2    = -8,
                        CustomPallet = 0
                    };
                    Entry Border_TopRight = new Entry
                    {
                        X            = 32,
                        Y            = 0,
                        Width        = 8,
                        Height       = 8,
                        Snap_Right   = true,
                        Offset_X     = -8,
                        CustomPallet = 0
                    };
                    Entry Border_Left = new Entry
                    {
                        X            = 16,
                        Y            = 8,
                        Width        = 8,
                        Height       = 8,
                        Tile         = Vector2.UnitY,
                        Offset_Y     = 8,
                        Offset_Y2    = -8,
                        CustomPallet = 0
                    };
                    Entry Border_Right = new Entry
                    {
                        X            = 32,
                        Y            = 8,
                        Width        = 8,
                        Height       = 8,
                        Tile         = Vector2.UnitY,
                        Snap_Right   = true,
                        Offset_X     = -8,
                        Offset_Y     = 8,
                        Offset_Y2    = -8,
                        CustomPallet = 0
                    };
                    Entry Border_BottomLeft = new Entry
                    {
                        X            = 16,
                        Y            = 16,
                        Width        = 8,
                        Height       = 8,
                        Snap_Bottom  = true,
                        Offset_Y     = -8,
                        CustomPallet = 0
                    };
                    Entry Border_BottomRight = new Entry
                    {
                        X            = 32,
                        Y            = 16,
                        Width        = 8,
                        Height       = 8,
                        Snap_Bottom  = true,
                        Snap_Right   = true,
                        Offset_X     = -8,
                        Offset_Y     = -8,
                        CustomPallet = 0
                    };

                    entries[ID.Bar_BG] = new EntryGroup(new Entry
                    {
                        X            = 16,
                        Y            = 24,
                        Width        = 8,
                        Height       = 8,
                        Tile         = Vector2.UnitX,
                        CustomPallet = 0
                    });
                    entries[ID.Bar_Fill] = new EntryGroup(new Entry
                    {
                        X            = 0,
                        Y            = 16,
                        Width        = 8,
                        Height       = 8,
                        Tile         = Vector2.UnitX,
                        Offset_Y     = 1,
                        CustomPallet = 5
                    });
                    entries[ID.Menu_BG_256] = new EntryGroup(BG, Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight);
                    entries[ID.Menu_BG_368] = new EntryGroup(BG, new Entry
                    {
                        X            = 0,
                        Y            = 64,
                        Offset_X     = 256,
                        Width        = 112,
                        Height       = 16,
                        CustomPallet = 1,
                        Tile         = Vector2.UnitY
                    }, Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight);
                    Count = (uint)entries.Count;

                    entries[ID.DEBUG] = new EntryGroup(
                        new Entry {
                        X = 128, Y = 24, Width = 7, Height = 8
                    },
                        new Entry {
                        X = 65, Y = 8, Width = 6, Height = 8, Offset_X = 7
                    },
                        new Entry {
                        X = 147, Y = 24, Width = 6, Height = 8, Offset_X = 13
                    },
                        new Entry {
                        X = 141, Y = 24, Width = 6, Height = 8, Offset_X = 19
                    },
                        new Entry {
                        X = 104, Y = 16, Width = 6, Height = 8, Offset_X = 25
                    }
                        );
                }
            }
        }