public ImageUnitPaletteForm() { InitializeComponent(); SetExplain(); this.UNITCLASS_LIST.OwnerDraw(ListBoxEx.DrawUnitAndClassAndText, DrawMode.OwnerDrawFixed); if (Program.ROM.RomInfo.version() == 8) { this.UNITCLASS_LIST.ItemListToJumpForm("UNITPALETTEFE8", new string[] { "UID" }); } else { this.UNITCLASS_LIST.ItemListToJumpForm("UNIT"); } this.InputFormRef = Init(this); this.InputFormRef.AddressListExpandsEvent += AddressListExpandsEventNoCopyP12; this.InputFormRef.MakeGeneralAddressListContextMenu(true); this.PaletteZoomComboBox.SelectedIndex = 0; this.PaletteIndexComboBox.SelectedIndex = 0; PaletteFormRef.MakePaletteUI(this, OnChangeColor, GetSampleBitmap); U.SetIcon(ExportButton, Properties.Resources.icon_arrow); U.SetIcon(ImportButton, Properties.Resources.icon_upload); }
private void PaletteWriteButton_Click(object sender, EventArgs e) { if (PALETTE_ADDRESS.Value == 0) { R.ShowStopError("パレット領域が割り当てられていません。\r\nまずは、「新規パレット割り当て」ボタンを押して領域を確保してください。"); return; } int paletteIndex = this.PaletteIndexComboBox.SelectedIndex; if (PaletteOverradeALL.Visible && PaletteOverradeALL.Checked) {//全部同じパレットにする paletteIndex = PaletteFormRef.OVERRAIDE_ALL_PALETTE; } uint newAddr = PaletteFormRef.MakePaletteUIToROM(this, (uint)PALETTE_ADDRESS.Value, true, paletteIndex); if (newAddr == U.NOT_FOUND) { return; } P12.Value = U.toPointer(newAddr); WriteButton.PerformClick(); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); InputFormRef.ShowWriteNotifyAnimation(this, newAddr); }
static bool PaletteImportOne(Form self, Bitmap bitmap, uint palette_plist, bool isFog) { Undo.UndoData undodata = Program.Undo.NewUndoData(self); //パレット情報の書き込み. uint palette_address = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist); if (palette_address == 0) {//未割り当てならば新規確保しようか palette_address = InputFormRef.AppendBinaryData(PaletteFormRef.NewNullPalette(MAX_MAP_PALETTE_COUNT), undodata); } if (isFog) { PaletteFormRef.MakePaletteBitmapToROM(self, bitmap, palette_address + (0x20 * PARTS_MAP_PALETTE_COUNT), PARTS_MAP_PALETTE_COUNT, undodata); } else { PaletteFormRef.MakePaletteBitmapToROM(self, bitmap, palette_address, PARTS_MAP_PALETTE_COUNT, undodata); } //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist, palette_address, undodata); if (!r) { Program.Undo.Rollback(undodata); return(false); } Program.Undo.Push(undodata); return(true); }
private void X_PIC_MouseDown(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Right) { return; } PaletteFormRef.SpoitTool_SelectPalette(this.X_PIC, this.CurrntControls, this.PaletteZoomComboBox.SelectedIndex, e); }
private void PaletteWriteButton_Click(object sender, EventArgs e) { uint addr = PaletteFormRef.MakePaletteUIToROM(this, (uint)PALETTE_ADDRESS.Value, false, this.PaletteIndexComboBox.SelectedIndex); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); InputFormRef.ShowWriteNotifyAnimation(this, addr); }
public ImageBattleAnimePalletForm() { InitializeComponent(); this.PaletteZoomComboBox.SelectedIndex = 0; this.PaletteIndexComboBox.SelectedIndex = 0; this.Is32ColorMode = false; PaletteFormRef.MakePaletteUI(this, OnChangeColor, GetSampleBitmap); SetExpain(); }
private void PALETTE_POINTER_ValueChanged(object sender, EventArgs e) { if (PALETTE_ADDRESS.Value == 0) { return; } PaletteFormRef.MakePaletteROMToUI(this, (uint)PALETTE_ADDRESS.Value, false, this.PaletteIndexComboBox.SelectedIndex); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); }
private void MapStyleEditorForm_Load(object sender, EventArgs e) { IsInit = true; //マップIDリストを作る. List <U.AddrResult> maplist = MapSettingForm.MakeMapIDList(); //マップスタイルリストを作る this.MapEditConf = MapEditorForm.MakeMapStyleList(maplist); //マップスタイルリストを作る MakeMapStyleCombo(); U.SelectedIndexSafety(this.MapStyle, 0); List <U.AddrResult> terrainList = MapTerrainNameForm.MakeList(); U.ConvertComboBox(terrainList, ref this.ConfigTerrain); //マップオブジェクト this.MAP.SetChipSize(8); Bitmap black = ImageUtil.BlankDummy(); U.MakeTransparent(black); this.MAP.SetDefualtIcon(black); //パレット PaletteFormRef.MakePaletteUI(this, OnChangeColor, GetSampleBitmap); U.SelectedIndexSafety(this.PaletteCombo, 0); //TSA変更のイベント適応. List <Control> controls = InputFormRef.GetAllControls(this); InputFormRef.MakeLinkEvent("Config_", controls); //最大化禁止 //C#のバグである Anchorを四隅にすると、スクロールバーが消えるというバグに対処するために、 //フォームを固定化しないとおかしなことになる。 //クレームは microsoft あたりまでどうぞ. this.MaximizeBox = false; IsInit = false; U.AllowDropFilename(this, ImageFormRef.IMAGE_FILE_FILTER, (string filename) => { using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename)) { ObjImportButton_Click(null, null); } }); U.AllowDropFilename(this, new string[] { ".MAPCHIP_CONFIG" }, (string filename) => { using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename)) { MapChipImportButton_Click(null, null); } }); }
private void PALETTE_TO_CLIPBOARD_BUTTON_Click(object sender, EventArgs e) { bool r = PaletteFormRef.PALETTE_TO_CLIPBOARD_BUTTON_Click(this); if (r) { //書き込み PaletteWriteButton.PerformClick(); } }
private void ImportButton_Click(object sender, EventArgs e) { bool r = PaletteFormRef.MakePaletteBitmapToUIEx(this, 0, this.DrawBitmap); if (!r) { return; } //書き込み PaletteWriteButton.PerformClick(); }
private void PALETTE_POINTER_ValueChanged(object sender, EventArgs e) { if (PALETTE_ADDRESS.Value == 0) { return; } PaletteFormRef.MakePaletteROMToUI(this, (uint)PALETTE_ADDRESS.Value, false, this.PaletteIndexComboBox.SelectedIndex); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); this.Battle.Image = this.DrawBitmap; this.CHIPLIST.Image = this.ChipDisplayCache; }
private void PaletteWriteButton_Click(object sender, EventArgs e) { uint newAddr = PaletteFormRef.MakePaletteUIToROM(this, (uint)PALETTE_ADDRESS.Value, false, this.PaletteIndexComboBox.SelectedIndex); if (newAddr == U.NOT_FOUND) { return; } PALETTE_ADDRESS.Value = U.toPointer(newAddr); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); InputFormRef.ShowWriteNotifyAnimation(this, newAddr); }
private void BattleScreenForm_Load(object sender, EventArgs e) { ClearUndoBuffer(); uint palette = Program.ROM.p32(Program.ROM.RomInfo.battle_screen_palette_pointer()); U.ForceUpdate(PALETTE_ADDRESS, palette); PaletteFormRef.MakePaletteUI(this, OnChangeColor, GetSampleBitmap); this.PaletteIndexComboBox.SelectedIndex = 0; InitLoadChipsetInfo(); LoadChipsetInfo(); //チップセット関係の読込 LoadBattleScreen(); //ROM TSAをメモリに読み込んで // MakeBattleScreen(); //TSA描画 Zoom.SelectedIndex = 1; //2倍拡大 }
private void PALETTE_POINTER_ValueChanged(object sender, EventArgs e) { uint addr = (uint)PALETTE_ADDRESS.Value; if (!U.isSafetyPointer(addr)) { return; } PaletteFormRef.MakePaletteROMToUI(this, addr, true, this.PaletteIndexComboBox.SelectedIndex); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); uint class_id = InputFormRef.SelectToAddr(this.UNITCLASS_LIST); uint battleAnimeID = ImageBattleAnimeForm.GetAnimeIDByClassID(class_id); U.ForceUpdate(this.X_BATTLEANIME, battleAnimeID); }
public ImagePalletForm() { InitializeComponent(); this.PaletteZoomComboBox.SelectedIndex = 0; PaletteFormRef.MakePaletteUI(this, OnChangeColor, GetSampleBitmap); U.SetIcon(ExportButton, Properties.Resources.icon_arrow); U.SetIcon(ImportButton, Properties.Resources.icon_upload); U.AllowDropFilename(this, ImageFormRef.IMAGE_FILE_FILTER, (string filename) => { using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename)) { ImportButton_Click(null, null); } }); }
private void PaletteCombo_SelectedIndexChanged(object sender, EventArgs e) { uint palIndex = CalcPatelleIndex(); if (palIndex == U.NOT_FOUND) { return; } PaletteFormRef.MakePaletteBitmapToUI(this, this.MapObjImage, (int)palIndex); Bitmap newbitmap = ImageUtil.SwapPalette(this.MapObjImage, (int)palIndex); this.MAP.LoadMap(newbitmap); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); }
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(); //キャンバスの再描画 }
private void PALETTE_POINTER_ValueChanged(object sender, EventArgs e) { if (PALETTE_ADDRESS.Value == 0) { return; } PaletteFormRef.MakePaletteROMToUI(this, (uint)PALETTE_ADDRESS.Value, true, this.PaletteIndexComboBox.SelectedIndex); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); if (this.Is32ColorMode) {//32colorモード 常に最初のパレットで描画 DrawSample(this.BattleAnimeID, 0); } else {//通常モード DrawSample(this.BattleAnimeID, this.PaletteIndexComboBox.SelectedIndex); } }
public void Init(uint width8, uint height8, uint zimgPointer, bool isHeaderTSA, bool isLZ77TSA, uint tsaPointer, uint palettePointer, uint paletteAddress, int paletteCount) { ClearUndoBuffer(); this.ZImgPointer = zimgPointer; this.IsHeaderTSA = isHeaderTSA; this.IsLZ77TSA = isLZ77TSA; this.TSAPointer = tsaPointer; this.PalettePointer = palettePointer; this.PaletteAddress = paletteAddress; this.Width8 = width8; this.Height8 = height8; this.PaletteCount = paletteCount; if (this.IsHeaderTSA) { this.Width8 = Math.Max(256 / 8, this.Width8); this.Height8 = Math.Max(160 / 8, this.Height8); } if (this.PalettePointer == U.NOT_FOUND) { PALETTE_ADDRESS.Value = U.toOffset(this.PaletteAddress); } else { PALETTE_ADDRESS.Value = Program.ROM.p32(this.PalettePointer); } PaletteFormRef.MakePaletteUI(this, OnChangeColor, GetSampleBitmap); this.PaletteIndexComboBox.SelectedIndex = 0; InitLoadChipsetInfo(); LoadChipsetInfo(); //チップセット関係の読込 LoadBattleScreen(); //ROM TSAをメモリに読み込んで //MakeBattleScreen(); //TSA描画 Zoom.SelectedIndex = 1; //2倍拡大 EraseSurplusPalette(); //余剰パレットの削除. ShowTSAInfo(); }
bool WriteMapChipPalette(Bitmap bitmap, bool importObjWithPalette, Undo.UndoData undodata) { const int palette_count = MAX_MAP_PALETTE_COUNT; if (importObjWithPalette) {//パレットもインポートする場合 //パレットの交換 this.MapObjImage = bitmap; U.ForceUpdate(this.PaletteTypeCombo, 0); U.ForceUpdate(this.PaletteCombo, 0); //パレット情報の書き込み. uint palette_plist = this.MapEditConf[this.MapStyle.SelectedIndex].palette_plist; uint palette_address = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist); if (palette_address == 0) {//未割り当てならば新規確保しようか palette_address = InputFormRef.AppendBinaryData(PaletteFormRef.NewNullPalette(palette_count), undodata); } PFR.MakePaletteBitmapToROM(bitmap, palette_address, palette_count, undodata); //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist, palette_address, undodata); if (!r) { Program.Undo.Rollback(undodata); return(false); } PaletteAddress.Value = palette_address; } else {//パレットはインポートしない場合 //パレット情報の継承. bitmap.Palette = this.MapObjImage.Palette; //obj Bitmap交換 this.MapObjImage = bitmap; } return(true); }
private void PaletteWriteButton_Click(object sender, EventArgs e) { if (this.MapStyle.SelectedIndex < 0) { return; } uint palette_plist = this.MapEditConf[this.MapStyle.SelectedIndex].palette_plist; int palette_count = MAX_MAP_PALETTE_COUNT; Undo.UndoData undodata = Program.Undo.NewUndoData(this); //パレット情報の書き込み. uint palette_address = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist); if (palette_address == 0) {//未割り当てならば新規確保しようか palette_address = InputFormRef.AppendBinaryData(PaletteFormRef.NewNullPalette(palette_count), undodata); } PFR.MakePaletteColorPaletteToROM(this.MapObjImage.Palette, palette_address, palette_count, undodata); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist, palette_address, undodata); if (!r) { Program.Undo.Rollback(undodata); return; } Program.Undo.Push(undodata); //マップエディタが開いていれば更新する MapEditorForm.UpdateMapStyleIfOpen(); }
void ReDrawBitmap() { PaletteFormRef.SetScaleSampleImage(this.X_PIC, this.AutoScrollPanel, this.DrawBitmap, this.PaletteZoomComboBox.SelectedIndex); }
public static bool MakePaletteBitmapToUIEx(Form self, int palette_index, Bitmap hintBitmap) { Debug.Assert(ImageUtil.Is16ColorBitmap(hintBitmap)); string imagefilename = ImageFormRef.OpenFilenameDialogFullColor(self); if (imagefilename == "") { return(false); } Bitmap fullColor = ImageUtil.OpenLowBitmap(imagefilename); //bitmapそのものの色で開く. if (fullColor == null) { return(false); } Bitmap bitmap; if (palette_index <= 0) { if (!ImageUtil.Is16ColorBitmap(fullColor)) { R.ShowStopError("パレット数が正しくありません。\r\n{1}種類以下(16色*{1}種類) でなければなりません。\r\n\r\n選択された画像のパレット種類:{0}種類", palette_index, "fullcolor"); fullColor.Dispose(); return(false); } bitmap = ImageUtil.OpenBitmap(imagefilename); //16色に変換して開く. if (bitmap == null) { fullColor.Dispose(); return(false); } if (ImageUtil.IsFullColorBitmap(fullColor) || !ImageUtil.CheckPaletteTransparent(bitmap)) {//パレットではない画像なので何かしらの変換が必要 if (hintBitmap == null || (hintBitmap.Width != fullColor.Width && hintBitmap.Height != fullColor.Height)) { DialogResult dr = R.ShowNoYes("この画像のパレットは破壊されています。\r\n復元しようとしましたが、元画像と異なる画像のため、復元できませんでした。\r\n無視して強引にインポートすることは可能ですが、継続しますか?"); if (dr == DialogResult.No) { fullColor.Dispose(); bitmap.Dispose(); return(false); } } else {//壊れたパレットを復元します. Bitmap recolor = ImageUtil.ReColorPaletteWithHint(bitmap, hintBitmap); ErrorPaletteMissMatchForm f = (ErrorPaletteMissMatchForm)InputFormRef.JumpFormLow <ErrorPaletteMissMatchForm>(); f.SetOrignalImage(bitmap, hintBitmap); f.SetReOrderImage1(recolor, hintBitmap); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { fullColor.Dispose(); return(false); } } } } else { //16色以上 bitmap = ImageUtil.OpenBitmap(imagefilename); //16色に変換して開く. if (bitmap == null) { fullColor.Dispose(); return(false); } int bitmap_palette_count = ImageUtil.GetPalette16Count(bitmap); if (bitmap_palette_count > palette_index) { R.ShowStopError("パレット数が正しくありません。\r\n{1}種類以下(16色*{1}種類) でなければなりません。\r\n\r\n選択された画像のパレット種類:{0}種類", bitmap_palette_count, palette_index); fullColor.Dispose(); bitmap.Dispose(); return(false); } if (ImageUtil.IsFullColorBitmap(fullColor)) {//パレットではない画像なので何かしらの変換が必要 if (hintBitmap == null || (hintBitmap.Width != fullColor.Width && hintBitmap.Height != fullColor.Height)) { DialogResult dr = R.ShowNoYes("この画像のパレットは破壊されています。\r\n復元しようとしましたが、元画像と異なる画像のため、復元できませんでした。\r\n無視して強引にインポートすることは可能ですが、継続しますか?"); if (dr == DialogResult.No) { fullColor.Dispose(); bitmap.Dispose(); return(false); } } else {//壊れたパレットを復元します. Bitmap recolor = ImageUtil.ReColorPaletteWithHint(bitmap, hintBitmap); ErrorPaletteMissMatchForm f = (ErrorPaletteMissMatchForm)InputFormRef.JumpFormLow <ErrorPaletteMissMatchForm>(); f.SetOrignalImage(bitmap, hintBitmap); f.SetReOrderImage1(recolor, hintBitmap); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { fullColor.Dispose(); return(false); } } } } PaletteFormRef.MakePaletteBitmapToUI(self, bitmap, palette_index); fullColor.Dispose(); bitmap.Dispose(); return(true); }
private void ObjImportButton_Click(object sender, EventArgs e) { if (this.MapStyle.SelectedIndex < 0) { return; } uint obj_plist = this.MapEditConf[this.MapStyle.SelectedIndex].obj_plist; uint obj2_plist = (obj_plist >> 8) & 0xFF; //FE8にはないが FE7は、 plistを2つ設定できることがある. Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this); if (bitmap == null) { return; } int width = 32 * 8; int height = 32 * 8; int palette_count = MAX_MAP_PALETTE_COUNT; if (bitmap.Width != width || bitmap.Height < 128) { R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height); return; } height = ImageUtil.CalcHeight(width, width * bitmap.Height / 2); if (ObjImportOption.SelectedIndex == 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; } bitmap = PaletteSwapper(bitmap); } //画像 byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height); //画像等データの書き込み Undo.UndoData undodata = Program.Undo.NewUndoData(this); if (obj2_plist > 0) {//FE7とかあるフィールド画像分割 byte[] image1 = U.subrange(image, 0, (uint)(image.Length / 2)); byte[] image2 = U.subrange(image, (uint)(image.Length / 2), (uint)image.Length); byte[] image1Z = LZ77.compress(image1); byte[] image2Z = LZ77.compress(image2); uint newaddr = InputFormRef.WriteBinaryData(this, (uint)ObjAddress.Value, image1Z, InputFormRef.get_data_pos_callback_lz77, undodata); if (newaddr == U.NOT_FOUND) { Program.Undo.Rollback(undodata); return; } ObjAddress.Value = newaddr; //拡張領域に書き込んでいる可能性もあるので plstを更新する. MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.OBJECT, obj_plist, newaddr, undodata); //分割されたデータを書き込み newaddr = InputFormRef.WriteBinaryData(this, (uint)ObjAddress2.Value, image2Z, InputFormRef.get_data_pos_callback_lz77, undodata); if (newaddr == U.NOT_FOUND) { Program.Undo.Rollback(undodata); return; } ObjAddress2.Value = newaddr; //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.OBJECT, obj2_plist, newaddr, undodata); if (!r) { Program.Undo.Rollback(undodata); return; } //書き込んだ通知. InputFormRef.ShowWriteNotifyAnimation(this, newaddr); } else { byte[] imageZ = LZ77.compress(image); uint newaddr = InputFormRef.WriteBinaryData(this, (uint)ObjAddress.Value, imageZ, InputFormRef.get_data_pos_callback_lz77, undodata); if (newaddr == U.NOT_FOUND) { Program.Undo.Rollback(undodata); return; } ObjAddress.Value = newaddr; //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.OBJECT, obj_plist, newaddr, undodata); if (!r) { Program.Undo.Rollback(undodata); return; } //書き込んだ通知. InputFormRef.ShowWriteNotifyAnimation(this, newaddr); } if (ObjImportOption.SelectedIndex == 1) {//パレットもインポートする場合 //パレットの交換 MapObjImage = bitmap; U.ForceUpdate(this.PaletteTypeCombo, 0); U.ForceUpdate(this.PaletteCombo, 0); //パレット情報の書き込み. uint palette_plist = this.MapEditConf[this.MapStyle.SelectedIndex].palette_plist; uint palette_address = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist); if (palette_address == 0) {//未割り当てならば新規確保しようか palette_address = InputFormRef.AppendBinaryData(PaletteFormRef.NewNullPalette(palette_count), undodata); } PaletteFormRef.MakePaletteBitmapToROM(this, bitmap, palette_address, palette_count, undodata); //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.PALETTE, palette_plist, palette_address, undodata); if (!r) { Program.Undo.Rollback(undodata); return; } PaletteAddress.Value = palette_address; } else {//パレットはインポートしない場合 //パレット情報の継承. bitmap.Palette = this.MapObjImage.Palette; //obj Bitmap交換 this.MapObjImage = bitmap; } Program.Undo.Push(undodata); //チップセットの更新. Chipset_Update(); SelectedChipset_Update(); MapStyle_SelectedIndexChanged(sender, e); InputFormRef.WriteButtonToYellow(this.PaletteWriteButton, false); //マップエディタが開いていれば更新する MapEditorForm.UpdateMapStyleIfOpen(); }