mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-28 15:41:38 +00:00
Implement VV) - rotate asm.emu.str in visual graph
This commit is contained in:
parent
dd6b395e74
commit
185c91eefd
@ -157,6 +157,21 @@ static int mode2opts(const RAGraph *g) {
|
||||
return opts;
|
||||
}
|
||||
|
||||
// duplicated from visual.c
|
||||
static void rotateAsmemu(RCore *core) {
|
||||
const bool isEmuStr = r_config_get_i (core->config, "asm.emu.str");
|
||||
const bool isEmu = r_config_get_i (core->config, "asm.emu");
|
||||
if (isEmu) {
|
||||
if (isEmuStr) {
|
||||
r_config_set (core->config, "asm.emu.str", "false");
|
||||
} else {
|
||||
r_config_set (core->config, "asm.emu", "false");
|
||||
}
|
||||
} else {
|
||||
r_config_set (core->config, "asm.emu.str", "true");
|
||||
}
|
||||
}
|
||||
|
||||
static char *get_title(ut64 addr) {
|
||||
return r_str_newf ("0x%"PFMT64x, addr);
|
||||
}
|
||||
@ -3817,6 +3832,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
||||
" _ - enter hud selector\n"
|
||||
" > - show function callgraph (see graph.refs)\n"
|
||||
" < - show program callgraph (see graph.refs)\n"
|
||||
" ) - rotate asm.emu and asm.emu.str\n"
|
||||
" Home/End - go to the top/bottom of the canvas\n"
|
||||
" Page-UP/DOWN - scroll canvas up/down\n"
|
||||
" C - toggle scr.colors\n"
|
||||
@ -3974,6 +3990,10 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
||||
mousemode = 3;
|
||||
}
|
||||
break;
|
||||
case ')':
|
||||
rotateAsmemu (core);
|
||||
g->need_reload_nodes = true;
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
int wheel = r_config_get_i (core->config, "scr.wheel");
|
||||
|
@ -26,9 +26,6 @@ void r_core_hack_help(const RCore *core) {
|
||||
}
|
||||
|
||||
R_API bool r_core_hack_arm64(RCore *core, const char *op, const RAnalOp *analop) {
|
||||
const int bits = core->assembler->bits;
|
||||
const ut8 *b = core->block;
|
||||
|
||||
if (!strcmp (op, "nop")) {
|
||||
r_core_cmdf (core, "wx 1f2003d5");
|
||||
} else if (!strcmp (op, "ret")) {
|
||||
@ -240,8 +237,7 @@ R_API bool r_core_hack_x86(RCore *core, const char *op, const RAnalOp *analop) {
|
||||
R_API int r_core_hack(RCore *core, const char *op) {
|
||||
bool (*hack)(RCore *core, const char *op, const RAnalOp *analop) = NULL;
|
||||
const char *asmarch = r_config_get (core->config, "asm.arch");
|
||||
const int asmbits = r_config_get (core->config, "asm.bits");
|
||||
RAnalOp analop;
|
||||
const int asmbits = core->assembler->bits;
|
||||
|
||||
if (!asmarch) {
|
||||
return false;
|
||||
@ -258,6 +254,7 @@ R_API int r_core_hack(RCore *core, const char *op) {
|
||||
eprintf ("TODO: write hacks are only for x86\n");
|
||||
}
|
||||
if (hack) {
|
||||
RAnalOp analop;
|
||||
if (!r_anal_op (core->anal, &analop, core->offset, core->block, core->blocksize)) {
|
||||
eprintf ("anal op fail\n");
|
||||
return false;
|
||||
|
@ -87,6 +87,20 @@ static void rotateAsmBits(RCore *core) {
|
||||
}
|
||||
}
|
||||
|
||||
static void rotateAsmemu(RCore *core) {
|
||||
const bool isEmuStr = r_config_get_i (core->config, "asm.emu.str");
|
||||
const bool isEmu = r_config_get_i (core->config, "asm.emu");
|
||||
if (isEmu) {
|
||||
if (isEmuStr) {
|
||||
r_config_set (core->config, "asm.emu.str", "false");
|
||||
} else {
|
||||
r_config_set (core->config, "asm.emu", "false");
|
||||
}
|
||||
} else {
|
||||
r_config_set (core->config, "asm.emu.str", "true");
|
||||
}
|
||||
}
|
||||
|
||||
static void printSnow(RCore *core) {
|
||||
if (!snows) {
|
||||
snows = r_list_newf (free);
|
||||
@ -2386,19 +2400,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
}
|
||||
break;
|
||||
case ')':
|
||||
{
|
||||
bool isEmuStr = r_config_get_i (core->config, "asm.emu.str");
|
||||
bool isEmu = r_config_get_i (core->config, "asm.emu");
|
||||
if (isEmu) {
|
||||
if (isEmuStr) {
|
||||
r_config_set (core->config, "asm.emu.str", "false");
|
||||
} else {
|
||||
r_config_set (core->config, "asm.emu", "false");
|
||||
}
|
||||
} else {
|
||||
r_config_set (core->config, "asm.emu.str", "true");
|
||||
}
|
||||
}
|
||||
rotateAsmemu (core);
|
||||
break;
|
||||
case '*':
|
||||
if (core->print->cur_enabled) {
|
||||
|
Loading…
Reference in New Issue
Block a user