Example #1
0
        //空き領域の探索
        static uint SearchFreeSpaceOneLow(uint newSize, uint searchStart)
        {
            uint addr;
            //00=ファイル末尾
            //01=0x09000000以降の拡張領域で、0x00が規定数+必要データ数連続している領域
            //02=0x09000000以降の拡張領域で、0xFFが規定数+必要データ数連続している領域
            //03=0x08000000以降の通常領域で、0x00が規定数+必要データ数連続している領域
            //04=0x08000000以降の通常領域で、0xFFが規定数+必要データ数連続している領域
            const int LTRIM_SPACE_SIZE = 8;
            uint      needSize         = U.Padding4(FREE_SPACE_SIZE + newSize);

            addr = Program.ROM.FindFreeSpace(searchStart, needSize);
            if (addr != U.NOT_FOUND)
            {
                if (ImageUtilMagic.IsMagicArea(ref addr))
                {//魔法領域として使われているなら振り直し
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                if (IsSkillReserve(ref addr))
                {
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }

                return(addr + LTRIM_SPACE_SIZE);
            }

            return(AppendEndOfFile(newSize));
        }
        public ImageMagicFEditorForm()
        {
            InitializeComponent();
            U.SetIcon(MagicAnimeExportButton, Properties.Resources.icon_arrow);
            U.SetIcon(MagicAnimeImportButton, Properties.Resources.icon_upload);

            if (ImageUtilMagic.SearchMagicSystem(out MagicEngineBaseAddr, out DimAddr, out NoDimAddr) != ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
            {
                Debug.Assert(false);
                return;
            }

            InputFormRef.markupJumpLabel(LinkInternt);

            U.SelectedIndexSafety(ShowZoomComboBox, 0);
            Dictionary <uint, string> effectDic = U.LoadDicResource(U.ConfigDataFilename("item_anime_effect_"));
            uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount();
            uint csaSpellTablePointer;
            uint csaSpellTable = ImageUtilMagic.FindCSASpellTable("FEditor", out csaSpellTablePointer);

            if (csaSpellTable == U.NOT_FOUND)
            {
                R.ShowWarning("魔法リストの拡張がされていません。\r\nリストの拡張を選択して、魔法リストを増やしてください。");
            }

            this.InputFormRef = Init(this, DimAddr, NoDimAddr, spellDataCount, csaSpellTable, effectDic);
            this.InputFormRef.MakeGeneralAddressListContextMenu(true);
            this.InputFormRef.IsMemoryNotContinuous = true; //メモリは連続していないので、警告不能.
            if (this.InputFormRef.DataCount > Program.ROM.RomInfo.magic_effect_original_data_count())
            {                                               //拡張済みなので、拡張ボタンを無効にする
                MagicListExpandsButton.Enabled = false;
            }
        }
Example #3
0
        static bool IsConflictCheck(uint addr)
        {
            if (ImageUtilMagic.IsMagicArea(ref addr))
            {//魔法領域として使われているならだめ
                return(true);
            }
            if (IsSkillReserve(ref addr))
            {
                return(true);
            }
            if (EventUnitForm.IsEventUnitReserve(ref addr))
            {
                return(true);
            }
            //                if (IsTextAreaReserrve(ref addr))
            //                {
            //                    return break;
            //                }
            uint a = Program.ROM.p32(Program.ROM.RomInfo.item_pointer());

            if (a == addr)
            {
                return(true);
            }
            a = Program.ROM.p32(Program.ROM.RomInfo.class_pointer());
            if (a == addr)
            {
                return(true);
            }
            return(false);
        }
        //全データの取得
        public static void MakeAllDataLength(List <Address> list, bool isPointerOnly)
        {
            string       name;
            InputFormRef InputFormRef;
            uint         baseaddr, dimaddr, no_dimaddr;

            if (ImageUtilMagic.SearchMagicSystem(out baseaddr, out dimaddr, out no_dimaddr) != ImageUtilMagic.magic_system_enum.CSA_CREATOR)
            {
                return;
            }

            {
                uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount();
                uint csaSpellTable  = ImageUtilMagic.GetCSASpellTableAddr();
                if (csaSpellTable == U.NOT_FOUND)
                {
                    return;
                }
                uint csaSpellTablePointer = ImageUtilMagic.GetCSASpellTablePointer();

                Dictionary <uint, string> effectDic = new Dictionary <uint, string>();
                InputFormRef = Init(null, dimaddr, no_dimaddr, spellDataCount, csaSpellTable, effectDic);

                name = "Magic";
                FEBuilderGBA.Address.AddAddress(list
                                                , InputFormRef
                                                , name, new uint[] { 0 }
                                                );

                //追加魔法テーブル(結構無駄な構造ですが、仕方ない)
                FEBuilderGBA.Address.AddAddress(list
                                                , csaSpellTable
                                                , InputFormRef.DataCount * 4 * 5
                                                , csaSpellTablePointer
                                                , "Magic_Append_SpellTable"
                                                , FEBuilderGBA.Address.DataTypeEnum.MAGIC_APPEND_SPELLTABLE
                                                );

                uint addr = InputFormRef.BaseAddress;
                for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
                {
                    uint baseaddress = Program.ROM.p32(Program.ROM.RomInfo.magic_effect_pointer);
                    uint csaaddress  = (uint)(csaSpellTable + (20 * i));

                    uint dataaddr = Program.ROM.p32(addr);
                    if (dataaddr == 0)
                    {
                        continue;
                    }
                    if (
                        dataaddr == dimaddr ||
                        dataaddr == no_dimaddr)
                    {
                        name = "Magic:" + U.To0xHexString(i);
                        ImageUtilMagicCSACreator.RecycleOldAnime(ref list, name, isPointerOnly, csaaddress);
                    }
                }
            }
        }
Example #5
0
 private void ImageMagicButton_Click(object sender, EventArgs e)
 {
     ImageUtilMagic.magic_system_enum magic = ImageUtilMagic.SearchMagicSystem();
     if (magic == ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
     {
         InputFormRef.JumpForm <ImageMagicFEditorForm>();
     }
     else if (magic == ImageUtilMagic.magic_system_enum.CSA_CREATOR)
     {
         InputFormRef.JumpForm <ImageMagicCSACreatorForm>();
     }
 }
 static Dictionary <uint, string> MakeItemEffectAndAppendMagicLow()
 {
     ImageUtilMagic.magic_system_enum magic = ImageUtilMagic.SearchMagicSystem();
     if (magic == ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
     {
         return(ImageMagicFEditorForm.MakeItemEffectAndAppendMagic(null));
     }
     else if (magic == ImageUtilMagic.magic_system_enum.CSA_CREATOR)
     {
         return(ImageMagicCSACreatorForm.MakeItemEffectAndAppendMagic(null));
     }
     return(U.LoadDicResource(U.ConfigDataFilename("item_anime_effect_")));
 }
Example #7
0
        //空き領域の探索
        static uint SearchFreeSpaceOneLow(uint newSize, uint searchStart)
        {
            uint addr;
            //00=ファイル末尾
            //01=0x09000000以降の拡張領域で、0x00が規定数+必要データ数連続している領域
            //02=0x09000000以降の拡張領域で、0xFFが規定数+必要データ数連続している領域
            //03=0x08000000以降の通常領域で、0x00が規定数+必要データ数連続している領域
            //04=0x08000000以降の通常領域で、0xFFが規定数+必要データ数連続している領域
            const int LTRIM_SPACE_SIZE = 16;
            uint      needSize         = U.Padding4(FREE_SPACE_SIZE + newSize);

            addr = Program.ROM.FindFreeSpace(searchStart, needSize);
            if (addr != U.NOT_FOUND)
            {
                if (ImageUtilMagic.IsMagicArea(ref addr))
                {//魔法領域として使われているなら振り直し
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                if (IsSkillReserve(ref addr))
                {
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                if (EventUnitForm.IsEventUnitReserve(ref addr))
                {
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
//                if (IsTextAreaReserrve(ref addr))
//                {
//                    return SearchFreeSpaceOneLow(newSize, addr);
//                }
                if (IsUnknownCollision(ref addr, newSize))
                {//未知の衝突防止
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                uint a = Program.ROM.p32(Program.ROM.RomInfo.item_pointer());
                if (a >= addr && a < addr + newSize)
                {
                    return(SearchFreeSpaceOneLow(newSize, addr + 0x100));
                }
                a = Program.ROM.p32(Program.ROM.RomInfo.class_pointer());
                if (a >= addr && a < addr + newSize)
                {
                    return(SearchFreeSpaceOneLow(newSize, addr + 0x100));
                }

                return(addr + LTRIM_SPACE_SIZE);
            }

            return(AppendEndOfFile(newSize));
        }
Example #8
0
        private void ImageMagicButton_Click(object sender, EventArgs e)
        {
            HowDoYouLikePatchForm.CheckAndShowPopupDialog(HowDoYouLikePatchForm.TYPE.MagicPatch_By_Menu);

            ImageUtilMagic.magic_system_enum magic = ImageUtilMagic.SearchMagicSystem();
            if (magic == ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
            {
                InputFormRef.JumpForm <ImageMagicFEditorForm>();
            }
            else if (magic == ImageUtilMagic.magic_system_enum.CSA_CREATOR)
            {
                InputFormRef.JumpForm <ImageMagicCSACreatorForm>();
            }
        }
        //エラーチェック
        public static void MakeCheckError(List <FELint.ErrorSt> errors)
        {
            string       name;
            InputFormRef InputFormRef;
            uint         baseaddr, dimaddr, no_dimaddr;

            if (ImageUtilMagic.SearchMagicSystem(out baseaddr, out dimaddr, out no_dimaddr) != ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
            {
                return;
            }

            {
                uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount();
                uint csaSpellTablePointer;
                uint csaSpellTable = ImageUtilMagic.FindCSASpellTable("FEditor", out csaSpellTablePointer);
                if (csaSpellTable == U.NOT_FOUND)
                {
                    return;
                }
                Dictionary <uint, string> effectDic = new Dictionary <uint, string>();
                InputFormRef = Init(null, dimaddr, no_dimaddr, spellDataCount, csaSpellTable, effectDic);

                uint addr = InputFormRef.BaseAddress;
                for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
                {
                    uint baseaddress = Program.ROM.p32(Program.ROM.RomInfo.magic_effect_pointer());
                    uint csaaddress  = (uint)(csaSpellTable + (20 * i));

                    uint dataaddr = Program.ROM.p32(addr);
                    if (dataaddr == 0)
                    {
                        continue;
                    }

                    if (U.isSafetyOffset(dataaddr))
                    {
                    }

                    if (
                        dataaddr == dimaddr ||
                        dataaddr == no_dimaddr)
                    {
                        name = "Magic:" + U.To0xHexString(i);

                        ImageUtilMagicFEditor.MakeCheckError(ref errors, name, csaaddress, (uint)i);
                    }
                }
            }
        }
        //変更するアニメデータから、他のアニメーションでも使っているものを除外する
        public static void SubConfilctArea(RecycleAddress ra, uint Now_baseaddress)
        {
            InputFormRef InputFormRef;
            uint         baseaddr, dimaddr, no_dimaddr;

            if (ImageUtilMagic.SearchMagicSystem(out baseaddr, out dimaddr, out no_dimaddr) != ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
            {
                return;
            }

            {
                uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount();
                uint csaSpellTable  = ImageUtilMagic.GetCSASpellTableAddr();
                if (csaSpellTable == U.NOT_FOUND)
                {
                    return;
                }
                Dictionary <uint, string> effectDic = new Dictionary <uint, string>();
                InputFormRef = Init(null, dimaddr, no_dimaddr, spellDataCount, csaSpellTable, effectDic);

                uint addr = InputFormRef.BaseAddress;
                for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
                {
                    uint baseaddress = Program.ROM.p32(Program.ROM.RomInfo.magic_effect_pointer);
                    uint csaaddress  = (uint)(csaSpellTable + (20 * i));

                    uint dataaddr = Program.ROM.p32(addr);
                    if (dataaddr == 0)
                    {
                        continue;
                    }
                    if (csaaddress == Now_baseaddress)
                    {
                        continue;
                    }

                    if (
                        dataaddr == dimaddr ||
                        dataaddr == no_dimaddr)
                    {
                        List <Address> list = new List <Address>();
                        ImageUtilMagicFEditor.RecycleOldAnime(ref list, "", false, csaaddress);
                        ra.SubRecycle(list);
                    }
                }
            }
        }
Example #11
0
        //魔法拡張は大量の0x00地帯が生れるので、フリー領域と誤認しないように確認する.
        public static bool IsMagicArea(ref uint addr)
        {
            magic_system_enum magicType = SearchMagicSystem();

            if (magicType == magic_system_enum.NO)
            {
                return(false);
            }
            uint csaSpellTable, csaSpellTablePointer;

            if (magicType == magic_system_enum.CSA_CREATOR)
            {
                csaSpellTable = ImageUtilMagic.FindCSASpellTable("SCA_Creator", out csaSpellTablePointer);
            }
            else if (magicType == magic_system_enum.FEDITOR_ADV)
            {
                csaSpellTable = ImageUtilMagic.FindCSASpellTable("FEditor", out csaSpellTablePointer);
            }
            else
            {
                Debug.Assert(false);
                return(false);
            }

            uint effect_table_addr = Program.ROM.p32(Program.ROM.RomInfo.magic_effect_pointer());

            if (!U.isSafetyOffset(effect_table_addr))
            {
                return(false);
            }

            uint end = effect_table_addr + (0x4 * 0xff);

            if (addr >= effect_table_addr && addr < end)
            {
                addr = end;
                return(true);
            }
            end = csaSpellTable + (0x4 * 0x5 * 0xff);
            if (addr >= csaSpellTable && addr < end)
            {
                addr = end;
                return(true);
            }
            return(false);
        }
        public static Dictionary <uint, string> MakeItemEffectAndAppendMagic(Form from)
        {
            InputFormRef InputFormRef;
            Dictionary <uint, string> effectDic = U.LoadDicResource(U.ConfigDataFilename("item_anime_effect_"));

            uint baseaddr, dimaddr, no_dimaddr;

            if (ImageUtilMagic.SearchMagicSystem(out baseaddr, out dimaddr, out no_dimaddr) != ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
            {
                return(effectDic);
            }

            uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount();
            uint csaSpellTable  = ImageUtilMagic.GetCSASpellTableAddr();

            if (csaSpellTable == U.NOT_FOUND)
            {
                return(effectDic);
            }

            InputFormRef = Init(from, dimaddr, no_dimaddr, spellDataCount, csaSpellTable, effectDic);
            List <U.AddrResult> ret = InputFormRef.MakeList();

            for (int i = 0; i < ret.Count; i++)
            {
                U.AddrResult ar = ret[i];
                if (ar.name.IndexOf(" EMPTY") >= 0)
                {
                    continue;
                }

                //処理効率最悪なのだが、 テキストの先頭に16進数でIDが入っている
                uint   no         = U.atoh(ar.name);
                string effectname = R._("追加魔法");
                if (Program.CommentCache.CheckFast(ar.addr))
                {
                    effectname = " " + Program.CommentCache.At(ar.addr);
                }

                effectDic[no] = effectname;
            }

            return(effectDic);
        }
        private void MagicListExpandsButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = R.ShowYesNo("魔法テーブルを拡張してもよろしいですか?");

            if (dr != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }

            Undo.UndoData undodata = Program.Undo.NewUndoData(this, "expands");

            uint csaSpellTablePointer = ImageUtilMagic.GetCSASpellTablePointer();

            if (csaSpellTablePointer == U.NOT_FOUND)
            {
                R.ShowStopError("CSASpellTable Not Found.");
                return;
            }

            //魔法エフェクトテーブルの拡張.
            uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount();
            uint datasize       = spellDataCount;

            InputFormRef.ExpandsArea(this, 254, Program.ROM.RomInfo.magic_effect_pointer, datasize, FEBuilderGBA.InputFormRef.ExpandsFillOption.NO, 4, undodata);

            //CSA追加魔法テーブルの拡張
            if (U.isSafetyOffset(csaSpellTablePointer) && InputFormRef != null)
            {//CSA追加魔法テーブルが正しくセットされている場合
                datasize = InputFormRef.DataCount;
            }
            else
            {//セットされていなければ初期値は0
                datasize = 0;
            }

            uint csaSpellTable = InputFormRef.ExpandsArea(this, 254, csaSpellTablePointer, datasize, FEBuilderGBA.InputFormRef.ExpandsFillOption.NO, 5 * 4, undodata);

            Program.Undo.Push(undodata);

            //開きなおす.
            InputFormRef.ReOpenForm <ImageMagicCSACreatorForm>();
        }
        private void ImageMagicForm_Load(object sender, EventArgs e)
        {
            if (ImageUtilMagic.SearchMagicSystem() != ImageUtilMagic.magic_system_enum.FEDITOR_ADV)
            {
                this.Close();
            }
            uint csaSpellTable = ImageUtilMagic.GetCSASpellTableAddr();

            if (csaSpellTable == U.NOT_FOUND)
            {
                this.MagicListExpandsButton.PerformClick();
            }

            U.AllowDropFilename(this, new string[] { ".TXT" }, (string filename) =>
            {
                using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename))
                {
                    MagicAnimeImportButton_Click(null, null);
                }
            });
        }
        //魔法拡張は大量の0x00地帯が生れるので、フリー領域と誤認しないように確認する.
        public static bool IsMagicArea(ref uint addr)
        {
            magic_system_enum magicType = SearchMagicSystem();

            if (magicType == magic_system_enum.NO)
            {
                return(false);
            }
            uint csaSpellTable = ImageUtilMagic.GetCSASpellTableAddr();

            if (csaSpellTable == U.NOT_FOUND)
            {
                return(false);
            }

            uint effect_table_addr = Program.ROM.p32(Program.ROM.RomInfo.magic_effect_pointer);

            if (!U.isSafetyOffset(effect_table_addr))
            {
                return(false);
            }

            uint end = effect_table_addr + (0x4 * 0xff);

            if (addr >= effect_table_addr && addr < end)
            {
                addr = end;
                return(true);
            }
            end = csaSpellTable + (0x4 * 0x5 * 0xff);
            if (addr >= csaSpellTable && addr < end)
            {
                addr = end;
                return(true);
            }
            return(false);
        }
        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 #17
0
        public MainSimpleMenuImageSubForm()
        {
            InitializeComponent();

            ImageBGButton.BackgroundImage = MakeTransparent(Trim(ImageBGForm.DrawBG(0)));

            if (Program.ROM.RomInfo.version() >= 7)
            {
                BigCGButton.BackgroundImage = MakeTransparent(Trim(ImageCGForm.DrawImageByID(0)));
            }
            else
            {
                BigCGButton.Hide();
            }

            ImagePortraitButton.BackgroundImage     = MakeTransparent(ImagePortraitForm.DrawPortraitUnit(2));
            ImageBattleAnimeButton.BackgroundImage  = MakeTransparent(BattleZoom(ImageBattleAnimeForm.DrawBattleAnime(1, ImageBattleAnimeForm.ScaleTrim.SCALE_90)));
            ImageUnitWaitIconButton.BackgroundImage = MakeTransparent(ImageUnitWaitIconFrom.DrawWaitUnitIconBitmap(1, 0, false));
            ImageUnitMoveIconButton.BackgroundImage = MakeTransparent(ImageUnitMoveIconFrom.DrawMoveUnitIconBitmap(3, 0, 0));
            ImageIconButton.BackgroundImage         = MakeTransparent(ImageItemIconForm.DrawIconWhereID(0xB));
            SystemIconButton.BackgroundImage        = MakeTransparent(ImageSystemIconForm.YubiYoko());
            //BattleScreenButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.Allows(8));
            BattleScreenButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.WeaponIcon(0));

            ImageBattleFieldButton.BackgroundImage   = MakeTransparent(ImageBattleBGForm.DrawBG(2));
            ImageBattleTerrainButton.BackgroundImage = MakeTransparent((ImageBattleTerrainForm.Draw(2)));

            if (Program.ROM.RomInfo.version() == 8)
            {
                ImageUnitPaletteButton.BackgroundImage = MakeTransparent(BattleZoom(UnitPaletteForm.DrawSample(2, 3)));
            }
            else
            {//for FE6 , FE7
                ImageUnitPaletteButton.BackgroundImage = MakeTransparent(BattleZoom(ImageBattleAnimeForm.DrawBattleAnime(ImageBattleAnimeForm.GetAnimeIDByClassID(UnitForm.GetClassID(2))
                                                                                                                         , ImageBattleAnimeForm.ScaleTrim.SCALE_90, UnitForm.GetPaletteLowClass(2))));
            }

            WorldMapImageButton.BackgroundImage = MakeTransparent(WorldMapImageForm.DrawWorldMap());

            if (Program.ROM.RomInfo.version() == 7 && Program.ROM.RomInfo.is_multibyte() == false)
            {//英語版FE7は、章タイトルをテキストで保持していて、40260c nazo fontで、描画している.
                ImageChapterTitleButton.Hide();
            }
            else
            {
                ImageChapterTitleButton.BackgroundImage = MakeTransparent(ImageChapterTitleForm.DrawSample(0));
            }


            if (ImageUtilMagic.SearchMagicSystem() != ImageUtilMagic.magic_system_enum.NO)
            {
                ImageMagicButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.WeaponIcon(8 - 3));
            }
            else
            {
                ImageMagicButton.Hide();
            }

            if (Program.ROM.RomInfo.is_multibyte())
            {
                OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
                if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
                {
//                    FontButton.BackgroundImage = MakeTransparent(FontZHForm.DrawFontString("字形", true));
                }
                else
                {
                    FontButton.BackgroundImage = MakeTransparent(FontForm.DrawFontString("フォント", true));
                }
            }
            else
            {
                FontButton.BackgroundImage = MakeTransparent(FontForm.DrawFontString("Font", true));
            }
        }
        public static bool CheckAndShowPopupDialog(TYPE type)
        {
            Func <bool> checkFunc = null;
            string      title     = "";
            string      reason    = "";

            string patchName1    = "";
            string patchName2    = "";
            string patchShowName = null;

            string patchName3     = "";
            string patchName4     = "";
            string patchShowName3 = null;

            if (type == TYPE.MagicPatch_By_Menu)
            {
                checkFunc = () => {
                    return(ImageUtilMagic.SearchMagicSystem() != ImageUtilMagic.magic_system_enum.NO);
                };
                title = R._("魔法を追加するには、魔法システムパッチが必要です。");
                string version = Program.ROM.RomInfo.VersionToFilename();
                if (version == "FE6")
                {                                            //FE6
                    //patchName1 = "FEditorMagicCSASystem_FE6";///No Translate
                    patchName3 = "CSA_Creator_For_FE6_ver2"; ///No Translate
                }
                else if (version == "FE7J")
                {                                                 //FE7J
                    patchName1 = "Custom Spell Animation Engine"; ///No Translate
                    //patchName3 = "CSA_Creator_For_FE7U";///No Translate

//                    string no_patch = R._("残念ながら、FE7J用の魔法システムパッチは存在しません。\r\n");
//                    R.ShowStopError(title + "\r\n" + no_patch);
//                    return false;
                }
                else if (version == "FE7U")
                {                                             //FE7U
                    //patchName1 = "FEditorMagicCSASystem_FE7U";///No Translate
                    patchName3 = "CSA_Creator_For_FE7U_ver2"; ///No Translate
                }
                else if (version == "FE8J")
                {                                                       //FE8J
                    patchName1 = "magic patch (FeditorAdvMagicSystem)"; ///No Translate
                    patchName3 = "CSA_Creator_For_FE8J_ver2";           ///No Translate
                }
                else if (version == "FE8U")
                {                                              //FE8U
                    patchName1 = "FEditorMagicCSASystem_FE8U"; ///No Translate
                    patchName3 = "CSA_Creator_For_FE8U_ver2";  ///No Translate
                }

                if (patchName1 != "" && patchName3 != "")
                {
                    reason  = R._("魔法システムパッチは2つあるので、どちらかを選んでください。\r\n");
                    reason += R._("FEditorMagicCSASystemは、長い動作実績のある魔法システムです。\r\n");
                    reason += R._("CSA_Creatorは、より解像度をサポートする、新進気鋭の魔法システムです。\r\n");
                }
                else
                {
                    reason = R._("魔法システムパッチを適用してください。");
                }
            }
            else if (type == TYPE.DrawFont_By_Translate)
            {
                checkFunc = () => { return(PatchUtil.draw_font_enum.NO != PatchUtil.SearchDrawFontPatch()); };
                title     = R._("他の言語を表示するにはDrawFontパッチが必要です。");
                if (Program.ROM.RomInfo.is_multibyte())
                {
                    patchName3 = "DrawSingleByte";///No Translate
                }
                else
                {
                    patchName1 = "DrawMultiByte"; ///No Translate
                    patchName3 = "DrawUTF8";      ///No Translate

                    reason += R._("日本語へ翻訳する場合は、DrawMultiByte を選択してください。\r\n");
                    reason += R._("日本語以外へ翻訳する場合は、DrawUTF8 を選択してください\r\n");
                }
            }

            Debug.Assert(checkFunc != null);
            Debug.Assert(title != "");
            if (checkFunc())
            {//すでに適応されている.
                return(true);
            }
            if (patchShowName == null)
            {
                patchShowName = patchName1;
            }
            if (patchShowName3 == null)
            {
                patchShowName3 = patchName3;
            }

            HowDoYouLikePatch2Form f = (HowDoYouLikePatch2Form)InputFormRef.JumpFormLow <HowDoYouLikePatch2Form>();

            f.Text             = title;
            f.ReasonLabel.Text = R._("{0}\r\n\r\n{1}", title, reason);

            if (patchName1 == "")
            {
                f.EnableButton.Hide();
            }
            else
            {
                f.EnableButton.Text   = R._("{0}パッチを有効にする", patchShowName);
                f.EnableButton.Click += (sender, e) =>
                {
                    f.Close();

                    PatchForm patchF = (PatchForm)InputFormRef.JumpForm <PatchForm>();
                    patchF.ApplyPatch(patchName1, patchName2); ///No Translate
                };
            }

            if (patchName3 == "")
            {
                f.EnableButton3.Hide();
            }
            else
            {
                f.EnableButton3.Text   = R._("{0}パッチを有効にする", patchShowName3);
                f.EnableButton3.Click += (sender, e) =>
                {
                    f.Close();

                    PatchForm patchF = (PatchForm)InputFormRef.JumpForm <PatchForm>();
                    patchF.ApplyPatch(patchName3, patchName4); ///No Translate
                };
            }

            if (Program.IsCommandLine)
            {//コマンドラインモードだったら自動適応するしかないね。
                f.CommandLineClick(patchName1, patchName3);
                return(checkFunc());
            }

            f.ShowDialog();

            return(checkFunc());
        }