Implement Vd1! to toggle all bits from the selected byte ##visual

This commit is contained in:
pancake 2024-11-12 20:03:34 +01:00
parent 2028e53633
commit 2d5ff60b23
3 changed files with 12 additions and 4 deletions

View File

@ -4728,7 +4728,7 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
uninit = true;
at += bsz;
if (!r_io_is_valid_offset (core->io, at, 0)) {
R_LOG_ERROR ("invalid memory");
R_LOG_ERROR ("invalid memory at 0x%08"PFMT64x, at);
break;
}
continue;

View File

@ -426,7 +426,7 @@ R_API bool r_core_visual_esil(RCore *core, const char *input) {
r_cons_clear00 ();
r_cons_printf (
"VdE?: Visual Esil Debugger Help (aev):\n\n"
" q - quit the bit editor\n"
" q - quit the esil debugger\n"
" h/r - reset / go back (reinitialize esil state)\n"
" s - esil step in\n"
" S - esil step over\n"
@ -435,6 +435,7 @@ R_API bool r_core_visual_esil(RCore *core, const char *input) {
" j/k - next/prev instruction\n"
" n/p - go next/prev instruction\n"
" = - enter cmd.vprompt command\n"
" ! - toggle all bits\n"
" : - enter command\n");
r_cons_flush ();
r_cons_any_key (NULL);
@ -666,6 +667,12 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
free (op_hex);
}
return false;
case '!':
{
const int nbyte = x / 8;
*(buf + nbyte) = ~*(buf + nbyte);
}
break;
case 'H':
{
const int y = R_MAX (x - 8, 0);
@ -705,7 +712,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
}
break;
case '>':
buf[x/8] = rotate_nibble (buf [(x / 8)], -1);
buf[x / 8] = rotate_nibble (buf [(x / 8)], -1);
break;
case '<':
buf[x / 8] = rotate_nibble (buf [(x / 8)], 1);
@ -770,6 +777,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
" </> - rotate left/right byte value\n"
" i - insert numeric value of byte\n"
" = - set cmd.vprompt command\n"
" ! - toggle all the bits\n"
" : - run r2 command\n");
r_cons_flush ();
r_cons_any_key (NULL);

View File

@ -164,7 +164,7 @@ void __magic_file_badread(RMagic *ms) {
__magic_file_error (ms, errno, "error reading");
}
int __magic_file_buffer(RMagic *ms, int fd, const char *inname, const void *buf, size_t nb) {
R_IPI int __magic_file_buffer(RMagic *ms, int fd, const char *inname, const void *buf, size_t nb) {
int mime, m = 0;
if (!ms) {
return -1;