mirror of
https://github.com/rizinorg/jsdec.git
synced 2026-11-07 06:45:57 -10:00
39 lines
876 B
C++
39 lines
876 B
C++
// SPDX-FileCopyrightText: 2024 Giovanni Dante Grazioli <[email protected]>
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#include "JSDecDecompiler.h"
|
|
#include <Cutter.h>
|
|
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
#include <QJsonArray>
|
|
|
|
#include "../c/jsdec-cutter.h"
|
|
|
|
JSDecDecompiler::JSDecDecompiler(QObject *parent)
|
|
: Decompiler("jsdec", "jsdec", parent) {
|
|
task = nullptr;
|
|
}
|
|
|
|
void JSDecDecompiler::decompileAt(RVA addr) {
|
|
if (task) {
|
|
return;
|
|
}
|
|
|
|
task = new RizinFunctionTask([addr](RzCore *core) {
|
|
return jsdec_as_annotation(core, addr);
|
|
});
|
|
|
|
connect(task, &RizinFunctionTask::finished, this, [this]() {
|
|
auto res = reinterpret_cast<RzAnnotatedCode *>(task->getResult());
|
|
delete task;
|
|
task = nullptr;
|
|
if (!res) {
|
|
res = Decompiler::makeWarning(tr("Failed to parse JSON from jsdec"));
|
|
}
|
|
emit finished(res);
|
|
});
|
|
|
|
task->startTask();
|
|
}
|