public static string GetMenuNameWhereMenuCommandID(uint num) { List <U.AddrResult> menuDefineList = MenuDefinitionForm.MakeListAll(); for (int n = 0; n < menuDefineList.Count; n++) { if (!U.isSafetyOffset(menuDefineList[n].addr + 8)) { continue; } uint p = menuDefineList[n].addr + 8; if (!U.isSafetyOffset(Program.ROM.p32(p))) { continue; } List <U.AddrResult> list = MenuCommandForm.MakeListPointer(p); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint menuCommandID = MenuCommandForm.GetMenuCommandID(list[i].addr); if (menuCommandID == num) { return(MenuCommandForm.GetMenuName(list[i].addr)); } } } return(""); }
public static void MakeTextIDArray(List <UseTextID> list, uint pointer, bool isDirectAddress) { if (pointer == 0) { return; } InputFormRef InputFormRef = Init(null); if (isDirectAddress) { InputFormRef.ReInit(pointer); } else { InputFormRef.ReInitPointer(pointer); } uint p = InputFormRef.BaseAddress; for (int i = 0; i < InputFormRef.DataCount; i++, p += InputFormRef.BlockSize) { uint paddr; paddr = Program.ROM.p32(8 + p); if (!U.isSafetyOffset(paddr)) { continue; } MenuCommandForm.MakeTextIDArray(list, 8 + p); } }
public static void ExportExtraMenu(string filename) { if (PatchUtil.SearchSkillSystem() != PatchUtil.skill_system_enum.SkillSystem) { return; } StringBuilder sb = new StringBuilder(); uint addr; uint[] menus = { 0x4F, 0xF00, //全預け+ Give All+ 0x63, 0xF75, //特殊 0x6B, 0x6BF, //待機 }; for (int i = 0; i < menus.Length; i += 2) { uint menuid = menus[i + 0]; uint helpid = menus[i + 1]; addr = MenuCommandForm.SearchMenuUnitOrGame(menuid, helpid); if (addr != U.NOT_FOUND) { byte[] bin = Program.ROM.getBinaryData(addr, MenuCommandForm.MENU_SIZE); sb.AppendLine(U.HexsToString(bin)); } } File.WriteAllText(filename, sb.ToString()); }
//エラーチェック public static void MakeCheckError(List <FELint.ErrorSt> errors) { uint[] pointers = GetPointers(); InputFormRef InputFormRef = Init(null); for (int n = 0; n < pointers.Length; n++) { if (pointers[n] == 0) { continue; } InputFormRef.ReInitPointer(pointers[n]); uint p = InputFormRef.BaseAddress; for (uint i = 0; i < InputFormRef.DataCount; i++, p += InputFormRef.BlockSize) { string name = "MenuDef" + i + "_"; uint paddr; paddr = Program.ROM.p32(8 + p); if (!U.isSafetyOffset(paddr)) { continue; } FELint.CheckPointer(U.toPointer(paddr), errors, FELint.Type.MENU_DEFINE, p, i); MenuCommandForm.MakeCheckError(errors, 8 + p); paddr = Program.ROM.u32(12 + p); FELint.CheckASMPointerOrNull(paddr, errors, FELint.Type.MENU_DEFINE, p, i); paddr = Program.ROM.u32(16 + p); FELint.CheckASMPointerOrNull(paddr, errors, FELint.Type.MENU_DEFINE, p, i); paddr = Program.ROM.u32(20 + p); FELint.CheckASMPointerOrNull(paddr, errors, FELint.Type.MENU_DEFINE, p, i); paddr = Program.ROM.u32(24 + p); FELint.CheckASMPointerOrNull(paddr, errors, FELint.Type.MENU_DEFINE, p, i); paddr = Program.ROM.u32(28 + p); FELint.CheckASMPointerOrNull(paddr, errors, FELint.Type.MENU_DEFINE, p, i); paddr = Program.ROM.u32(32 + p); FELint.CheckASMPointerOrNull(paddr, errors, FELint.Type.MENU_DEFINE, p, i); } } }
public static string MakeMenuPreview(uint addr) { if (!U.isSafetyOffset(addr)) { return(""); } List <U.AddrResult> menuList = MenuCommandForm.MakeListPointer(addr); string ret = ""; for (int i = 0; i < menuList.Count; i++) { ret += "/" + U.skip(menuList[i].name, " "); } return(U.substr(ret, 1)); }
static void CopySubMenu() { uint[] menus = { 0x4E, 0xf07, 0x4E, 0xf09, 0x4E, 0xE12, 0x4E, 0xE0C, 0x4E, 0xE0E, 0x4E, 0xE10, 0x4E, 0xEDB, 0x4E, 0xE0A, 0x4E, 0xEE0, 0x4E, 0xE14, 0x4E, 0xE16, 0x4E, 0xE18, 0x4E, 0xE1A, 0x4E, 0xE1C, 0x4E, 0xF77, }; Undo.UndoData undodata = Program.Undo.NewUndoData("CopySubMenu"); for (int i = 0; i < menus.Length; i += 2) { uint menuid = menus[i + 0]; uint helpid = menus[i + 1]; uint dest = MenuCommandForm.SearchMenu("DEBUG1", menuid, helpid); if (dest == U.NOT_FOUND) { continue; } uint src = MenuCommandForm.SearchMenuUnitOrGame(menuid, helpid); if (src == U.NOT_FOUND) { continue; } byte[] bin = Program.ROM.getBinaryData(src, MenuCommandForm.MENU_SIZE); Program.ROM.write_range(dest, bin, undodata); } Program.Undo.Push(undodata); }
public static void ImportExtraMenu(string filename) { if (PatchUtil.SearchSkillSystem() != PatchUtil.skill_system_enum.SkillSystem) { return; } if (!File.Exists(filename)) { return; } Undo.UndoData undodata = Program.Undo.NewUndoData("ImportExtraMenu"); string[] lines = File.ReadAllLines(filename); foreach (string line in lines) { byte[] bin = U.StringToHexs(line); if (bin.Length < MenuCommandForm.MENU_SIZE) { continue; } uint menuID = U.u8(bin, 0x9); uint helpID = U.u16(bin, 0x6); uint addr = MenuCommandForm.SearchMenuUnitOrGame(menuID, helpID); if (addr != U.NOT_FOUND) { if (menuID == 0x6B && helpID == 0x6BF) {//wait Program.ROM.write_range(addr, bin, undodata); } continue; } //空き部分に追加. addr = MenuCommandForm.SearchMenuUnitOrGame(0x0, 0x0); if (addr == U.NOT_FOUND) {//空きがない continue; } Program.ROM.write_range(addr, bin, undodata); } Program.Undo.Push(undodata); CopySubMenu(); }
public static void MakeAllDataLength(List <Address> list, uint pointer, bool isDirectAddress) { InputFormRef InputFormRef = Init(null); if (isDirectAddress) { InputFormRef.ReInit(pointer); } else { InputFormRef.ReInitPointer(pointer); } FEBuilderGBA.Address.AddAddressButDoNotLengthPuls1(list , InputFormRef , "MenuDefinition" , new uint[] { 8, 12, 16, 20, 24, 28, 32 } , FEBuilderGBA.Address.DataTypeEnum.InputFormRef_MIX ); uint p = InputFormRef.BaseAddress; for (int i = 0; i < InputFormRef.DataCount; i++, p += InputFormRef.BlockSize) { string name = "MenuDef" + i + "_"; uint paddr; paddr = Program.ROM.p32(8 + p); if (!U.isSafetyOffset(paddr)) { continue; } MenuCommandForm.MakeAllDataLengthP(list, 8 + p, name); paddr = Program.ROM.p32(12 + p); FEBuilderGBA.Address.AddAddress(list, DisassemblerTrumb.ProgramAddrToPlain(paddr) , 0 //プログラムなので長さ不明 , p + 12 , name + "_HandleBPress" , FEBuilderGBA.Address.DataTypeEnum.ASM); paddr = Program.ROM.p32(16 + p); FEBuilderGBA.Address.AddAddress(list, DisassemblerTrumb.ProgramAddrToPlain(paddr) , 0 //プログラムなので長さ不明 , p + 16 , name + "_HandleRPress" , FEBuilderGBA.Address.DataTypeEnum.ASM); paddr = Program.ROM.p32(20 + p); FEBuilderGBA.Address.AddAddress(list, DisassemblerTrumb.ProgramAddrToPlain(paddr) , 0 //プログラムなので長さ不明 , p + 20 , name + "_Construction" , FEBuilderGBA.Address.DataTypeEnum.ASM); paddr = Program.ROM.p32(24 + p); FEBuilderGBA.Address.AddAddress(list, DisassemblerTrumb.ProgramAddrToPlain(paddr) , 0 //プログラムなので長さ不明 , p + 24 , name + "_Destruction" , FEBuilderGBA.Address.DataTypeEnum.ASM); paddr = Program.ROM.p32(28 + p); FEBuilderGBA.Address.AddAddress(list, DisassemblerTrumb.ProgramAddrToPlain(paddr) , 0 //プログラムなので長さ不明 , p + 28 , name + "_UnkP28" , FEBuilderGBA.Address.DataTypeEnum.ASM); paddr = Program.ROM.p32(32 + p); FEBuilderGBA.Address.AddAddress(list, DisassemblerTrumb.ProgramAddrToPlain(paddr) , 0 //プログラムなので長さ不明 , p + 32 , name + "_Unk32" , FEBuilderGBA.Address.DataTypeEnum.ASM); } }
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.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.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.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 void ImportFont(Form self, string FontROMTextBox, bool FontAutoGenelateCheckBox, Font ttf) { string filename = FontROMTextBox; this.YourROM = new ROM(); this.ProcessedFont = new Dictionary <string, bool>(); this.MyselfPriorityCode = PatchUtil.SearchPriorityCode(); string version; if (this.YourROM.Load(filename, out version)) {//フォントを取るようのROM this.YourPriorityCode = PatchUtil.SearchPriorityCode(this.YourROM); } else { this.YourROM = null; } if (FontAutoGenelateCheckBox) {//自動生成する this.UseAutoGenFont = ttf; } else {//自動生成しない this.UseAutoGenFont = null; } FETextDecode decode = new FETextDecode(); //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(self)) { this.UndoData = Program.Undo.NewUndoData("FONT Import"); //文字列からフォントを探索 { List <U.AddrResult> list = TextForm.MakeItemList(); for (int i = 0; i < list.Count; i++) { string text = decode.Decode((uint)i); pleaseWait.DoEvents("String:" + U.To0xHexString((uint)i)); FontImporter(text); } } //メニュー1 if (Program.ROM.RomInfo.is_multibyte()) { List <U.AddrResult> menuDefineList = MenuDefinitionForm.MakeListAll(); for (int n = 0; n < menuDefineList.Count; n++) { if (!U.isSafetyOffset(menuDefineList[n].addr + 8)) { continue; } uint p = menuDefineList[n].addr + 8; if (!U.isSafetyOffset(Program.ROM.p32(p))) { continue; } List <U.AddrResult> list = MenuCommandForm.MakeListPointer(p); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint textid = Program.ROM.u32(list[i].addr + 0); string str = FETextDecode.Direct(textid); pleaseWait.DoEvents("Menu:" + U.To0xHexString(textid)); FontImporter(str); } } } //地形 if (Program.ROM.RomInfo.is_multibyte()) { List <U.AddrResult> list = MapTerrainNameForm.MakeList(); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint textid = Program.ROM.u32(list[i].addr + 0); string str = FETextDecode.Direct(textid); pleaseWait.DoEvents("Terrain:" + U.To0xHexString(textid)); FontImporter(str); } } //サウンドルーム //FE7のサウンドルームは、日本語直地 if (Program.ROM.RomInfo.is_multibyte() && Program.ROM.RomInfo.version() == 7) { List <U.AddrResult> list = SoundRoomForm.MakeList(); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint textid = Program.ROM.u32(list[i].addr + 12); string str = FETextDecode.Direct(textid); pleaseWait.DoEvents("SoundRoom:" + U.To0xHexString(textid)); FontImporter(str); } } //その他文字列 { List <U.AddrResult> list = OtherTextForm.MakeList(); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint p_str = Program.ROM.p32(list[i].addr); string str = Program.ROM.getString(p_str); pleaseWait.DoEvents("Other:" + U.To0xHexString(p_str)); FontImporter(str); } } Program.Undo.Push(this.UndoData); } }
private void MenuButton_Click(object sender, EventArgs e) { MenuCommandForm f = (MenuCommandForm)InputFormRef.JumpForm <MenuCommandForm>(); f.JumpToAddr(Program.ROM.p32(Program.ROM.RomInfo.menu1_pointer())); }
public void ExportallText(Form self , string writeTextFileName , string tralnslate_from, string tralnslate_to , string rom_from, string rom_to , bool isModifiedTextOnly , bool isOneLiner ) { //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(self)) { FETextDecode decode = new FETextDecode(); Dictionary <string, string> transDic = TranslateTextUtil.MakeFixedDic(tralnslate_from, tralnslate_to, rom_from, rom_to); if (ExportFilterArray != null) { using (StreamWriter writer = new StreamWriter(writeTextFileName)) { List <U.AddrResult> list = TextForm.MakeItemList(); for (int i = 0; i < list.Count; i++) { if (!ExportFilterArray.ContainsKey(i)) { continue; } string text = decode.Decode((uint)i); pleaseWait.DoEvents("Text:" + U.To0xHexString((uint)i)); ExportText(writer, (uint)i, text, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner); } } return; } using (StreamWriter writer = new StreamWriter(writeTextFileName)) { //テキスト { List <U.AddrResult> list = TextForm.MakeItemList(); for (int i = 0; i < list.Count; i++) { if (ExportFilterArray != null && ExportFilterArray[i] != false) { continue; } string text = decode.Decode((uint)i); pleaseWait.DoEvents("Text:" + U.To0xHexString((uint)i)); ExportText(writer, (uint)i, text, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner); } } //メニュー1 if (Program.ROM.RomInfo.is_multibyte) { List <U.AddrResult> menuDefineList = MenuDefinitionForm.MakeListAll(); for (int n = 0; n < menuDefineList.Count; n++) { if (!U.isSafetyOffset(menuDefineList[n].addr + 8)) { continue; } uint p = menuDefineList[n].addr + 8; if (!U.isSafetyOffset(Program.ROM.p32(p))) { continue; } List <U.AddrResult> list = MenuCommandForm.MakeListPointer(p); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint text_pointer = list[i].addr + 0; uint textid = Program.ROM.u32(text_pointer); string str = FETextDecode.Direct(textid); if (str.Trim() == "") { continue; } pleaseWait.DoEvents("Menu:" + U.To0xHexString(textid)); ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner); } } } //地形 if (Program.ROM.RomInfo.is_multibyte) { List <U.AddrResult> list = MapTerrainNameForm.MakeList(); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint text_pointer = list[i].addr + 0; uint textid = Program.ROM.u32(text_pointer); string str = FETextDecode.Direct(textid); if (str.Trim() == "") { continue; } pleaseWait.DoEvents("Terrain:" + U.To0xHexString(textid)); ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner); } } //サウンドルーム //FE7のサウンドルームは、日本語直地 if (Program.ROM.RomInfo.is_multibyte && Program.ROM.RomInfo.version == 7) { List <U.AddrResult> list = SoundRoomForm.MakeList(); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint text_pointer = list[i].addr + 12; uint textid = Program.ROM.u32(text_pointer); string str = FETextDecode.Direct(textid); if (str.Trim() == "") { continue; } pleaseWait.DoEvents("SoundRoom:" + U.To0xHexString(textid)); ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner); } } //その他文字列 { List <U.AddrResult> list = OtherTextForm.MakeList(); for (int i = 0; i < list.Count; i++) { if (!U.isSafetyOffset(list[i].addr)) { continue; } uint text_pointer = list[i].addr + 0; uint p_str = Program.ROM.p32(text_pointer); string str = Program.ROM.getString(p_str); if (str.Trim() == "") { continue; } pleaseWait.DoEvents("Other:" + U.To0xHexString(p_str)); ExportText(writer, U.toPointer(text_pointer), str, tralnslate_from, tralnslate_to, transDic, isModifiedTextOnly, isOneLiner); } } } } }