Skip to content

Commit

Permalink
Fix build for latest r2-5.9.9
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Feb 27, 2025
1 parent 008e0e3 commit 3d7e682
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
21 changes: 13 additions & 8 deletions src/core/Iaito.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
#else
#define BO o
#endif
#if R2_VERSION_NUMBER >= 50909
#define ADDRESS_OF(x) (x)->addr
#else
#define ADDRESS_OF(x) (x)->offset
#endif

Q_GLOBAL_STATIC(IaitoCore, uniqueInstance)

Expand Down Expand Up @@ -409,13 +414,13 @@ QString IaitoCore::cmdHtml(const char *str)
{
CORE_LOCK();

RVA offset = core->offset;
RVA offset = ADDRESS_OF (core);
r_core_cmd0(core, "e scr.html=true;e scr.color=2");
char *res = r_core_cmd_str(core, str);
r_core_cmd0(core, "e scr.html=false;e scr.color=0");
QString o = fromOwnedCharPtr(res);

if (offset != core->offset) {
if (offset != ADDRESS_OF (core)) {
updateSeek();
}
return o;
Expand All @@ -425,11 +430,11 @@ QString IaitoCore::cmd(const char *str)
{
CORE_LOCK();

RVA offset = core->offset;
RVA offset = ADDRESS_OF (core);
char *res = r_core_cmd_str(core, str);
QString o = fromOwnedCharPtr(res);

if (offset != core->offset) {
if (offset != ADDRESS_OF (core)) {
updateSeek();
}
return o;
Expand Down Expand Up @@ -490,13 +495,13 @@ bool IaitoCore::asyncCmd(const char *str, QSharedPointer<R2Task> &task)

CORE_LOCK();

RVA offset = core->offset;
RVA offset = ADDRESS_OF (core);

task = QSharedPointer<R2Task>(new R2Task(str, true));
connect(task.data(), &R2Task::finished, task.data(), [this, offset, task]() {
CORE_LOCK();

if (offset != core->offset) {
if (offset != ADDRESS_OF (core)) {
updateSeek();
}
});
Expand Down Expand Up @@ -991,7 +996,7 @@ void IaitoCore::seek(ut64 offset)

// use cmd and not cmdRaw to make sure seekChanged is emitted
cmd(QStringLiteral("s %1").arg(offset));
// cmd already does emit seekChanged(core_->offset);
// cmd already does emit seekChanged(core_->addr);
}

void IaitoCore::showMemoryWidget()
Expand Down Expand Up @@ -1070,7 +1075,7 @@ RVA IaitoCore::nextOpAddr(RVA startAddr, int count)

RVA IaitoCore::getOffset()
{
return core_->offset;
return ADDRESS_OF (core_);
}

ut64 IaitoCore::math(const QString &expr)
Expand Down
8 changes: 7 additions & 1 deletion src/core/Iaito.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class R2TaskDialog;
#include "common/R2Task.h"
#include "dialogs/R2TaskDialog.h"

#if R2_VERSION_NUMBER >= 50909
#define ADDRESS_OF(x) (x)->addr
#else
#define ADDRESS_OF(x) (x)->offset
#endif

#if __APPLE__ && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#define QFILEDIALOG_FLAGS QFileDialog::DontUseNativeDialog
#else
Expand Down Expand Up @@ -65,7 +71,7 @@ class IAITO_EXPORT IaitoCore : public QObject

AsyncTaskManager *getAsyncTaskManager() { return asyncTaskManager; }

RVA getOffset() const { return core_->offset; }
RVA getOffset() const { return ADDRESS_OF (core_); }

/* Core functions (commands) */
static QString sanitizeStringForCommand(QString s);
Expand Down

0 comments on commit 3d7e682

Please sign in to comment.