static InputFormRef N_Init(Form self) { return(new InputFormRef(self , "N_" , 0 , 4 , (int i, uint addr) => { //終端まで if (Program.ROM.u8(addr) != 0) { //先頭は0でなければならない return false; } return Program.ROM.u32(addr) != 0; } , (int i, uint addr) => { uint class_type = Program.ROM.u16(addr + 2); U.AddrResult ar = new U.AddrResult(); ar.addr = addr; ar.name = U.ToHexString(class_type) + " " + ClassForm.GetClassType(class_type); return ar; } )); }
public static int CommandLineLint() { if (Program.ROM == null) { U.echo(R._("ROMが読みこまれていないので実行できません")); return(-2); } U.echo("Check..."); List <U.AddrResult> errorMapUI = ScanWithoutUI(null, false); for (int i = 0; i < errorMapUI.Count; i++) { U.AddrResult ar = errorMapUI[i]; string text = R._("//エラー:{0}個のエラーがあります", ar.tag); U.echo(ar.name + text); } if (errorMapUI.Count > 0) { return(-1); } U.echo("System ALL GREEN!"); return(0); }
void WriteDim() { if (this.AddressList.SelectedIndex < 0) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); Debug.Assert(ar.tag != 0); if (!U.CheckZeroAddressWriteHigh(ar.tag)) { return; } if (!U.CheckPaddingALIGN4(ar.tag)) { return; } if (DimComboBox.SelectedIndex == 0) {//dim Program.ROM.write_p32(ar.tag, this.DimAddr); } else if (DimComboBox.SelectedIndex == 1) {//no dim Program.ROM.write_p32(ar.tag, this.NoDimAddr); } else if (DimComboBox.SelectedIndex == 2) {//empty Program.ROM.write_u32(ar.tag, 0); } }
private void JUMP_TO_BATTLEANIME_Click(object sender, EventArgs e) { U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); uint id = U.atoh(ar.name) - 1; InputFormRef.JumpTo(null, id, "BATTLEANIME", new string[] { "ANIMEID" }); }
private Size DrawErrorList(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw) { U.AddrResult ar = InputFormRef.SelectToAddrResult(lb, index); uint mapid = ar.addr; SolidBrush brush = new SolidBrush(lb.ForeColor); SolidBrush errorBrush = new SolidBrush(OptionForm.Color_Error_ForeColor()); Font normalFont = lb.Font; Font boldFont = new Font(lb.Font, FontStyle.Bold); string text; Rectangle bounds = listbounds; int lineHeight = (int)lb.Font.Height; int maxHeight = (int)lb.Font.Height; bounds.X += U.DrawText(ar.name, g, boldFont, brush, isWithDraw, bounds); bounds.X += 20; text = R._("//エラー:{0}個のエラーがあります", ar.tag); bounds.X += U.DrawText(text, g, boldFont, errorBrush, isWithDraw, bounds); bounds.Y += maxHeight; return(new Size(bounds.X, bounds.Y)); }
static InputFormRef N_Init(Form self) { return(new InputFormRef(self , "N_" , Program.ROM.RomInfo.map_setting_pointer() , Program.ROM.RomInfo.map_setting_datasize() , (int i, uint addr) => { //0 がポインタであればデータがあると考える. uint a = Program.ROM.u32(addr + 0); // return U.isPointer(a) || a == 0; return U.isPointer(a); } , (int i, uint addr) => { U.AddrResult r = new U.AddrResult(); uint worldmapEventPlist = MapSettingForm.GetWorldMapEventIDWhereAddr(addr); if (worldmapEventPlist <= 0) { return r; } r.name = U.ToHexString(i) + MapSettingForm.GetMapNameWhereAddr(addr); r.addr = Program.ROM.p32(Program.ROM.RomInfo.map_map_pointer_pointer()) + (worldmapEventPlist * 4); return r; } )); }
static InputFormRef Init(Form self) { return(new InputFormRef(self , "" , Program.ROM.RomInfo.item_pointer , Program.ROM.RomInfo.item_datasize , (int i, uint addr) => { //12補正 16特効 がポインタ or nullであれば return U.isPointerOrNULL(Program.ROM.u32(addr + 12)) && U.isPointerOrNULL(Program.ROM.u32(addr + 16)) ; } , (int i, uint addr) => { uint ITEMSTATBOOSTER = Program.ROM.u32(addr + 12); if (!U.isPointer(ITEMSTATBOOSTER)) { return new U.AddrResult(); } U.AddrResult ar = new U.AddrResult(); ar.addr = U.toOffset(ITEMSTATBOOSTER); uint id = Program.ROM.u16(addr); ar.name = U.ToHexString(i) + " " + TextForm.Direct(id); return ar; } )); }
void LoadPath() { PathList = new List <Path>(); if (this.PathType.SelectedIndex < 0) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(this.PathType, this.PathType.SelectedIndex); uint addr = ar.addr; if (!U.isSafetyOffset(addr)) { return; } uint p = Program.ROM.p32(addr + 0); if (!U.isSafetyOffset(p)) { return; } if (Program.ROM.u32(p) == 0x0) {//道データがnull 必須0x01 があるので 0はありえない return; } U.ForceUpdate(MapAddress, U.toPointer(p)); LoadPathLow(Program.ROM.Data, p); }
private void N_P8_ValueChanged(object sender, EventArgs e) { if (this.InputFormRef != null && this.InputFormRef.IsUpdateLock) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); uint mapid = ar.tag; int width = (int)N_B3.Value; int height = (int)N_B4.Value; uint change_address = (uint)N_P8.Value; MapPictureBox.SetDefualtIcon( MapSettingForm.DrawMapChange(mapid, width, height, change_address) ); if (!U.isSafetyPointer(change_address)) { if (change_address == 0) { N_J_8.ErrorMessage = R._("データが設定されていません。マップエディタから、データを作成してください。"); } else { N_J_8.ErrorMessage = R._("ポインタが正しくありません"); } } else { N_J_8.ErrorMessage = ""; } }
static List <U.AddrResult> MakeTileAnimation2() { Dictionary <uint, bool> alreadFound = new Dictionary <uint, bool>(); List <U.AddrResult> ret_list = new List <U.AddrResult>(); uint mapmax = MapSettingForm.GetDataCount(); for (uint i = 0; i < mapmax; i++) { MapSettingForm.PLists plist = MapSettingForm.GetMapPListsWhereMapID(i); if (plist.anime2_plist == 0) { continue; } if (alreadFound.ContainsKey(plist.anime2_plist)) { continue; } uint addr = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.ANIMATION2, plist.anime2_plist); string name = R._("タイルアニメーション2 パレットアニメ:{0}", U.ToHexString(plist.anime2_plist)); if (addr == U.NOT_FOUND) { name += R._("(破損)"); } U.AddrResult ar = new U.AddrResult(addr, name, plist.anime2_plist); ret_list.Add(ar); alreadFound[plist.anime2_plist] = true; } return(ret_list); }
public void JumpToPlist(uint anime2_plist) { int selected = -1; uint addr = U.NOT_FOUND; for (int i = 0; i < FilterComboBox.Items.Count; i++) { U.AddrResult ar = InputFormRef.SelectToAddrResult(FilterComboBox, i); if (ar.isNULL()) { continue; } if (ar.tag == anime2_plist) {//一致 selected = i; addr = ar.addr; break; } } if (addr == U.NOT_FOUND) { return; } FilterComboBox.SelectedIndex = selected; this.InputFormRef.ReInit(addr); }
private void FilterComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (this.InputFormRef == null) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(FilterComboBox, FilterComboBox.SelectedIndex); if (ar.isNULL()) { return; } //サンプルのマップを表示します. uint mapmax = MapSettingForm.GetDataCount(); for (uint i = 0; i < mapmax; i++) { MapSettingForm.PLists plist = MapSettingForm.GetMapPListsWhereMapID(i); if (plist.anime2_plist == ar.tag) { this.MapPictureBox.LoadMap(i); break; } } this.InputFormRef.ReInit(ar.addr); }
private void TextWriteButton_Click(object sender, EventArgs e) { U.AddrResult ar = InputFormRef.SelectToAddrResult(AddressList, AddressList.SelectedIndex); if (ar.isNULL()) { return; } byte[] stringbyte = Program.SystemTextEncoder.Encode(TextBox.Text); stringbyte = U.ArrayAppend(stringbyte, new byte[] { 0x00 }); string undoname = this.Text + ":" + U.ToHexString(this.AddressList.SelectedIndex); Undo.UndoData undodata = Program.Undo.NewUndoData(undoname); uint writeAddr = InputFormRef.WriteBinaryDataPointer(this , ar.addr , stringbyte , PatchUtil.get_data_pos_callback , undodata ); Program.Undo.Push(undodata); InputFormRef.ShowWriteNotifyAnimation(this, writeAddr); UpdateAddressList(); }
private void AddressList_SelectedIndexChanged(object sender, EventArgs e) { U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); if (ar.isNULL()) { this.FlagNameTextBox.Text = ""; return; } this.FlagNameTextBox.Text = ar.name; DeleteButton.Visible = (this.BaseFlag[ar.addr] != ar.name); }
private void AddressList_DoubleClick(object sender, EventArgs e) { if (this.UpdateCallbackEventHandler == null) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); InputFormRef.ExpandsEventArgs args = new InputFormRef.ExpandsEventArgs(); args.NewBaseAddress = ar.addr; this.UpdateCallbackEventHandler(sender, args); this.Close(); }
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]; }
void EnterEvent() { U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); if (ar.name == null) { return; } uint mapid = ar.addr; //マップIDが入っています. MainSimpleMenuEventErrorForm f = (MainSimpleMenuEventErrorForm)InputFormRef.JumpForm <MainSimpleMenuEventErrorForm>(U.NOT_FOUND); f.Init(mapid, ShowAllError1.Checked); }
private void EVENT_LISTBOX_SelectedIndexChanged(object sender, EventArgs e) { U.AddrResult ar = InputFormRef.SelectToAddrResult(this.EVENT_LISTBOX); if (!U.isSafetyOffset(ar.addr)) { this.MapPictureBox.ClearAllPoint(); return; } //タグにマップ番号が入っている. MapPictureBox.LoadMap(ar.tag); this.MapPictureBox.ClearAllPoint(); this.InputFormRef.ReInit(ar.addr); }
public List <U.AddrResult> MakeList() { List <U.AddrResult> list = new List <U.AddrResult>(); foreach (var pair in this.Flag) { U.AddrResult ar = new U.AddrResult( pair.Key , pair.Value ); list.Add(ar); } return(list); }
private void N_P8_ValueChanged(object sender, EventArgs e) { if (this.InputFormRef != null && this.InputFormRef.IsUpdateLock) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); uint mapid = ar.tag; int width = (int)N_B3.Value; int height = (int)N_B4.Value; uint change_address = (uint)N_P8.Value; MapPictureBox.SetDefualtIcon( MapSettingForm.DrawMapChange(mapid, width, height, change_address) ); }
private void X_JUMP_MAPEDITOR_Click(object sender, EventArgs e) { if (AddressList.SelectedIndex < 0) { return; } if (N_AddressList.SelectedIndex < 0) { return; } U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); uint mapid = ar.tag; MapEditorForm f = (MapEditorForm)InputFormRef.JumpForm <MapEditorForm>(U.NOT_FOUND); f.JumpTo(mapid, (uint)N_B0.Value); }
//プレイヤーユニットの重複を警告する. private void EventUnitForm_CheckDuplicatePlayerUnits(object sender, EventArgs e) { uint mapid = (uint)MAP_LISTBOX.SelectedIndex; U.AddrResult selectEventAR = InputFormRef.SelectToAddrResult(this.EVENT_LISTBOX); U.AddrResult selectUnitAR = InputFormRef.SelectToAddrResult(this.AddressList); uint unitID = (uint)B0.Value; uint unitGrow = (uint)B3.Value; uint posHash = ((uint)B4.Value) << 8 | ((uint)B5.Value); L_0_UNIT.ErrorMessage = EventUnitForm.ErrorCheckDuplicatePlayerUnits(unitID , unitGrow , posHash , selectEventAR.addr , selectUnitAR.addr , mapid); }
public static void AppendTextID(List <UseTextID> list, FELint.Type dataType, InputFormRef ifr, uint[] textIDIndexes) { List <U.AddrResult> arlist = ifr.MakeList(); for (int i = 0; i < ifr.DataCount; i++) { U.AddrResult ar = arlist[i]; for (int n = 0; n < textIDIndexes.Length; n++) { uint id = Program.ROM.u16(ar.addr + textIDIndexes[n]); if (id == 0 || id >= 0x7FFF) { continue; } list.Add(new UseTextID(dataType, ar.addr, ar.name, id, (uint)i)); } } }
public static Dictionary <uint, string> MakeItemEffectAndAppendMagic(Form from) { InputFormRef InputFormRef; Dictionary <uint, string> effectDic = U.LoadDicResource(U.ConfigDataFilename("item_anime_effect_")); uint baseaddr, dimaddr, no_dimaddr; if (ImageUtilMagic.SearchMagicSystem(out baseaddr, out dimaddr, out no_dimaddr) != ImageUtilMagic.magic_system_enum.FEDITOR_ADV) { return(effectDic); } uint spellDataCount = ImageUtilMagicFEditor.SpellDataCount(); uint csaSpellTable = ImageUtilMagic.GetCSASpellTableAddr(); if (csaSpellTable == U.NOT_FOUND) { return(effectDic); } InputFormRef = Init(from, dimaddr, no_dimaddr, spellDataCount, csaSpellTable, effectDic); List <U.AddrResult> ret = InputFormRef.MakeList(); for (int i = 0; i < ret.Count; i++) { U.AddrResult ar = ret[i]; if (ar.name.IndexOf(" EMPTY") >= 0) { continue; } //処理効率最悪なのだが、 テキストの先頭に16進数でIDが入っている uint no = U.atoh(ar.name); string effectname = R._("追加魔法"); if (Program.CommentCache.CheckFast(ar.addr)) { effectname = " " + Program.CommentCache.At(ar.addr); } effectDic[no] = effectname; } return(effectDic); }
private void AddressList_SelectedIndexChanged(object sender, EventArgs e) { U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); uint mapid = ar.tag; MapPictureBox.LoadMap(mapid); this.MapPictureBox.ClearAllPoint(); uint change_addr = MapSettingForm.GetMapChangeAddrWhereMapID(mapid); if (!U.isSafetyOffset(change_addr)) { this.N_InputFormRef.ClearSelect(true); this.N_AddressListExpandsButton_80.Enabled = false; return; } this.N_InputFormRef.ReInit(change_addr); }
public static void AppendFlagIDFixedMapID(List <UseFlagID> list, FELint.Type dataType, InputFormRef ifr, uint flagIDPlus, uint chapterIDPlus) { List <U.AddrResult> arlist = ifr.MakeList(); for (int i = 0; i < ifr.DataCount; i++) { U.AddrResult ar = arlist[i]; uint id = Program.ROM.u16(ar.addr + flagIDPlus); if (id == 0) { continue; } uint mapid = Program.ROM.u8(ar.addr + chapterIDPlus); if (mapid >= 0xF0) { mapid = U.NOT_FOUND; } list.Add(new UseFlagID(dataType, ar.addr, ar.name, id, mapid, (uint)i)); } }
private void WriteButton_Click(object sender, EventArgs e) { U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); if (ar.isNULL()) { return; } string name = this.FlagNameTextBox.Text; if (this.BaseFlag[ar.addr] == name) { return; } Program.FlagCache.Update(ar.addr, name, this.BaseFlag[ar.addr]); //読み直し. Init(); //再選択 U.ReSelectList(this.AddressList); InputFormRef.ShowWriteNotifyAnimation(this, U.NOT_FOUND); }
private void AddressList_SelectedIndexChanged(object sender, EventArgs e) { ShowFrameUpDown.Value = 0; U.AddrResult ar = InputFormRef.SelectToAddrResult(this.AddressList); uint dim = Program.ROM.p32(ar.tag); if (dim == this.DimAddr) { DimComboBox.SelectedIndex = 0; } else if (dim == this.NoDimAddr) { DimComboBox.SelectedIndex = 1; } else { DimComboBox.SelectedIndex = 2; } this.MagicComment.Text = Program.CommentCache.At(ar.addr); DrawSelectedAnime(); }
static InputFormRef N_Init(Form self) { return(new InputFormRef(self , "N_" , 0 , 1 , (int i, uint addr) => { //12補正 16特効 がポインタ or nullであれば return Program.ROM.u8(addr) != 0; } , (int i, uint addr) => { uint class_id = Program.ROM.u8(addr); U.AddrResult ar = new U.AddrResult(); ar.addr = addr; ar.name = U.ToHexString(class_id) + " " + ClassForm.GetClassName(class_id); return ar; } )); }
public static void AppendTextIDPP(List <UseValsID> list, FELint.Type dataType, InputFormRef ifr, uint[] textIDIndexes) { List <U.AddrResult> arlist = ifr.MakeList(); for (int i = 0; i < ifr.DataCount; i++) { U.AddrResult ar = arlist[i]; for (int n = 0; n < textIDIndexes.Length; n++) { uint pointer = Program.ROM.p32(ar.addr + textIDIndexes[n]); if (!U.isSafetyOffset(pointer)) { continue; } uint id = Program.ROM.u32(pointer); if (id == 0 || id >= 0x7FFF) { continue; } list.Add(new UseValsID(dataType, ar.addr, ar.name, id, TargetTypeEnum.TEXTID, (uint)i)); } } }