//全データの取得
        public static void MakeAllDataLength(List <Address> list)
        {
            string name = "ItemWeaponEffect";

            InputFormRef InputFormRef = Init(null);

            FEBuilderGBA.Address.AddAddress(list, InputFormRef, name, new uint[] { 8 });
            uint addr = InputFormRef.BaseAddress;

            for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
            {
                uint mapAnime = Program.ROM.p32(addr + 8);
                if (!U.isSafetyOffset(mapAnime))
                {
                    continue;
                }
                uint   itemid    = Program.ROM.u8(addr + 0);
                string proc_name = name + "_PROC_" + U.ToHexString(itemid) + " " + ItemForm.GetItemName(itemid);

                FEBuilderGBA.Address.AddPointer(list
                                                , addr + 8
                                                , ProcsScriptForm.CalcLengthAndCheck(mapAnime)
                                                , proc_name
                                                , FEBuilderGBA.Address.DataTypeEnum.PROCS
                                                );
            }
        }
Example #2
0
        public static void AddProcsAddress(List <Address> list, uint addr, uint pointer, string info, bool isPointerOnly)
        {
            addr = U.toOffset(addr);
            if (!U.isSafetyOffset(addr))
            {
                return;
            }
            if (pointer != U.NOT_FOUND)
            {
                pointer = U.toOffset(pointer);
                if (!U.isSafetyOffset(pointer))
                {
                    return;
                }
            }

            uint length;

            if (isPointerOnly)
            {
                length = 0;
            }
            else
            {
                length = ProcsScriptForm.CalcLengthAndCheck(addr);
            }
            list.Add(new Address(addr, length, pointer, info, DataTypeEnum.PROCS));
        }
Example #3
0
        public static void MakeAllDataLength(List <Address> list, List <DisassemblerTrumb.LDRPointer> ldrmap)
        {
            List <Address> procs = new List <Address>();
            FindProc       find  = new FindProc(procs, ldrmap);

            list.AddRange(procs); //発見したProcsを追加.

            //Procsに付属するデータを発見する
            foreach (Address a in procs)
            {
                uint addr = a.Addr;
                uint end  = addr + a.Length;
                for (; addr < end; addr += 8)
                {
                    uint code = Program.ROM.u8(addr);

                    if (ProcsScriptForm.hasASMRoutine(code))
                    {//呼び出しているASM関数
                        uint arg = Program.ROM.p32(addr + 4);
                        if (arg != 0)
                        {
                            FEBuilderGBA.Address.AddFunction(list, addr + 4, GetProcsName(a) + " CallASM");
                        }
                    }
                    else if (code == 0x01)
                    {//Set name
                        FEBuilderGBA.Address.AddCString(list, addr + 4);
                    }
                }
            }
        }
Example #4
0
        //長さを求める.
        static uint CalcLength(uint addr)
        {
            uint start = addr;
            uint limit = (uint)Program.ROM.Data.Length;

            while (addr + 8 <= limit)
            {
                uint code = Program.ROM.u16(addr + 0);
                uint sarg = Program.ROM.u16(addr + 2);
                uint parg = Program.ROM.u32(addr + 4);
                addr += 8; //命令は8バイト固定.
                if (addr + 8 > limit)
                {
                    break;
                }

                if (code == 0x0C)
                {     //parg is null
                    if (sarg == 0)
                    { //GOTO LABEL 0があった
                     //Goto 0の時だけは、pargにゴミが入るときがある.

                        //先読みをしてみる.
                        uint sakiyomi = ProcsScriptForm.CalcLengthAndCheck(addr + 8);
                        if (sakiyomi == U.NOT_FOUND)
                        {     //この先が壊れているなら、自分が終端.
                            if (start == addr)
                            { //自分が終端なのに、それが最初に出てくるのはおかしいよね.
                                return(U.NOT_FOUND);
                            }
                            break;
                        }
                    }
                    else if (parg != 0)
                    {//規約違反
                        return(U.NOT_FOUND);
                    }
                }

                if (code == 0x800)
                {//EXIT その3
                    break;
                }

                if (code == 0x00)
                {//EXIT
                    break;
                }
            }
            return(addr - start);
        }
Example #5
0
            void FindProcOne(uint pointer, uint addr, bool child6C)
            {
                uint length = CalcLengthAndCheck(addr);

                if (U.NOT_FOUND == length)
                {
                    this.AlreadyMatch[addr] = false; //ダメだったということを記録しておこう
                    return;
                }

                if (child6C == false)
                {
                    if (IsTooShort(length, addr) == false)
                    {
                        this.AlreadyMatch[addr] = false; //ダメだったということを記録しておこう
                        return;
                    }
                }

                string name = Get6CName2(addr, length, U.at(ProcsName, pointer), U.at(ProcsNameByAddr, addr));

                FEBuilderGBA.Address.AddAddress(this.List, addr, length, pointer, name, Address.DataTypeEnum.PROCS);
                this.AlreadyMatch[addr] = true;

                uint end = addr + length;

                for (; addr < end; addr += 8)
                {
                    uint code = Program.ROM.u8(addr);
                    if (ProcsScriptForm.hasChildProcs(code))
                    {
                        uint arg = Program.ROM.p32(addr + 4);

                        bool result;
                        if (this.AlreadyMatch.TryGetValue(arg, out result))
                        {//既に知っている.
                            if (result)
                            {
                                continue;
                            }
                        }
                        FindProcOne(addr + 4, arg, true);
                    }
                }
            }
Example #6
0
        private void ParamLabel_Clicked(object sender, EventArgs e)
        {
            EventScript.OneCode code;
            int selectID;
            int argindex;

            if (!Get_Select_ParamSrc_Object(sender, out code, out selectID, out argindex))
            {
                return;
            }

            NumericUpDown src_object = ScriptEditSetTables[selectID].ParamSrc;

            EventScript.Arg arg   = code.Script.Args[argindex];
            uint            value = EventScriptForm.GetValueOneScriptEditSetTables(ScriptEditSetTables[selectID], arg);

            if (arg.Type == EventScript.ArgType.POINTER_TEXT)
            {
                CStringForm f = (CStringForm)InputFormRef.JumpForm <CStringForm>();
                f.Init(src_object);
            }
            else if (arg.Type == EventScript.ArgType.POINTER_PROCS)
            {
                ProcsScriptForm f = (ProcsScriptForm)InputFormRef.JumpForm <ProcsScriptForm>(U.NOT_FOUND);
                f.JumpTo(value);
            }
            else if (arg.Type == EventScript.ArgType.POINTER_ASM)
            {
                DisASMForm f = (DisASMForm)InputFormRef.JumpForm <DisASMForm>(U.NOT_FOUND);
                f.JumpTo(DisassemblerTrumb.ProgramAddrToPlain(value));
            }
            else if (arg.Type == EventScript.ArgType.POINTER_AIUNIT)
            {
                AIUnitsForm f = (AIUnitsForm)InputFormRef.JumpFormLow <AIUnitsForm>();
                f.JumpTo(value);
                f.ShowDialog();
                U.SetActiveControl(src_object);
                U.ForceUpdate(src_object, f.GetBaseAddress());
            }
        }
Example #7
0
        public static void MakeCheckError(List <FELint.ErrorSt> errors, List <DisassemblerTrumb.LDRPointer> ldrmap)
        {
            List <Address> procs = new List <Address>();
            FindProc       find  = new FindProc(procs, ldrmap);

            //Procsに付属するデータを発見する
            foreach (Address a in procs)
            {
                uint addr = a.Addr;
                uint end  = addr + a.Length;
                for (; addr < end; addr += 8)
                {
                    uint code = Program.ROM.u8(addr);

                    if (ProcsScriptForm.hasASMRoutine(code))
                    {//呼び出しているASM関数
                        uint arg = Program.ROM.u32(addr + 4);
                        if (arg != 0)
                        {
                            FELint.CheckASMPointer(arg, errors, FELint.Type.PROCS, a.Addr, addr);
                        }
                    }
                    else if (ProcsScriptForm.hasChildProcs(code))
                    {//子Procsの確認
                        uint arg = Program.ROM.u32(addr + 4);
                        if (arg != 0)
                        {
                            FELint.CheckProcsPointer(arg, errors, FELint.Type.PROCS, a.Addr, addr);
                        }
                    }
                    else if (code == 0x01)
                    {//Set name
                        uint name = Program.ROM.u32(addr + 4);
                        FELint.CheckText(name, "PROCS", errors, FELint.Type.SOUNDROOM, a.Addr, addr);
                    }
                }
            }
        }
Example #8
0
        static void ScanSystem(List <FELint.ErrorSt> errors, List <DisassemblerTrumb.LDRPointer> ldrmap)
        {
            ROMCheck(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageBattleAnimeForm"))
            {
                return;
            }
            ImageBattleAnimeForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageBGForm"))
            {
                return;
            }
            ImageBGForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem UnitForm"))
            {
                return;
            }
            UnitForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ClassForm"))
            {
                return;
            }
            ClassForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ItemForm"))
            {
                return;
            }
            ItemForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem MoveCostForm"))
            {
                return;
            }
            MoveCostForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem PatchForm"))
            {
                return;
            }
            PatchForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageUnitMoveIconFrom"))
            {
                return;
            }
            ImageUnitMoveIconFrom.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageUnitWaitIconFrom"))
            {
                return;
            }
            ImageUnitWaitIconFrom.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ItemEffectPointerForm"))
            {
                return;
            }
            ItemEffectPointerForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageUnitPaletteForm"))
            {
                return;
            }
            ImageUnitPaletteForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageBattleScreen"))
            {
                return;
            }
            ImageBattleScreenForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ImageMagic"))
            {
                return;
            }
            ImageMagicFEditorForm.MakeCheckError(errors);
            ImageMagicCSACreatorForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem Procs"))
            {
                return;
            }
            ProcsScriptForm.MakeCheckError(errors, ldrmap);

            if (InputFormRef.DoEvents(null, "ScanSystem MenuDefinition"))
            {
                return;
            }
            MenuDefinitionForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem EventUnit"))
            {
                return;
            }
            EventUnitForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem AIScript"))
            {
                return;
            }
            AIScriptForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem SongTable"))
            {
                return;
            }
            SongTableForm.MakeCheckError(errors);

            if (InputFormRef.DoEvents(null, "ScanSystem ItemWeaponEffect"))
            {
                return;
            }
            ItemWeaponEffectForm.MakeCheckError(errors);

            if (Program.ROM.RomInfo.version() == 8)
            {
                if (InputFormRef.DoEvents(null, "ScanSystem SoundFootStepsForm"))
                {
                    return;
                }
                SoundFootStepsForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem ImagePortraitForm"))
                {
                    return;
                }
                ImagePortraitForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EventHaikuForm"))
                {
                    return;
                }
                EventHaikuForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EventBattleTalkForm"))
                {
                    return;
                }
                EventBattleTalkForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SupportTalkForm"))
                {
                    return;
                }
                SupportTalkForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SupportUnitForm"))
                {
                    return;
                }
                SupportUnitForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SoundRoomForm"))
                {
                    return;
                }
                SoundRoomForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EDForm"))
                {
                    return;
                }
                EDForm.MakeCheckError(errors);
            }
            else if (Program.ROM.RomInfo.version() == 7)
            {
                if (InputFormRef.DoEvents(null, "ScanSystem ImagePortraitForm"))
                {
                    return;
                }
                ImagePortraitForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EventHaikuFE7Form"))
                {
                    return;
                }
                EventHaikuFE7Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EventBattleTalkFE7Form"))
                {
                    return;
                }
                EventBattleTalkFE7Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SupportTalkFE7Form"))
                {
                    return;
                }
                SupportTalkFE7Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SupportUnitForm"))
                {
                    return;
                }
                SupportUnitForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SoundRoomForm"))
                {
                    return;
                }
                SoundRoomForm.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EDForm"))
                {
                    return;
                }
                EDFE7Form.MakeCheckError(errors);
            }
            else
            {
                if (InputFormRef.DoEvents(null, "ScanSystem ImagePortraitFE6Form"))
                {
                    return;
                }
                ImagePortraitFE6Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EventHaikuFE6Form"))
                {
                    return;
                }
                EventHaikuFE6Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EventBattleTalkFE6Form"))
                {
                    return;
                }
                EventBattleTalkFE6Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem SupportTalkFE6Form"))
                {
                    return;
                }
                SupportTalkFE6Form.MakeCheckError(errors);

                if (InputFormRef.DoEvents(null, "ScanSystem EDForm"))
                {
                    return;
                }
                EDFE6Form.MakeCheckError(errors);
            }
        }
Example #9
0
        void TypeToLengthAndName(AsmMapSt p, uint pointer, ROM rom)
        {
            string type = p.TypeName;

            if (type == "LZ77")
            {
                p.Length = LZ77.getCompressedSize(rom.Data, U.toOffset(pointer));
            }
            else if (type == "OAMREGS")
            {
                p.Length = U.OAMREGSLength(U.toOffset(pointer), rom);
                p.Name  += " Count_" + ((p.Length - 2) / (3 * 2));
            }
            else if (type == "OAMREGS_ARRAY")
            {
                p.Length = ScanOAMREGSTable(pointer, p.Name, rom);
            }
            else if (type == "TEXTBATCH")
            {
                p.Length = U.TextBatchLength(U.toOffset(pointer), rom);
                p.Name  += " Count_" + ((p.Length) / 8);
            }
            else if (type == "TEXTBATCHSHORT")
            {
                p.Length = U.TextBatchShortLength(U.toOffset(pointer), rom);
                p.Name  += " Count_" + ((p.Length) / 2);
            }
            else if (type == "EVENT")
            {
                p.Length = EventScript.SearchEveneLength(rom.Data, U.toOffset(pointer));
                p.Name  += " Count_" + ((p.Length - 2) / (3 * 2));
            }
            else if (type == "HEADERTSA")
            {
                p.Length = ImageUtil.CalcByteLengthForHeaderTSAData(rom.Data, (int)U.toOffset(pointer));
            }
            else if (type == "ROMPALETTEANIMEFRAME")
            {
                p.Length = ImageRomAnimeForm.GetPaletteFrameCountLow(rom.Data, U.toOffset(pointer)) * 2;
            }
            else if (type == "PALETTE")
            {
                p.Length = 0x20;
            }
            else if (type == "PALETTE2")
            {
                p.Length = 0x20 * 2;
            }
            else if (type == "PALETTE3")
            {
                p.Length = 0x20 * 3;
            }
            else if (type == "PALETTE4")
            {
                p.Length = 0x20 * 4;
            }
            else if (type == "PALETTE8")
            {
                p.Length = 0x20 * 8;
            }
            else if (type == "PALETTE7")
            {
                p.Length = 0x20 * 7;
            }
            else if (type == "PALETTE16")
            {
                p.Length = 0x20 * 16;
            }
            else if (type == "ROMTCS")
            {
                p.Length = ImageUtilAP.CalcROMTCSLength(U.toOffset(pointer), rom);
            }
            else if (type == "NAZO60")
            {
                p.Length = 60;
            }
            else if (type == "FONTCOLOR0x200")
            {
                p.Length = 0x200;
            }
            else if (type == "NewPopupSimple")
            {
                p.Length = ImageUtilAP.CalcPopupSimpleLength(U.toOffset(pointer), rom);
            }
            else if (type == "SECONDARYOAM")
            {
                p.Length = 14;
            }
            else if (type == "SECONDARYOAM_ARRAY")
            {
                p.Length = ScanSECONDARYOAMTable(pointer, p.Name, rom);
            }
            else if (type == "CSTRING")
            {
                int    length;
                string strname = rom.getString(U.toOffset(pointer), out length);
                p.Length = (uint)length;
                p.Name  += " => " + strname;
            }
            else if (type == "SOUND_85COMMAND_POINTER_ARRAY")
            {
                p.Length = ScanSOUND85COMMANDPointerTable(pointer, p.Name, rom);
            }
            else if (type == "ASM_POINTER_ARRAY")
            {
                p.Length = ScanASMPointerTable(pointer, p.Name, rom);
            }
            else if (type == "PROC")
            {
                uint length = ProcsScriptForm.CalcLengthAndCheck(U.toOffset(pointer));
                if (length != U.NOT_FOUND)
                {
                    p.Length = length;
                }
            }
            else if (type == "NAZO8_DATA_POINTER_ARRAY")
            {
                p.Length = ScanNazo8DataPointerTable(pointer, p.Name, rom);
            }
            else if (type == "ASM")
            {
                p.Length = 0;
            }
            else if (type == "BGCONFIG")
            {
                p.Length = 10 * 2;
            }
        }
Example #10
0
        AsmMapFile MakeFullLow()
        {
            AsmMapFile map = new AsmMapFile(this.BaseSymbol);

            if (IsStopFlag)
            {
                return(map);
            }

            //LDRマップのクリア
            this.LDRMapCache = new List <DisassemblerTrumb.LDRPointer>(0x1000);
            this.FELintCache = new Dictionary <uint, List <FELint.ErrorSt> >();

            List <DisassemblerTrumb.LDRPointer> ldrmap;

            try
            {
                ldrmap           = DisassemblerTrumb.MakeLDRMap(Program.ROM.Data, 0x100);
                this.LDRMapCache = ldrmap;
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
                return(map);
            }

            try
            {
                MakeHardCodeWarning(); //ハードコーディングされているデータの警告
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                ScanFELintByThread(ldrmap);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
                return(map);
            }

            Dictionary <uint, bool> knownDic = new Dictionary <uint, bool>();
            List <Address>          structlist;

            try
            {
                structlist = U.MakeAllStructPointersList(false); //既存の構造体
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
                return(map);
            }

            try
            {
                PatchForm.MakePatchStructDataList(structlist, true, true, false); //パッチが知っている領域.
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                //参照の逆追跡
                this.VarsIDArray = U.MakeVarsIDArray(map);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                GraphicsToolForm.MakeLZ77DataList(structlist); //lz77で圧縮されたもの(主に画像)
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                ProcsScriptForm.MakeAllDataLength(structlist, ldrmap);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                OAMSPForm.MakeAllDataLength(structlist, structlist, ldrmap);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                knownDic = AsmMapFile.MakeKnownListToDic(structlist);
                AsmMapFile.MakeFreeDataList(structlist, knownDic, 0x100, 0x00, 16); //フリー領域
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                AsmMapFile.MakeFreeDataList(structlist, knownDic, 0x100, 0xFF, 16); //フリー領域
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                map.AppendMAP(structlist);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            Dictionary <uint, uint> ldrtable = new Dictionary <uint, uint>();  //LDR参照データがある位置を記録します. コードの末尾などにあります. 数が多くなるのでマップする.

            try
            {
                AsmMapFile.MakeSwitchDataList(ldrtable, 0x100, 0);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            try
            {
                map.AppendMAP(ldrtable);
                if (IsStopFlag)
                {
                    return(map);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                Debug.Assert(false);
            }

            //近場リスト生成.
            map.MakeNearSearchSortedList();

            return(map);
        }
Example #11
0
        AsmMapFile MakeFullLow()
        {
            AsmMapFile map = MakeInstant();

            if (IsStopFlag)
            {
                return(map);
            }

            //LDRマップのクリア
            this.LDRMapCache = new List <DisassemblerTrumb.LDRPointer>();
            this.FELintCache = new Dictionary <uint, List <FELint.ErrorSt> >();

            List <DisassemblerTrumb.LDRPointer> ldrmap;

#if !DEBUG
            try
            {
#endif
            ldrmap           = DisassemblerTrumb.MakeLDRMap(Program.ROM.Data, 0x100);
            this.LDRMapCache = ldrmap;
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }

        catch (Exception e)
        {
            Log.Error(e.ToString());
            return(map);
        }
#endif
#if !DEBUG
            try
            {
#endif
            MakeHardCodeWarning(); //ハードコーディングされているデータの警告
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            ScanFELintByThread(ldrmap);
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
            return(map);
        }
#endif
            List <Address> structlist;
#if !DEBUG
            try
            {
#endif
            structlist = U.MakeAllStructPointersList(false); //既存の構造体
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
            return(map);
        }
#endif

#if !DEBUG
            try
            {
#endif
            PatchForm.MakePatchStructDataList(structlist, true, true, false); //パッチが知っている領域.
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            map.MakeTextIDArray(); //全テキストIDの検出
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            GraphicsToolForm.MakeLZ77DataList(structlist); //lz77で圧縮されたもの(主に画像)
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            ProcsScriptForm.MakeAllDataLength(structlist, ldrmap);
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif


#if !DEBUG
            try
            {
#endif
            OAMSPForm.MakeAllDataLength(structlist, structlist, ldrmap);
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            AsmMapFile.MakeFreeDataList(structlist, 0x100, 0x00, 16); //フリー領域
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            AsmMapFile.MakeFreeDataList(structlist, 0x100, 0xFF, 16); //フリー領域
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif
            map.AppendMAP(structlist);
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
            Dictionary <uint, uint> ldrtable = new Dictionary <uint, uint>();  //LDR参照データがある位置を記録します. コードの末尾などにあります. 数が多くなるのでマップする.
#if !DEBUG
            try
            {
#endif

            AsmMapFile.MakeSwitchDataList(ldrtable, 0x100, 0);
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif
#if !DEBUG
            try
            {
#endif

            map.AppendMAP(ldrtable);
            if (IsStopFlag)
            {
                return(map);
            }
#if !DEBUG
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
        }
#endif

            //近場リスト生成.
            map.MakeNearSearchSortedList();

            return(map);
        }
        public static void GotoEvent(FELint.Type dataType, uint addr, uint tag, uint mapid)
        {
            if (dataType == FELint.Type.EVENTSCRIPT ||
                dataType == FELint.Type.WORLDMAP_EVENT)
            {//イベント内で発生したエラー
                EventScriptForm f = (EventScriptForm)InputFormRef.JumpForm <EventScriptForm>(U.NOT_FOUND);
                f.JumpTo(addr, tag);
                return;
            }
            else if (dataType == FELint.Type.PROCS)
            {
                ProcsScriptForm f = (ProcsScriptForm)InputFormRef.JumpForm <ProcsScriptForm>(U.NOT_FOUND);
                f.JumpTo(addr, tag);
                return;
            }
            else if (dataType == FELint.Type.AISCRIPT)
            {
                AIScriptForm f = (AIScriptForm)InputFormRef.JumpForm <AIScriptForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.MAPSETTING_PLIST_OBJECT ||
                     dataType == FELint.Type.MAPSETTING_PLIST_CONFIG ||
                     dataType == FELint.Type.MAPSETTING_PLIST_MAP ||
                     dataType == FELint.Type.MAPSETTING_PLIST_PALETTE ||
                     dataType == FELint.Type.MAPSETTING_PLIST_MAPCHANGE ||
                     dataType == FELint.Type.MAPSETTING_PLIST_ANIMETION1 ||
                     dataType == FELint.Type.MAPSETTING_PLIST_ANIMETION2 ||
                     dataType == FELint.Type.MAPSETTING_WORLDMAP ||
                     dataType == FELint.Type.MAPSETTING
                     )
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    InputFormRef.JumpForm <MapSettingFE6Form>(mapid);
                }
                else if (Program.ROM.RomInfo.version() == 7)
                {
                    if (!Program.ROM.RomInfo.is_multibyte())
                    {
                        InputFormRef.JumpForm <MapSettingFE7UForm>(mapid);
                    }
                    else
                    {
                        InputFormRef.JumpForm <MapSettingFE7Form>(mapid);
                    }
                }
                else
                {
                    InputFormRef.JumpForm <MapSettingForm>(mapid);
                }
                return;
            }
            else if (dataType == FELint.Type.BATTLE_ANIME)
            {
                ImageBattleAnimeForm f = (ImageBattleAnimeForm)InputFormRef.JumpForm <ImageBattleAnimeForm>(U.NOT_FOUND);
                f.JumpToAnimeID(tag);
                return;
            }
            else if (dataType == FELint.Type.BATTLE_ANIME_CLASS)
            {
                ImageBattleAnimeForm f = (ImageBattleAnimeForm)InputFormRef.JumpForm <ImageBattleAnimeForm>(U.NOT_FOUND);
                f.JumpToClassID(tag);
                return;
            }
            else if (dataType == FELint.Type.BG)
            {
                InputFormRef.JumpForm <ImageBGForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.PORTRAIT)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    InputFormRef.JumpForm <ImagePortraitFE6Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <ImagePortraitForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.HAIKU)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    InputFormRef.JumpForm <EventHaikuForm>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 7)
                {
                    InputFormRef.JumpForm <EventHaikuFE7Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <EventHaikuFE6Form>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.BATTTLE_TALK)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    InputFormRef.JumpForm <EventBattleTalkForm>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 7)
                {
                    InputFormRef.JumpForm <EventBattleTalkFE7Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <EventBattleTalkFE6Form>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.SUPPORT_TALK)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    InputFormRef.JumpForm <SupportTalkForm>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 7)
                {
                    InputFormRef.JumpForm <SupportTalkFE7Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <SupportTalkFE6Form>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.SUPPORT_UNIT)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    SupportUnitFE6Form f = (SupportUnitFE6Form)InputFormRef.JumpForm <SupportUnitFE6Form>();
                    f.JumpToAddr(addr);
                }
                else
                {
                    SupportUnitForm f = (SupportUnitForm)InputFormRef.JumpForm <SupportUnitForm>();
                    f.JumpToAddr(addr);
                }
                return;
            }
            else if (dataType == FELint.Type.CLASS)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    InputFormRef.JumpForm <ClassFE6Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <ClassForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.ITEM)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    InputFormRef.JumpForm <ItemFE6Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <ItemForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.ITEM_WEAPON_EFFECT)
            {
                ItemWeaponEffectForm f = (ItemWeaponEffectForm)InputFormRef.JumpForm <ItemWeaponEffectForm>(U.NOT_FOUND);
                f.JumpTo(tag);
                return;
            }
            else if (dataType == FELint.Type.UNIT)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    InputFormRef.JumpForm <UnitForm>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 7)
                {
                    InputFormRef.JumpForm <UnitFE7Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <UnitFE6Form>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.MAPCHANGE)
            {
                MapChangeForm f = (MapChangeForm)InputFormRef.JumpForm <MapChangeForm>(tag);
                f.JumpToMAPIDAndAddr(mapid, tag);
                return;
            }
            else if (dataType == FELint.Type.SOUND_FOOT_STEPS)
            {
                SoundFootStepsForm f = (SoundFootStepsForm)InputFormRef.JumpForm <SoundFootStepsForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.MOVECOST_NORMAL)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm <MoveCostFE6Form>();
                    f.JumpToClassID(tag, 0 + 1);
                }
                else
                {
                    MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm <MoveCostForm>();
                    f.JumpToClassID(tag, 0 + 1);
                }
                return;
            }
            else if (dataType == FELint.Type.MOVECOST_RAIN)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm <MoveCostFE6Form>();
                    f.JumpToClassID(tag, 1 + 1);
                }
                else
                {
                    MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm <MoveCostForm>();
                    f.JumpToClassID(tag, 1 + 1);
                }
                return;
            }
            else if (dataType == FELint.Type.MOVECOST_SHOW)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm <MoveCostFE6Form>();
                    f.JumpToClassID(tag, 2 + 1);
                }
                else
                {
                    MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm <MoveCostForm>();
                    f.JumpToClassID(tag, 2 + 1);
                }
                return;
            }
            else if (dataType == FELint.Type.MOVECOST_AVOID)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm <MoveCostFE6Form>();
                    f.JumpToClassID(tag, 3 + 1);
                }
                else
                {
                    MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm <MoveCostForm>();
                    f.JumpToClassID(tag, 3 + 1);
                }
                return;
            }
            else if (dataType == FELint.Type.MOVECOST_DEF)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm <MoveCostFE6Form>();
                    f.JumpToClassID(tag, 4 + 1);
                }
                else
                {
                    MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm <MoveCostForm>();
                    f.JumpToClassID(tag, 4 + 1);
                }
                return;
            }
            else if (dataType == FELint.Type.MOVECOST_RES)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm <MoveCostFE6Form>();
                    f.JumpToClassID(tag, 5 + 1);
                }
                else
                {
                    MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm <MoveCostForm>();
                    f.JumpToClassID(tag, 5 + 1);
                }
                return;
            }
            else if (dataType == FELint.Type.OP_CLASS_DEMO)
            {
                if (Program.ROM.RomInfo.version() == 7 && Program.ROM.RomInfo.is_multibyte())
                {
                    InputFormRef.JumpForm <OPClassDemoFE7Form>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 7 && !Program.ROM.RomInfo.is_multibyte())
                {
                    InputFormRef.JumpForm <OPClassDemoFE7UForm>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 8 && Program.ROM.RomInfo.is_multibyte())
                {
                    InputFormRef.JumpForm <OPClassDemoForm>(tag);
                }
                else if (Program.ROM.RomInfo.version() == 8 && !Program.ROM.RomInfo.is_multibyte())
                {
                    InputFormRef.JumpForm <OPClassDemoFE8UForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.WMAP_BASE_POINT)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    InputFormRef.JumpForm <WorldMapPointForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.SOUNDROOM)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    InputFormRef.JumpForm <SoundRoomFE6Form>(tag);
                }
                else
                {
                    InputFormRef.JumpForm <SoundRoomForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.SENSEKI)
            {
                if (Program.ROM.RomInfo.version() == 7)
                {
                    InputFormRef.JumpForm <EDSensekiCommentForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.DIC)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    InputFormRef.JumpForm <TextDicForm>(U.NOT_FOUND);
                }
                return;
            }
            else if (dataType == FELint.Type.MENU)
            {
                MenuCommandForm f = (MenuCommandForm)InputFormRef.JumpForm <MenuCommandForm>();
                f.JumpToAddr(addr);
                return;
            }
            else if (dataType == FELint.Type.STATUS)
            {
                InputFormRef.JumpForm <StatusParamForm>();
                return;
            }
            else if (dataType == FELint.Type.ED)
            {
                if (Program.ROM.RomInfo.version() == 6)
                {
                    InputFormRef.JumpForm <EDFE6Form>();
                }
                else if (Program.ROM.RomInfo.version() == 7)
                {
                    InputFormRef.JumpForm <EDFE7Form>();
                }
                else
                {
                    InputFormRef.JumpForm <EDForm>();
                }
                return;
            }
            else if (dataType == FELint.Type.TERRAIN)
            {
                if (Program.ROM.RomInfo.is_multibyte())
                {
                    InputFormRef.JumpForm <MapTerrainNameForm>();
                }
                else
                {
                    InputFormRef.JumpForm <MapTerrainNameEngForm>();
                }
                return;
            }
            else if (dataType == FELint.Type.SKILL_CONFIG)
            {
                if (Program.ROM.RomInfo.version() == 8)
                {
                    PatchUtil.skill_system_enum skill = PatchUtil.SearchSkillSystem();
                    if (skill == PatchUtil.skill_system_enum.SkillSystem)
                    {
                        InputFormRef.JumpForm <SkillConfigSkillSystemForm>();
                    }
                    else if (skill == PatchUtil.skill_system_enum.FE8N ||
                             skill == PatchUtil.skill_system_enum.yugudora ||
                             skill == PatchUtil.skill_system_enum.FE8N_ver2
                             )
                    {
                        InputFormRef.JumpForm <SkillConfigFE8NSkillForm>();
                    }
                }
                return;
            }
            else if (dataType == FELint.Type.RMENU)
            {
                InputFormRef.JumpForm <StatusRMenuForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.ITEM_USAGE_POINTER)
            {
                InputFormRef.JumpForm <ItemUsagePointerForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.PATCH)
            {
                PatchForm f = (PatchForm)InputFormRef.JumpForm <PatchForm>();
                f.SelectPatchByTag(tag);
                return;
            }
            else if (dataType == FELint.Type.MAPEXIT)
            {
                InputFormRef.JumpForm <MapExitPointForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.IMAGE_UNIT_WAIT_ICON)
            {
                InputFormRef.JumpForm <ImageUnitWaitIconFrom>(tag);
                return;
            }
            else if (dataType == FELint.Type.IMAGE_UNIT_MOVE_ICON)
            {
                InputFormRef.JumpForm <ImageUnitMoveIconFrom>(tag);
                return;
            }
            else if (dataType == FELint.Type.ITEM_EEFECT_POINTER)
            {
                InputFormRef.JumpForm <ItemEffectPointerForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.IMAGE_UNIT_PALETTE)
            {
                InputFormRef.JumpForm <ImageUnitPaletteForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.IMAGE_BATTLE_SCREEN)
            {
                InputFormRef.JumpForm <ImageBattleScreenForm>();
                return;
            }
            else if (dataType == FELint.Type.ASM)
            {
                DisASMForm f = (DisASMForm)InputFormRef.JumpForm <DisASMForm>(U.NOT_FOUND);
                f.JumpTo(DisassemblerTrumb.ProgramAddrToPlain(tag));
                return;
            }
            else if (dataType == FELint.Type.ASMDATA)
            {
                HexEditorForm f = (HexEditorForm)InputFormRef.JumpForm <HexEditorForm>();
                f.JumpTo(tag);
                return;
            }
            else if (dataType == FELint.Type.STATUS_UNITS_MENU)
            {
                InputFormRef.JumpForm <StatusUnitsMenuForm>(tag);
                return;
            }
            else if (dataType == FELint.Type.TEXTID_FOR_SYSTEM)
            {
                return;
            }
            else if (dataType == FELint.Type.TEXTID_FOR_USER)
            {
                return;
            }
            else if (dataType == FELint.Type.POINTER_TALKGROUP)
            {
                EventTalkGroupFE7Form f = (EventTalkGroupFE7Form)InputFormRef.JumpForm <EventTalkGroupFE7Form>();
                f.JumpToAddr(addr);
                return;
            }
            else if (dataType == FELint.Type.POINTER_MENUEXTENDS)
            {
                MenuExtendSplitMenuForm f = (MenuExtendSplitMenuForm)InputFormRef.JumpForm <MenuExtendSplitMenuForm>();
                f.JumpToAddr(addr);
                return;
            }
            else if (dataType == FELint.Type.POINTER_UNITSSHORTTEXT)
            {
                UnitsShortTextForm f = (UnitsShortTextForm)InputFormRef.JumpForm <UnitsShortTextForm>();
                f.JumpTo(addr);
                return;
            }
            else if (dataType == FELint.Type.MAGIC_ANIME_EXTENDS)
            {
                if (tag >= Program.ROM.RomInfo.magic_effect_original_data_count())
                {
                    tag -= Program.ROM.RomInfo.magic_effect_original_data_count();
                }
                ImageUtilMagic.magic_system_enum magic = ImageUtilMagic.SearchMagicSystem();
                if (magic == ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
                {
                    InputFormRef.JumpForm <ImageMagicFEditorForm>(tag);
                }
                else if (magic == ImageUtilMagic.magic_system_enum.CSA_CREATOR)
                {
                    InputFormRef.JumpForm <ImageMagicCSACreatorForm>(tag);
                }
                return;
            }
            else if (dataType == FELint.Type.FELINT_SYSTEM_ERROR)
            {
                InputFormRef.JumpForm <ToolProblemReportForm>();
                return;
            }
            else if (dataType == FELint.Type.STATUS_GAME_OPTION)
            {
                InputFormRef.JumpForm <StatusOptionForm>(tag);
                return;
            }

            //イベント
            {
                EventCondForm f = (EventCondForm)InputFormRef.JumpForm <EventCondForm>(U.NOT_FOUND);
                f.JumpToMAPIDAndAddr(mapid, FELint.TypeToEventCond(dataType), (uint)addr);
            }
        }
Example #13
0
        private void ProcsScriptButton_Click(object sender, EventArgs e)
        {
            ProcsScriptForm f = (ProcsScriptForm)InputFormRef.JumpForm <ProcsScriptForm>(U.NOT_FOUND);

            f.JumpTo(0);
        }