Example #1
0
        public static string MakeEAAutoDef(string target_filename, uint freearea, uint org_sp)
        {
            StringBuilder sb = new StringBuilder();

            string target_text = File.ReadAllText(target_filename);

            if (IsInjectHackInstallation(target_text))
            {
                sb.AppendLine("#include \"Extensions/Hack Installation.txt\"");
            }

            if (freearea == U.NOT_FOUND && org_sp == U.NOT_FOUND)
            {
                sb.AppendLine(String.Format("#include \"{0}\"\r\n"
                                            , Path.GetFileName(target_filename)));
                return(sb.ToString());
            }

            EAUtil ea = new EAUtil(target_filename);

            for (int i = 0; i < ea.IfNDefList.Count; i++)
            {
                string ifndef_keyword = ea.IfNDefList[i];
                switch (ifndef_keyword)
                {
                case "FreeSpace":
                    if (freearea != 0)
                    {
                        sb.AppendLine("#define FreeSpace " + U.To0xHexString(freearea));
                    }
                    break;
                }
            }

            sb.AppendLine("#define ItemImage "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.icon_pointer())));
            sb.AppendLine("#define ItemPalette "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.icon_palette_pointer())));
            sb.AppendLine("#define ItemTable "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.item_pointer())));
            sb.AppendLine("#define TextTable "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.text_pointer())));
            sb.AppendLine("#define PortraitTable "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.face_pointer())));
            if (Program.ROM.RomInfo.version() == 8)
            {
                sb.AppendLine("#define SummonUnitTable "
                              + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.summon_unit_pointer())));
                if (PatchUtil.SearchSkillSystem() == PatchUtil.skill_system_enum.SkillSystem)
                {
                    SkillConfigSkillSystemForm.Export(sb);
                }
            }
            sb.AppendLine("#define AI1Table "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.ai1_pointer())));
            sb.AppendLine("#define AI2Table "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.ai2_pointer())));


            UnitActionPointerForm.SupportActionRework(sb);
            if (org_sp != U.NOT_FOUND)
            {
                sb.AppendLine("#define FEBUILDER_EXTRA_ORG " + U.To0xHexString(org_sp));
            }

            Program.ExportFunction.ExportEA(sb);

            if (freearea != 0)
            {
                sb.AppendLine(String.Format("ORG {0}\r\n#include \"{1}\"\r\n"
                                            , U.To0xHexString(freearea), target_filename));
            }
            else
            {
                sb.AppendLine(String.Format("#include \"{0}\"\r\n"
                                            , Path.GetFileName(target_filename)));
            }
            return(sb.ToString());
        }
Example #2
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");
        }
Example #3
0
        public static string MakeEAAutoDef(string target_filename, uint freearea, uint org_sp, uint org_data, bool isColorzCore)
        {
            StringBuilder sb = new StringBuilder();

            string target_text = File.ReadAllText(target_filename);

            if (IsInjectHackInstallation(target_text))
            {
                sb.AppendLine("#include \"Extensions/Hack Installation.txt\"");
            }

            if (freearea == U.NOT_FOUND && org_sp == U.NOT_FOUND)
            {
                sb.AppendLine(String.Format("#include \"{0}\"\r\n"
                                            , Path.GetFileName(target_filename)));
                return(sb.ToString());
            }

            EAUtil ea = new EAUtil(target_filename);

            for (int i = 0; i < ea.IfNDefList.Count; i++)
            {
                string ifndef_keyword = ea.IfNDefList[i];
                switch (ifndef_keyword)
                {
                case "FreeSpace":
                    if (freearea != 0)
                    {
                        sb.AppendLine("#define FreeSpace " + U.To0xHexString(freearea));
                    }
                    break;
                }
            }

            sb.AppendLine("#define ItemImage "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.icon_pointer)));
            sb.AppendLine("#define ItemPalette "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.icon_palette_pointer)));
            sb.AppendLine("#define ItemTable "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.item_pointer)));
            sb.AppendLine("#define TextTable "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.text_pointer)));
            sb.AppendLine("#define PortraitTable "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.portrait_pointer)));
            if (Program.ROM.RomInfo.version == 8)
            {
                sb.AppendLine("#define SummonUnitTable "
                              + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.summon_unit_pointer)));
                if (PatchUtil.SearchSkillSystem() == PatchUtil.skill_system_enum.SkillSystem)
                {
                    SkillConfigSkillSystemForm.Export(sb, isColorzCore);
                }
            }
            sb.AppendLine("#define AI1Table "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.ai1_pointer)));
            sb.AppendLine("#define AI2Table "
                          + U.To0xHexString(Program.ROM.p32(Program.ROM.RomInfo.ai2_pointer)));


            UnitActionPointerForm.SupportActionRework(sb);
            if (org_sp != U.NOT_FOUND)
            {
                sb.AppendLine("#define FEBUILDER_EXTRA_ORG " + U.To0xHexString(org_sp));
            }
            if (org_data != U.NOT_FOUND)
            {
                sb.AppendLine("#define FEBUILDER_DATA_ORG " + U.To0xHexString(org_data));
            }

            Program.ExportFunction.ExportEA(sb, isColorzCore);

            PatchUtil.skill_system_enum skillsystem = PatchUtil.SearchSkillSystem();
            if (skillsystem == PatchUtil.skill_system_enum.SkillSystem)
            {
                if (sb.ToString().IndexOf("SkillTester") >= 0)
                {
                    sb.AppendLine("#define SKILLSYSTEM_SKILL_TESTER SkillTester");
                }
            }
            //魔法分離パッチ
            MagicSplitUtil.magic_split_enum magic_split = MagicSplitUtil.SearchMagicSplit();
            if (magic_split == MagicSplitUtil.magic_split_enum.FE8NMAGIC)
            {
                sb.AppendLine("#define MAGIC_PATCH");
            }
            else if (magic_split == MagicSplitUtil.magic_split_enum.FE8UMAGIC)
            {
                sb.AppendLine("#define USE_STRMAG_SPLIT");
            }
            else if (magic_split == MagicSplitUtil.magic_split_enum.FE7UMAGIC)
            {
                sb.AppendLine("#define USE_STRMAG_SPLIT");
            }


            if (freearea == 0 || freearea == U.NOT_FOUND)
            {
                sb.AppendLine(String.Format("#include \"{0}\"\r\n"
                                            , Path.GetFileName(target_filename)));
            }
            else
            {
                sb.AppendLine(String.Format("ORG {0}\r\n#include \"{1}\"\r\n"
                                            , U.To0xHexString(freearea), target_filename));
            }
            return(sb.ToString());
        }