public static bool ImportAllData(string filename) { InputFormRef InputFormRef; if (PatchUtil.SearchSkillSystem() != PatchUtil.skill_system_enum.SkillSystem) { return(false); } string[] lines = File.ReadAllLines(filename); { uint iconP = SkillConfigSkillSystemForm.FindIconPointer(); uint textP = SkillConfigSkillSystemForm.FindTextPointer(); uint assignUnitP = SkillConfigSkillSystemForm.FindAssignPersonalSkillPointer(); uint assignLevelUpP = SkillConfigSkillSystemForm.FindAssignUnitLevelUpSkillPointer(); if (iconP == U.NOT_FOUND) { return(false); } if (textP == U.NOT_FOUND) { return(false); } if (assignUnitP == U.NOT_FOUND) { return(false); } if (assignLevelUpP == U.NOT_FOUND) { return(false); } InputFormRef = Init(null, assignUnitP); Dictionary <uint, string> skillNames = new Dictionary <uint, string>(); InputFormRef N1_InputFormRef = N1_Init(null, skillNames); uint classBaseSkillAddr = InputFormRef.BaseAddress; uint assignLevelUpAddr = Program.ROM.p32(assignLevelUpP); for (uint i = 0; i < InputFormRef.DataCount; i++, assignLevelUpAddr += 4, classBaseSkillAddr += 1) { if (!U.isSafetyOffset(assignLevelUpAddr)) { break; } if (i >= lines.Length) { break; } string[] sp = lines[i].Split('\t'); if (sp.Length < 2) { continue; } { uint skill = U.atoh(sp[0]); Program.ROM.write_u8(classBaseSkillAddr + 0, skill); } uint levelupSkillAddr = U.atoh(sp[1]); if (U.isExtrendsROMArea(levelupSkillAddr) || levelupSkillAddr == 0) {//拡張領域、または0の値が設定されている場合は書き戻す Program.ROM.write_p32(assignLevelUpAddr, levelupSkillAddr); continue; } uint levelupList = Program.ROM.p32(assignLevelUpAddr); if (!U.isSafetyOffset(levelupList)) { continue; } N1_InputFormRef.ReInitPointer(assignLevelUpAddr); uint levelupAddr = N1_InputFormRef.BaseAddress; for (uint n = 0; n < N1_InputFormRef.DataCount; n++, levelupAddr += 2) { uint level = U.atoh(U.at(sp, 2 + (n * 2) + 0)); uint skill = U.atoh(U.at(sp, 2 + (n * 2) + 1)); Program.ROM.write_u8(levelupAddr + 0, level); Program.ROM.write_u8(levelupAddr + 1, skill); } } } return(true); }
public static List <U.AddrResult> MakeList() { InputFormRef InputFormRef = N_Init(null); return(InputFormRef.MakeList()); }
//全データの取得 public static void MakeAllDataLength(List <Address> list) { InputFormRef InputFormRef = Init(null); FEBuilderGBA.Address.AddAddress(list, InputFormRef, "AIMapSetting", new uint[] { }); }
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(); }
private void JUMP_ENDING2_EVENT_Click(object sender, EventArgs e) { EventScriptForm f = (EventScriptForm)InputFormRef.JumpForm <EventScriptForm>(); f.JumpTo((uint)ENDING2_EVENT.Value); }
public static uint DataCount() { InputFormRef InputFormRef = Init(null); return(InputFormRef.DataCount); }
void AutoSearch() { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } if (this.OtherROMData == null || this.OtherROMData.Length <= 0) {//別のROMを読込んでいないので探索不可能 SearchCurrentROM(); return; } using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { bool isNearMatch = false; int lastNearMatchSlideComboBox = -1; int lastNearMatchTestMatchDataSizeComboBox = -1; int lastNearMatchGrepType = -1; HideError(); uint addr = U.atoh(Address.Text); if (addr == 0) { return; } bool isCode = (addr % 4) == 1; if (isCode) { addr = addr - 1; DataType.SelectedIndex = 1;//ASM } addr = U.ChangeEndian32(addr); SearchCurrentROM(); if (UseASMMAPCheckBox.Checked) { if (SearchASMMap()) { return; } } uint autoMatictrackLevel = U.atoh(AutomaticTrackingComboBox.Text); if (autoMatictrackLevel == 0) {//自動追跡しない Search(); if (IsDataFound(out isNearMatch)) {//見つかった return; } return; } //自動追跡のため初期化 SlideComboBox.SelectedIndex = 0; //スキップしない. TestMatchDataSizeComboBox.SelectedIndex = 0; //ディフォルトは32バイト Search(); if (this.OtherROMData == null) { return; } //自動追跡初期化 pleaseWait.DoEvents(R._("MakeOtherROMLDRFuncList")); { uint address = U.atoh(Address.Text); uint pointer = U.toPointer(address); this.OtherROMLDRFuncList = MakeOtherROMLDRFuncList(pointer); } int maxDeepSearch = (int)((autoMatictrackLevel >> 8) & 0xF) + 2; int maxSkipSearch = (int)(autoMatictrackLevel & 0xF) + 1; for (int deepSearch = 1; deepSearch < maxDeepSearch; deepSearch++) { pleaseWait.DoEvents(R._("自動追跡 {0}/{1}", deepSearch * maxSkipSearch, maxDeepSearch * maxSkipSearch)); TestMatchDataSizeComboBox.SelectedIndex = deepSearch; //マッチサイズを少しだけ下げる. GrepType.SelectedIndex = 0; //パターンマッチしない if (IsDataFound(out isNearMatch)) { //見つかった return; } if (isNearMatch && lastNearMatchSlideComboBox == -1) {//惜しいマッチをした場合記録する. lastNearMatchSlideComboBox = SlideComboBox.SelectedIndex; lastNearMatchTestMatchDataSizeComboBox = TestMatchDataSizeComboBox.SelectedIndex; lastNearMatchGrepType = GrepType.SelectedIndex; } GrepType.SelectedIndex = 1; //パターンマッチ if (IsDataFound(out isNearMatch)) { //見つかった return; } if (isNearMatch && lastNearMatchSlideComboBox == -1) {//惜しいマッチをした場合記録する. lastNearMatchSlideComboBox = SlideComboBox.SelectedIndex; lastNearMatchTestMatchDataSizeComboBox = TestMatchDataSizeComboBox.SelectedIndex; lastNearMatchGrepType = GrepType.SelectedIndex; } for (int skipSearch = 1; skipSearch < maxSkipSearch; skipSearch++) { pleaseWait.DoEvents(R._("自動追跡 {0}/{1}", deepSearch * maxSkipSearch + skipSearch, maxDeepSearch * maxSkipSearch)); //Nバイトスキップ SlideComboBox.SelectedIndex = skipSearch; if (IsDataFound(out isNearMatch)) {//見つかった return; } if (isNearMatch && lastNearMatchSlideComboBox == -1) {//惜しいマッチをした場合記録する. lastNearMatchSlideComboBox = SlideComboBox.SelectedIndex; lastNearMatchTestMatchDataSizeComboBox = TestMatchDataSizeComboBox.SelectedIndex; lastNearMatchGrepType = GrepType.SelectedIndex; } } } //どこにもマッチしなかった場合、 //惜しいマッチをしていた場合、それを復元する. if (lastNearMatchSlideComboBox != -1) {//惜しいマッチをした場合記録する. SlideComboBox.SelectedIndex = lastNearMatchSlideComboBox; TestMatchDataSizeComboBox.SelectedIndex = lastNearMatchTestMatchDataSizeComboBox; GrepType.SelectedIndex = lastNearMatchGrepType; } } }
public static void MakeVarsIDArray(List <UseValsID> list) { InputFormRef InputFormRef = Init(null); UseValsID.AppendTextID(list, FELint.Type.CLASS, InputFormRef, new uint[] { 0, 2 }); }
public static uint GetClassAddr(uint id) { InputFormRef InputFormRef = Init(null); return(InputFormRef.IDToAddr(id)); }
public static void MakeFlagIDArray(List <UseFlagID> list) { InputFormRef InputFormRef = Init(null); UseFlagID.AppendFlagID(list, FELint.Type.HAIKU, InputFormRef, 4, 3); }
public static void MakeCheckError(List <FELint.ErrorSt> errors) { InputFormRef InputFormRef = Init(null); if (InputFormRef.DataCount < 10) { errors.Add(new FELint.ErrorSt(FELint.Type.CLASS, U.NOT_FOUND , R._("クラスデータが極端に少ないです。破損している可能性があります。"))); } bool isFE6 = Program.ROM.RomInfo.version() == 6; //武器魔法混在パッチを適応しているか bool is_melee_range_fix = PatchUtil.SearchMeleeAndMagicFixPatch(); uint class_addr = InputFormRef.BaseAddress; for (uint i = 0; i < InputFormRef.DataCount; i++, class_addr += InputFormRef.BlockSize) { uint name = Program.ROM.u16(class_addr + 0); FELint.CheckText(name, "NAME1", errors, FELint.Type.CLASS, class_addr, i); uint info = Program.ROM.u16(class_addr + 2); FELint.CheckText(info, "DETAIL3", errors, FELint.Type.CLASS, class_addr, i); uint id = Program.ROM.u8(class_addr + 4); if (name == 0 && id == 0) {//ただの使っていないデータ } else {//IDチェック FELint.CheckID(id, i, errors, FELint.Type.CLASS, class_addr); } if (is_melee_range_fix == false) {//武器魔法混在パッチがないので、混在のチェックをします bool mix; if (isFE6) { mix = (ClassFE6Form.isMeleeMagicMix(class_addr)); } else { mix = (isMeleeMagicMix(class_addr)); } if (mix) { errors.Add(new FELint.ErrorSt(FELint.Type.CLASS, class_addr , R._("武器レベルで、近接と魔法を混在させています。\r\n混在を可能にするパッチを当てていない状態で、近接と魔法を混在すると、戦闘アニメが正しく動作しません。"), i)); } } //移動速度が0or1かどうかチェックする uint movespeed = Program.ROM.u8(class_addr + 7); if (movespeed >= 2) { errors.Add(new FELint.ErrorSt(FELint.Type.CLASS, class_addr , R._("「移動速度」に2以上が設定されています。「移動速度」が、2以上になっているユニットは移動した時に正しく描画されません。"), i)); } } }
private void ToolUseFlagButton_Click(object sender, EventArgs e) { ToolUseFlagForm f = (ToolUseFlagForm)InputFormRef.JumpFormLow <ToolUseFlagForm>(); f.JumpToMAPID(this.MapID); }
private void DiffDebugToolButton_Click(object sender, EventArgs e) { InputFormRef.JumpForm <ToolDiffDebugSelectForm>(); }
public static int MakeUnitSkillButtons(uint uid, Button[] buttons, ToolTipEx tooltip) { uint iconP = SkillConfigSkillSystemForm.FindIconPointer(); uint textP = SkillConfigSkillSystemForm.FindTextPointer(); uint assignUnitP = SkillConfigSkillSystemForm.FindAssignPersonalSkillPointer(); if (iconP == U.NOT_FOUND) { return(0); } if (textP == U.NOT_FOUND) { return(0); } if (assignUnitP == U.NOT_FOUND) { return(0); } InputFormRef InputFormRef = Init(null, assignUnitP); List <U.AddrResult> list = InputFormRef.MakeList(); if (uid < 0 || uid >= list.Count) { return(0); } uint classaddr = list[(int)uid].addr; if (!U.isSafetyOffset(classaddr)) { return(0); } uint b0 = Program.ROM.u8(classaddr); if (b0 <= 0) { return(0); } uint icon = Program.ROM.p32(iconP); uint text = Program.ROM.p32(textP); int skillCount = 0; { Bitmap bitmap = SkillConfigSkillSystemForm.DrawIcon((uint)b0, icon); U.MakeTransparent(bitmap); buttons[0].BackgroundImage = bitmap; buttons[0].Tag = b0; string skillCaption = SkillConfigSkillSystemForm.GetSkillText((uint)b0, text); tooltip.SetToolTip(buttons[skillCount], skillCaption); } skillCount++; //レベルアップで覚えるスキル. Dictionary <uint, string> skillNames = new Dictionary <uint, string>(); InputFormRef N1_InputFormRef = N1_Init(null, skillNames); uint assignLevelUpP = SkillConfigSkillSystemForm.FindAssignUnitLevelUpSkillPointer(); if (assignLevelUpP == U.NOT_FOUND) {//昔のバージョンには、存在しなかった return(skillCount); } SkillAssignmentClassSkillSystemForm.MakeUnitSkillButtonsList(uid, buttons, tooltip, assignLevelUpP, icon, text, skillCount); return(skillCount); }
public static void GotoEvent(FELint.Type dataType, uint addr, uint tag,uint mapid) { if (dataType == FELint.Type.EVENTSCRIPT || dataType == FELint.Type.WORLDMAP_EVENT) {//イベント内で発生したエラー EventScriptForm f = (EventScriptForm)InputFormRef.JumpForm<EventScriptForm>(U.NOT_FOUND); f.JumpTo(addr, tag); return; } else if (dataType == FELint.Type.EVENTUNITS) { if (Program.ROM.RomInfo.version() == 6) { EventUnitFE6Form f = (EventUnitFE6Form)InputFormRef.JumpForm<EventUnitFE6Form>(U.NOT_FOUND); f.JumpTo(addr); } else if (Program.ROM.RomInfo.version() == 7) { EventUnitFE7Form f = (EventUnitFE7Form)InputFormRef.JumpForm<EventUnitFE7Form>(U.NOT_FOUND); f.JumpTo(addr); } else { EventUnitForm f = (EventUnitForm)InputFormRef.JumpForm<EventUnitForm>(U.NOT_FOUND); f.JumpTo(addr); } return; } else if (dataType == FELint.Type.PROCS) { ProcsScriptForm f = (ProcsScriptForm)InputFormRef.JumpForm<ProcsScriptForm>(U.NOT_FOUND); f.JumpTo(addr, tag); return; } else if (dataType == FELint.Type.AISCRIPT) { AIScriptForm f = (AIScriptForm)InputFormRef.JumpForm<AIScriptForm>(tag); return; } else if (dataType == FELint.Type.MAPSETTING_PLIST_OBJECT || dataType == FELint.Type.MAPSETTING_PLIST_CONFIG || dataType == FELint.Type.MAPSETTING_PLIST_MAP || dataType == FELint.Type.MAPSETTING_PLIST_PALETTE || dataType == FELint.Type.MAPSETTING_PLIST_MAPCHANGE || dataType == FELint.Type.MAPSETTING_PLIST_ANIMETION1 || dataType == FELint.Type.MAPSETTING_PLIST_ANIMETION2 || dataType == FELint.Type.MAPSETTING_WORLDMAP || dataType == FELint.Type.MAPSETTING ) { if (Program.ROM.RomInfo.version() == 6) { InputFormRef.JumpForm<MapSettingFE6Form>(mapid); } else if (Program.ROM.RomInfo.version() == 7) { if (!Program.ROM.RomInfo.is_multibyte()) { InputFormRef.JumpForm<MapSettingFE7UForm>(mapid); } else { InputFormRef.JumpForm<MapSettingFE7Form>(mapid); } } else { InputFormRef.JumpForm<MapSettingForm>(mapid); } return; } else if (dataType == FELint.Type.BATTLE_ANIME) { ImageBattleAnimeForm f = (ImageBattleAnimeForm)InputFormRef.JumpForm<ImageBattleAnimeForm>(U.NOT_FOUND); f.JumpToAnimeID(tag); return; } else if (dataType == FELint.Type.BATTLE_ANIME_CLASS) { ImageBattleAnimeForm f = (ImageBattleAnimeForm)InputFormRef.JumpForm<ImageBattleAnimeForm>(U.NOT_FOUND); f.JumpToClassID(tag); return; } else if (dataType == FELint.Type.BG) { InputFormRef.JumpForm<ImageBGForm>(tag); return; } else if (dataType == FELint.Type.PORTRAIT) { if (Program.ROM.RomInfo.version() == 6) { InputFormRef.JumpForm<ImagePortraitFE6Form>(tag); } else { InputFormRef.JumpForm<ImagePortraitForm>(tag); } return; } else if (dataType == FELint.Type.HAIKU) { if (Program.ROM.RomInfo.version() == 8) { InputFormRef.JumpForm<EventHaikuForm>(tag); } else if (Program.ROM.RomInfo.version() == 7) { InputFormRef.JumpForm<EventHaikuFE7Form>(tag); } else { InputFormRef.JumpForm<EventHaikuFE6Form>(tag); } return; } else if (dataType == FELint.Type.BATTTLE_TALK) { if (Program.ROM.RomInfo.version() == 8) { InputFormRef.JumpForm<EventBattleTalkForm>(tag); } else if (Program.ROM.RomInfo.version() == 7) { InputFormRef.JumpForm<EventBattleTalkFE7Form>(tag); } else { InputFormRef.JumpForm<EventBattleTalkFE6Form>(tag); } return; } else if (dataType == FELint.Type.SUPPORT_TALK) { if (Program.ROM.RomInfo.version() == 8) { InputFormRef.JumpForm<SupportTalkForm>(tag); } else if (Program.ROM.RomInfo.version() == 7) { InputFormRef.JumpForm<SupportTalkFE7Form>(tag); } else { InputFormRef.JumpForm<SupportTalkFE6Form>(tag); } return; } else if (dataType == FELint.Type.SUPPORT_UNIT) { if (Program.ROM.RomInfo.version() == 6) { SupportUnitFE6Form f = (SupportUnitFE6Form)InputFormRef.JumpForm<SupportUnitFE6Form>(); f.JumpToAddr(addr); } else { SupportUnitForm f = (SupportUnitForm)InputFormRef.JumpForm<SupportUnitForm>(); f.JumpToAddr(addr); } return; } else if (dataType == FELint.Type.CLASS) { if (Program.ROM.RomInfo.version() == 6) { InputFormRef.JumpForm<ClassFE6Form>(tag); } else { InputFormRef.JumpForm<ClassForm>(tag); } return; } else if (dataType == FELint.Type.ITEM) { if (Program.ROM.RomInfo.version() == 6) { InputFormRef.JumpForm<ItemFE6Form>(tag); } else { InputFormRef.JumpForm<ItemForm>(tag); } return; } else if (dataType == FELint.Type.ITEM_WEAPON_EFFECT) { ItemWeaponEffectForm f = (ItemWeaponEffectForm)InputFormRef.JumpForm<ItemWeaponEffectForm>(U.NOT_FOUND); f.JumpTo(tag); return; } else if (dataType == FELint.Type.UNIT) { if (Program.ROM.RomInfo.version() == 8) { InputFormRef.JumpForm<UnitForm>(tag); } else if (Program.ROM.RomInfo.version() == 7) { InputFormRef.JumpForm<UnitFE7Form>(tag); } else { InputFormRef.JumpForm<UnitFE6Form>(tag); } return; } else if (dataType == FELint.Type.MAPCHANGE) { MapChangeForm f = (MapChangeForm)InputFormRef.JumpForm<MapChangeForm>(tag); f.JumpToMAPIDAndAddr(mapid, tag); return; } else if (dataType == FELint.Type.SOUND_FOOT_STEPS) { SoundFootStepsForm f = (SoundFootStepsForm)InputFormRef.JumpForm<SoundFootStepsForm>(tag); return; } else if (dataType == FELint.Type.MOVECOST_NORMAL) { if (Program.ROM.RomInfo.version() == 6) { MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm<MoveCostFE6Form>(); f.JumpToClassID(tag, 0 + 1); } else { MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm<MoveCostForm>(); f.JumpToClassID(tag, 0 + 1); } return; } else if (dataType == FELint.Type.MOVECOST_RAIN) { if (Program.ROM.RomInfo.version() == 6) { MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm<MoveCostFE6Form>(); f.JumpToClassID(tag, 1 + 1); } else { MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm<MoveCostForm>(); f.JumpToClassID(tag, 1 + 1); } return; } else if (dataType == FELint.Type.MOVECOST_SHOW) { if (Program.ROM.RomInfo.version() == 6) { MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm<MoveCostFE6Form>(); f.JumpToClassID(tag, 2 + 1); } else { MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm<MoveCostForm>(); f.JumpToClassID(tag, 2 + 1); } return; } else if (dataType == FELint.Type.MOVECOST_AVOID) { if (Program.ROM.RomInfo.version() == 6) { MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm<MoveCostFE6Form>(); f.JumpToClassID(tag, 3 + 1); } else { MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm<MoveCostForm>(); f.JumpToClassID(tag, 3 + 1); } return; } else if (dataType == FELint.Type.MOVECOST_DEF) { if (Program.ROM.RomInfo.version() == 6) { MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm<MoveCostFE6Form>(); f.JumpToClassID(tag, 4 + 1); } else { MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm<MoveCostForm>(); f.JumpToClassID(tag, 4 + 1); } return; } else if (dataType == FELint.Type.MOVECOST_RES) { if (Program.ROM.RomInfo.version() == 6) { MoveCostFE6Form f = (MoveCostFE6Form)InputFormRef.JumpForm<MoveCostFE6Form>(); f.JumpToClassID(tag, 5 + 1); } else { MoveCostForm f = (MoveCostForm)InputFormRef.JumpForm<MoveCostForm>(); f.JumpToClassID(tag, 5 + 1); } return; } else if (dataType == FELint.Type.OP_CLASS_DEMO) { if (Program.ROM.RomInfo.version() == 7 && Program.ROM.RomInfo.is_multibyte()) { InputFormRef.JumpForm<OPClassDemoFE7Form>(tag); } else if (Program.ROM.RomInfo.version() == 7 && !Program.ROM.RomInfo.is_multibyte()) { InputFormRef.JumpForm<OPClassDemoFE7UForm>(tag); } else if (Program.ROM.RomInfo.version() == 8 && Program.ROM.RomInfo.is_multibyte()) { InputFormRef.JumpForm<OPClassDemoForm>(tag); } else if (Program.ROM.RomInfo.version() == 8 && !Program.ROM.RomInfo.is_multibyte()) { InputFormRef.JumpForm<OPClassDemoFE8UForm>(tag); } return; } else if (dataType == FELint.Type.WMAP_BASE_POINT) { if (Program.ROM.RomInfo.version() == 8) { InputFormRef.JumpForm<WorldMapPointForm>(tag); } return; } else if (dataType == FELint.Type.SOUNDROOM) { if (Program.ROM.RomInfo.version() == 6) { InputFormRef.JumpForm<SoundRoomFE6Form>(tag); } else { InputFormRef.JumpForm<SoundRoomForm>(tag); } return; } else if (dataType == FELint.Type.SONGTABLE) { InputFormRef.JumpForm<SongTableForm>(tag); return; } else if (dataType == FELint.Type.SENSEKI) { if (Program.ROM.RomInfo.version() == 7) { InputFormRef.JumpForm<EDSensekiCommentForm>(tag); } return; } else if (dataType == FELint.Type.DIC) { if (Program.ROM.RomInfo.version() == 8) { InputFormRef.JumpForm<TextDicForm>(U.NOT_FOUND); } return; } else if (dataType == FELint.Type.MENU) { MenuCommandForm f = (MenuCommandForm)InputFormRef.JumpForm<MenuCommandForm>(); f.JumpToAddr(addr); return; } else if (dataType == FELint.Type.STATUS) { InputFormRef.JumpForm<StatusParamForm>(); return; } else if (dataType == FELint.Type.ED) { if (Program.ROM.RomInfo.version() == 6) { InputFormRef.JumpForm<EDFE6Form>(); } else if (Program.ROM.RomInfo.version() == 7) { InputFormRef.JumpForm<EDFE7Form>(); } else { InputFormRef.JumpForm<EDForm>(); } return; } else if (dataType == FELint.Type.TERRAIN) { if (Program.ROM.RomInfo.is_multibyte()) { InputFormRef.JumpForm<MapTerrainNameForm>(); } else { InputFormRef.JumpForm<MapTerrainNameEngForm>(); } return; } else if (dataType == FELint.Type.SKILL_CONFIG) { if (Program.ROM.RomInfo.version() == 8) { PatchUtil.skill_system_enum skill = PatchUtil.SearchSkillSystem(); if (skill == PatchUtil.skill_system_enum.SkillSystem) { InputFormRef.JumpForm<SkillConfigSkillSystemForm>(); } else if (skill == PatchUtil.skill_system_enum.FE8N || skill == PatchUtil.skill_system_enum.yugudora || skill == PatchUtil.skill_system_enum.FE8N_ver2 ) { InputFormRef.JumpForm<SkillConfigFE8NSkillForm>(); } } return; } else if (dataType == FELint.Type.RMENU) { InputFormRef.JumpForm<StatusRMenuForm>(tag); return; } else if (dataType == FELint.Type.ITEM_USAGE_POINTER) { InputFormRef.JumpForm<ItemUsagePointerForm>(tag); return; } else if (dataType == FELint.Type.PATCH) { PatchForm f = (PatchForm)InputFormRef.JumpForm<PatchForm>(); f.SelectPatchByTag(tag); return; } else if (dataType == FELint.Type.MAPEXIT) { InputFormRef.JumpForm<MapExitPointForm>(tag); return; } else if (dataType == FELint.Type.IMAGE_UNIT_WAIT_ICON) { InputFormRef.JumpForm<ImageUnitWaitIconFrom>(tag); return; } else if (dataType == FELint.Type.IMAGE_UNIT_MOVE_ICON) { InputFormRef.JumpForm<ImageUnitMoveIconFrom>(tag); return; } else if (dataType == FELint.Type.ITEM_EEFECT_POINTER) { InputFormRef.JumpForm<ItemEffectPointerForm>(tag); return; } else if (dataType == FELint.Type.IMAGE_UNIT_PALETTE) { InputFormRef.JumpForm<ImageUnitPaletteForm>(tag); return; } else if (dataType == FELint.Type.IMAGE_BATTLE_SCREEN) { InputFormRef.JumpForm<ImageBattleScreenForm>(); return; } else if (dataType == FELint.Type.ASM) { DisASMForm f = (DisASMForm)InputFormRef.JumpForm<DisASMForm>(U.NOT_FOUND); f.JumpTo(DisassemblerTrumb.ProgramAddrToPlain(tag)); return; } else if (dataType == FELint.Type.ASMDATA) { HexEditorForm f = (HexEditorForm)InputFormRef.JumpForm<HexEditorForm>(); f.JumpTo(tag); return; } else if (dataType == FELint.Type.STATUS_UNITS_MENU) { InputFormRef.JumpForm<StatusUnitsMenuForm>(tag); return; } else if (dataType == FELint.Type.TEXTID_FOR_SYSTEM) { return; } else if (dataType == FELint.Type.TEXTID_FOR_USER) { return; } else if (dataType == FELint.Type.POINTER_TALKGROUP) { EventTalkGroupFE7Form f = (EventTalkGroupFE7Form) InputFormRef.JumpForm<EventTalkGroupFE7Form>(); f.JumpToAddr(addr); return; } else if (dataType == FELint.Type.POINTER_MENUEXTENDS) { MenuExtendSplitMenuForm f = (MenuExtendSplitMenuForm) InputFormRef.JumpForm<MenuExtendSplitMenuForm>(); f.JumpToAddr(addr); return; } else if (dataType == FELint.Type.POINTER_UNITSSHORTTEXT) { UnitsShortTextForm f = (UnitsShortTextForm)InputFormRef.JumpForm<UnitsShortTextForm>(); f.JumpTo(addr); return; } else if (dataType == FELint.Type.EVENT_FINAL_SERIF) { EventFinalSerifFE7Form f = (EventFinalSerifFE7Form)InputFormRef.JumpForm<EventFinalSerifFE7Form>(tag); return; } else if (dataType == FELint.Type.MAGIC_ANIME_EXTENDS) { if (tag >= Program.ROM.RomInfo.magic_effect_original_data_count()) { tag -= Program.ROM.RomInfo.magic_effect_original_data_count(); } ImageUtilMagic.magic_system_enum magic = ImageUtilMagic.SearchMagicSystem(); if (magic == ImageUtilMagic.magic_system_enum.FEDITOR_ADV) { InputFormRef.JumpForm<ImageMagicFEditorForm>(tag); } else if (magic == ImageUtilMagic.magic_system_enum.CSA_CREATOR) { InputFormRef.JumpForm<ImageMagicCSACreatorForm>(tag); } return; } else if (dataType == FELint.Type.FELINT_SYSTEM_ERROR) { InputFormRef.JumpForm<ToolProblemReportForm>(); return; } else if (dataType == FELint.Type.STATUS_GAME_OPTION) { InputFormRef.JumpForm<StatusOptionForm>(tag); return; } //イベント { EventCondForm f = (EventCondForm)InputFormRef.JumpForm<EventCondForm>(U.NOT_FOUND); f.JumpToMAPIDAndAddr(mapid, FELint.TypeToEventCond(dataType), (uint)addr); } }
//全データの取得 public static void MakeAllDataLength(List <Address> list) { string name = "Class"; InputFormRef InputFormRef = Init(null); FEBuilderGBA.Address.AddAddress(list, InputFormRef, name, new uint[] { 52, 56, 60, 64, 68, 72, 76 }); //移動コスト uint addr = InputFormRef.BaseAddress; for (uint cid = 0; cid < InputFormRef.DataCount; cid++, addr += InputFormRef.BlockSize) { uint pointer; pointer = Program.ROM.p32(addr + 56); if (U.isSafetyOffset(pointer)) { FEBuilderGBA.Address.AddPointer(list , addr + 56 , 66 , "MoveCost Clear" , FEBuilderGBA.Address.DataTypeEnum.BIN); } pointer = Program.ROM.p32(addr + 60); if (U.isSafetyOffset(pointer)) { FEBuilderGBA.Address.AddPointer(list , addr + 60 , 66 , "MoveCost Rain" , FEBuilderGBA.Address.DataTypeEnum.BIN); } pointer = Program.ROM.p32(addr + 64); if (U.isSafetyOffset(pointer)) { FEBuilderGBA.Address.AddPointer(list , addr + 64 , 66 , "MoveCost Snow" , FEBuilderGBA.Address.DataTypeEnum.BIN); } pointer = Program.ROM.p32(addr + 68); if (U.isSafetyOffset(pointer)) { FEBuilderGBA.Address.AddPointer(list , addr + 68 , 66 , "MoveCost avoid" , FEBuilderGBA.Address.DataTypeEnum.BIN); } pointer = Program.ROM.p32(addr + 72); if (U.isSafetyOffset(pointer)) { FEBuilderGBA.Address.AddPointer(list , addr + 72 , 66 , "MoveCost def" , FEBuilderGBA.Address.DataTypeEnum.BIN); } pointer = Program.ROM.p32(addr + 76); if (U.isSafetyOffset(pointer)) { FEBuilderGBA.Address.AddPointer(list , addr + 76 , 66 , "MoveCost ref" , FEBuilderGBA.Address.DataTypeEnum.BIN); } } //全クラス共通地形回復 FEBuilderGBA.Address.AddPointer(list, Program.ROM.RomInfo.terrain_recovery_pointer() , 66 , "MoveCost ref" , FEBuilderGBA.Address.DataTypeEnum.BIN); //全クラス共通地形バッドステータス回復 FEBuilderGBA.Address.AddPointer(list, Program.ROM.RomInfo.terrain_bad_status_recovery_pointer() , 66 , "MoveCost ref" , FEBuilderGBA.Address.DataTypeEnum.BIN); }
//アイテムリストを得る public static List <U.AddrResult> MakeItemList(Func <uint, bool> condCallback) { InputFormRef InputFormRef = Init(null); return(InputFormRef.MakeList(condCallback)); }
public static uint GetSongAddr(uint song_id) { InputFormRef InputFormRef = Init(null); return(InputFormRef.IDToAddr(song_id)); }
public static void MakeTextIDArray(List <UseTextID> list) { InputFormRef InputFormRef = Init(null); UseTextID.AppendTextID(list, FELint.Type.ITEM, InputFormRef, new uint[] { 0, 2, 4 }); }
public static void CHEAT_WARP_FE7(EmulatorMemoryForm form, uint warp_chapter, uint edtion) { Debug.Assert(Program.ROM.RomInfo.version() == 7); uint work_address = Program.ROM.RomInfo.workmemory_last_string_address() - 0x70; //テキストバッファの一番下をデータ置き場として利用する. uint eventExecuteFucntion; uint endAllMenusFunction; uint deletePlayerPhaseInterface6CsFunction; if (Program.ROM.RomInfo.is_multibyte()) {//FE7J eventExecuteFucntion = 0x0800AEB0; endAllMenusFunction = 0x0804AC78; deletePlayerPhaseInterface6CsFunction = 0x0808667C; } else {//FE7U eventExecuteFucntion = 0x0800af74; endAllMenusFunction = 0x0804A490; deletePlayerPhaseInterface6CsFunction = 0x08085C7C; } //Search MAPTASK Procs uint maptask = SearchMapTaskProcsAddr(); if (maptask == U.NOT_FOUND) { R.ShowStopError("MAPTASK Procsの位置を特定できませんでした"); return; } byte[] warpCode = { //ASM 0x00, 0xB5, 0x12, 0x4A, 0x42, 0x60, 0x12, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x11, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x78, 0x46, 0x0E, 0x30, 0x01, 0x21, 0x0F, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x01, 0xBC, 0x00, 0x47, 0xC0, 0x46, //Event +24 0x7F, 0x00, 0xFF, 0xFF, //MNCH 0x01, 0x00, 0x00, 0x00, //_1 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //ENDA //hook procs +34 0x02, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x02, 0x02, 0x0E, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, //backCode 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08 //eventExecuteFucntion }; if (Program.ROM.RomInfo.is_multibyte() == false) {//FE7Uだと、MNCHは、0x7f 0x00 ではなく、 0x81 0x00. U.write_u8(warpCode, 0x24, 0x81); } //章ID U.write_u16(warpCode, 0x26, warp_chapter); //Procsで実行を指定するASMコードの位置 U.write_u32(warpCode, 0x38, work_address + 1); //メニューがあれば閉じる命令 U.write_u32(warpCode, 0x50, endAllMenusFunction); //TI PIなどのプレイヤーUIがあれば閉じる命令 U.write_u32(warpCode, 0x54, deletePlayerPhaseInterface6CsFunction); //イベント命令を実行する命令 U.write_u32(warpCode, 0x58, eventExecuteFucntion); //復帰するProcsのコード uint backCode = Program.RAM.u32(maptask + 4); U.write_u32(warpCode, 0x4C, backCode); Program.RAM.write_range(work_address, warpCode); uint procs_jump_addr = work_address + 0x34; Program.RAM.write_u32(maptask + 4, procs_jump_addr); //Edition uint stageStructAddr = Program.ROM.RomInfo.workmemory_mapid_address() - 0xE; Program.RAM.write_u8(stageStructAddr + 0x1b, edtion); InputFormRef.ShowWriteNotifyAnimation(form, procs_jump_addr); }
public static int ComandLineSearch() { string target = U.at(Program.ArgsDic, "--target"); if (!File.Exists(target)) { U.echo(R.Error("--targetで、相手のROMを指定してください。")); return(-2); } PointerToolForm f = (PointerToolForm)InputFormRef.JumpFormLow <PointerToolForm>(); f.LoadTargetROM(target); string tracelevel = U.at(Program.ArgsDic, "--tracelevel"); if (tracelevel != "") { U.SelectedIndexSafety(f.AutomaticTrackingComboBox, U.atoi0x(tracelevel)); } string address = U.at(Program.ArgsDic, "--address"); if (File.Exists(address)) { address = File.ReadAllText(address); } string[] lines = address.Split(new string[] { "\r\n", ",", "\t" }, StringSplitOptions.RemoveEmptyEntries); foreach (string a in lines) { if (!U.isHexString(a)) { continue; } f.Address.Text = a; f.AutoSearch(); bool isNearMatch; if (!f.IsDataFound(out isNearMatch)) {//見つからなかった U.echo( f.Address.Text + "\t" + U.ToHexString(U.NOT_FOUND) + "\t" + U.ToHexString(U.NOT_FOUND) + "\t" + U.ToHexString(U.NOT_FOUND) + "\t" + U.ToHexString(U.NOT_FOUND)); } else { U.echo( f.Address.Text + "\t" + f.OtherROMAddressWithLDRRef.Text + "\t" + f.OtherROMAddressWithLDR.Text + "\t" + f.OtherROMRefPointer2.Text + "\t" + f.OtherROMAddress2.Text); } } f.Close(); return(0); }
public static void CHEAT_WARP_FE6(EmulatorMemoryForm form, uint warp_chapter) { Debug.Assert(Program.ROM.RomInfo.version() == 6); uint work_address = Program.ROM.RomInfo.workmemory_last_string_address() - 0x70; //テキストバッファの一番下をデータ置き場として利用する. uint eventExecuteFucntion; uint endAllMenusFunction; uint deletePlayerPhaseInterface6CsFunction; eventExecuteFucntion = 0x0800d9b8; endAllMenusFunction = 0x08041A38; deletePlayerPhaseInterface6CsFunction = 0x08073324; //Search MAPTASK Procs uint maptask = SearchMapTaskProcsAddr(); if (maptask == U.NOT_FOUND) { R.ShowStopError("MAPTASK Procsの位置を特定できませんでした"); return; } byte[] warpCode = { //ASM 0x00, 0xB5, 0x12, 0x4A, 0x42, 0x60, 0x12, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x11, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x78, 0x46, 0x0E, 0x30, 0x01, 0x21, 0x0F, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x01, 0xBC, 0x00, 0x47, 0xC0, 0x46, //Event +24 0x3D, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, //MNCH 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //END //hook procs +34 0x02, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x02, 0x02, 0x0E, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, //backCode 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08 //eventExecuteFucntion }; //章ID U.write_u16(warpCode, 0x28, warp_chapter); //Procsで実行を指定するASMコードの位置 U.write_u32(warpCode, 0x38, work_address + 1); //メニューがあれば閉じる命令 U.write_u32(warpCode, 0x50, endAllMenusFunction); //TI PIなどのプレイヤーUIがあれば閉じる命令 U.write_u32(warpCode, 0x54, deletePlayerPhaseInterface6CsFunction); //イベント命令を実行する命令 U.write_u32(warpCode, 0x58, eventExecuteFucntion); //復帰するProcsのコード uint backCode = Program.RAM.u32(maptask + 4); U.write_u32(warpCode, 0x4C, backCode); Program.RAM.write_range(work_address, warpCode); uint procs_jump_addr = work_address + 0x34; Program.RAM.write_u32(maptask + 4, procs_jump_addr); InputFormRef.ShowWriteNotifyAnimation(form, procs_jump_addr); }
private void PaletteExportButton_Click(object sender, EventArgs e) { Bitmap newbitmap = this.MapObjImage; ImageFormRef.ExportImage(this, newbitmap, InputFormRef.MakeSaveImageFilename(this, MapStyle), MAX_MAP_PALETTE_COUNT); }
public static void CHEAT_CALLENDEvent(EmulatorMemoryForm form) { uint work_address = Program.ROM.RomInfo.workmemory_last_string_address() - 0x70; //テキストバッファの一番下をデータ置き場として利用する. uint endAllMenusFunction; uint deletePlayerPhaseInterface6CsFunction; uint setFlagFunction; uint callEndEventFunction; if (Program.ROM.RomInfo.version() == 8) { if (Program.ROM.RomInfo.is_multibyte()) {//FE8J endAllMenusFunction = 0x0804FCAC; deletePlayerPhaseInterface6CsFunction = 0x0808F44C; setFlagFunction = 0x080860A8; callEndEventFunction = 0x080855B8; } else {//FE8U endAllMenusFunction = 0x0804ef20; deletePlayerPhaseInterface6CsFunction = 0x0808d150; setFlagFunction = 0x08083D80; callEndEventFunction = 0x08083280; } } else if (Program.ROM.RomInfo.version() == 7) { if (Program.ROM.RomInfo.is_multibyte()) {//FE7J endAllMenusFunction = 0x0804AC78; deletePlayerPhaseInterface6CsFunction = 0x0808667C; setFlagFunction = 0x0807A0B4; callEndEventFunction = 0x0807a208; } else {//FE7U endAllMenusFunction = 0x0804A490; deletePlayerPhaseInterface6CsFunction = 0x08085C7C; setFlagFunction = 0x080798E4; callEndEventFunction = 0x08079A38; } } else {//FE6 endAllMenusFunction = 0x08041A38; deletePlayerPhaseInterface6CsFunction = 0x08073324; setFlagFunction = 0x0806BA48; callEndEventFunction = 0x0806B5B0; } //Search MAPTASK Procs uint maptask = SearchMapTaskProcsAddr(); if (maptask == U.NOT_FOUND) { R.ShowStopError("MAPTASK Procsの位置を特定できませんでした"); return; } byte[] warpCode = { //ASM 0x00, 0xB5, 0x08, 0x49, 0x41, 0x60, 0x08, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x07, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x03, 0x20, 0x06, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x06, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x01, 0xBC, 0x00, 0x47, 0x11, 0x11, 0x11, 0x11, 0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x55, 0x55, 0x55, 0x55, //hook procs +38 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x0E, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x5E, 0x5C, 0x08, //backCode 0xAC, 0xFC, 0x04, 0x08, 0x4C, 0xF4, 0x08, 0x08, 0x40, 0xD3, 0x00, 0x08 //eventExecuteFucntion }; //Procsで実行を指定するASMコードの位置 U.write_u32(warpCode, 0x3C, work_address + 1); //メニューがあれば閉じる命令 U.write_u32(warpCode, 0x28, endAllMenusFunction); //TI PIなどのプレイヤーUIがあれば閉じる命令 U.write_u32(warpCode, 0x2C, deletePlayerPhaseInterface6CsFunction); //フラグを立てる命令 U.write_u32(warpCode, 0x30, setFlagFunction); //イベント命令を実行する命令 U.write_u32(warpCode, 0x34, callEndEventFunction); //復帰するProcsのコード uint backCode = Program.RAM.u32(maptask + 4); U.write_u32(warpCode, 0x24, backCode); Program.RAM.write_range(work_address, warpCode); uint procs_jump_addr = work_address + 0x38; Program.RAM.write_u32(maptask + 4, procs_jump_addr); InputFormRef.ShowWriteNotifyAnimation(form, procs_jump_addr); return; }
private void EventWriteButton_Click(object sender, EventArgs e) { Program.ROM.write_p32(Program.ROM.RomInfo.ending1_event_pointer(), (uint)ENDING1_EVENT.Value); Program.ROM.write_p32(Program.ROM.RomInfo.ending2_event_pointer(), (uint)ENDING2_EVENT.Value); InputFormRef.ShowWriteNotifyAnimation(this, U.NOT_FOUND); }
public static void CHEAT_WARP_FE8(EmulatorMemoryForm form, uint warp_chapter, uint edtion, uint worldmap_node) { Debug.Assert(Program.ROM.RomInfo.version() == 8); uint work_address = Program.ROM.RomInfo.workmemory_last_string_address() - 0x70; //テキストバッファの一番下をデータ置き場として利用する. uint gSomeWMEventRelatedStruct; uint eventExecuteFucntion; uint endAllMenusFunction; uint deletePlayerPhaseInterface6CsFunction; PatchUtil.mnc2_fix_enum use_mnc2 = PatchUtil.SearchSkipWorldMapPatch(); if (use_mnc2 == PatchUtil.mnc2_fix_enum.NO) { R.ShowStopError("MNC2の修正パッチを適応していないので、章ワープを利用できません。"); return; } if (Program.ROM.RomInfo.is_multibyte()) {//FE8J gSomeWMEventRelatedStruct = 0x03005270; eventExecuteFucntion = 0x0800D340; endAllMenusFunction = 0x0804FCAC; deletePlayerPhaseInterface6CsFunction = 0x0808F44C; } else {//FE8U gSomeWMEventRelatedStruct = 0x03005280; eventExecuteFucntion = 0x0800D07C; endAllMenusFunction = 0x0804ef20; deletePlayerPhaseInterface6CsFunction = 0x0808d150; } //Search MAPTASK Procs uint maptask = SearchMapTaskProcsAddr(); if (maptask == U.NOT_FOUND) { R.ShowStopError("MAPTASK Procsの位置を特定できませんでした"); return; } byte[] warpCode = { //ASM 0x00, 0xB5, 0x12, 0x4A, 0x42, 0x60, 0x12, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x11, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x78, 0x46, 0x0E, 0x30, 0x01, 0x21, 0x0F, 0x4B, 0x9E, 0x46, 0x00, 0xF8, 0x01, 0xBC, 0x00, 0x47, 0xC0, 0x46, //Event +24 0x22, 0x2A, 0xFF, 0xFF, //MNC2 0x28, 0x02, 0x07, 0x00, 0x20, 0x01, 0x00, 0x00, //NoFade+Term 0x00, 0x00, 0x00, 0x00, //padding //hook procs +34 0x02, 0x00, 0x00, 0x00, 0x61, 0xB6, 0x02, 0x02, 0x0E, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x5E, 0x5C, 0x08, //backCode 0xAC, 0xFC, 0x04, 0x08, 0x4C, 0xF4, 0x08, 0x08, 0x40, 0xD3, 0x00, 0x08 //eventExecuteFucntion }; //章ID U.write_u16(warpCode, 0x26, warp_chapter); //Procsで実行を指定するASMコードの位置 U.write_u32(warpCode, 0x38, work_address + 1); //メニューがあれば閉じる命令 U.write_u32(warpCode, 0x50, endAllMenusFunction); //TI PIなどのプレイヤーUIがあれば閉じる命令 U.write_u32(warpCode, 0x54, deletePlayerPhaseInterface6CsFunction); //イベント命令を実行する命令 U.write_u32(warpCode, 0x58, eventExecuteFucntion); //復帰するProcsのコード uint backCode = Program.RAM.u32(maptask + 4); U.write_u32(warpCode, 0x4C, backCode); Program.RAM.write_range(work_address, warpCode); uint procs_jump_addr = work_address + 0x34; Program.RAM.write_u32(maptask + 4, procs_jump_addr); //Edition uint stageStructAddr = Program.ROM.RomInfo.workmemory_mapid_address() - 0xE; Program.RAM.write_u8(stageStructAddr + 0x1b, edtion); //拠点 Program.RAM.write_u8(gSomeWMEventRelatedStruct + 0x11, worldmap_node); InputFormRef.ShowWriteNotifyAnimation(form, procs_jump_addr); return; }
public static void MakeVarsIDArray(List <UseValsID> list) { InputFormRef InputFormRef = Init(null); UseValsID.AppendTextID(list, FELint.Type.SUPPORT_TALK, InputFormRef, new uint[] { 4, 8, 12 }); }
private void IgnoreErrorButton_Click(object sender, EventArgs e) { if (this.EventList.SelectedIndex < 0 || this.EventList.SelectedIndex >= this.ErrorList.Count) { return; } FELint.ErrorSt est = this.ErrorList[this.EventList.SelectedIndex]; MainSimpleMenuEventErrorIgnoreErrorForm f = (MainSimpleMenuEventErrorIgnoreErrorForm)InputFormRef.JumpFormLow<MainSimpleMenuEventErrorIgnoreErrorForm>(); f.Init(est); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return; } Program.LintCache.Update(est.Addr, f.GetComment()); Scan(); //EVENTとASMのキャッシュをクリア FELintの再生成を指示する Program.AsmMapFileAsmCache.ClearCache(); }
public static void ExportAllData(string filename) { InputFormRef InputFormRef; if (PatchUtil.SearchSkillSystem() != PatchUtil.skill_system_enum.SkillSystem) { return; } List <string> lines = new List <string>(); { uint iconP = SkillConfigSkillSystemForm.FindIconPointer(); uint textP = SkillConfigSkillSystemForm.FindTextPointer(); uint assignClassP = SkillConfigSkillSystemForm.FindAssignClassSkillPointer(); uint assignLevelUpP = SkillConfigSkillSystemForm.FindAssignClassLevelUpSkillPointer(); if (iconP == U.NOT_FOUND) { return; } if (textP == U.NOT_FOUND) { return; } if (assignClassP == U.NOT_FOUND) { return; } if (assignLevelUpP == U.NOT_FOUND) { return; } InputFormRef = Init(null, assignClassP); Dictionary <uint, string> skillNames = new Dictionary <uint, string>(); InputFormRef N1_InputFormRef = N1_Init(null, skillNames); uint classBaseSkillAddr = InputFormRef.BaseAddress; uint assignLevelUpAddr = Program.ROM.p32(assignLevelUpP); for (uint i = 0; i < InputFormRef.DataCount; i++, assignLevelUpAddr += 4, classBaseSkillAddr += 1) { if (!U.isSafetyOffset(assignLevelUpAddr)) { break; } StringBuilder sb = new StringBuilder(); sb.Append(U.ToHexString(Program.ROM.u8(classBaseSkillAddr + 0))); uint levelupList = Program.ROM.p32(assignLevelUpAddr); sb.Append("\t"); sb.Append(U.ToHexString(levelupList)); if (!U.isSafetyOffset(levelupList)) { lines.Add(sb.ToString()); continue; } N1_InputFormRef.ReInitPointer(assignLevelUpAddr); uint levelupAddr = N1_InputFormRef.BaseAddress; for (uint n = 0; n < N1_InputFormRef.DataCount; n++, levelupAddr += 2) { sb.Append("\t"); sb.Append(U.ToHexString(Program.ROM.u8(levelupAddr + 0))); sb.Append("\t"); sb.Append(U.ToHexString(Program.ROM.u8(levelupAddr + 1))); } lines.Add(sb.ToString()); } } File.WriteAllLines(filename, lines); }
//道データの書き込み void WritePathData() { List <byte> data = new List <byte>(); for (int i = 0; i < PathList.Count;) { U.append_u8(data, (uint)(PathList[i].worldmap_x / 8)); U.append_u8(data, (uint)(PathList[i].worldmap_y / 8)); //Y軸が同じデータがいくつ続くか調べる. int n = i + 1; int lasty = PathList[i].worldmap_y; for (; n < PathList.Count; n++) { if (lasty != PathList[n].worldmap_y) { break; } } U.append_u8(data, (uint)(n - i)); //Y軸の個数 U.append_u8(data, (uint)1); //常に1 for (; i < n; i++) { uint tile = (uint)PathList[i].path_y / 8; uint flag = (uint)PathList[i].path_x / 8; if (flag == 0) { flag = 0x0; } else if (flag == 1) { flag = 0x4; } else if (flag == 2) { flag = 0x8; } else { flag = 0xC; } U.append_u8(data, tile); U.append_u8(data, flag); } } //終端データ U.append_u8(data, 0xFF); U.append_u8(data, 0x0); U.append_u8(data, 0x0); U.append_u8(data, 0x0); U.AddrResult ar = InputFormRef.SelectToAddrResult(this.PathType, this.PathType.SelectedIndex); if (!U.isSafetyOffset(ar.addr)) { return; } string undo_name = PathType.Text; Undo.UndoData undodata = Program.Undo.NewUndoData(undo_name); uint addr = (uint)MapAddress.Value; uint newaddr = InputFormRef.WriteBinaryData(this , addr , data.ToArray() , get_path_data_length_callback , undodata); if (newaddr == U.NOT_FOUND) { return; } U.ForceUpdate(MapAddress, U.toPointer(newaddr)); //道データのポインタ1を書き換える. Program.ROM.write_p32(ar.addr + 0, newaddr, undodata); Program.Undo.Push(undodata); InputFormRef.ShowWriteNotifyAnimation(this, newaddr); }