static void AddROMTCSPointer(List <Address> list, uint addr, uint pointer, string info, bool isPointerOnly) { addr = U.toOffset(addr); if (!U.isSafetyOffset(addr)) { return; } if (pointer != U.NOT_FOUND) { pointer = U.toOffset(pointer); if (!U.isSafetyOffset(pointer)) { return; } } uint length; if (isPointerOnly) { length = 0; } else { length = ImageUtilAP.CalcROMTCSLength(addr); } list.Add(new Address(addr, length, pointer, info, DataTypeEnum.ROMTCS)); }
public static void SaveAPImages(string filename, uint image_addr, uint ap_addr, int x, int y) { image_addr = U.toOffset(image_addr); Bitmap parts = DrawBorderBitmap(image_addr); ap_addr = U.toOffset(ap_addr); ImageUtilAP ap = new ImageUtilAP(); bool r = ap.Parse(ap_addr); if (!r) { return; } Bitmap borderimg = ImageUtil.Blank(256, 160, parts); ap.DrawFrame(borderimg, 0, x, y, parts); string export_filename = ImageFormRef.ExportImage(null, borderimg, filename); string name_filename = MakeBorderNameImageFileName(export_filename); borderimg = ImageUtil.Blank(256, 160, parts); ap.DrawFrame(borderimg, 1, x, y, parts); ImageUtil.BlackOutUnnecessaryColors(borderimg, 1); borderimg.Save(name_filename); }
private void ExportAPButton_Click(object sender, EventArgs e) { string title = R._("保存するファイル名を選択してください"); string filter = R._("AP|*.romtcs.ap.bin|All files|*"); SaveFileDialog save = new SaveFileDialog(); save.Title = title; save.Filter = filter; Program.LastSelectedFilename.Load(this, "", save, InputFormRef.MakeSaveImageFilename(".romtcs.ap.bin")); DialogResult dr = save.ShowDialog(); if (dr != DialogResult.OK) { return; } if (save.FileNames.Length <= 0 || !U.CanWriteFileRetry(save.FileNames[0])) { return; } string filename = save.FileNames[0]; Program.LastSelectedFilename.Save(this, "", save); uint ap_address = U.toOffset((uint)P4.Value); uint ap_length = ImageUtilAP.CalcAPLength(ap_address); if (ap_length == 0) { return ; } byte[] current_ap = Program.ROM.getBinaryData(ap_address, ap_length); U.WriteAllBytes(filename, current_ap); U.SelectFileByExplorer(filename); }
public static Bitmap DrawBorderImages(Bitmap parts, uint ap_addr, int x, int y) { ap_addr = U.toOffset(ap_addr); ImageUtilAP ap = new ImageUtilAP(); bool r = ap.Parse(ap_addr); if (!r) { return(null); } Bitmap borderimg = ImageUtil.Blank(256, 160, parts); ap.DrawFrame(borderimg, 0, x, y, parts); ap.DrawFrame(borderimg, 1, x, y, parts); Bitmap worldmap = ImageUtilMap.DrawWorldMapEvent(); Bitmap retScreen = new Bitmap(256, 160); using (Graphics g = Graphics.FromImage(retScreen)) { g.DrawImage(worldmap, 0, 0); U.MakeTransparent(borderimg); g.DrawImage(borderimg, 0, 0); borderimg.Dispose(); } return(retScreen); }
public static void CheckAP(uint apAddress, List <ErrorSt> errors, Type cond, uint addr, uint tag = U.NOT_FOUND) { if (!U.isSafetyOffset(apAddress)) {//無効なポインタ errors.Add(new FELint.ErrorSt(cond, U.toOffset(addr) , R._("アドレス「{0}」は無効なアドレスです。", U.To0xHexString(apAddress)), tag)); } ImageUtilAP.CheckAPErrors(apAddress, errors, cond, addr, tag); }
//APの長さを求めるコールバック public static MoveToUnuseSpace.ADDR_AND_LENGTH get_data_pos_callback_ap(uint addr) { addr = U.toOffset(addr); MoveToUnuseSpace.ADDR_AND_LENGTH aal = new MoveToUnuseSpace.ADDR_AND_LENGTH(); aal.addr = addr; aal.length = ImageUtilAP.CalcAPLength(addr); return aal; }
public static void CheckAPErrorsPointerOrNull(uint apAddress, List <ErrorSt> errors, Type cond, uint addr, uint tag = U.NOT_FOUND) { uint p = Program.ROM.p32(apAddress); if (p == 0) { return; } ImageUtilAP.CheckAPErrors(p, errors, cond, addr, tag); }
static string CalcAPMD5(uint ap_addr) { uint length = ImageUtilAP.CalcAPLength(ap_addr); byte[] ap_bin = Program.ROM.getBinaryData(ap_addr, length); string ap_md5 = U.md5(ap_bin); return(ap_md5); }
public static void TEST_FE8J_APParseTest_WordmapBorder() { if (Program.ROM.RomInfo.VersionToFilename != "FE8J") { return; } uint ap = 0xB2449C; ImageUtilAP p = new ImageUtilAP(); p.Parse(ap); }
//APのサイズを自動的に計算します. public static uint CalcAPLength(uint addr) { ImageUtilAP ap = new ImageUtilAP(); bool r = ap.Parse(addr); if (!r) {//サイズ不明 return(0); } uint newapLen = ap.GetLength(); return(newapLen); }
public static void CheckAPErrors(uint apAddress, List <FELint.ErrorSt> errors, FELint.Type cond, uint addr, uint tag = U.NOT_FOUND) { ImageUtilAP ap = new ImageUtilAP(); bool r = ap.Parse(apAddress); if (!r) {//エラー errors.Add(new FELint.ErrorSt(cond , U.toOffset(addr) , ap.GetErrorMessage() , tag)); } }
void TypeToLengthAndName(AsmMapSt p, uint pointer, ROM rom) { string type = p.TypeName; if (type == "LZ77") { p.Length = LZ77.getCompressedSize(rom.Data, U.toOffset(pointer)); } else if (type == "OAMREGS") { p.Length = U.OAMREGSLength(U.toOffset(pointer), rom); p.Name += " Count_" + ((p.Length - 2) / (3 * 2)); } else if (type == "OAMREGS_ARRAY") { p.Length = ScanOAMREGSTable(pointer, p.Name, rom); } else if (type == "TEXTBATCH") { p.Length = U.TextBatchLength(U.toOffset(pointer), rom); p.Name += " Count_" + ((p.Length) / 8); } else if (type == "TEXTBATCHSHORT") { p.Length = U.TextBatchShortLength(U.toOffset(pointer), rom); p.Name += " Count_" + ((p.Length) / 2); } else if (type == "EVENT") { p.Length = EventScript.SearchEveneLength(rom.Data, U.toOffset(pointer)); p.Name += " Count_" + ((p.Length - 2) / (3 * 2)); } else if (type == "HEADERTSA") { p.Length = ImageUtil.CalcByteLengthForHeaderTSAData(rom.Data, (int)U.toOffset(pointer)); } else if (type == "ROMPALETTEANIMEFRAME") { p.Length = ImageRomAnimeForm.GetPaletteFrameCountLow(rom.Data, U.toOffset(pointer)) * 2; } else if (type == "PALETTE") { p.Length = 0x20; } else if (type == "PALETTE2") { p.Length = 0x20 * 2; } else if (type == "PALETTE3") { p.Length = 0x20 * 3; } else if (type == "PALETTE4") { p.Length = 0x20 * 4; } else if (type == "PALETTE8") { p.Length = 0x20 * 8; } else if (type == "PALETTE7") { p.Length = 0x20 * 7; } else if (type == "PALETTE16") { p.Length = 0x20 * 16; } else if (type == "ROMTCS") { p.Length = ImageUtilAP.CalcROMTCSLength(U.toOffset(pointer), rom); } else if (type == "NAZO60") { p.Length = 60; } else if (type == "FONTCOLOR0x200") { p.Length = 0x200; } else if (type == "NewPopupSimple") { p.Length = ImageUtilAP.CalcPopupSimpleLength(U.toOffset(pointer), rom); } else if (type == "SECONDARYOAM") { p.Length = 14; } else if (type == "SECONDARYOAM_ARRAY") { p.Length = ScanSECONDARYOAMTable(pointer, p.Name, rom); } else if (type == "CSTRING") { int length; string strname = rom.getString(U.toOffset(pointer), out length); p.Length = (uint)length; p.Name += " => " + strname; } else if (type == "SOUND_85COMMAND_POINTER_ARRAY") { p.Length = ScanSOUND85COMMANDPointerTable(pointer, p.Name, rom); } else if (type == "ASM_POINTER_ARRAY") { p.Length = ScanASMPointerTable(pointer, p.Name, rom); } else if (type == "PROC") { uint length = ProcsScriptForm.CalcLengthAndCheck(U.toOffset(pointer)); if (length != U.NOT_FOUND) { p.Length = length; } } else if (type == "NAZO8_DATA_POINTER_ARRAY") { p.Length = ScanNazo8DataPointerTable(pointer, p.Name, rom); } else if (type == "ASM") { p.Length = 0; } else if (type == "BGCONFIG") { p.Length = 10 * 2; } }