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); }
static void AddAPAddress(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.CalcAPLength(addr); } list.Add(new Address(addr, length, pointer, info, DataTypeEnum.AP)); }
//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; }
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); }