Beispiel #1
0
        static string RunAutoReCompile(string eaFilename)
        {
            if (!File.Exists(eaFilename))
            {
                return("");
            }

            EAUtil ea = new EAUtil(eaFilename);

            foreach (EAUtil.Data d in ea.DataList)
            {
                if (d.Dir == "")
                {
                    continue;
                }

                if (d.DataType == EAUtil.DataEnum.ASM ||
                    d.DataType == EAUtil.DataEnum.LYN)
                {
                    string targetfilename = Path.Combine(d.Dir, d.Name);

                    string sourceCode;
                    if (!IsUpdateSourceCode(targetfilename, out sourceCode))
                    {
                        continue;
                    }

                    MainFormUtil.CompileType compileType = MainFormUtil.CompileType.NONE;
                    if (d.DataType == EAUtil.DataEnum.LYN)
                    {
                        if (targetfilename.IndexOf(".lyn.event") >= 0)
                        {
                            compileType = MainFormUtil.CompileType.CONVERT_LYN;
                        }
                        else
                        {
                            compileType = MainFormUtil.CompileType.KEEP_ELF;
                        }
                    }

                    string error;
                    string symbol;
                    bool   r = MainFormUtil.Compile(sourceCode, out error, out symbol, compileType, checkMissingLabelCheck: true);
                    if (!r)
                    {
                        return(error);
                    }
                    SymbolUtil.ProcessSymbolByComment(sourceCode, symbol, SymbolUtil.DebugSymbol.SaveSymTxt, 0);
                }
            }

            return("");
        }
Beispiel #2
0
        static string RunAutoReCompile(string eaFilename)
        {
            if (!File.Exists(eaFilename))
            {
                return("");
            }

            EAUtil ea = new EAUtil(eaFilename);

            foreach (EAUtil.Data d in ea.DataList)
            {
                if (d.DataType == EAUtil.DataEnum.ASM ||
                    d.DataType == EAUtil.DataEnum.LYN)
                {
                    string targetfilename = Path.Combine(ea.Dir, d.Name);

                    string sourceCode;
                    if (!IsUpdateSourceCode(targetfilename, out sourceCode))
                    {
                        continue;
                    }

                    MainFormUtil.CompileType compileType = MainFormUtil.CompileType.NONE;
                    if (d.DataType == EAUtil.DataEnum.LYN)
                    {
                        string lyn_event = U.ChangeExtFilename(targetfilename, "lyn.event");
                        if (File.Exists(lyn_event))
                        {
                            compileType = MainFormUtil.CompileType.CONVERT_LYN;
                        }
                        else
                        {
                            compileType = MainFormUtil.CompileType.KEEP_ELF;
                        }
                    }

                    string error;
                    string symbol;
                    bool   r = MainFormUtil.Compile(sourceCode, out error, out symbol, compileType);
                    if (!r)
                    {
                        return(error);
                    }
                }
            }

            return("");
        }
Beispiel #3
0
        static string RunAutoReCompile(string eaFilename)
        {
            if (!File.Exists(eaFilename))
            {
                return("");
            }

            EAUtil ea = new EAUtil(eaFilename);

            foreach (EAUtil.Data d in ea.DataList)
            {
                if (d.DataType == EAUtil.DataEnum.ASM ||
                    d.DataType == EAUtil.DataEnum.LYN)
                {
                    string targetfilename = Path.Combine(ea.Dir, d.Name);

                    string sourceCode;
                    if (!IsUpdateSourceCode(targetfilename, out sourceCode))
                    {
                        continue;
                    }

                    bool isKeepElf = false;
                    if (d.DataType == EAUtil.DataEnum.LYN)
                    {
                        isKeepElf = true;
                    }

                    string error;
                    string symbol;
                    bool   r = MainFormUtil.Compile(sourceCode, out error, out symbol, isKeepElf);
                    if (!r)
                    {
                        return(error);
                    }
                }
            }

            return("");
        }
Beispiel #4
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());
        }
Beispiel #5
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());
        }