Skip to content

Commit 068f799

Browse files
authored
Fix core conf on cutter plugin (#64)
1 parent 123fca0 commit 068f799

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

c/jsdec-cutter.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,21 @@ static RzAnnotatedCode *parse_json(RzStrBuf *sb) {
319319
return code;
320320
}
321321

322+
RZ_API void jsdec_init_config(RzCore *core) {
323+
RzConfig *cfg = core->config;
324+
325+
rz_config_lock(cfg, false);
326+
SETPREF("jsdec.asm", "false", "if true, shows pseudo next to the assembly.");
327+
SETPREF("jsdec.blocks", "false", "if true, shows only scopes blocks.");
328+
SETPREF("jsdec.casts", "false", "if false, hides all casts in the pseudo code.");
329+
SETPREF("jsdec.debug", "false", "do not catch exceptions in jsdec.");
330+
SETPREF("jsdec.highlight", "default", "highlights the current address.");
331+
SETPREF("jsdec.paddr", "false", "if true, all xrefs uses physical addresses compare.");
332+
SETPREF("jsdec.slow", "false", "load all the data before to avoid multirequests to rizin.");
333+
SETPREF("jsdec.xrefs", "false", "if true, shows all xrefs in the pseudo code.");
334+
rz_config_lock(cfg, true);
335+
}
336+
322337
RZ_API RzAnnotatedCode *jsdec_as_annotation(RzCore *core, ut64 addr) {
323338
ExecContext ectx;
324339
ectx.core = core;

cutter-plugin/JSDecDecompiler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010

1111
#include "jsdec-cutter.h"
1212

13-
JSDecDecompiler::JSDecDecompiler(QObject *parent)
14-
: Decompiler("jsdec", "jsdec", parent) {
13+
JSDecDecompiler::JSDecDecompiler(CutterCore *core)
14+
: Decompiler("jsdec", "jsdec", core) {
1515
task = nullptr;
16+
RzCoreLocked c = core->core();
17+
jsdec_init_config(c);
1618
}
1719

1820
void JSDecDecompiler::decompileAt(RVA addr) {

cutter-plugin/JSDecDecompiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class JSDecDecompiler: public Decompiler
1313
RizinFunctionTask *task;
1414

1515
public:
16-
JSDecDecompiler(QObject *parent = nullptr);
16+
JSDecDecompiler(CutterCore *core = nullptr);
1717
virtual void decompileAt(RVA addr) override;
1818
virtual bool isRunning() override { return task != nullptr; }
1919
};

include/jsdec-cutter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extern "C" {
1010

1111
#include <rz_util/rz_annotated_code.h>
1212

13+
RZ_API void jsdec_init_config(RzCore *core);
1314
RZ_API RzAnnotatedCode *jsdec_as_annotation(RzCore *core, ut64 addr);
1415

1516
#ifdef __cplusplus

0 commit comments

Comments
 (0)