mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-21 14:16:08 +00:00
Move HTML Disasm formatting to Cutter
This commit is contained in:
parent
e832f57bbd
commit
9f31fd40b4
@ -2535,11 +2535,16 @@ QList<DisassemblyLine> CutterCore::disassembleLines(RVA offset, int lines)
|
|||||||
|
|
||||||
for (const QJsonValue &value : array) {
|
for (const QJsonValue &value : array) {
|
||||||
QJsonObject object = value.toObject();
|
QJsonObject object = value.toObject();
|
||||||
|
char *html = r_cons_html_filter(object[RJsonKey::text].toString().toUtf8(), nullptr);
|
||||||
|
if (!html) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
DisassemblyLine line;
|
DisassemblyLine line;
|
||||||
|
|
||||||
line.offset = object[RJsonKey::offset].toVariant().toULongLong();
|
line.offset = object[RJsonKey::offset].toVariant().toULongLong();
|
||||||
line.text = object[RJsonKey::text].toString();
|
line.text = QString::fromUtf8(html);
|
||||||
|
free (html);
|
||||||
|
|
||||||
r << line;
|
r << line;
|
||||||
}
|
}
|
||||||
|
@ -170,8 +170,7 @@ void DisassemblerGraphView::refreshView()
|
|||||||
void DisassemblerGraphView::loadCurrentGraph()
|
void DisassemblerGraphView::loadCurrentGraph()
|
||||||
{
|
{
|
||||||
TempConfig tempConfig;
|
TempConfig tempConfig;
|
||||||
tempConfig.set("scr.html", true)
|
tempConfig.set("scr.color", COLOR_MODE_16M)
|
||||||
.set("scr.color", COLOR_MODE_16M)
|
|
||||||
.set("asm.bbline", false)
|
.set("asm.bbline", false)
|
||||||
.set("asm.lines", false)
|
.set("asm.lines", false)
|
||||||
.set("asm.lines.fcn", false);
|
.set("asm.lines.fcn", false);
|
||||||
@ -290,11 +289,13 @@ void DisassemblerGraphView::loadCurrentGraph()
|
|||||||
// Skip last byte, otherwise it will overlap with next instruction
|
// Skip last byte, otherwise it will overlap with next instruction
|
||||||
i.size -= 1;
|
i.size -= 1;
|
||||||
|
|
||||||
QString disas;
|
|
||||||
disas = op["text"].toString();
|
|
||||||
|
|
||||||
QTextDocument textDoc;
|
QTextDocument textDoc;
|
||||||
textDoc.setHtml(disas);
|
char *html = r_cons_html_filter(op["text"].toString().toUtf8().constData(), nullptr);
|
||||||
|
if (html) {
|
||||||
|
textDoc.setHtml(QString::fromUtf8(html));
|
||||||
|
free (html);
|
||||||
|
}
|
||||||
|
|
||||||
i.plainText = textDoc.toPlainText();
|
i.plainText = textDoc.toPlainText();
|
||||||
|
|
||||||
RichTextPainter::List richText = RichTextPainter::fromTextDocument(textDoc);
|
RichTextPainter::List richText = RichTextPainter::fromTextDocument(textDoc);
|
||||||
|
@ -224,8 +224,7 @@ void DisassemblyWidget::refreshDisasm(RVA offset)
|
|||||||
QList<DisassemblyLine> disassemblyLines;
|
QList<DisassemblyLine> disassemblyLines;
|
||||||
{
|
{
|
||||||
TempConfig tempConfig;
|
TempConfig tempConfig;
|
||||||
tempConfig.set("scr.html", true)
|
tempConfig.set("scr.color", COLOR_MODE_16M);
|
||||||
.set("scr.color", COLOR_MODE_16M);
|
|
||||||
disassemblyLines = Core()->disassembleLines(topOffset, maxLines);
|
disassemblyLines = Core()->disassembleLines(topOffset, maxLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
|||||||
{
|
{
|
||||||
// temporarily simplify the disasm output to get it colorful and simple to read
|
// temporarily simplify the disasm output to get it colorful and simple to read
|
||||||
TempConfig tempConfig;
|
TempConfig tempConfig;
|
||||||
tempConfig.set("scr.html", true)
|
tempConfig
|
||||||
.set("scr.color", COLOR_MODE_16M)
|
.set("scr.color", COLOR_MODE_16M)
|
||||||
.set("asm.lines", false)
|
.set("asm.lines", false)
|
||||||
.set("asm.var", false)
|
.set("asm.var", false)
|
||||||
|
Loading…
Reference in New Issue
Block a user