improve html layout
This commit is contained in:
parent
4eae524e5f
commit
b79d6151ce
2 changed files with 24 additions and 6 deletions
|
|
@ -62,7 +62,7 @@ impl DexFile {
|
|||
));
|
||||
}
|
||||
current_line.push(format!(
|
||||
"<td class=\"{}\">{:02x}</td>",
|
||||
"<td id=\"cell_{i:08x}\" class=\"{}\">{:02x}</td>",
|
||||
classes.join(" "),
|
||||
raw[i as usize]
|
||||
));
|
||||
|
|
@ -80,6 +80,7 @@ impl DexFile {
|
|||
let table = lines.join("\n");
|
||||
let mut chunk_style_lines = vec![];
|
||||
let mut data_lines = vec![];
|
||||
let mut unreferenced_lines = vec![];
|
||||
for (off, size, dscr) in &self.layout_map {
|
||||
let classname = format!("chunk_{off}_{size}");
|
||||
chunk_style_lines.push(format!(
|
||||
|
|
@ -89,11 +90,27 @@ impl DexFile {
|
|||
"html:has(.{classname}:hover) .dscr_{classname} {{ display: block; }}"
|
||||
));
|
||||
data_lines.push(format!(
|
||||
"<pre class=\"dex_dscr dscr_{classname}\"><code>{dscr}</code></pre>"
|
||||
))
|
||||
"<pre class=\"dex_dscr dscr_{classname}\"><code>0x{off:08x}: {dscr}</code></pre>"
|
||||
));
|
||||
if dscr == "Unreferenced Data" {
|
||||
unreferenced_lines.push(format!(
|
||||
"<li><a href=\"#cell_{off:08x}\">offset: 0x{off:08x}, size: 0x{size:x}</a></li>"
|
||||
));
|
||||
}
|
||||
}
|
||||
let chunk_style = chunk_style_lines.join("\n ");
|
||||
let data = data_lines.join("\n ");
|
||||
let unreferenced = unreferenced_lines.join("\n ");
|
||||
let unreferenced = if !unreferenced_lines.empty() {
|
||||
format!(
|
||||
"<h3>Unreferenced Data:</h3>
|
||||
<ul>
|
||||
{unreferenced}
|
||||
</ul>"
|
||||
)
|
||||
} else {
|
||||
"".into()
|
||||
};
|
||||
|
||||
format!(
|
||||
"<html>
|
||||
|
|
@ -105,6 +122,7 @@ impl DexFile {
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{unreferenced}
|
||||
<table class=\"hex_table\">
|
||||
{table}
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl<'a> DexFileReader<'a> {
|
|||
.expect("Failed to acquire mutex lock on layout_map")
|
||||
.insert(
|
||||
(0, tmp_file.header.size()),
|
||||
format!("{:x?}", tmp_file.header),
|
||||
format!("{:#x?}", tmp_file.header),
|
||||
);
|
||||
if tmp_file.header.map_off != 0 {
|
||||
tmp_file.map_list = tmp_file.get_struct_at_offset(tmp_file.header.map_off)?;
|
||||
|
|
@ -433,7 +433,7 @@ impl<'a> DexFileReader<'a> {
|
|||
.lock()
|
||||
.expect("Failed to acquire mutex lock on layout_map")
|
||||
.entry((pos as u32, size))
|
||||
.or_insert_with(|| format!("{item:x?}"));
|
||||
.or_insert_with(|| format!("{item:#x?}"));
|
||||
}
|
||||
}
|
||||
Ok(list)
|
||||
|
|
@ -479,7 +479,7 @@ impl<'a> DexFileReader<'a> {
|
|||
.lock()
|
||||
.expect("Failed to acquire mutex lock on layout_map")
|
||||
.entry((offset, size))
|
||||
.or_insert_with(|| format!("{r:x?}"));
|
||||
.or_insert_with(|| format!("{r:#x?}"));
|
||||
}
|
||||
r
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue