Example #1
0
        public static void DeathQuoteTextMessage(uint textid, List <ErrorSt> errors, Type cond, uint addr, uint tag = U.NOT_FOUND)
        {
            string text         = FETextDecode.Direct(textid);
            string errorMessage = TextForm.CheckConversationTextMessage(text, TextForm.MAX_DEATH_QUOTE_WIDTH);

            if (errorMessage != "")
            {
                errors.Add(new FELint.ErrorSt(cond, U.toOffset(addr)
                                              , R._("TextID:{0}\r\n{1}", U.To0xHexString(textid), errorMessage), tag));
            }
        }
Example #2
0
        public static void CheckText(uint textid, string arg1, List <ErrorSt> errors, Type cond, uint addr, uint tag = U.NOT_FOUND)
        {
            string text         = FETextDecode.Direct(textid);
            string errorMessage = TextForm.GetErrorMessage(text, textid, arg1);

            if (errorMessage != "")
            {
                errors.Add(new FELint.ErrorSt(cond, U.toOffset(addr)
                                              , R._("TextID:{0}\r\n{1}", U.To0xHexString(textid), errorMessage), tag));
            }
        }
        public static string GetName(uint id)
        {
            InputFormRef InputFormRef = Init(null);
            uint         addr         = InputFormRef.IDToAddr(id);

            if (!U.isSafetyOffset(addr))
            {
                return("");
            }
            uint text_id = Program.ROM.u16(addr);

            return(FETextDecode.Direct(text_id));
        }
Example #4
0
        public static void MakeCheckError(List <FELint.ErrorSt> errors)
        {
            InputFormRef InputFormRef = Init(null);

            if (InputFormRef.DataCount < 10)
            {
                errors.Add(new FELint.ErrorSt(FELint.Type.ITEM, U.NOT_FOUND
                                              , R._("アイテムデータが極端に少ないです。破損している可能性があります。")));
            }

            Dictionary <uint, U.AddrResult> itemWeaponEffectDic = ItemWeaponEffectForm.MakeDic();

            uint item_addr = InputFormRef.BaseAddress;

            for (uint i = 0; i < InputFormRef.DataCount; i++, item_addr += InputFormRef.BlockSize)
            {
                uint name = Program.ROM.u16(item_addr + 0);
                FELint.CheckText(name, "NAME1", errors, FELint.Type.ITEM, item_addr, i);

                uint id = Program.ROM.u8(item_addr + 6);
                if (id == 0)
                {//ただの使っていないデータ
                    continue;
                }

                if (i > 0)
                {
                    uint   info         = Program.ROM.u16(item_addr + 2);
                    uint   info2        = Program.ROM.u16(item_addr + 4);
                    uint   type         = Program.ROM.u8(item_addr + 7);
                    uint   attr1        = Program.ROM.u8(item_addr + 8);
                    bool   isEquip      = (attr1 & 0x01) == 0x01;
                    string errorMessage = ChcekTextItem1ErrorMessage(id, FETextDecode.Direct(info), info, type, isEquip);
                    if (errorMessage != "")
                    {
                        errors.Add(new FELint.ErrorSt(FELint.Type.ITEM, U.toOffset(item_addr)
                                                      , R._("TextID:{0}\r\n{1}", U.To0xHexString(info), errorMessage), i));
                    }

                    errorMessage = ChcekTextItem2ErrorMessage(id, FETextDecode.Direct(info2), info2, type, isEquip);
                    if (errorMessage != "")
                    {
                        errors.Add(new FELint.ErrorSt(FELint.Type.ITEM, U.toOffset(item_addr)
                                                      , R._("TextID:{0}\r\n{1}", U.To0xHexString(info2), errorMessage), i));
                    }
                }

                //武器攻撃範囲のチェック
                MakeCheckErrorWeaponRange(itemWeaponEffectDic, item_addr, i, errors);
            }
        }
Example #5
0
        public static void ConversationTextMessage(uint textid, List <ErrorSt> errors, Type cond, uint addr, uint tag = U.NOT_FOUND)
        {
            string text         = FETextDecode.Direct(textid);
            string errorMessage = TextForm.CheckConversationTextMessage(text, textid, TextForm.MAX_SERIF_WIDTH);

            if (errorMessage != "")
            {
                if (IsVanillaGlitchForConversationTextMessage(text, textid, cond))
                {
                    return;
                }
                errors.Add(new FELint.ErrorSt(cond, U.toOffset(addr)
                                              , R._("TextID:{0}\r\n{1}", U.To0xHexString(textid), errorMessage), tag));
            }
        }
Example #6
0
 static InputFormRef Init(Form self)
 {
     return(new InputFormRef(self
                             , ""
                             , Program.ROM.p32(Program.ROM.RomInfo.unit_pointer())
                             , 52
                             , (int i, uint addr) =>
     {    //個数が固定できまっている
         return i < Program.ROM.RomInfo.unit_maxcount();
     }
                             , (int i, uint addr) =>
     {
         uint id = Program.ROM.u16(addr);
         return U.ToHexString(i + 1) + " " + FETextDecode.Direct(id);
     }
                             ));
 }
        public static String GetMapNameWhereAddr(uint addr)
        {
            uint id;

            if (Program.ROM.RomInfo.version() == 6)
            {//FE6
                id = Program.ROM.u16(addr + 56);
                return(FETextDecode.Direct(id));
            }

            String map_cp   = "";
            uint   chaptere = Program.ROM.u8(addr + 128);

            if (chaptere > 0)
            {
                map_cp = ChaptereToString(chaptere);
            }

            id = Program.ROM.u16(addr + 112);
            return(map_cp + " " + TextForm.Direct(id));
        }
Example #8
0
        public void ImportFont(Form self, string FontROMTextBox, bool FontAutoGenelateCheckBox, Font ttf)
        {
            string filename = FontROMTextBox;

            this.YourROM = new ROM();

            this.ProcessedFont      = new Dictionary <string, bool>();
            this.MyselfPriorityCode = PatchUtil.SearchPriorityCode();

            string version;

            if (this.YourROM.Load(filename, out version))
            {//フォントを取るようのROM
                this.YourPriorityCode = PatchUtil.SearchPriorityCode(this.YourROM);
            }
            else
            {
                this.YourROM = null;
            }

            if (FontAutoGenelateCheckBox)
            {//自動生成する
                this.UseAutoGenFont = ttf;
            }
            else
            {//自動生成しない
                this.UseAutoGenFont = null;
            }
            FETextDecode decode = new FETextDecode();


            //少し時間がかかるので、しばらくお待ちください表示.
            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(self))
            {
                this.UndoData = Program.Undo.NewUndoData("FONT Import");

                //文字列からフォントを探索
                {
                    List <U.AddrResult> list = TextForm.MakeItemList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        string text = decode.Decode((uint)i);
                        pleaseWait.DoEvents("String:" + U.To0xHexString((uint)i));

                        FontImporter(text);
                    }
                }
                //メニュー1
                if (Program.ROM.RomInfo.is_multibyte())
                {
                    List <U.AddrResult> menuDefineList = MenuDefinitionForm.MakeListAll();
                    for (int n = 0; n < menuDefineList.Count; n++)
                    {
                        if (!U.isSafetyOffset(menuDefineList[n].addr + 8))
                        {
                            continue;
                        }
                        uint p = menuDefineList[n].addr + 8;
                        if (!U.isSafetyOffset(Program.ROM.p32(p)))
                        {
                            continue;
                        }
                        List <U.AddrResult> list = MenuCommandForm.MakeListPointer(p);
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!U.isSafetyOffset(list[i].addr))
                            {
                                continue;
                            }
                            uint   textid = Program.ROM.u32(list[i].addr + 0);
                            string str    = FETextDecode.Direct(textid);

                            pleaseWait.DoEvents("Menu:" + U.To0xHexString(textid));
                            FontImporter(str);
                        }
                    }
                }

                //地形
                if (Program.ROM.RomInfo.is_multibyte())
                {
                    List <U.AddrResult> list = MapTerrainNameForm.MakeList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!U.isSafetyOffset(list[i].addr))
                        {
                            continue;
                        }
                        uint   textid = Program.ROM.u32(list[i].addr + 0);
                        string str    = FETextDecode.Direct(textid);

                        pleaseWait.DoEvents("Terrain:" + U.To0xHexString(textid));
                        FontImporter(str);
                    }
                }

                //サウンドルーム
                //FE7のサウンドルームは、日本語直地
                if (Program.ROM.RomInfo.is_multibyte() && Program.ROM.RomInfo.version() == 7)
                {
                    List <U.AddrResult> list = SoundRoomForm.MakeList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!U.isSafetyOffset(list[i].addr))
                        {
                            continue;
                        }
                        uint   textid = Program.ROM.u32(list[i].addr + 12);
                        string str    = FETextDecode.Direct(textid);

                        pleaseWait.DoEvents("SoundRoom:" + U.To0xHexString(textid));
                        FontImporter(str);
                    }
                }
                //その他文字列
                {
                    List <U.AddrResult> list = OtherTextForm.MakeList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!U.isSafetyOffset(list[i].addr))
                        {
                            continue;
                        }

                        uint   p_str = Program.ROM.p32(list[i].addr);
                        string str   = Program.ROM.getString(p_str);

                        pleaseWait.DoEvents("Other:" + U.To0xHexString(p_str));
                        FontImporter(str);
                    }
                }

                Program.Undo.Push(this.UndoData);
            }
        }
Example #9
0
        public void ExportallText(Form self
                                  , string writeTextFileName
                                  , string tralnslate_from, string tralnslate_to
                                  , string rom_from, string rom_to
                                  , bool isModifiedTextOnly
                                  , bool isOneLiner
                                  )
        {
            //少し時間がかかるので、しばらくお待ちください表示.
            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(self))
            {
                FETextDecode decode = new FETextDecode();

                Dictionary <string, string> transDic = TranslateTextUtil.MakeFixedDic(tralnslate_from, tralnslate_to, rom_from, rom_to);
                if (ExportFilterArray != null)
                {
                    using (StreamWriter writer = new StreamWriter(writeTextFileName))
                    {
                        List <U.AddrResult> list = TextForm.MakeItemList();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!ExportFilterArray.ContainsKey(i))
                            {
                                continue;
                            }
                            string text = decode.Decode((uint)i);

                            pleaseWait.DoEvents("Text:" + U.To0xHexString((uint)i));
                            ExportText(writer, (uint)i, text, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner);
                        }
                    }
                    return;
                }

                using (StreamWriter writer = new StreamWriter(writeTextFileName))
                {
                    //テキスト
                    {
                        List <U.AddrResult> list = TextForm.MakeItemList();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (ExportFilterArray != null && ExportFilterArray[i] != false)
                            {
                                continue;
                            }
                            string text = decode.Decode((uint)i);

                            pleaseWait.DoEvents("Text:" + U.To0xHexString((uint)i));
                            ExportText(writer, (uint)i, text, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner);
                        }
                    }

                    //メニュー1
                    if (Program.ROM.RomInfo.is_multibyte)
                    {
                        List <U.AddrResult> menuDefineList = MenuDefinitionForm.MakeListAll();
                        for (int n = 0; n < menuDefineList.Count; n++)
                        {
                            if (!U.isSafetyOffset(menuDefineList[n].addr + 8))
                            {
                                continue;
                            }
                            uint p = menuDefineList[n].addr + 8;
                            if (!U.isSafetyOffset(Program.ROM.p32(p)))
                            {
                                continue;
                            }
                            List <U.AddrResult> list = MenuCommandForm.MakeListPointer(p);
                            for (int i = 0; i < list.Count; i++)
                            {
                                if (!U.isSafetyOffset(list[i].addr))
                                {
                                    continue;
                                }
                                uint   text_pointer = list[i].addr + 0;
                                uint   textid       = Program.ROM.u32(text_pointer);
                                string str          = FETextDecode.Direct(textid);
                                if (str.Trim() == "")
                                {
                                    continue;
                                }

                                pleaseWait.DoEvents("Menu:" + U.To0xHexString(textid));
                                ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner);
                            }
                        }
                    }

                    //地形
                    if (Program.ROM.RomInfo.is_multibyte)
                    {
                        List <U.AddrResult> list = MapTerrainNameForm.MakeList();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!U.isSafetyOffset(list[i].addr))
                            {
                                continue;
                            }
                            uint   text_pointer = list[i].addr + 0;
                            uint   textid       = Program.ROM.u32(text_pointer);
                            string str          = FETextDecode.Direct(textid);
                            if (str.Trim() == "")
                            {
                                continue;
                            }

                            pleaseWait.DoEvents("Terrain:" + U.To0xHexString(textid));
                            ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner);
                        }
                    }

                    //サウンドルーム
                    //FE7のサウンドルームは、日本語直地
                    if (Program.ROM.RomInfo.is_multibyte && Program.ROM.RomInfo.version == 7)
                    {
                        List <U.AddrResult> list = SoundRoomForm.MakeList();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!U.isSafetyOffset(list[i].addr))
                            {
                                continue;
                            }
                            uint   text_pointer = list[i].addr + 12;
                            uint   textid       = Program.ROM.u32(text_pointer);
                            string str          = FETextDecode.Direct(textid);
                            if (str.Trim() == "")
                            {
                                continue;
                            }

                            pleaseWait.DoEvents("SoundRoom:" + U.To0xHexString(textid));
                            ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner);
                        }
                    }
                    //その他文字列
                    {
                        List <U.AddrResult> list = OtherTextForm.MakeList();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!U.isSafetyOffset(list[i].addr))
                            {
                                continue;
                            }
                            uint   text_pointer = list[i].addr + 0;
                            uint   p_str        = Program.ROM.p32(text_pointer);
                            string str          = Program.ROM.getString(p_str);
                            if (str.Trim() == "")
                            {
                                continue;
                            }

                            pleaseWait.DoEvents("Other:" + U.To0xHexString(p_str));
                            ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner);
                        }
                    }
                }
            }
        }