Exemple #1
0
        public static void Init()
        {
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_FIELD);

            string[] lists   = aw.GetListOfFiles();
            string   maplist = lists.First(x => x.ToLower().Contains("mapdata.fs"));

            maplist = maplist.Substring(0, maplist.Length - 3);
            byte[] fs  = ArchiveWorker.GetBinaryFile(Memory.Archives.A_FIELD, $"{maplist}{Memory.Archives.B_FileArchive}");
            byte[] fl  = ArchiveWorker.GetBinaryFile(Memory.Archives.A_FIELD, $"{maplist}{Memory.Archives.B_FileList}");
            byte[] fi  = ArchiveWorker.GetBinaryFile(Memory.Archives.A_FIELD, $"{maplist}{Memory.Archives.B_FileIndex}");
            string map = System.Text.Encoding.UTF8.GetString(fl).TrimEnd();

            string[] maplistb = System.Text.Encoding.UTF8.GetString(
                ArchiveWorker.FileInTwoArchives(fi, fs, fl, map))
                                .Replace("\r", "")
                                .Split('\n');
            Memory.FieldHolder.fields = maplistb;
        }
Exemple #2
0
        private static void Init()
        {
            ArchiveWorker aw = new ArchiveWorker($"{Memory.Archives.A_FIELD}.fs");

            string[] test = aw.GetListOfFiles();
            if (Memory.FieldHolder.FieldID >= Memory.FieldHolder.fields.Length ||
                Memory.FieldHolder.FieldID < 0)
            {
                return;
            }
            var CollectionEntry = test.Where(x => x.ToLower().Contains(Memory.FieldHolder.fields[Memory.FieldHolder.FieldID]));

            if (!CollectionEntry.Any())
            {
                return;
            }
            string fieldArchive = CollectionEntry.First();
            int    fieldLen     = fieldArchive.Length - 2;

            fieldArchive = fieldArchive.Substring(0, fieldLen);
            byte[] fs = ArchiveWorker.GetBinaryFile(Memory.Archives.A_FIELD, $"{fieldArchive}fs");
            byte[] fi = ArchiveWorker.GetBinaryFile(Memory.Archives.A_FIELD, $"{fieldArchive}fi");
            byte[] fl = ArchiveWorker.GetBinaryFile(Memory.Archives.A_FIELD, $"{fieldArchive}fl");
            if (fs == null || fi == null || fl == null)
            {
                return;
            }
            string[] test_ = ArchiveWorker.GetBinaryFileList(fl);
            string   mim   = null;
            string   map   = null;

            try
            {
                mim = test_.First(x => x.ToLower().Contains(".mim"));
            }
            catch {}
            try
            {
                map = test_.First(x => x.ToLower().Contains(".map"));
            }
            catch {}

            if (mim != null && map != null)
            {
                byte[] mimb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, mim);
                byte[] mapb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, map);

                ParseBackground(mimb, mapb);
            }

#if DEBUG
            if (Memory.FieldHolder.FieldID == 180)
            {
                goto safeDebugpoint;                                    //delete me
            }
#endif
            //let's start with scripts
            byte[] jsm   = null;
            byte[] sy    = null;
            string s_jsm = null;
            string s_sy  = null;
            try
            {
                s_jsm = test_.First(x => x.ToLower().Contains(".jsm"));
            }
            catch { }
            try
            {
                s_sy = test_.First(x => x.ToLower().Contains(".sy"));
            }
            catch { }
            if (s_jsm != null && s_sy != null)
            {
                jsm = ArchiveWorker.FileInTwoArchives(fi, fs, fl, s_jsm);
                sy  = ArchiveWorker.FileInTwoArchives(fi, fs, fl, s_sy);

                ParseScripts(jsm, sy);
            }
            Stack = new List <int>();
#if DEBUG
            OutputAllParsedScripts();
#endif

            //string mch = test_.Where(x => x.ToLower().Contains(".mch")).First();
            //string one = test_.Where(x => x.ToLower().Contains(".one")).First();
            //string msd = test_.Where(x => x.ToLower().Contains(".msd")).First();
            //string inf = test_.Where(x => x.ToLower().Contains(".inf")).First();
            //string id = test_.Where(x => x.ToLower().Contains(".id")).First();
            //string ca = test_.Where(x => x.ToLower().Contains(".ca")).First();
            //string tdw = test_.Where(x => x.ToLower().Contains(".tdw")).First();
            //string msk = test_.Where(x => x.ToLower().Contains(".msk")).First();
            //string rat = test_.Where(x => x.ToLower().Contains(".rat")).First();
            //string pmd = test_.Where(x => x.ToLower().Contains(".pmd")).First();
            //string sfx = test_.Where(x => x.ToLower().Contains(".sfx")).First();

            //byte[] mchb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, mch); //Field character models
            //byte[] oneb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, one); //Field character models container
            //byte[] msdb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, msd); //dialogs
            //byte[] infb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, inf); //gateways
            //byte[] idb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, id); //walkmesh
            //byte[] cab = ArchiveWorker.FileInTwoArchives(fi, fs, fl, ca); //camera
            //byte[] tdwb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, tdw); //extra font
            //byte[] mskb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, msk); //movie cam
            //byte[] ratb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, rat); //battle on field
            //byte[] pmdb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, pmd); //particle info
            //byte[] sfxb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, sfx); //sound effects



safeDebugpoint:
            mod++;
            return;
        }