Пример #1
0
 public static byte[] GetBinaryFile(string archiveName, string fileName)
 {
     byte[] isComp = GetBin(Extended.GetUnixFullPath(archiveName), fileName);
     if (isComp == null)
     {
         throw new FileNotFoundException($"Searched {archiveName} and could not find {fileName}.", fileName);
     }
     if (_compressed)
     {
         isComp = isComp.Skip(4).ToArray();
     }
     return(isComp == null ? null : _compressed?LZSS.DecompressAllNew(isComp) : isComp);
 }
Пример #2
0
        public static void Init(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, ContentManager content)
        {
            FF8DIRdata = Extended.GetUnixFullPath(Path.Combine(FF8DIR, "Data"));
            string testdir = Extended.GetUnixFullPath(Path.Combine(FF8DIRdata, "lang-en"));

            FF8DIRdata_lang = Directory.Exists(testdir) ? testdir : FF8DIRdata;

            Memory.graphics                = graphics;
            Memory.spriteBatch             = spriteBatch;
            Memory.content                 = content;
            Memory.DirtyEncoding           = new DirtyEncoding();
            Memory.FieldHolder.FieldMemory = new int[1024];
            InitTask = new Task(InitTaskMethod);
            InitTask.Start();
        }
Пример #3
0
        private void ReadSkeleton()
        {
            ms.Seek(pBase + pBones, SeekOrigin.Begin);

            if (ms.Position > ms.Length)
            {
                return; //error handler
            }
            bones = new Bone[cSkeletonBones];
            for (int i = 0; i < cSkeletonBones; i++)
            {
                bones[i] = Extended.ByteArrayToStructure <Bone>(br.ReadBytes(64));
            }

            return;
        }
Пример #4
0
        public ArchiveWorker(string path)
        {
            _path = Extended.GetUnixFullPath(path);
            string root = Path.GetDirectoryName(_path);
            string file = Path.GetFileNameWithoutExtension(_path);
            string fi   = Extended.GetUnixFullPath($"{Path.Combine(root, file)}{Memory.Archives.B_FileIndex}");
            string fl   = Extended.GetUnixFullPath($"{Path.Combine(root, file)}{Memory.Archives.B_FileList}");

            if (!File.Exists(fi))
            {
                throw new Exception($"There is no {file}.fi file!\nExiting...");
            }
            if (!File.Exists(fl))
            {
                throw new Exception($"There is no {file}.fl file!\nExiting...");
            }
            FileList = ProduceFileLists();
        }
Пример #5
0
 public static void Init()
 {
     movieDirs = new string[] {
         Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "movies")),     //this folder has most movies
         Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata_lang, "movies")) //this folder has rest of movies
     };
     _movies = new List <string>();
     foreach (string s in movieDirs)
     {
         if (Directory.Exists(s))
         {
             _movies.AddRange(Directory.GetFiles(s, "*", SearchOption.AllDirectories).Where(x =>
                                                                                            x.EndsWith(".avi", StringComparison.OrdinalIgnoreCase) ||
                                                                                            x.EndsWith(".mkv", StringComparison.OrdinalIgnoreCase) ||
                                                                                            x.EndsWith(".bik", StringComparison.OrdinalIgnoreCase)));
         }
     }
     ReturnState = Memory.MODULE_MAINMENU_DEBUG;
 }
Пример #6
0
        private void ReadGeometry()
        {
            ms.Seek(pBase + pVertices, SeekOrigin.Begin);
            if (ms.Position > ms.Length || pVertices + ms.Position > ms.Length) //pvert error handler
            {
                return;                                                         //error handler
            }
            vertices = new Vector4[cVertices];
            for (int i = 0; i < vertices.Length; i++)
            {
                vertices[i] = new Vector4(br.ReadInt16(), br.ReadInt16(), br.ReadInt16(), br.ReadInt16());
            }

            ms.Seek(pBase + pFaces, SeekOrigin.Begin);
            List <Face> face = new List <Face>();

            for (int i = 0; i < cFaces; i++)
            {
                face.Add(Extended.ByteArrayToStructure <Face>(br.ReadBytes(64)));
            }
            faces = face.ToArray();
            return;
        }