示例#1
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            if (this.SearchChar.Text.Length <= 0)
            {
                return;
            }
            Color  bgcolor     = GetFontColor(this.FontType.SelectedIndex == 0);
            Bitmap paletteHint = ImageUtil.ByteToImage4(16, 16, new byte[64], 0, bgcolor);
            Bitmap bitmap      = ImageUtil.LoadAndCheckPaletteUI(this
                                                                 , paletteHint
                                                                 , 2 * 8, 2 * 8);

            if (bitmap == null)
            {
                return;
            }

            //画像
            this.SelectFontBitmapByte = ImageUtil.Image4ToByte(bitmap);
            U.ForceUpdate(this.FontWidth, 9);

            //画像等データの書き込み
            WriteButton.PerformClick();
            //即検索
            SearchButton.PerformClick();
        }
示例#2
0
        private void AddressListExpandsEvent_N4(object sender, EventArgs arg)
        {
            InputFormRef.ExpandsEventArgs eearg = (InputFormRef.ExpandsEventArgs)arg;
            uint addr  = eearg.NewBaseAddress;
            int  count = (int)eearg.NewDataCount;

            Undo.UndoData undodata = Program.Undo.NewUndoData(this, "N4");

            //スキルが0だと終端がわからなくなるので、適当なものを入れる.
            uint       a             = addr + (eearg.OldDataCount * eearg.BlockSize);
            const uint default_skill = 0x01;

            for (int i = (int)eearg.OldDataCount; i < count; i++)
            {
                uint skill_lv = Program.ROM.u8(a);
                if (skill_lv == 0)
                {
                    Program.ROM.write_u8(a, default_skill, undodata);
                }

                a += eearg.BlockSize;
            }
            Program.Undo.Push(undodata);

            P16.Value = addr;
            WriteButton.PerformClick();

            N4_ReadCount.Value = eearg.NewDataCount;
            N4_InputFormRef.ReInit(addr, eearg.NewDataCount);
        }
示例#3
0
        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);
        }
示例#4
0
        void ImportGBAWave(NumericUpDown addrNumObj)
        {
            uint addr = (uint)addrNumObj.Value;

            addr = U.toOffset(addr);

            if (AddressList.SelectedIndex < 0)
            {
                return;
            }
            uint songtable_address = InputFormRef.BaseAddress + (InputFormRef.BlockSize * (uint)AddressList.SelectedIndex);

            string title  = R._("インポートするwavファイルを選択してください");
            string filter = R._("wav|*.wav|All files|*");

            OpenFileDialog open = new OpenFileDialog();

            open.Title  = title;
            open.Filter = filter;
            Program.LastSelectedFilename.Load(this, "", open);
            DialogResult dr = open.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }
            if (!U.CanReadFileRetry(open))
            {
                return;
            }
            Program.LastSelectedFilename.Save(this, "", open);
            string filename = open.FileNames[0];

            SongInstrumentImportWaveForm f = (SongInstrumentImportWaveForm)InputFormRef.JumpFormLow <SongInstrumentImportWaveForm>();

            f.Init(filename);
            dr = f.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                f.Dettach();
                return;
            }
            byte[] wave    = File.ReadAllBytes(f.GetFilename());
            byte[] gbawave = SongUtil.wavToByte(wave);
            if (gbawave == null)
            {
                return;
            }

            f.Dettach();

            Undo.UndoData undodata = Program.Undo.NewUndoData(this, "Instrument Wave");
            uint          newaddr  = InputFormRef.WriteBinaryData(this, addr, gbawave, gbawave_length, undodata);

            Program.Undo.Push(undodata);

            addrNumObj.Value = newaddr;
            WriteButton.PerformClick();
        }
示例#5
0
        private void AddressListExpandsEvent_N4(object sender, EventArgs arg)
        {
            InputFormRef.ExpandsEventArgs eearg = (InputFormRef.ExpandsEventArgs)arg;
            uint addr = eearg.NewBaseAddress;

            P16.Value = addr;
            WriteButton.PerformClick();

            N4_ReadCount.Value = eearg.NewDataCount;
            N4_InputFormRef.ReInit(addr, eearg.NewDataCount);
        }
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            this.FlagNameTextBox.Text = "";
            WriteButton.PerformClick();

            //元に戻す.
            U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList);
            if (ar.isNULL())
            {
                return;
            }
            this.FlagNameTextBox.Text = this.BaseFlag[ar.addr];
        }
示例#7
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            if (this.SearchChar.Text.Length <= 0)
            {
                return;
            }

            bool IsItemFont = (this.FontType.SelectedIndex == 0);
            int  w          = (int)FontWidth.Value;

            Color  bgcolor = GetFontColor(IsItemFont);
            Bitmap paletteHint;

            if (IsItemFont)
            {
                paletteHint = ImageUtil.ByteToImage4ZH(w + 1, 0xD, new byte[64], 0, bgcolor);
            }
            else
            {
                paletteHint = ImageUtil.ByteToImage4ZH(w, 0xD, new byte[64], 0, bgcolor);
            }

            Bitmap bitmap = ImageUtil.LoadAndCheckPaletteUI(this
                                                            , paletteHint
                                                            , 0, 0);

            if (bitmap == null)
            {
                return;
            }

            uint width = (uint)bitmap.Width;

            //画像
            if (IsItemFont)
            {
                this.SelectFontBitmapByte = ImageUtil.Image4ToByteZH(bitmap, (int)width + 1);
            }
            else
            {
                this.SelectFontBitmapByte = ImageUtil.Image4ToByteZH(bitmap, (int)width);
            }
            U.ForceUpdate(this.FontWidth, width);

            //画像等データの書き込み
            WriteButton.PerformClick();
            //即検索
            SearchButton.PerformClick();
        }
示例#8
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);
                }
            }
        }