diff --git a/view/sharedcache/ui/Plugin.cpp b/view/sharedcache/ui/Plugin.cpp index 1d52fd6a30..9aad843ee6 100644 --- a/view/sharedcache/ui/Plugin.cpp +++ b/view/sharedcache/ui/Plugin.cpp @@ -14,6 +14,7 @@ extern "C" { UINotifications::init(); UIAction::registerAction("Load Image by Name"); + UIAction::registerAction("Load Image by Address"); UIAction::registerAction("Load Section by Address"); UIAction::registerAction("Load ADDRHERE"); UIAction::registerAction("Load IMGHERE"); diff --git a/view/sharedcache/ui/SharedCacheUINotifications.cpp b/view/sharedcache/ui/SharedCacheUINotifications.cpp index 6979bac359..c3650df81f 100644 --- a/view/sharedcache/ui/SharedCacheUINotifications.cpp +++ b/view/sharedcache/ui/SharedCacheUINotifications.cpp @@ -51,6 +51,18 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q Ref cache = new SharedCacheAPI::SharedCache(view); DisplayDSCPicker(ctx.context, view); })); + ah->bindAction("Load Image by Address", UIAction([view = view](const UIActionContext& ctx) { + Ref cache = new SharedCacheAPI::SharedCache(ctx.binaryView); + uint64_t addr = 0; + bool gotAddr = GetAddressInput(addr, "Address", "Address"); + if (gotAddr) + { + BackgroundThread::create(ctx.context->mainWindow())->thenBackground( + [cache=cache, addr=addr]() { + cache->LoadImageContainingAddress(addr); + })->start(); + } + })); ah->bindAction("Load Section by Address", UIAction([view = view](const UIActionContext& ctx) { Ref cache = new SharedCacheAPI::SharedCache(ctx.binaryView); uint64_t addr = 0; @@ -121,12 +133,15 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q }); if (auto linearView = qobject_cast(viewInt->widget())) { - linearView->contextMenu().addAction("Load ADDRHERE", VIEW_NAME); - linearView->contextMenu().addAction("Load IMGHERE", VIEW_NAME); - linearView->contextMenu().addAction("Load Image by Name", "DSCView2"); - linearView->contextMenu().addAction("Load Section by Address", "DSCView2"); - linearView->contextMenu().setGroupOrdering(VIEW_NAME, 0); - linearView->contextMenu().setGroupOrdering("DSCView2", 1); + constexpr auto groupOneName = VIEW_NAME; + constexpr auto groupTwoName = VIEW_NAME "2"; + linearView->contextMenu().addAction("Load ADDRHERE", groupOneName); + linearView->contextMenu().addAction("Load IMGHERE", groupOneName); + linearView->contextMenu().addAction("Load Image by Name", groupTwoName); + linearView->contextMenu().addAction("Load Image by Address", groupTwoName); + linearView->contextMenu().addAction("Load Section by Address", groupTwoName); + linearView->contextMenu().setGroupOrdering(groupOneName, 0); + linearView->contextMenu().setGroupOrdering(groupTwoName, 1); } } }