bool LoadTBL(OptionForm.textencoding_enum textencoding, ROM rom)
        {
            if (rom == null)
            {
                return(false);
            }

            if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
            {
                string resoucefilename = System.IO.Path.Combine(Program.BaseDirectory, "config", "translate", "zh_tbl", rom.RomInfo.TitleToFilename() + ".tbl");
                if (!File.Exists(resoucefilename))
                {
                    Log.Error("tbl not found. filename:{0}", resoucefilename);
                    return(false);
                }
                this.TBLEncode = new SystemTextEncoderTBLEncode(resoucefilename);
                this.Encoder   = null;
                return(true);
            }
            else if (textencoding == OptionForm.textencoding_enum.EN_TBL)
            {
                string resoucefilename = System.IO.Path.Combine(Program.BaseDirectory, "config", "translate", "en_tbl", rom.RomInfo.TitleToFilename() + ".tbl");
                if (!File.Exists(resoucefilename))
                {
                    Log.Error("tbl not found. filename:{0}", resoucefilename);
                    return(false);
                }
                this.TBLEncode = new SystemTextEncoderTBLEncode(resoucefilename);
                this.Encoder   = null;
                return(true);
            }
            else if (textencoding == OptionForm.textencoding_enum.AR_TBL)
            {
                string resoucefilename = System.IO.Path.Combine(Program.BaseDirectory, "config", "translate", "ar_tbl", rom.RomInfo.TitleToFilename() + ".arabic_tbl");
                if (!File.Exists(resoucefilename))
                {
                    Log.Error("tbl not found. filename:{0}", resoucefilename);
                    return(false);
                }
                SystemTextEncoderTBLEncode inner = null;
                if (Program.ROM.RomInfo.version() == 6)
                {
                    string resoucefilename_inner = System.IO.Path.Combine(Program.BaseDirectory, "config", "translate", "en_tbl", rom.RomInfo.TitleToFilename() + ".tbl");
                    if (!File.Exists(resoucefilename))
                    {
                        return(false);
                    }
                    inner = new SystemTextEncoderTBLEncode(resoucefilename_inner);
                }
                this.TBLEncode = new SystemTextEncoderArabianTBLEncode(resoucefilename, inner);
                this.Encoder   = null;
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 static bool isZH()
 {
     if (Program.ROM.RomInfo.is_multibyte)
     {
         OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
         if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 3
0
 private void FontButton_Click(object sender, EventArgs e)
 {
     if (Program.ROM.RomInfo.is_multibyte())
     {
         OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
         if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
         {
             InputFormRef.JumpForm <FontZHForm>();
             return;
         }
     }
     InputFormRef.JumpForm <FontForm>();
 }
        public void AddJPFonts(List <Address> list)
        {
            if (!Program.ROM.RomInfo.is_multibyte)
            {//英語ROMなので無関係
                return;
            }
            OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
            if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
            {//フォントシステムが違うので無理
                return;
            }

            if (Program.ROM.RomInfo.version != 8)
            {//FE8のみ
                return;
            }

            //消したらダメなのを登録
            MakeKeepFontFE8J();


            //既存のフォントテーブルのクリア
            uint textFontStart = 0x5942F4;
            uint textFontEnd   = 0x5B8CDC;

            SerchCustomFonts(false, textFontEnd, list);
            Address.AddAddress(list
                               , textFontStart
                               , textFontEnd - textFontStart
                               , U.NOT_FOUND
                               , "TextFont Wipe"
                               , Address.DataTypeEnum.BIN
                               );
            uint itemFontStart = 0x579CCC;
            uint itemFontEnd   = 0x593ECC;

            SerchCustomFonts(true, itemFontEnd, list);
            Address.AddAddress(list
                               , itemFontStart
                               , itemFontEnd - itemFontStart
                               , U.NOT_FOUND
                               , "ItemFont Wipe"
                               , Address.DataTypeEnum.BIN
                               );
            //アイテムフォントのテーブルを消す
            Program.ROM.write_fill(0x57994C, 896, 0);
            //テキストフォントのテーブルを消す
            Program.ROM.write_fill(0x593F74, 896, 0);
        }
Esempio n. 5
0
        public FontForm()
        {
            InitializeComponent();
            this.ZoomComboBox.SelectedIndex = 2;
            this.FontType.SelectedIndex     = 0;
            U.SetIcon(ExportButton, Properties.Resources.icon_arrow);
            U.SetIcon(ImportButton, Properties.Resources.icon_upload);

            UseFontNameTextEdit.Text            = UseFontNameTextEdit.Font.FontFamily.ToString();
            AutoGenbutton.AccessibleDescription = R._("ROMに存在しいフォントをPCに存在するフォントから自動的に作成します。\r\nまとめて複数のフォントを一気に作りたい場合は、ROM翻訳ツールから作ることをお勧めします。");

            if (Program.ROM.RomInfo.is_multibyte())
            {
                OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
                if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
                {
                    Debug.Assert(false);
                }
                else if (textencoding == OptionForm.textencoding_enum.EN_TBL)
                {
                    this.FontSample.Text = "AB@cd"; ///No Translate
                    this.SearchChar.Text = "X";     ///No Translate
                }
                else
                {
                    this.FontSample.Text = "あい@うえお"; ///No Translate
                    this.SearchChar.Text = "剣";      ///No Translate
                }
            }
            else
            {
                this.FontSample.Text = "AB@cd"; ///No Translate
                this.SearchChar.Text = "X";     ///No Translate
            }

            U.AllowDropFilename(this, ImageFormRef.IMAGE_FILE_FILTER, (string filename) =>
            {
                using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename))
                {
                    ImportButton_Click(null, null);
                }
            });
        }
        public void Build(OptionForm.textencoding_enum textencoding, ROM rom)
        {
            bool r = LoadTBL(textencoding, rom);

            if (r)
            {//TBLを利用.
                return;
            }

            if (textencoding == OptionForm.textencoding_enum.Auto)
            {//自動選択
                PatchUtil.PRIORITY_CODE priorityCode = PatchUtil.SearchPriorityCode(rom);
                if (priorityCode == PatchUtil.PRIORITY_CODE.UTF8)
                {
                    this.Encoder = System.Text.Encoding.GetEncoding("UTF-8");
                }
                else if (priorityCode == PatchUtil.PRIORITY_CODE.LAT1)
                {
                    this.Encoder = System.Text.Encoding.GetEncoding("iso-8859-1");
                }
                else
                {
                    //ディフォルトは日本語.
                    this.Encoder = System.Text.Encoding.GetEncoding("Shift_JIS");
                }
            }
            else if (textencoding == OptionForm.textencoding_enum.LAT1)
            {
                this.Encoder = System.Text.Encoding.GetEncoding("iso-8859-1");
            }
            else if (textencoding == OptionForm.textencoding_enum.UTF8)
            {
                this.Encoder = System.Text.Encoding.GetEncoding("UTF-8");
            }
            else if (textencoding == OptionForm.textencoding_enum.Shift_JIS)
            {
                this.Encoder = System.Text.Encoding.GetEncoding("Shift_JIS");
            }

            this.TBLEncode = null;
        }
 public void Build()
 {
     OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
     Build(textencoding, Program.ROM);
 }
 public SystemTextEncoder(OptionForm.textencoding_enum textencoding, ROM rom)
 {
     Build(textencoding, rom);
 }
Esempio n. 9
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));
            }
        }