示例#1
0
        private static readonly byte[] Revert12_2 = { 0xC3, 0xFE, 0xFF, 0x54 }; // bl

        public ShinyRateSWSH(byte[] data, int offset = 0x700_000) : base(data)
        {
            CodeOffset1 = CodePattern.IndexOfBytes(data, Pattern, offset);
            CodeOffset2 = CodePattern.IndexOfBytes(data, Pattern, CodeOffset1 + 8); // after CodeOffset1

            Debug.Assert(CodeOffset2 - 0x30 == CodeOffset1);
        }
示例#2
0
        public TMEditorGG(byte[] data)
        {
            NSO  = new NSO(data);
            Data = NSO.DecompressedRO;

            // tm list is stored immediately after TM item index list
            var pattern = CodePattern.TMHM_GG;

            Offset = CodePattern.IndexOfBytes(Data, pattern, 0x200_000);
            if (Valid)
            {
                Offset += pattern.Length;
            }
        }
示例#3
0
        public void EditTypeChart()
        {
            var path = Path.Combine(ROM.PathExeFS, "main");
            var data = FileMitm.ReadAllBytes(path);
            var nso  = new NSO(data);

            byte[] pattern = // N2nn3pia9transport18UnreliableProtocolE
            {
                0x4E, 0x32, 0x6E, 0x6E, 0x33, 0x70, 0x69, 0x61, 0x39, 0x74, 0x72, 0x61, 0x6E, 0x73, 0x70, 0x6F, 0x72,
                0x74, 0x31, 0x38, 0x55, 0x6E, 0x72, 0x65, 0x6C, 0x69, 0x61, 0x62, 0x6C, 0x65, 0x50, 0x72, 0x6F, 0x74,
                0x6F, 0x63, 0x6F, 0x6C, 0x45, 0x00
            };
            int ofs = CodePattern.IndexOfBytes(nso.DecompressedRO, pattern);

            if (ofs < 0)
            {
                WinFormsUtil.Alert("Not able to find type chart data in ExeFS.");
                return;
            }
            ofs += pattern.Length + 0x24; // 0x5B4C0C in lgpe 1.0 RO

            var cdata = new byte[18 * 18];
            var types = ROM.GetStrings(TextName.Types);

            Array.Copy(nso.DecompressedRO, ofs, cdata, 0, cdata.Length);
            var chart = new TypeChartEditor(cdata);

            using var editor = new TypeChart(chart, types);
            editor.ShowDialog();
            if (!editor.Modified)
            {
                return;
            }

            chart.Data.CopyTo(nso.DecompressedRO, ofs);
            data = nso.Write();
            FileMitm.WriteAllBytes(path, data);
        }