Example #1
0
        public void MakeVarsIDArray(List <UseValsID> list)
        {
            List <uint> tracelist = new List <uint>();

            foreach (var pair in this.AsmMap)
            {
                if (pair.Value.Length <= 0)
                {
                    continue;
                }

                if (pair.Value.TypeName == "TEXTBATCH")
                {
                    UseValsID.AppendASMDATATextID(list, pair.Value, U.toOffset(pair.Key), 4);
                }
                else if (pair.Value.TypeName == "TEXTBATCHSHORT")
                {
                    UseValsID.AppendASMDATATextID(list, pair.Value, U.toOffset(pair.Key), 2);
                }
                else if (pair.Value.TypeName == "EVENT")
                {
                    uint   event_addr = U.toOffset(pair.Key);
                    string name       = pair.Value.Name;
                    EventCondForm.MakeVarsIDArrayByEventAddress(list, event_addr, name, tracelist);
                }
            }
        }
Example #2
0
        public static void MakeVarsIDArray(List <UseValsID> list)
        {
            string infobase = R._("死亡セリフ");

            InputFormRef InputFormRef = Init(null);
            List <uint>  tracelist    = new List <uint>();
            uint         haiku_addr   = InputFormRef.BaseAddress;

            for (uint i = 0; i < InputFormRef.DataCount; i++, haiku_addr += InputFormRef.BlockSize)
            {
                uint unitid = Program.ROM.u8(haiku_addr + 0);

                string info   = infobase + " " + UnitForm.GetUnitName(unitid);
                uint   textid = Program.ROM.u16(haiku_addr + 6);

                if (textid <= 0)
                {
                    uint event_addr = Program.ROM.p32(haiku_addr + 8);
                    EventCondForm.MakeVarsIDArrayByEventAddress(list, event_addr, info, tracelist);
                }
                else
                {
                    UseValsID.AppendTextID(list, FELint.Type.HAIKU, haiku_addr, info, textid, i);
                }
            }
//            UseValsID.AppendTextID(list, FELint.Type.HAIKU, InputFormRef, new uint[] { 6 });
        }
Example #3
0
        private void MAP_LISTBOX_SelectedIndexChanged(object sender, EventArgs e)
        {
            uint mapid = (uint)MAP_LISTBOX.SelectedIndex;

            if (mapid == U.NOT_FOUND)
            {
                return;
            }
            uint addr = MapSettingForm.GetEventAddrWhereMapID(mapid);

            if (!U.isSafetyOffset(addr))
            {
                return;
            }

            List <U.AddrResult> list = EventCondForm.MakeUnitPointer(mapid);

            //未記帳の拡張した領域があれば追加する.
            EventUnitForm.AppendNoWriteNewData(list, mapid);

            U.ConvertListBox(list, ref this.EVENT_LISTBOX);
            if (this.EVENT_LISTBOX.Items.Count > 0)
            {
                this.EVENT_LISTBOX.SelectedIndex = 0;
            }
            else
            {
                MapPictureBox.LoadMap(mapid);
            }
        }
        //テキストIDの取得
        public static void MakeTextIDArray(List <UseTextID> list)
        {
            List <uint> tracelist = new List <uint>();
            {
                InputFormRef ifr = N_Init(null);

                string basename;
                basename = "WorldMapEvent ";

                uint p = ifr.BaseAddress;
                for (int i = 0; i < ifr.DataCount; i++, p += ifr.BlockSize)
                {
                    string name = basename + U.To0xHexString((uint)i);
                    EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
                }
            }
            {
                uint   p    = Program.ROM.RomInfo.ending1_event_pointer();
                string name = R._("エリウッドエンディング");
                EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
            }
            {
                uint   p    = Program.ROM.RomInfo.ending2_event_pointer();
                string name = R._("ヘクトルエンディング");
                EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
            }
        }
        private void CALL_EndEvent_button_Click(object sender, EventArgs e)
        {
            uint mapid = EventCondForm.GetMapID(this.ParentControls);

            this.CallEventAddr = EventCondForm.GetEndEvent(mapid);
            this.NeedFlag03    = true;
            this.Close();
        }
        static List <U.AddrResult> MakeShopListLow()
        {
            List <U.AddrResult> ret = new List <U.AddrResult>();
            uint p;

            //編成準備店.
            p = Program.ROM.RomInfo.item_shop_hensei_pointer;
            if (p != 0)
            {
                ret.Add(new U.AddrResult(
                            Program.ROM.p32(p)
                            , R._("編成準備店")
                            , p));
            }
            if (Program.ROM.RomInfo.version >= 8)
            {
                //まずワールドマップイベントをスキャン.
                List <U.AddrResult> worldmaplist = WorldMapPointForm.MakeWorldMapPointList();
                for (uint i = 0; i < worldmaplist.Count; i++)
                {
                    List <U.AddrResult> shops =
                        WorldMapPointForm.GetShopAddr(U.toOffset(worldmaplist[(int)i].addr));
                    foreach (U.AddrResult shop in shops)
                    {
                        if (Program.ROM.u8(shop.addr) == 0)
                        {//店に品物がない.
                            continue;
                        }

                        ret.Add(shop);
                    }
                }
            }
            List <U.AddrResult> maplist = MapSettingForm.MakeMapIDList();

            for (int n = 0; n < maplist.Count; n++)
            {
                uint addr = MapSettingForm.GetEventAddrWhereMapID((uint)n);
                if (!U.isSafetyOffset(addr))
                {
                    continue;
                }
                string mapname = MapSettingForm.GetMapName((uint)n);

                List <U.AddrResult> shops = EventCondForm.MakeShopPointerListBox(addr);
                foreach (U.AddrResult shop in shops)
                {
                    if (Program.ROM.u8(shop.addr) == 0)
                    {//店に品物がない.
                        continue;
                    }
                    shop.name = mapname + " " + shop.name;
                    ret.Add(shop);
                }
            }

            return(ret);
        }
Example #7
0
        public static void CheckPrologeEventPointerErrors(uint mapid, List <ErrorSt> errors)
        {
            List <U.AddrResult> units = EventCondForm.MakeUnitPointer(mapid);

            for (int i = 0; i < units.Count; i++)
            {
                uint addr     = units[i].addr;
                uint pageSize = Program.ROM.RomInfo.eventunit_data_size();
                for (; Program.ROM.u8(addr) != 0x0; addr += pageSize)
                {
                    if (!U.isSafetyOffset(addr + pageSize))
                    {
                        break;
                    }
                    uint unitGrow = Program.ROM.u8(addr + 3);
                    uint assign   = U.ParseUnitGrowAssign(unitGrow);
                    if (assign != 0)
                    {//自軍でないなら関係ない.
                        continue;
                    }

                    uint unit_id = Program.ROM.u8(addr);
                    if (!UnitForm.isMainUnit(unit_id))
                    {
                        continue;
                    }

                    if (!UnitForm.isLoadClass(unit_id))
                    {
                        uint class_id = Program.ROM.u8(addr + 1);
                        if (class_id == 0)
                        {//未入力の場合は推測します.
                            class_id = UnitForm.GetClassID(unit_id);
                        }
                        if (!ClassForm.isLoadClass(class_id))
                        {
                            continue;
                        }
                    }
                    //条件にマッチするロードユニットを発見
                    return;
                }
            }

            if (Program.ROM.RomInfo.version() == 7)
            {
                errors.Add(new FELint.ErrorSt(EventCondForm.CONDTYPE.PLAYER_UNIT, U.NOT_FOUND
                                              , R._("序章でUnitID:0x01 or 0x02 or 0x03のロードユニットを仲間にしていません。\r\n序章で、このロードユニットを仲間に入れないと多くのイベントがフリーズします。")));
            }
            else
            {
                errors.Add(new FELint.ErrorSt(EventCondForm.CONDTYPE.PLAYER_UNIT, U.NOT_FOUND
                                              , R._("序章でUnitID:0x01のロードユニットを仲間にしていません。\r\n序章で、このロードユニットを仲間に入れないと多くのイベントがフリーズします。")));
            }
        }
Example #8
0
        AsmMapFile MakeBaseSymbol()
        {
            AsmMapFile map = new AsmMapFile(Program.ROM);

            if (Program.ROM.RomInfo.version == 0)
            {
                return(map);
            }

            {
                List <Address> list     = new List <Address>(50000);
                uint           maxcount = MapSettingForm.GetDataCount();
                for (uint mapid = 0; mapid < maxcount; mapid++)
                {
                    //イベント命令 一覧の取得(開始イベントと終了イベントのみ)
                    List <U.AddrResult> eventlist = EventCondForm.MakeEventScriptPointerStartAndEndEventOnly(mapid);
                    for (int i = 0; i < eventlist.Count; i++)
                    {
                        if (!U.isSafetyOffset(eventlist[i].addr))
                        {
                            continue;
                        }

                        Address.AddAddress(list
                                           , eventlist[i].addr
                                           , 4
                                           , U.NOT_FOUND
                                           , eventlist[i].name
                                           , Address.DataTypeEnum.EVENTSCRIPT);
                    }
                }
                map.AppendMAP(list, "EVENT");
            }
            //イベント命令にあるASM命令
            {
                List <Address> list = new List <Address>(0x40);
                EventScript.MakeEventASMMAPList(list, false, "", true);
                map.AppendMAP(list);
            }
            //イベント命令にあるEVENT命令
            {
                List <Address> list = new List <Address>(0x40);
                EventScript.MakeEventASMMAPList(list, true, "", true);
                map.AppendMAP(list, "EVENT");
            }
            map.MakeNearSearchSortedList();

            return(map);
        }
Example #9
0
        void LoadCodes(EventTemplate et)
        {
            this.Codes = new List <EventScript.OneCode>();

            string fullfilename = Path.Combine(Program.BaseDirectory, "config", "data", et.Filename);

            if (!File.Exists(fullfilename))
            {
                return;
            }

            string XXXXXXXX = null;
            string YYYYYYYY = null;

            if (et.Filename.IndexOf("template_event_CALL_END_EVENT") >= 0)
            {
                XXXXXXXX = ToPointerToString(EventCondForm.GetEndEvent(this.MapID));
            }
            else if (et.Filename.IndexOf("template_event_PREPARATION") >= 0)
            {
                XXXXXXXX = ToPointerToString(EventCondForm.GetPlayerUnits(this.MapID));
                YYYYYYYY = ToPointerToString(EventCondForm.GetEnemyUnits(this.MapID));
            }
            else if (et.Filename.IndexOf("_COND_") >= 0)
            {
                uint labelX = GetUnuseLabelID(0x9000);
                XXXXXXXX = ToUShortToString(labelX);

                uint labelY = GetUnuseLabelID(labelX + 1);
                YYYYYYYY = ToUShortToString(labelY);
            }


            byte[] bin = EventScriptInnerControl.ConverteventTextToBin(fullfilename
                                                                       , EventScriptInnerControl.TermCode.NoTerm
                                                                       , XXXXXXXX, YYYYYYYY);
            uint addr  = 0;
            uint limit = (uint)bin.Length;

            while (addr < limit)
            {
                EventScript.OneCode code = Program.EventScript.DisAseemble(bin, addr);
                this.Codes.Add(code);
                addr += (uint)code.Script.Size;
            }
            this.SampleEventListbox.DummyAlloc(this.Codes.Count, 0);
        }
Example #10
0
 bool ConvertAddrToMapAndEvent(uint starti, uint endi, uint addr, out int out_mapindex, out int out_eventindex)
 {
     for (uint i = starti; i < endi; i++)
     {
         List <U.AddrResult> eventlist = EventCondForm.MakeUnitPointer(i);
         for (int n = 0; n < eventlist.Count; n++)
         {
             if (eventlist[n].addr == addr)
             {//FOUND!
                 out_mapindex   = (int)i;
                 out_eventindex = n;
                 return(true);
             }
         }
     }
     out_mapindex   = -1;
     out_eventindex = -1;
     return(false);
 }
Example #11
0
        //テキストIDの取得
        public static void MakeTextIDArray(List <UseTextID> list)
        {
            List <uint> tracelist = new List <uint>();
            {
                InputFormRef InputFormRef = Init(null);

                string basename = "WorldMapEvent Before ";

                uint p = InputFormRef.BaseAddress;
                for (int i = 0; i < InputFormRef.DataCount; i++, p += InputFormRef.BlockSize)
                {
                    string name = basename + U.To0xHexString((uint)i);
                    EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
                }
            }

            //FE8だけ、フリーマップがあるので複雑なイベントが設定されています.
            {
                InputFormRef InputFormRef = N_Init(null);

                uint p = InputFormRef.BaseAddress;
                for (int i = 0; i < InputFormRef.DataCount; i++, p += InputFormRef.BlockSize)
                {
                    string name = "WorldMapEvent After " + U.To0xHexString((uint)i);
                    EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
                }
            }
            {
                uint   p    = Program.ROM.RomInfo.oping_event_pointer();
                string name = R._("オープニングイベント");
                EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
            }
            {
                uint   p    = Program.ROM.RomInfo.ending1_event_pointer();
                string name = R._("エイリークエンディング");
                EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
            }
            {
                uint   p    = Program.ROM.RomInfo.ending2_event_pointer();
                string name = R._("エフラムエンディング");
                EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
            }
        }
Example #12
0
        public static void AppendTextID(List <UseValsID> list, FELint.Type dataType, InputFormRef ifr, uint[] textIDIndexes, uint eventIndex, List <uint> tracelist)
        {
            List <U.AddrResult> arlist = ifr.MakeList();

            for (int i = 0; i < ifr.DataCount; i++)
            {
                U.AddrResult ar = arlist[i];
                for (int n = 0; n < textIDIndexes.Length; n++)
                {
                    uint id = Program.ROM.u16(ar.addr + textIDIndexes[n]);
                    if (id == 0 || id >= 0x7FFF)
                    {
                        continue;
                    }
                    list.Add(new UseValsID(dataType, ar.addr, ar.name, id, TargetTypeEnum.TEXTID, (uint)i));
                }
                uint eventAddr = Program.ROM.p32(ar.addr + eventIndex);
                if (U.isSafetyOffset(eventAddr))
                {
                    EventCondForm.MakeVarsIDArrayByEventAddress(list, eventAddr, ar.name, tracelist);
                }
            }
        }
Example #13
0
        //テキストIDの取得
        public static void MakeTextIDArray(List <UseTextID> list)
        {
            List <uint> tracelist = new List <uint>();
            uint        mapmax    = MapSettingForm.GetDataCount();

            for (uint mapid = 0; mapid < mapmax; mapid++)
            {
                uint wmapid = MapSettingForm.GetWorldMapEventIDWhereMapID(mapid);
                if (wmapid == 0)
                {//存在しない
                    continue;
                }
                //FE6はPLISTが格納されている.
                uint p;
                uint event_addr = MapPointerForm.PlistToOffsetAddrFast(MapPointerForm.PLIST_TYPE.WORLDMAP_FE6ONLY, wmapid, out p);
                if (event_addr == U.NOT_FOUND)
                {
                    continue;
                }

                string name = "WorldMapEvent " + U.To0xHexString(mapid) + " ";
                EventCondForm.MakeTextIDArrayByEventPointer(list, p, name, tracelist);
            }
        }
Example #14
0
        static List <FELint.ErrorSt> ScanMAPLow(uint mapid, List <DisassemblerTrumb.LDRPointer> ldrmap)
        {
            List <FELint.ErrorSt> errors = new List <ErrorSt>();

            if (mapid == SYSTEM_MAP_ID)
            {
                ScanSystem(errors, ldrmap);
                return(errors);
            }

            if (InputFormRef.DoEvents(null, "Scan Map " + U.ToHexString(mapid)))
            {
                return(errors);
            }
            EventCondForm.MakeCheckErrors(mapid, errors);

            if (InputFormRef.DoEvents(null, null))
            {
                return(errors);
            }
            MapSettingForm.MakeCheckErrors(mapid, errors);

            if (InputFormRef.DoEvents(null, null))
            {
                return(errors);
            }
            MapChangeForm.MakeCheckError(mapid, errors);

            if (InputFormRef.DoEvents(null, null))
            {
                return(errors);
            }
            MapExitPointForm.MakeCheckError(mapid, errors);

            if (Program.ROM.RomInfo.version() == 8)
            {
                if (InputFormRef.DoEvents(null, null))
                {
                    return(errors);
                }
                WorldMapEventPointerForm.MakeCheckErrors(mapid, errors);

                if (mapid == 0)
                {
                    if (InputFormRef.DoEvents(null, null))
                    {
                        return(errors);
                    }
                    //FELint.CheckPrologeEventPointer(0, errors);
                }
            }
            else if (Program.ROM.RomInfo.version() == 7)
            {
                if (InputFormRef.DoEvents(null, null))
                {
                    return(errors);
                }
                WorldMapEventPointerFE7Form.MakeCheckErrors(mapid, errors);

                if (mapid == 0)
                {
                    if (InputFormRef.DoEvents(null, null))
                    {
                        return(errors);
                    }
                    //FELint.CheckPrologeEventPointer(0, errors);
                }
            }
            else
            {//ver6
                if (InputFormRef.DoEvents(null, null))
                {
                    return(errors);
                }
                WorldMapEventPointerFE6Form.MakeCheckErrors(mapid, errors);

                if (mapid == 1)
                {
                    if (InputFormRef.DoEvents(null, null))
                    {
                        return(errors);
                    }
                    //FELint.CheckPrologeEventPointer(1, errors);
                }
            }

            return(errors);
        }
Example #15
0
        public Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            SolidBrush brush            = new SolidBrush(lb.ForeColor);
            SolidBrush foreKeywordBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor());
            Font       normalFont       = lb.Font;
            Font       boldFont         = new Font(lb.Font, FontStyle.Bold);
            Rectangle  bounds           = listbounds;
            int        lineHeight       = normalFont.Height;

            UseFlagID current = this.FlagList[index];
            string    text;
            int       maxWidth = 0;

            if (index == 0 || current.ID != this.FlagList[index - 1].ID)
            {     //フラグ名を描画
                if (index != 0)
                { //空行を入れる
                    bounds.Y += lineHeight;
                }

                //フラグのアイコンを描画
                Bitmap bitmap = ImageSystemIconForm.FlagIcon();
                U.MakeTransparent(bitmap);

                Rectangle b = bounds;
                b.Width   = lineHeight;
                b.Height  = lineHeight;
                bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                bitmap.Dispose();

                //フラグ名を書く
                string dummy;
                text      = ":";
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                text      = U.ToHexString(current.ID);
                bounds.X += U.DrawText(text, g, boldFont, brush, isWithDraw, bounds);

                text      = "  " + InputFormRef.GetFlagName(current.ID, out dummy);
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                //次の行へ
                maxWidth  = bounds.X;
                bounds.Y += lineHeight;
                bounds.X  = listbounds.X;
            }

            //名称の表示
            bounds.X += 10;
            text      = MainSimpleMenuEventErrorForm.TypeToString(current.DataType, current.Addr, current.Tag);
            bounds.X += U.DrawText(text, g, boldFont, foreKeywordBrush, isWithDraw, bounds);

            //次の行へ
            maxWidth  = Math.Max(bounds.X, maxWidth);
            bounds.Y += lineHeight;
            bounds.X  = listbounds.X;

            //情報を書く.
            bounds.X += 6;
            text      = current.Info;

            Size ss;

            if (current.DataType == FELint.Type.BATTTLE_TALK || current.DataType == FELint.Type.HAIKU)
            {
                ss = DrawUnitAllowToAllow(text, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_ALWAYS)
            {
                ss = EventCondForm.DrawEventListAlwaysOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_OBJECT)
            {
                ss = EventCondForm.DrawEventListObjectOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TALK)
            {
                ss = EventCondForm.DrawEventListTalkOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TURN)
            {
                ss = EventCondForm.DrawEventListTurnOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENTSCRIPT)
            {
                EventScript.OneCode code = Program.EventScript.DisAseemble(Program.ROM.Data, current.Tag);
                ss = EventScriptForm.DrawCode(lb, g, bounds, isWithDraw, code);
            }
            else
            {
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
                bounds.Y += lineHeight;
                ss        = new Size(bounds.X, bounds.Y);
            }
            bounds.X = ss.Width;
            bounds.Y = ss.Height;

            brush.Dispose();
            foreKeywordBrush.Dispose();

            //最後の改行
            maxWidth = Math.Max(bounds.X, maxWidth);
            return(new Size(maxWidth, bounds.Y));
        }
Example #16
0
        void UpdateList()
        {
            this.FlagList.Clear();
            uint mapid = (uint)this.MAP_LISTBOX.SelectedIndex;

            EventCondForm.MakeFlagIDArray(mapid, this.FlagList);
            MapChangeForm.MakeFlagIDArray(mapid, this.FlagList);

            List <UseFlagID> flagListInner = new List <UseFlagID>();

            if (Program.ROM.RomInfo.version() == 8)
            {
                EventHaikuForm.MakeFlagIDArray(flagListInner);
                EventBattleTalkForm.MakeFlagIDArray(flagListInner);
            }
            else if (Program.ROM.RomInfo.version() == 7)
            {//7
                EventHaikuFE7Form.MakeFlagIDArray(flagListInner);
                EventBattleTalkFE7Form.MakeFlagIDArray(flagListInner);
            }
            else
            {//6
                EventHaikuFE6Form.MakeFlagIDArray(flagListInner);
                EventBattleTalkFE6Form.MakeFlagIDArray(flagListInner);
            }

            if (this.ShowANYCheckBox.Checked)
            {
                foreach (UseFlagID u in flagListInner)
                {
                    if (u.MapID == mapid || u.MapID == U.NOT_FOUND)
                    {
                        this.FlagList.Add(u);
                    }
                }
            }
            else
            {
                foreach (UseFlagID u in flagListInner)
                {
                    if (u.MapID == mapid)
                    {
                        this.FlagList.Add(u);
                    }
                }
            }


            this.FlagList.Sort((UseFlagID a, UseFlagID b) =>
            {
                if (a.ID == b.ID)
                {
                    if (a.MapID == b.MapID)
                    {
                        return((int)a.DataType - (int)b.DataType);
                    }
                    return((int)a.MapID - (int)b.MapID);
                }
                return((int)a.ID - (int)b.ID);
            });
        }
        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 #18
0
        //ROM読みこみに伴うシステムの初期化.
        static void InitSystem(string fullfilename)
        {
            Log.Notify("InitSystem:", Path.GetFileName(ROM.Filename), "ver:", ROM.RomInfo.VersionToFilename(), "length:", ROM.Data.Length.ToString("X"), "FEBuilderGBA:", U.getVersion());

            //Undoバッファの準備
            Undo = new Undo();


            //数を求める部分はあまりにたくさん呼び出すのでキャッシュすることにしました.
            InputFormRef.ClearCacheDataCount();
            //パッチのインストールの是非の判定 FE8には策パッチがあるのでキャッシュする.
            PatchForm.ClearCheckIF();

            if (fullfilename != "")
            {
                //変更監視
                UpdateWatcher.RegistMain(fullfilename);
            }


            //tbl適応判定
            OptionForm.AutoUpdateTBLOption();

            //システム側のテキストエンコード どうやってUnicodeにするかどうか.
            ReBuildSystemTextEncoder();

            //FEテキストエンコード用のハフマンツリーマップの構成
            ReBuildFETextEncoder();

            //イベントの読込
            ReLoadEventScript();

            //イベント条件の解釈リスト
            EventCondForm.PreLoadResource(U.ConfigDataFilename("eventcond_"));

            //AI1 と 2, 3
            EventUnitForm.PreLoadResourceAI1(U.ConfigDataFilename("ai1_"));
            EventUnitForm.PreLoadResourceAI2(U.ConfigDataFilename("ai2_"));
            EventUnitForm.PreLoadResourceAI3(U.ConfigDataFilename("ai3_"));

            //SondEffectリスト
            SongTableForm.PreLoadResource(U.ConfigDataFilename("sound_"));
            //UnitActionリスト
            UnitActionPointerForm.PreLoadResource(U.ConfigDataFilename("unitaction_"));

            //ROM内アニメ
            ImageRomAnimeForm.PreLoadResource();
            ImageTSAAnimeForm.PreLoadResource();
            if (Program.ROM.RomInfo.version() == 8)
            {
                ImageTSAAnime2Form.PreLoadResource();
            }

            //MODの読込.
            ReLoadMod();

            //新規に追加ユニットリストキャッシュの削除
            EventUnitForm.ClearNewData();

            //システムアイコンキャッシュのクリア
            ImageSystemIconForm.ClearCache();

            //EVENTとASMのキャッシュをクリア
            AsmMapFileAsmCache = new FEBuilderGBA.AsmMapFileAsmCache();
            //asm mapキャッシュの更新.
            AsmMapFileAsmCache.ClearCache();

            //RAM
            ReBuildRAM();

            if (fullfilename != "" &&
                fullfilename != Program.Config.at("Last_Rom_Filename"))
            {//最後に開いたファイル名を保存する.
                Program.Config["Last_Rom_Filename"] = fullfilename;
                Program.Config.Save();
            }
            //Log.Notify("InitSystem:Complate");
        }