Ejemplo n.º 1
0
            protected override void LoadArchiveFiles()
            {
                StringFiles = new StringFile(118);
                GetFileLocations();
                var aw     = ArchiveWorker.Load(Archive, true);
                var buffer = aw.GetBinaryFile(FileNames[0], true);

                if (buffer == null)
                {
                    return;
                }
                using (var br = new BinaryReader(new MemoryStream(buffer)))
                {
                    for (var key = 0; key < StringFiles.SubPositions.Count; key++)
                    {
                        var pad = (Array.IndexOf(StringsPadLoc, key) >= 0);
                        if (pad || Array.IndexOf(StringsLoc, key) >= 0)
                        {
                            Get_Strings_Offsets(br, FileNames[0], key, pad);
                        }
                        else if (BinMsg.ContainsKey(key))
                        {
                            Get_Strings_BinMSG(br, FileNames[0], key, StringFiles.SubPositions[(int)BinMsg[key]].Seek, 1, 6);
                        }
                        else if (ComplexStr.ContainsKey(key))
                        {
                            Get_Strings_ComplexStr(br, FileNames[0], key, ComplexStr[key]);
                        }
                    }
                }
            }
Ejemplo n.º 2
0
            /// <summary>
            /// Fetch strings from kernel.bin
            /// </summary>
            /// <see cref="http://www.balamb.pl/qh/kernel-pointers.htm"/>
            protected override void LoadArchiveFiles()
            {
                Settings = (FF8StringReference.Settings.MultiCharByte | FF8StringReference.Settings.Namedic);
                ArchiveWorker aw = new ArchiveWorker(Archive);

                Files = new StringFile(56);
                MemoryStream ms = null;

                byte[] buffer = aw.GetBinaryFile(Filenames[0], true);
                if (buffer != null)
                {
                    using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer)))
                    {
                        GetFileLocations(br);
                        //index, grab, skip
                        StringLocations = new Dictionary <uint, Tuple <uint, uint, uint> > {
                            //working
                            { 0, new Tuple <uint, uint, uint>(31, 2, 4) },
                            { 1, new Tuple <uint, uint, uint>(32, 2, 56) },
                            { 2, new Tuple <uint, uint, uint>(33, 2, 128) },
                            { 3, new Tuple <uint, uint, uint>(34, 1, 18) },//38,58,178, or 78
                            { 4, new Tuple <uint, uint, uint>(35, 1, 10) },
                            { 5, new Tuple <uint, uint, uint>(36, 2, 20) },
                            { 6, new Tuple <uint, uint, uint>(37, 1, 34) },//+1interval 70 //character names here.
                            { 7, new Tuple <uint, uint, uint>(38, 2, 20) },
                            { 8, new Tuple <uint, uint, uint>(39, 1, 0) },
                            { 9, new Tuple <uint, uint, uint>(40, 1, 18) },
                            { 11, new Tuple <uint, uint, uint>(41, 2, 4) },
                            { 12, new Tuple <uint, uint, uint>(42, 2, 4) },
                            { 13, new Tuple <uint, uint, uint>(43, 2, 4) },
                            { 14, new Tuple <uint, uint, uint>(44, 2, 4) },
                            { 15, new Tuple <uint, uint, uint>(45, 2, 4) },
                            { 16, new Tuple <uint, uint, uint>(46, 2, 4) },
                            { 17, new Tuple <uint, uint, uint>(47, 2, 4) },
                            { 18, new Tuple <uint, uint, uint>(48, 2, 20) },
                            { 19, new Tuple <uint, uint, uint>(49, 2, 12) },
                            { 21, new Tuple <uint, uint, uint>(50, 2, 20) },
                            { 22, new Tuple <uint, uint, uint>(51, 2, 28) },
                            { 24, new Tuple <uint, uint, uint>(52, 2, 4) },
                            { 25, new Tuple <uint, uint, uint>(53, 1, 18) },
                            { 28, new Tuple <uint, uint, uint>(54, 1, 10) },
                            { 30, new Tuple <uint, uint, uint>(55, 1, 0) },
                        };

                        for (uint key = 0; key < Files.subPositions.Count; key++)
                        {
                            Loc fpos = Files.subPositions[(int)key];
                            if (StringLocations.ContainsKey(key))
                            {
                                Get_Strings_BinMSG(br, Filenames[0], key, Files.subPositions[(int)(StringLocations[key].Item1)].seek, StringLocations[key].Item2, StringLocations[key].Item3);
                            }
                        }
                        ms = null;
                    }
                }
            }
Ejemplo n.º 3
0
            protected override void LoadArchiveFiles()
            {
                Files = new StringFile(118);
                GetFileLocations();
                ArchiveWorker aw = new ArchiveWorker(Archive, true);
                MemoryStream  ms = null;

                byte[] buffer = aw.GetBinaryFile(Filenames[0], true);
                if (buffer != null)
                {
                    using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer)))
                    {
                        //string contain padding values at start of file
                        //then location data before strings
                        StringsPadLoc = new uint[] { (uint)SectionID.tkmnmes1, (uint)SectionID.tkmnmes2, (uint)SectionID.tkmnmes3 };
                        //only location data before strings
                        StringsLoc = new uint[] { 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
                                                  55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
                                                  71, 72, 73, 81, 82, 83, 84, 85, 86, 87, 88, 116 };
                        //complexstr has locations in first file,
                        //and they have 8 bytes of stuff at the start of each entry, 6 bytes UNK and ushort length?
                        //also can have multiple null ending strings per entry.
                        ComplexStr = new Dictionary <uint, List <uint> > {
                            { 74, new List <uint> {
                                  75, 76, 77, 78, 79, 80
                              } }
                        };
                        //these files come in pairs. the bin has string offsets and 6 bytes of other data
                        //msg is where the strings are.
                        BinMSG = new Dictionary <uint, uint>
                        {
                            { 106, 111 }, { 107, 112 }, { 108, 113 }, { 109, 114 }, { 110, 115 }
                        };

                        for (uint key = 0; key < Files.subPositions.Count; key++)
                        {
                            Loc  fpos = Files.subPositions[(int)key];
                            bool pad  = (Array.IndexOf(StringsPadLoc, key) >= 0);
                            if (pad || Array.IndexOf(StringsLoc, key) >= 0)
                            {
                                Get_Strings_Offsets(br, Filenames[0], key, pad);
                            }
                            else if (BinMSG.ContainsKey(key))
                            {
                                Get_Strings_BinMSG(br, Filenames[0], key, Files.subPositions[(int)BinMSG[key]].seek, 1, 6);
                            }
                            else if (ComplexStr.ContainsKey(key))
                            {
                                Get_Strings_ComplexStr(br, Filenames[0], key, ComplexStr[key]);
                            }
                        }
                        ms = null;
                    }
                }
            }
Ejemplo n.º 4
0
            protected void simple_init()
            {
                ArchiveWorker aw = new ArchiveWorker(Archive, true);

                using (MemoryStream ms = new MemoryStream(aw.GetBinaryFile(Filenames[0], true)))
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        Files = new StringFile(1);
                        Files.subPositions.Add(new Loc {
                            seek = 0, length = uint.MaxValue
                        });
                        Get_Strings_Offsets(br, Filenames[0], 0);
                    }
            }
Ejemplo n.º 5
0
            protected void LoadArchiveFiles_Simple()
            {
                var aw     = ArchiveWorker.Load(Archive, true);
                var buffer = aw.GetBinaryFile(FileNames[0], true);

                if (buffer == null)
                {
                    return;
                }
                using (var br = new BinaryReader(new MemoryStream(buffer, true)))
                {
                    StringFiles = new StringFile(1);
                    StringFiles.SubPositions.Add(Loc.CreateInstance(0, uint.MaxValue));
                    Get_Strings_Offsets(br, FileNames[0], 0);
                }
            }
Ejemplo n.º 6
0
            protected void LoadArchiveFiles_Simple()
            {
                ArchiveBase  aw = ArchiveWorker.Load(Archive, true);
                MemoryStream ms;

                byte[] buffer = aw.GetBinaryFile(Filenames[0], true);
                if (buffer != null)
                {
                    using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer, true)))
                    {
                        Files = new StringFile(1);
                        Files.subPositions.Add(new Loc {
                            Seek = 0, Length = uint.MaxValue
                        });
                        Get_Strings_Offsets(br, Filenames[0], 0);
                        ms = null;
                    }
                }
            }