public void LoadMusic(uint sound_id, EventScript.ArgType argtype) { MAP.ClearAllPoint(); PlaySappyButton.Tag = sound_id; this.MusicName.Text = SongTableForm.GetSongName(sound_id); string errormessage = ""; if (argtype == EventScript.ArgType.SOUND) { errormessage = SongTableForm.GetErrorMessage(sound_id, "SFX"); } else if (argtype == EventScript.ArgType.MAPMUSIC) { errormessage = SongTableForm.GetErrorMessage(sound_id, "MAP"); } this.MusicName.ErrorMessage = errormessage; int width = 300; int height = 100; this.Tab.Width = width; this.Tab.Height = height; this.MAP.Width = width; this.MAP.Height = height; Tab.SelectedIndex = 2; this.Width = width; this.Height = height; }
public static void ReloadList() { SongTableForm f = (SongTableForm)InputFormRef.GetForm <SongTableForm>(); if (f == null) {//ウィンドウを開いていない return; } int selectedIndex = f.AddressList.SelectedIndex; f.ReloadListButton.PerformClick(); f.AddressList.SelectedIndex = selectedIndex; }
private void ConvertButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) { R.ShowStopError(InputFormRef.GetBusyErrorExplain()); return; } if (OtherSongList == null) { R.Error("相手のROMが読み込まれていません"); return; } if (OtherROMSongTable.SelectedIndex < 0 || OtherROMSongTable.SelectedIndex > OtherSongList.Count) { R.Error("エクスポートする曲がリストから選択されていません"); return; } if (SongTable.SelectedIndex < 0 || SongTable.SelectedIndex > MySongList.Count) { R.Error("インポートする曲がリストから選択されていません."); return; } if (SongTable.SelectedIndex == 0) { R.ShowStopError("SongID: 0x0に書き込むことはできません"); return; } { DialogResult dr = R.ShowYesNo("この音楽({0})を、現在のROMの({1})に、移植してもよろしいですか?", OtherROMSongTable.Text, SongTable.Text); if (dr != System.Windows.Forms.DialogResult.Yes) { return; } } ConvertSong(OtherROMData, OtherSongList[OtherROMSongTable.SelectedIndex], Program.ROM.Data, MySongList[SongTable.SelectedIndex]); R.Notify("曲のインポートが完了しました。"); //変更があったので、データを取り直して描画しなおす. int nowselect = SongTable.SelectedIndex; this.MySongList = SongTableToSongList(Program.ROM.Data); SongListToListBox(this.MySongList, this.SongTable, true); SongTable.SelectedIndex = nowselect; SongTableForm.ReloadList(); InputFormRef.ShowWriteNotifyAnimation(this, 0); }
void SongListToListBox(List <SongSt> songTable, ListBox list, bool isSourceROM) { list.BeginUpdate(); list.Items.Clear(); for (int i = 0; i < songTable.Count; i++) { string a = U.ToHexString(songTable[i].number); if (isSourceROM) { a += U.SA(SongTableForm.GetSongNameFast(songTable[i].number, songTable[i].table)); } a = a + " Table: " + U.To0xHexString(songTable[i].table) + " Header: " + U.To0xHexString(songTable[i].header) + " Voices: " + U.To0xHexString(songTable[i].voices) + " Tracks: " + U.To0xHexString(songTable[i].tracks); list.Items.Add(a); } list.EndUpdate(); }
public void LoadMusic(uint sound_id) { MAP.ClearAllPoint(); PlaySappyButton.Tag = sound_id; this.MusicName.Text = SongTableForm.GetSongName(sound_id); int width = 300; int height = 100; this.Tab.Width = width; this.Tab.Height = height; this.MAP.Width = width; this.MAP.Height = height; Tab.SelectedIndex = 2; this.Width = width; this.Height = height; }
static InputFormRef Init(Form self) { return(new InputFormRef(self , "" , Program.ROM.RomInfo.sound_table_pointer() , 8 , (int i, uint addr) => { //読込最大値検索 return U.isPointer(Program.ROM.u32(addr)); } , (int i, uint addr) => { uint songheader = Program.ROM.p32(addr + 0); string name = U.ToHexString(i) + " " + SongTableForm.GetSongName((uint)i); return new U.AddrResult(songheader, name); } )); }
public static void Check85Command(List <FELint.ErrorSt> errors, byte[] frameData_UZ, uint offset, Type cond, uint addr, uint tag) { Debug.Assert(frameData_UZ[offset + 3] == 0x85); //0x85 コマンド if (frameData_UZ[offset] == 0x48) { //音楽再生 uint song_id = U.u16(frameData_UZ, offset + 1); if (song_id <= 0) { return; } string errorMessage = SongTableForm.GetErrorMessage(song_id, "SFX"); if (errorMessage == "") { return; } errors.Add(new FELint.ErrorSt(cond, U.toOffset(addr) , errorMessage + " " + R._("SongID: {0}", U.ToHexString(song_id)), tag)); } }
public void JumpToSongID(uint song_id) { uint table = SongTableForm.GetSongAddr(song_id); if (table == U.NOT_FOUND) { return; } uint songheader = Program.ROM.p32(table); if (!U.isSafetyOffset(songheader)) { return; } uint voca = Program.ROM.p32(songheader + 4); if (!U.isSafetyOffset(voca)) { return; } InputFormRef.ReInit(voca); }
static void ScanSystem(List <FELint.ErrorSt> errors, List <DisassemblerTrumb.LDRPointer> ldrmap) { ROMCheck(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageBattleAnimeForm")) { return; } ImageBattleAnimeForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageBGForm")) { return; } ImageBGForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem UnitForm")) { return; } UnitForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ClassForm")) { return; } ClassForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ItemForm")) { return; } ItemForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem MoveCostForm")) { return; } MoveCostForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem PatchForm")) { return; } PatchForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageUnitMoveIconFrom")) { return; } ImageUnitMoveIconFrom.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageUnitWaitIconFrom")) { return; } ImageUnitWaitIconFrom.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ItemEffectPointerForm")) { return; } ItemEffectPointerForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageUnitPaletteForm")) { return; } ImageUnitPaletteForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageBattleScreen")) { return; } ImageBattleScreenForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImageMagic")) { return; } ImageMagicFEditorForm.MakeCheckError(errors); ImageMagicCSACreatorForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem Procs")) { return; } ProcsScriptForm.MakeCheckError(errors, ldrmap); if (InputFormRef.DoEvents(null, "ScanSystem MenuDefinition")) { return; } MenuDefinitionForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventUnit")) { return; } EventUnitForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem AIScript")) { return; } AIScriptForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SongTable")) { return; } SongTableForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ItemWeaponEffect")) { return; } ItemWeaponEffectForm.MakeCheckError(errors); if (Program.ROM.RomInfo.version() == 8) { if (InputFormRef.DoEvents(null, "ScanSystem SoundFootStepsForm")) { return; } SoundFootStepsForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem ImagePortraitForm")) { return; } ImagePortraitForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventHaikuForm")) { return; } EventHaikuForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventBattleTalkForm")) { return; } EventBattleTalkForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SupportTalkForm")) { return; } SupportTalkForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SupportUnitForm")) { return; } SupportUnitForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SoundRoomForm")) { return; } SoundRoomForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EDForm")) { return; } EDForm.MakeCheckError(errors); } else if (Program.ROM.RomInfo.version() == 7) { if (InputFormRef.DoEvents(null, "ScanSystem ImagePortraitForm")) { return; } ImagePortraitForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventHaikuFE7Form")) { return; } EventHaikuFE7Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventBattleTalkFE7Form")) { return; } EventBattleTalkFE7Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SupportTalkFE7Form")) { return; } SupportTalkFE7Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SupportUnitForm")) { return; } SupportUnitForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SoundRoomForm")) { return; } SoundRoomForm.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EDForm")) { return; } EDFE7Form.MakeCheckError(errors); } else { if (InputFormRef.DoEvents(null, "ScanSystem ImagePortraitFE6Form")) { return; } ImagePortraitFE6Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventHaikuFE6Form")) { return; } EventHaikuFE6Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EventBattleTalkFE6Form")) { return; } EventBattleTalkFE6Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem SupportTalkFE6Form")) { return; } SupportTalkFE6Form.MakeCheckError(errors); if (InputFormRef.DoEvents(null, "ScanSystem EDForm")) { return; } EDFE6Form.MakeCheckError(errors); } }
string MakeNMMDropDownList(InputFormRef ifr, string basefilename, Dictionary <string, string> addFiles, List <Control> controls, string linktype, int num) { string filename = basefilename + linktype + ".txt"; if (addFiles.ContainsKey(linktype)) { return(addFiles[filename]); } string data = ""; if (linktype == "INDEX") { data = MakeNMMDropDownListInner(ifr.MakeList()); } else if (linktype == "PORTRAIT") { data = MakeNMMDropDownListInner(ImagePortraitForm.MakePortraitList()); } else if (linktype == "UNIT") { List <U.AddrResult> list = UnitForm.MakeUnitList(); data = MakeNMMDropDownListInner(list); } else if (linktype == "CLASS") { data = MakeNMMDropDownListInner(ClassForm.MakeClassList()); } else if (linktype == "ITEM") { data = MakeNMMDropDownListInner(ItemForm.MakeItemList()); } else if (linktype == "SONG") { data = MakeNMMDropDownListInner(SongTableForm.MakeItemList()); } else if (linktype == "COMBO") { Control c = InputFormRef.FindObject(ifr.Prefix, controls, num + "_" + linktype); if (c is ComboBox) { data = MakeNMMDropDownListInner((ComboBox)c); data = string.Join("\r\n", U.ComboBoxToStringList((ComboBox)c)); } } else if (linktype == "ATTRIBUTE") { StringBuilder sb = new StringBuilder(); sb.AppendLine("8"); for (uint n = 0; n < 8; n++) { sb.AppendLine(U.To0xHexString(n) + " " + InputFormRef.GetAttributeName(n)); } data = sb.ToString(); } else if (linktype == "WEAPON") { StringBuilder sb = new StringBuilder(); sb.AppendLine("7"); sb.AppendLine("0x0 -"); sb.AppendLine("0x1 E"); sb.AppendLine("0x31 D"); sb.AppendLine("0x71 C"); sb.AppendLine("0x121 B"); sb.AppendLine("0x181 A"); sb.AppendLine("0x251 S"); data = sb.ToString(); } else if (linktype == "FLAG") { StringBuilder sb = new StringBuilder(); sb.AppendLine("128"); string dummy; for (uint n = 0; n < 128; n++) { sb.AppendLine(U.To0xHexString(n) + " " + InputFormRef.GetFlagName(n, out dummy)); } data = sb.ToString(); } else if (linktype == "BIT") { filename = basefilename + linktype + num + ".txt"; if (addFiles.ContainsKey(linktype)) { return(addFiles[filename]); } data = MakeBitsListInner(ifr, controls, linktype, num); } if (data == "") { return("NULL"); } addFiles[filename] = data; return(filename); }
public static void Export( string filename //書き込むファイル名 , uint anime_address) { string basename = Path.GetFileNameWithoutExtension(filename) + "_"; string basedir = Path.GetDirectoryName(filename); anime_address = U.toOffset(anime_address); if (!U.isSafetyOffset(anime_address)) { return; } string programCode; AnimeType animeType; uint anime_config_address = SkipCode(anime_address, out programCode, out animeType); if (anime_config_address == U.NOT_FOUND) { return; } if (anime_config_address + (4 * 5) > Program.ROM.Data.Length) {//範囲外 return; } //POIN Frames //POIN TSAList //POIN GraphicsList //POIN PalettesList //WORD 0x3d1 //sound id uint frames = Program.ROM.p32(anime_config_address + (4 * 0)); uint tsalist = Program.ROM.p32(anime_config_address + (4 * 1)); uint graphiclist = Program.ROM.p32(anime_config_address + (4 * 2)); uint palettelist = Program.ROM.p32(anime_config_address + (4 * 3)); uint sound_id = Program.ROM.u32(anime_config_address + (4 * 4)); if (!U.isSafetyOffset(frames)) { return; } if (!U.isSafetyOffset(tsalist)) { return; } if (!U.isSafetyOffset(graphiclist)) { return; } if (!U.isSafetyOffset(palettelist)) { return; } //同じアニメを何度も出力しないように記録する. Dictionary <uint, Bitmap> animeHash = new Dictionary <uint, Bitmap>(); List <string> lines = new List <string>(); if (animeType == AnimeType.D) { lines.Add("D #is defender anim"); } if (sound_id > 0) { lines.Add("S" + sound_id.ToString("X04") + " #play sound " + SongTableForm.GetSongName(sound_id)); } //圧縮されていないデータなので、事故防止のため リミッターをかける. uint limitter = frames + 1024 * 1024; //1MBサーチしたらもうあきらめる. limitter = (uint)Math.Min(limitter, Program.ROM.Data.Length); for (uint n = frames; n < limitter; n += 4) { uint id = Program.ROM.u16(n + 0); uint wait = Program.ROM.u16(n + 2); if (id == 0xFFFF) { break; } Bitmap bitmap; string imagefilename = basename.Replace(" ", "_") + "g" + id.ToString("000") + ".png"; if (animeHash.ContainsKey(id)) { bitmap = animeHash[id]; } else { bitmap = DrawFrameImage(n, graphiclist, tsalist, palettelist); int paletteCount = ImageUtil.GetPalette16Count(bitmap); if (paletteCount < 1) { paletteCount = 1; } //利用していないパレットを消す. ImageUtil.BlackOutUnnecessaryColors(bitmap, paletteCount); U.BitmapSave(bitmap, Path.Combine(basedir, imagefilename)); animeHash[id] = bitmap; } string line = wait.ToString() + " " + imagefilename; lines.Add(line); } //まとめて書き込み File.WriteAllLines(filename, lines); }
public static void Export( bool enableComment //コメントを出すかどうか , string filename //書き込むファイル名 , uint frame , uint objRightToLeftOAM , uint objBGRightToLeftOAM ) { objRightToLeftOAM = U.toOffset(objRightToLeftOAM); objBGRightToLeftOAM = U.toOffset(objBGRightToLeftOAM); string basename = Path.GetFileNameWithoutExtension(filename) + "_"; string basedir = Path.GetDirectoryName(filename); //読みやすいようにコメントを入れます. Dictionary <uint, string> Comment_85command_Dic = U.LoadDicResource(U.ConfigDataFilename("battleanime_85command_")); U.MapMarge(ref Comment_85command_Dic, U.LoadDicResource(U.ConfigDataFilename("magic_command_"))); List <String> lines = new List <String>(); string line; if (enableComment) { lines.Add("#######################################################"); lines.Add("#"); lines.Add("#" + R._("CSA_Creatorにインポートする時には各行の#以降を削除してください。")); lines.Add("#######################################################"); } //同じアニメを何度も出力しないように記録する. List <uint> animeHash = new List <uint>(); frame = U.toOffset(frame); byte[] frameData = Program.ROM.Data; //圧縮されていないデータなので、事故防止のため リミッターをかける. uint limitter = frame + 1024 * 1024; //1MBサーチしたらもうあきらめる. limitter = (uint)Math.Min(limitter, Program.ROM.Data.Length); int termCount = 0; for (uint n = frame; n < limitter; n += 4) { if (frameData[n + 3] == 0x80) //0x80 Term { //終端. termCount++; if (frameData[n + 1] == 0x01) //0x00 0x01 0x00 0x80 の場合続くときがある. { line = "~"; if (termCount == 1) { if (enableComment) { line += " #miss terminator"; } lines.Add(line); continue; } else { if (enableComment) { line += " #terminator"; } lines.Add(line); } } break; } else if (frameData[n + 3] == 0x85) //0x85 コマンド { if (frameData[n] == 0x48) {//音楽再生なのだが魔法ではS命令不可. uint musicid = U.u16(frameData, n + 1); uint id = U.u24(frameData, n); line = "C" + id.ToString("X06"); if (enableComment) { line += " #Sound " + musicid + " " + SongTableForm.GetSongName(musicid); } lines.Add(line); } else {//それ以外の 0x85命令 uint id = U.u24(frameData, n); line = "C" + id.ToString("X06"); if (enableComment) { line += " #" + U.at(Comment_85command_Dic, frameData[n]); } lines.Add(line); } continue; } else if (frameData[n + 3] != 0x86) {//不明な命令なので終了 break; } //0x86 画像 pointer uint wait = U.u16(frameData, n); //OBJの出力 string obj_framefilename = ImageUtilMagicFEditor.ExportOBjFrameImage( n , frameData , objRightToLeftOAM , objBGRightToLeftOAM , basedir , basename , animeHash ); //BGの出力 string bg_framefilename = ExportBGFrameImage(n, frameData , basedir , basename , animeHash ); if (obj_framefilename == "") { Log.Error("borken obj frame", n.ToString()); obj_framefilename = ImageUtil.SaveDummyImage(basedir, basename + "_broken_obj" + n + ".png" , 480, 160); } if (bg_framefilename == "") { Log.Error("borken bg frame", n.ToString()); bg_framefilename = ImageUtil.SaveDummyImage(basedir, basename + "_broken_bg" + n + ".png" , 264, 160); } line = "O " + obj_framefilename; lines.Add(line); line = "B " + bg_framefilename; lines.Add(line); //表示時間の出力. line = wait.ToString(); lines.Add(line); n += 24 + 4; // 24+4+4 = 32bytes lines.Add(""); } line = "/// - End of animation"; lines.Add(line); //まとめて書き込み File.WriteAllLines(filename, lines); }
//ROM読みこみに伴うシステムの初期化. static void InitSystem(string fullfilename) { Log.Notify("InitSystem:", Path.GetFileName(ROM.Filename), "ver:", ROM.RomInfo.VersionToFilename(), "length:", ROM.Data.Length.ToString("X"), "FEBuilderGBA:", U.getVersion()); //Undoバッファの準備 Undo = new Undo(); //数を求める部分はあまりにたくさん呼び出すのでキャッシュすることにしました. InputFormRef.ClearCacheDataCount(); //パッチのインストールの是非の判定 FE8には策パッチがあるのでキャッシュする. PatchForm.ClearCheckIF(); if (fullfilename != "") { //変更監視 UpdateWatcher.RegistMain(fullfilename); } //tbl適応判定 OptionForm.AutoUpdateTBLOption(); //システム側のテキストエンコード どうやってUnicodeにするかどうか. ReBuildSystemTextEncoder(); //FEテキストエンコード用のハフマンツリーマップの構成 ReBuildFETextEncoder(); //イベントの読込 ReLoadEventScript(); //イベント条件の解釈リスト EventCondForm.PreLoadResource(U.ConfigDataFilename("eventcond_")); //AI1 と 2, 3 EventUnitForm.PreLoadResourceAI1(U.ConfigDataFilename("ai1_")); EventUnitForm.PreLoadResourceAI2(U.ConfigDataFilename("ai2_")); EventUnitForm.PreLoadResourceAI3(U.ConfigDataFilename("ai3_")); //SondEffectリスト SongTableForm.PreLoadResource(U.ConfigDataFilename("sound_")); //UnitActionリスト UnitActionPointerForm.PreLoadResource(U.ConfigDataFilename("unitaction_")); //ROM内アニメ ImageRomAnimeForm.PreLoadResource(); ImageTSAAnimeForm.PreLoadResource(); if (Program.ROM.RomInfo.version() == 8) { ImageTSAAnime2Form.PreLoadResource(); } //MODの読込. ReLoadMod(); //新規に追加ユニットリストキャッシュの削除 EventUnitForm.ClearNewData(); //システムアイコンキャッシュのクリア ImageSystemIconForm.ClearCache(); //EVENTとASMのキャッシュをクリア AsmMapFileAsmCache = new FEBuilderGBA.AsmMapFileAsmCache(); //asm mapキャッシュの更新. AsmMapFileAsmCache.ClearCache(); //RAM ReBuildRAM(); if (fullfilename != "" && fullfilename != Program.Config.at("Last_Rom_Filename")) {//最後に開いたファイル名を保存する. Program.Config["Last_Rom_Filename"] = fullfilename; Program.Config.Save(); } //Log.Notify("InitSystem:Complate"); }
private void ImportButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } if (AddressList.SelectedIndex <= 0) { return; } if (!this.InputFormRef.CheckWriteProtectionID00()) { return; } string filename; if (ImageFormRef.GetDragFilePath(out filename)) { } else { string title = R._("インポートする音楽ファイルを選択してください"); string filter = R._("sound|*.s;*.wav;*.mid;*.midi;*.instrument|s|*.s|midi|*.mid;*.midi|wav|*.wav|MusicalInstrument|*.instrument|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); filename = open.FileNames[0]; } uint songtable_address = InputFormRef.BaseAddress + (InputFormRef.BlockSize * (uint)AddressList.SelectedIndex); string error = ""; string ext = U.GetFilenameExt(filename); if (ext == ".WAV" || ext == ".WAVE") { SongTrackImportWaveForm f = (SongTrackImportWaveForm)InputFormRef.JumpFormLow <SongTrackImportWaveForm>(); f.Init(filename); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { f.Dettach(); return; } error = SongUtil.ImportWave(f.GetFilename(), songtable_address, f.UseLoop()); f.Dettach(); } else if (ext == ".MID" || ext == ".MIDI") { //楽器セットとオプションを選択してもらう. SongTrackImportMidiForm f = (SongTrackImportMidiForm)InputFormRef.JumpFormLow <SongTrackImportMidiForm>(); f.Init((uint)P4.Value); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return; } //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { if (f.GetUseMID2AGB() == SongTrackImportMidiForm.ImportMethod.FEBuilderGBA) {//FEBuilderGBAでimport error = SongUtil.ImportMidiFile(filename, songtable_address , f.GetInstrumentAddr() , f.GetIgnoreMOD() , f.GetIgnoreBEND() , f.GetIgnoreLFOS() , f.GetIgnoreHEAD() , f.GetIgnoreBACK() ); } else {//mid2agbでimport error = SongUtil.ImportMidiFileMID2AGB(filename, songtable_address , f.GetInstrumentAddr() , f.GetMID2AGB_V() , f.GetMID2AGB_R() , f.GetIgnoreMOD() , f.GetIgnoreBEND() , f.GetIgnoreLFOS() ); } } } else if (ext == ".INSTRUMENT") { //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { error = SongUtil.ImportInstrument(filename, songtable_address); } } else { //楽器セットを選択してもらう. SongTrackImportSelectInstrumentForm f = (SongTrackImportSelectInstrumentForm)InputFormRef.JumpFormLow <SongTrackImportSelectInstrumentForm>(); f.Init((uint)P4.Value); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return; } //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { error = SongUtil.ImportS(filename, songtable_address, f.GetInstrumentAddr()); } } if (error != "") { R.ShowStopError(error); return; } int selectedIndex = AddressList.SelectedIndex; ReloadListButton.PerformClick(); AddressList.SelectedIndex = selectedIndex; SongTableForm.ReloadList(); InputFormRef.ShowWriteNotifyAnimation(this, 0); }
static InputFormRef Init(Form self) { return(new InputFormRef(self , "" , Program.ROM.RomInfo.sound_boss_bgm_pointer , 8 , (int i, uint addr) => { //0xFFまで if (Program.ROM.u16(addr) == 0xFFFF) { return false; } if (i > 10 && Program.ROM.IsEmpty(addr, 8 * 10)) { return false; } return true; } , (int i, uint addr) => { uint unit_id = (uint)Program.ROM.u8(addr); uint song_id = (uint)Program.ROM.u32(addr + 4); return U.ToHexString(unit_id) + " " + UnitForm.GetUnitName(unit_id) + " : " + U.ToHexString(song_id) + SongTableForm.GetSongName(song_id); } )); }