예제 #1
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            Bitmap bitmap        = DrawBG((uint)this.AddressList.SelectedIndex + 1);
            int    palette_count = ImageUtil.GetPalette16Count(bitmap);

            ImageFormRef.ExportImage(this, bitmap, InputFormRef.MakeSaveImageFilename(), palette_count);
        }
        private void ImportButton_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }

            int width         = MAP_X * 8;
            int height        = MAP_Y * 8;
            int palette_count = 4;

            if (bitmap.Width != width || bitmap.Height != height)
            {
                R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height);
                return;
            }
            int bitmap_palette_count = ImageUtil.GetPalette16Count(bitmap);

            if (bitmap_palette_count > palette_count)
            {
                R.ShowStopError("パレット数が正しくありません。\r\n{1}種類以下(16色*{1}種類) でなければなりません。\r\n\r\n選択された画像のパレット種類:{0}種類", bitmap_palette_count, palette_count);
                return;
            }
            //元画像
            this.IsNotUseList = new List <int>();
            this.HeightList   = new List <int>();
            Bitmap orignalBitmap = GetChipImage(this.IsNotUseList, this.HeightList);

            byte[] orignalImage = ImageUtil.ImageToByte16Tile(orignalBitmap, orignalBitmap.Width, orignalBitmap.Height);
            orignalBitmap.Dispose();

            //TSAを維持して、元画像に最小限の変化を加えたもの.
            byte[] saveImage = ImageUtil.ImageToByteKeepTSA(bitmap, width, height, this.Map, orignalImage);

            //画像等データの書き込み
            Undo.UndoData undodata = Program.Undo.NewUndoData(this);

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                //画像データを5分割して書き込み
                RevChipImage(saveImage, undodata);

                //パレットデータの書き込み
                byte[] paletteData    = ImageUtil.ImageToPalette(bitmap, palette_count);
                uint   newPaletteAddr = ImageFormRef.WriteImageData(this
                                                                    , Program.ROM.p32(Program.ROM.RomInfo.battle_screen_palette_pointer())
                                                                    , Program.ROM.RomInfo.battle_screen_palette_pointer()
                                                                    , paletteData, false, undodata);

                Program.Undo.Push(undodata);

                PALETTE_ADDRESS.Value = newPaletteAddr;
                this.PaletteIndexComboBox.SelectedIndex = 0;
            }
            LoadChipsetInfo();  //チップセット関係の読込
            LoadBattleScreen(); //ROM TSAをメモリに読み込んで
            MakeBattleScreen(); //TSA描画
        }
예제 #3
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }
            int width  = 2 * 8;
            int height = 2 * 8;

            if (bitmap.Width != width || bitmap.Height != height)
            {
                R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height);
                return;
            }

            uint skillPaletteAddress = GetSkillPaletteAddress((uint)W2.Value);
            //check palette
            {
                string palette_error =
                    ImageUtil.CheckPalette(bitmap.Palette
                                           , Program.ROM.Data
                                           , skillPaletteAddress
                                           , U.NOT_FOUND
                                           );
                if (palette_error != "")
                {
                    ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>();
                    f.SetErrorMessage(palette_error);
                    f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, skillPaletteAddress));
                    f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, skillPaletteAddress));
                    f.ShowForceButton();
                    f.ShowDialog();

                    bitmap = f.GetResultBitmap();
                    if (bitmap == null)
                    {
                        return;
                    }
                }
            }

            uint index = (uint)this.AddressList.SelectedIndex;

            uint iconbaseaddr = Program.ROM.p32(Program.ROM.RomInfo.icon_pointer());
            uint size         = 16 * 16 / 2; // /2しているのは16色のため
            uint addr         = iconbaseaddr + (size * (0x100 + index));

            byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height);

            //画像等データの書き込み
            Undo.UndoData undodata = Program.Undo.NewUndoData(this);

            Program.ROM.write_range(U.toOffset(addr), image, undodata);
            Program.Undo.Push(undodata);

            InputFormRef.ReloadAddressList();
            InputFormRef.ShowWriteNotifyAnimation(this, addr);
        }
예제 #4
0
        private void ObjImportButton_Click(object sender, EventArgs e)
        {
            if (this.MapStyle.SelectedIndex < 0)
            {
                return;
            }

            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }

            MapStyleEditorImportImageOptionForm f = (MapStyleEditorImportImageOptionForm)InputFormRef.JumpFormLow <MapStyleEditorImportImageOptionForm>();
            DialogResult dr = f.ShowDialog();

            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            if (f.ImportOption == MapStyleEditorImportImageOptionForm.ImportOptionEnum.WithPalette)
            {
                ImportObj(bitmap, importObjWithPalette: true);
            }
            else if (f.ImportOption == MapStyleEditorImportImageOptionForm.ImportOptionEnum.ImageOnly)
            {
                ImportObj(bitmap, importObjWithPalette: false);
            }
            else if (f.ImportOption == MapStyleEditorImportImageOptionForm.ImportOptionEnum.OnePicture)
            {
                ImportObjOnePicture(bitmap);
            }
        }
예제 #5
0
        private void Import_Palette_By_Address(uint palette_address)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }
            int palette_count        = 1;
            int bitmap_palette_count = ImageUtil.GetPalette16Count(bitmap);

            if (bitmap_palette_count > palette_count)
            {
                R.ShowStopError("パレット数が正しくありません。\r\n{1}種類以下(16色*{1}種類) でなければなりません。\r\n\r\n選択された画像のパレット種類:{0}種類", bitmap_palette_count, palette_count);
                return;
            }
            //パレット
            byte[] palette = ImageUtil.ImageToPalette(bitmap, palette_count);

            Program.Undo.Push(this.Text + "_unit_icon", palette_address, 0x20);
            Program.ROM.write_range(palette_address, palette);

            IconRedraw();

            InputFormRef.ShowWriteNotifyAnimation(this, palette_address);
        }
예제 #6
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            uint pic_address  = (uint)P0.Value;
            int  palette_type = X_PALETTE.SelectedIndex;

            string filename = ImageFormRef.SaveDialogPngOrGIF(InputFormRef);

            if (filename == "")
            {
                return;
            }

            string ext = U.GetFilenameExt(filename);

            if (ext == ".GIF")
            {
                bool r = SaveAnimeGif(filename, pic_address, palette_type);
                if (!r)
                {
                    return;
                }
            }
            else
            {
                Bitmap bitmap = DrawMoveUnitIcon(pic_address, palette_type);
                ImageUtil.BlackOutUnnecessaryColors(bitmap, 1);
                U.BitmapSave(bitmap, filename);
            }

            //エクスプローラで選択しよう
            U.SelectFileByExplorer(filename);
        }
예제 #7
0
        private void ImportButton3_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }
            int width  = 18 * 8;
            int height = 2 * 8;

            if (bitmap.Width != width || bitmap.Height != height)
            {
                R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height);
                return;
            }

            byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height);

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                //画像等データの書き込み
                Undo.UndoData undodata = Program.Undo.NewUndoData(this);
                this.InputFormRef.WriteImageData(this.P8, image, true, undodata);
                Program.Undo.Push(undodata);
            }

            //ポインタの書き込み
            this.WriteButton.PerformClick();
        }
        public static void SaveAPImages(string filename, uint image_addr, uint ap_addr, int x, int y)
        {
            image_addr = U.toOffset(image_addr);
            Bitmap parts = DrawBorderBitmap(image_addr);

            ap_addr = U.toOffset(ap_addr);
            ImageUtilAP ap = new ImageUtilAP();
            bool        r  = ap.Parse(ap_addr);

            if (!r)
            {
                return;
            }

            Bitmap borderimg = ImageUtil.Blank(256, 160, parts);

            ap.DrawFrame(borderimg, 0, x, y, parts);
            string export_filename = ImageFormRef.ExportImage(null, borderimg, filename);

            string name_filename = MakeBorderNameImageFileName(export_filename);

            borderimg = ImageUtil.Blank(256, 160, parts);
            ap.DrawFrame(borderimg, 1, x, y, parts);
            ImageUtil.BlackOutUnnecessaryColors(borderimg, 1);
            borderimg.Save(name_filename);
        }
예제 #9
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }
            int width  = 4 * 8;
            int height = 60 * 8;

            if (width != bitmap.Width || height > bitmap.Height)
            {
                Bitmap newbitmap = ImageUtil.ConvertSizeFormat(bitmap, width, height);
                if (newbitmap == null)
                {
                    R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height);
                    return;
                }
                bitmap.Dispose();
                bitmap = newbitmap;
            }

            //check palette
            {
                string palette_error =
                    ImageUtil.CheckPalette(bitmap.Palette
                                           , Program.ROM.Data
                                           , (Program.ROM.RomInfo.unit_icon_palette_address())
                                           , (Program.ROM.RomInfo.unit_icon_enemey_palette_address())
                                           );
                if (palette_error != "")
                {
                    ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>();
                    f.SetErrorMessage(palette_error);
                    f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_palette_address())));
                    f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_palette_address())));
                    f.SetReOrderImage2(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_enemey_palette_address())));
                    f.ShowForceButton();
                    f.ShowDialog();

                    bitmap = f.GetResultBitmap();
                    if (bitmap == null)
                    {
                        return;
                    }
                }
            }

            byte[] image = ImageUtil.ImageToByte16Tile(bitmap, bitmap.Width, bitmap.Height);

            //画像等データの書き込み
            Undo.UndoData undodata = Program.Undo.NewUndoData(this);
            this.InputFormRef.WriteImageData(this.P0, image, true, undodata);
            Program.Undo.Push(undodata);

            //ポインタの書き込み
            this.WriteButton.PerformClick();
        }
예제 #10
0
        void InitLoadChipsetInfo()
        {
            uint image = Program.ROM.p32(this.ZImgPointer);
            Size size  = U.CalcLZ77ImageToSizePointer(this.ZImgPointer);

            this.image1_ZIMAGE.Value = image;
            this.Image1 = new ImageFormRef(this, "image1", size.Width, size.Height, 1, this.ZImgPointer, 0, this.PalettePointer);
        }
예제 #11
0
 private void ExportButton_Click(object sender, EventArgs e)
 {
     if (this.DrawBitmap == null)
     {
         return;
     }
     ImageFormRef.ExportImage(this, this.DrawBitmap, InputFormRef.MakeSaveImageFilename(), 1);
 }
예제 #12
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }
            int width         = 32 * 8;
            int height        = GetThisImageHeight();
            int palette_count = 8;

            if (bitmap.Width != width || bitmap.Height != height)
            {
                if (bitmap.Width != 30 * 8 || bitmap.Height != height)
                {
                    R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height);
                    return;
                }
                //右側に余白がない場合、自動的に挿入する
                bitmap = ImageUtil.Copy(bitmap, 0, 0, width, height);
            }
            int bitmap_palette_count = ImageUtil.GetPalette16Count(bitmap);

            if (bitmap_palette_count > palette_count)
            {
                string error = R._("パレット数が正しくありません。\r\n{1}種類以下(16色*{1}種類) でなければなりません。\r\n\r\n選択された画像のパレット種類:{0}種類", bitmap_palette_count, palette_count) + "\r\n" + DecreaseColorTSAToolForm.GetExplainDecreaseColor();
                R.ShowStopError(error);
                return;
            }

            byte[] image; //画像
            byte[] tsa;   //TSA
            string error_string = ImageUtil.ImageToByteHeaderPackedTSA(bitmap, width, height, out image, out tsa);

            if (error_string != "")
            {
                error_string += "\r\n" + DecreaseColorTSAToolForm.GetExplainDecreaseColor();
                R.ShowStopError(error_string);
                return;
            }

            //パレット
            byte[] palette = ImageUtil.ImageToPalette(bitmap, palette_count);

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                //画像等データの書き込み
                Undo.UndoData undodata = Program.Undo.NewUndoData(this);
                this.InputFormRef.WriteImageData(this.P0, image, true, undodata);
                this.InputFormRef.WriteImageData(this.P4, palette, false, undodata);
                this.InputFormRef.WriteImageData(this.P8, tsa, true, undodata);
                Program.Undo.Push(undodata);
            }

            //ポインタの書き込み
            this.WriteButton.PerformClick();
        }
예제 #13
0
        private void SystemIconForm_Load(object sender, EventArgs e)
        {
            Size system_icon_size = GetSystemIconImageSize();

            system_icon             = new ImageFormRef(this, "system_icon", system_icon_size.Width, system_icon_size.Height, 1, Program.ROM.RomInfo.system_icon_pointer(), 0, Program.ROM.RomInfo.system_icon_palette_pointer());
            system_move_allowicon   = new ImageFormRef(this, "system_move_allowicon", 32 * 8, 2 * 8, 1, Program.ROM.RomInfo.system_move_allowicon_pointer(), 0, Program.ROM.RomInfo.system_move_allowicon_palette_pointer());
            system_weapon_icon_icon = new ImageFormRef(this, "system_weapon_icon_icon", 32 * 8, 32, 1, Program.ROM.RomInfo.system_weapon_icon_pointer(), 0, Program.ROM.RomInfo.system_weapon_icon_palette_pointer());
            system_music_icon_icon  = new ImageFormRef(this, "system_music_icon_icon", 32 * 8, 32, 1, Program.ROM.RomInfo.system_music_icon_pointer(), 0, Program.ROM.RomInfo.system_music_icon_palette_pointer());

            if (Program.ROM.RomInfo.version() >= 7)
            {
                systemmenu_goal = new ImageFormRef(this, "systemmenu_goal", 256, 256, 4, Program.ROM.RomInfo.systemmenu_common_image_pointer(), Program.ROM.RomInfo.systemmenu_goal_tsa_pointer(), Program.ROM.RomInfo.systemmenu_common_palette_pointer());
                systemmenu_goal_panel.Show();
            }
            else
            {//FE6
                systemmenu_goal_panel.Hide();
            }

            if (Program.ROM.RomInfo.version() >= 8)
            {//FE8
                systemmenu_badstatus = new ImageFormRef(this, "systemmenu_badstatus", 40, 8 * 9, 1, Program.ROM.RomInfo.systemmenu_badstatus_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                systemmenu_old_badstatus_panel.Hide();

                systemmenu_badstatus_panel.Height   = systemmenu_badstatus_panel.Height * 2;
                systemmenu_badstatus_Picture.Height = systemmenu_badstatus_Picture.Height * 2;
                InputFormRef.markupJumpLabel(X_StatusBackgroundLink);
            }
            else if (Program.ROM.RomInfo.version() >= 7)
            {//FE7
                systemmenu_badstatus     = new ImageFormRef(this, "systemmenu_badstatus", 32, 8 * 4, 1, Program.ROM.RomInfo.systemmenu_badstatus_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                systemmenu_old_badstatus = new ImageFormRef(this, "systemmenu_old_badstatus", 256, 32, 1, Program.ROM.RomInfo.systemmenu_badstatus_old_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                X_StatusBackgroundLink.Hide();
            }
            else
            {//FE6
                systemmenu_old_badstatus = new ImageFormRef(this, "systemmenu_old_badstatus", 256, 32, 1, Program.ROM.RomInfo.systemmenu_badstatus_old_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                systemmenu_badstatus_panel.Hide();
                systemmenu_old_badstatus_panel.Location = systemmenu_badstatus_panel.Location;
                X_StatusBackgroundLink.Hide();
            }
            systemmenu_terrain       = new ImageFormRef(this, "systemmenu_terrain", 256, 256, 4, Program.ROM.RomInfo.systemmenu_common_image_pointer(), Program.ROM.RomInfo.systemmenu_terrain_tsa_pointer(), Program.ROM.RomInfo.systemmenu_common_palette_pointer());
            systemmenu_name          = new ImageFormRef(this, "systemmenu_name", 256, 256, 4, Program.ROM.RomInfo.systemmenu_name_image_pointer(), Program.ROM.RomInfo.systemmenu_name_tsa_pointer(), Program.ROM.RomInfo.systemmenu_name_palette_pointer());
            systemmenu_battlepreview = new ImageFormRef(this, "systemmenu_battlepreview", 256, 256, 4, Program.ROM.RomInfo.systemmenu_battlepreview_image_pointer(), Program.ROM.RomInfo.systemmenu_battlepreview_tsa_pointer(), Program.ROM.RomInfo.systemmenu_battlepreview_palette_pointer());

            systemarea_move_gradation_palette.Value   = Program.ROM.p32(Program.ROM.RomInfo.systemarea_move_gradation_palette_pointer());
            systemarea_attack_gradation_palette.Value = Program.ROM.p32(Program.ROM.RomInfo.systemarea_attack_gradation_palette_pointer());
            systemarea_staff_gradation_palette.Value  = Program.ROM.p32(Program.ROM.RomInfo.systemarea_staff_gradation_palette_pointer());

            InputFormRef.markupJumpLabel(X_Jump_Patch);
            InputFormRef.markupJumpLabel(X_GraphicsTool);
            InputFormRef.markupJumpLabel(X_Internet);
            systemIconPictureBox1.Image = ImageSystemIconForm.Allows(8);
            systemIconPictureBox2.Image = ImageSystemIconForm.Fort();
            systemIconPictureBox3.Image = ImageSystemIconForm.Vendor();
            IconRedraw();
        }
예제 #14
0
        private void WorldMapImageFE7Form_Load(object sender, EventArgs e)
        {
            WMPictureBox.Image = DrawWorldMap();
            WMImageMap.Value   = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_image_pointer());
            WMPalette.Value    = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_palette_pointer());
            WMtsaMap.Value     = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_palettemap_pointer());

            WMEvent = new ImageFormRef(this, "WMEvent", 32 * 8, 20 * 8, 4, Program.ROM.RomInfo.worldmap_event_image_pointer(), Program.ROM.RomInfo.worldmap_event_tsa_pointer(), Program.ROM.RomInfo.worldmap_event_palette_pointer());
        }
예제 #15
0
        private void ImportAPButton_Click(object sender, EventArgs e)
        {
            string title  = R._("読込むファイル名を選択してください");
            string filter = R._("AP|*.romtcs.ap.bin|All files|*");

            OpenFileDialog open = new OpenFileDialog();

            open.Title  = title;
            open.Filter = filter;

            string filename;

            if (ImageFormRef.GetDragFilePath(out filename))
            {
            }
            else
            {
                DialogResult dr = open.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
                if (open.FileNames.Length <= 0 || !U.CanReadFileRetry(open.FileNames[0]))
                {
                    return;
                }
                filename = open.FileNames[0];
                Program.LastSelectedFilename.Save(this, "", open);
            }

            using (InputFormRef.AutoPleaseWait wait = new InputFormRef.AutoPleaseWait(this))
            {
                byte[] ap         = File.ReadAllBytes(filename);
                uint   ap_address = U.toOffset((uint)P4.Value);

                string        undoname = this.Text + " AP:" + U.ToHexString(ap_address);
                Undo.UndoData undodata = Program.Undo.NewUndoData(undoname);

                uint newaddr = InputFormRef.WriteBinaryData(this
                                                            , ap_address
                                                            , ap
                                                            , InputFormRef.get_data_pos_callback_ap
                                                            , undodata
                                                            );
                if (newaddr == U.NOT_FOUND)
                {
                    Program.Undo.Rollback(undodata);
                    return;
                }
                Program.Undo.Push(undodata);

                this.P4.Value = U.toPointer(newaddr);
            }

            //ポインタの書き込み
            this.WriteButton.PerformClick();
        }
        private void ImportButton3_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this);

            if (bitmap == null)
            {
                return;
            }
            int width  = 18 * 8;
            int height = 2 * 8;

            if (bitmap.Width != width || bitmap.Height != height)
            {
                R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height);
                return;
            }

            //check palette
            {
                string palette_error =
                    ImageUtil.CheckPalette(bitmap.Palette
                                           , Program.ROM.Data
                                           , Program.ROM.RomInfo.image_chapter_title_palette()
                                           , U.NOT_FOUND
                                           );
                if (palette_error != "")
                {
                    ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>();
                    f.SetErrorMessage(palette_error);
                    f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, Program.ROM.RomInfo.image_chapter_title_palette()));
                    f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, Program.ROM.RomInfo.image_chapter_title_palette()));
                    f.ShowForceButton();
                    f.ShowDialog();

                    bitmap = f.GetResultBitmap();
                    if (bitmap == null)
                    {
                        return;
                    }
                }
            }

            byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height);

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                //画像等データの書き込み
                Undo.UndoData undodata = Program.Undo.NewUndoData(this);
                this.InputFormRef.WriteImageData(this.P8, image, true, undodata);
                Program.Undo.Push(undodata);
            }

            //ポインタの書き込み
            this.WriteButton.PerformClick();
        }
예제 #17
0
        private void OrignalFilenameSelectButton_Click(object sender, EventArgs e)
        {
            string filename = ImageFormRef.OpenFilenameDialogFullColor(this);

            if (filename == "")
            {
                return;
            }

            this.OrignalFilename.Text = filename;
        }
예제 #18
0
 private void ExportButton_Click(object sender, EventArgs e)
 {
     if (this.DrawBimap == null)
     {
         return;
     }
     ImageFormRef.ExportImage(this
                              , this.DrawBimap
                              , InputFormRef.MakeSaveImageFilename(this, U.ToHexString((uint)Image.Value))
                              , (int)U.atoi(this.USE_PALETTE_NUMBER.Text)
                              );
 }
예제 #19
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            if (this.DrawBitmap == null)
            {
                return;
            }

            ImageFormRef.ExportImage(this
                                     , this.DrawBitmap
                                     , InputFormRef.MakeSaveImageFilename(this, U.ToHexString(this.PALETTE_ADDRESS.Value))
                                     , this.MaxPaletteCount);
        }
예제 #20
0
        private void MapChipImportButton_Click(object sender, EventArgs e)
        {
            if (MapStyleEditorFormWarningVanillaTileOverraideForm.CheckWarningUI((uint)ChipsetConfigAddress.Value))
            {
                return;
            }

            string title  = R._("読み込むファイル名を選択してください");
            string filter = R._("mapchip_config|*.mapchip_config|All files|*");

            string filename;

            if (ImageFormRef.GetDragFilePath(out filename))
            {
            }
            else
            {
                OpenFileDialog open = new OpenFileDialog();
                open.Title  = title;
                open.Filter = filter;
                Program.LastSelectedFilename.Load(this, "mapchip_config", open);
                DialogResult dr = open.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
                if (!U.CanReadFileRetry(open))
                {
                    return;
                }
                Program.LastSelectedFilename.Save(this, "mapchip_config", open);
                filename = open.FileNames[0];
            }

            byte[] map_config = File.ReadAllBytes(filename);
            if (map_config.Length < 9216)
            {
                R.ShowStopError("ファイルサイズが小さすぎます. 9216バイト必要です。");
                return;
            }

            Undo.UndoData undodata = Program.Undo.NewUndoData(this);
            bool          r        = OverraideMapConfig(map_config, undodata);

            if (!r)
            {
                return;
            }

            Program.Undo.Push(undodata);
        }
예제 #21
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            Bitmap bitmap   = DrawImageByID((uint)this.AddressList.SelectedIndex);
            uint   typeFlag = (uint)B0.Value;

            if (typeFlag == 0x00)
            {//単体
                ImageFormRef.ExportImage(this, bitmap, InputFormRef.MakeSaveImageFilename(), 8);
            }
            else
            {//10分割
                ImageFormRef.ExportImage(this, bitmap, InputFormRef.MakeSaveImageFilename(), 8);
            }
        }
예제 #22
0
        private void WorldMapImageForm_Load(object sender, EventArgs e)
        {
            WMPictureBox.Image = DrawWorldMap();
            WMImage.Value      = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_image_pointer());
            WMPalette.Value    = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_palette_pointer());
            WMdPalette.Value   = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_dpalette_pointer());
            WMPaletteMap.Value = Program.ROM.u32(Program.ROM.RomInfo.worldmap_big_palettemap_pointer());

            WMEvent  = new ImageFormRef(this, "WMEvent", 32 * 8, 20 * 8, 4, Program.ROM.RomInfo.worldmap_event_image_pointer(), Program.ROM.RomInfo.worldmap_event_tsa_pointer(), Program.ROM.RomInfo.worldmap_event_palette_pointer());
            WMMini   = new ImageFormRef(this, "WMMini", 8 * 8, 8 * 8, 1, Program.ROM.RomInfo.worldmap_mini_image_pointer(), 0, Program.ROM.RomInfo.worldmap_mini_palette_pointer());
            WMPoint1 = new ImageFormRef(this, "WMPoint1", 32 * 8, 8 * 8, 1, Program.ROM.RomInfo.worldmap_icon1_pointer(), 0, Program.ROM.RomInfo.worldmap_icon_palette_pointer());
            WMPoint2 = new ImageFormRef(this, "WMPoint2", 12 * 8, 4 * 8, 1, Program.ROM.RomInfo.worldmap_icon2_pointer(), 0, Program.ROM.RomInfo.worldmap_icon_palette_pointer());

            WMRoad = new ImageFormRef(this, "WMRoad", 8, 120, 1, Program.ROM.RomInfo.worldmap_road_tile_pointer(), 0, Program.ROM.RomInfo.worldmap_icon_palette_pointer());
        }
예제 #23
0
        //顔シートの出力
        private void ExportButton_Click(object sender, EventArgs e)
        {
            uint unit_face = (uint)this.D0.Value;

            if (unit_face != 0)
            {
                Bitmap seetbitmap = DrawPortraitSeetFE6((uint)this.AddressList.SelectedIndex);
                ImageFormRef.ExportImage(this, seetbitmap, InputFormRef.MakeSaveImageFilename());
            }
            else
            {
                Bitmap classbitmap = ImagePortraitForm.DrawPortraitClass((uint)this.AddressList.SelectedIndex);
                ImageFormRef.ExportImage(this, classbitmap, InputFormRef.MakeSaveImageFilename());
            }
        }
예제 #24
0
        private void AutoGenbutton_Click(object sender, EventArgs e)
        {//フォントの自動生成.
            string mojiText = SearchChar.Text;

            mojiText = mojiText.Trim();
            if (mojiText.Length <= 0)
            {
                return;
            }

            bool   isItemFont   = this.FontType.SelectedIndex == 0;
            bool   isSquareFont = true;
            int    font_width;
            Bitmap autogen = ImageUtil.AutoGenerateFont(mojiText, UseFontNameTextEdit.Font, isItemFont, isSquareFont, out font_width);

            if (autogen == null)
            {
                R.ShowStopError("フォントの自動生成に失敗しました。対応する日本語フォントがありません。");
                return;
            }

            DialogResult dr = R.ShowQ("フォントを自動生成しました。\r\nROMに書き込みますか?\r\n\r\n「はい」ならば、ROMに書き込みます。\r\n「いいえ」ならば、画像ファイルとして保存します。\r\n");

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                //画像
                this.SelectFontBitmapByte = ImageUtil.Image4ToByteZH(autogen, font_width);
                U.ForceUpdate(this.FontWidth, font_width);

                //画像等データの書き込み
                WriteButton.PerformClick();
                //即検索
                SearchButton.PerformClick();
            }
            else if (dr == System.Windows.Forms.DialogResult.No)
            {
                if (this.FontType.SelectedIndex == 0)
                {
                    //アイテム
                    ImageFormRef.ExportImage(this, autogen, InputFormRef.MakeSaveImageFilename(this, "Item_" + mojiText), font_width);
                }
                else
                {
                    //セリフ
                    ImageFormRef.ExportImage(this, autogen, InputFormRef.MakeSaveImageFilename(this, "Serif_" + mojiText), font_width);
                }
            }
        }
예제 #25
0
        private void AnimeImportButton_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }

            string filename;

            if (ImageFormRef.GetDragFilePath(out filename))
            {
            }
            else
            {
                string title  = R._("開くファイル名を選択してください");
                string filter = R._("アニメスクリプト|*.txt|All files|*");

                OpenFileDialog open = new OpenFileDialog();
                open.Title    = title;
                open.Filter   = filter;
                open.FileName = "romanime_" + this.AddressList.Text.Trim();
                DialogResult dr = open.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
                if (!U.CanReadFileRetry(open))
                {
                    return;
                }
                filename = open.FileNames[0];
                Program.LastSelectedFilename.Save(this, "", open);
            }

            string error = "";

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                error = Import(filename);
            }
            if (error != "")
            {
                R.ShowStopError(error);
                return;
            }

            U.ReSelectList(this.AddressList);
        }
예제 #26
0
        private void ObjExportButton_Click(object sender, EventArgs e)
        {
            uint palIndex = CalcPatelleIndex();

            if (palIndex == 0 || palIndex == U.NOT_FOUND)
            {//パレットは正しい順場
                Bitmap newbitmap = this.MapObjImage;
                ImageFormRef.ExportImage(this, newbitmap, InputFormRef.MakeSaveImageFilename(this, MapStyle), MAX_MAP_PALETTE_COUNT);
            }
            else
            {//現在選択しているパレット
                Bitmap newbitmap = ImageUtil.SwapPalette(this.MapObjImage, (int)palIndex);
                string name      = MapStyle.Text + "_swap_" + palIndex;
                ImageFormRef.ExportImage(this, newbitmap, InputFormRef.MakeSaveImageFilename(this, name), MAX_MAP_PALETTE_COUNT);
            }
        }
예제 #27
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            uint addr = InputFormRef.SelectToAddr(this.AddressList);

            if (addr == U.NOT_FOUND)
            {
                return;
            }

            uint img = Program.ROM.u32(addr);
            uint pal = Program.ROM.u32(addr + (8 * 4));

            Bitmap bitmap = Draw(img, pal);

            ImageFormRef.ExportImage(this, bitmap, InputFormRef.MakeSaveImageFilename());
        }
예제 #28
0
        private void MapChipImportButton_Click(object sender, EventArgs e)
        {
            string title  = R._("読み込むファイル名を選択してください");
            string filter = R._("mapchip_config|*.mapchip_config|All files|*");

            string filename;

            if (ImageFormRef.GetDragFilePath(out filename))
            {
            }
            else
            {
                OpenFileDialog open = new OpenFileDialog();
                open.Title  = title;
                open.Filter = filter;
                Program.LastSelectedFilename.Load(this, "mapchip_config", open);
                DialogResult dr = open.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
                if (!U.CanReadFileRetry(open))
                {
                    return;
                }
                Program.LastSelectedFilename.Save(this, "mapchip_config", open);
                filename = open.FileNames[0];
            }

            if (U.GetFileSize(filename) < 9216)
            {
                R.ShowStopError("ファイルサイズが小さすぎます. 9216バイト必要です。");
                return;
            }

            this.configUZ = File.ReadAllBytes(filename);

            //チップセットの更新.
            Chipset_Update();
            SelectedChipset_Update();

            //書き込み
            ConfigWriteButton.PerformClick();

            //マップエディタが開いていれば更新する
            MapEditorForm.UpdateMapStyleIfOpen();
        }
예제 #29
0
        private void WriteButton_Click(object sender, EventArgs e)
        {
            uint addr = Program.ROM.p32(this.TSAPointer);

            byte[] tsaByte = new byte[this.Width8 * this.Height8 * 2];
            Buffer.BlockCopy(this.Map, 0, tsaByte, 0, tsaByte.Length); //(byte[])

            Undo.UndoData undodata = Program.Undo.NewUndoData(this, "TSA Editor");
            if (this.IsHeaderTSA)
            {
                uint tsaHeaderX = this.Width8;
                uint tsaHeaderY = this.Height8;

                uint tsa_width_margin = 32 - tsaHeaderX;
                tsaHeaderX += tsa_width_margin;
                tsaByte     = ImageUtil.TSAToHeaderTSA(tsaByte, (int)tsaHeaderX * 8, (int)tsaHeaderY * 8, (int)tsa_width_margin);
            }

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                uint newAddr = ImageFormRef.WriteImageData(this, addr, this.TSAPointer, tsaByte, this.IsLZ77TSA, undodata);

                InputFormRef.WriteOnePointer(this.ZImgPointer, this.image1_ZIMAGE, undodata);
                this.Image1.WritePointer(undodata);
                ImageSystemIconForm.Fix_FE8_systemmenu_battlepreview_image(U.toOffset(this.ZImgPointer), undodata);
                Program.Undo.Push(undodata);

                //パレットも書き込む.
                PaletteFormRef.MakePaletteUIToROM(this, (uint)PALETTE_ADDRESS.Value, false, this.PaletteIndexComboBox.SelectedIndex);

                InputFormRef.WriteButtonToYellow(this.AllWriteButton, false);
                InputFormRef.ShowWriteNotifyAnimation(this, newAddr);
            }

            //チップセットを読みこむときに、最初のパレットを選択しないとダメだ.
            int selectedPalette = this.PaletteIndexComboBox.SelectedIndex;

            this.PaletteIndexComboBox.SelectedIndex = 0;
            LoadChipsetInfo();  //チップセット関係の読込
            this.PaletteIndexComboBox.SelectedIndex = selectedPalette;

            LoadBattleScreen();       //ROM TSAをメモリに読み込んで
            MakeBattleScreen();       //TSA描画
            this.Battle.Invalidate(); //キャンバスの再描画
        }
예제 #30
0
 private void WorldMapImageFE6Form_Load(object sender, EventArgs e)
 {
     //see https://serenesforest.net/forums/index.php?/topic/41095-fe6-localization-patch-v10-seriously-we-did-something/&page=48
     //For those interested in editing the world map bitmaps, there's 5 of them in the game. One zoomed out and 4 zoomed in for each corners (NW, NE, SW, SE). Here's the offsets for each:
     //$082AADA4: Elibe world map bitmap (NW, zoomed in)
     //$082B2380: Elibe world map bitmap (NE, zoomed in)
     //$082B9E64: Elibe world map bitmap (SW, zoomed in)
     //$082C1224: Elibe world map bitmap (SE, zoomed in)
     //$082C8874: Elibe world map bitmap (global, zoomed out)
     //There's 2 256-clrs palettes. One for the zoomed out map, and one for all the zoomed in ones (they use the same palette)
     //$082D1964: Elibe world map palette (all, zoomed in)
     //$082D1BA0: Elibe world map palette (global, zoomed out)
     WMZoomOut = new ImageFormRef(this, "WMZoomOUT", 240, 160, 16, Program.ROM.RomInfo.worldmap_big_image_pointer(), 0, U.toPointer(Program.ROM.RomInfo.worldmap_big_palette_pointer()));
     WMZoomNW  = new ImageFormRef(this, "WMZoomNW", 240, 160, 16, Program.ROM.RomInfo.worldmap_big_image_pointer() + 8, 0, U.toPointer(Program.ROM.RomInfo.worldmap_big_palette_pointer() + 8));
     WMZoomNE  = new ImageFormRef(this, "WMZoomNE", 240, 160, 16, Program.ROM.RomInfo.worldmap_big_image_pointer() + 16, 0, U.toPointer(Program.ROM.RomInfo.worldmap_big_palette_pointer() + 16));
     WMZoomSW  = new ImageFormRef(this, "WMZoomSW", 240, 160, 16, Program.ROM.RomInfo.worldmap_big_image_pointer() + 24, 0, U.toPointer(Program.ROM.RomInfo.worldmap_big_palette_pointer() + 24));
     WMZoomSE  = new ImageFormRef(this, "WMZoomSE", 240, 160, 16, Program.ROM.RomInfo.worldmap_big_image_pointer() + 32, 0, U.toPointer(Program.ROM.RomInfo.worldmap_big_palette_pointer() + 32));
 }